/* ============================================================
   OpenList 直链控制台 — 设计系统
   暗色优先，支持亮色切换；玻璃拟态面板 + 靛蓝渐变主色
   ============================================================ */

:root {
  --bg: #0a0d14;
  --bg-soft: #0e121c;
  --bg-inset: #0a0e18;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-hover: rgba(255, 255, 255, 0.08);
  --panel-solid: #121724;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #e8ecf4;
  --muted: #8b93a7;
  --accent: #6d7cff;
  --accent-2: #22d3ee;
  --accent-soft: rgba(109, 124, 255, 0.14);
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --ok-soft: rgba(52, 211, 153, 0.14);
  --warn-soft: rgba(251, 191, 36, 0.14);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.55);
  --sidebar-w: 232px;
}
html[data-theme="light"] {
  --bg: #eef1f8;
  --bg-soft: #ffffff;
  --bg-inset: #f3f5fb;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-hover: rgba(255, 255, 255, 1);
  --panel-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.18);
  --text: #17203a;
  --muted: #64708c;
  --accent-soft: rgba(109, 124, 255, 0.12);
  --shadow: 0 18px 40px -22px rgba(30, 41, 89, 0.3);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

/* 图标默认尺寸兜底：ic() 输出的 svg 未被容器规则约束时保持 1em */
svg[viewBox="0 0 24 24"] { width: 1em; height: 1em; display: inline-block; vertical-align: -0.12em; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.mono { font-family: "JetBrains Mono", Consolas, monospace; }

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

::selection { background: rgba(109, 124, 255, 0.35); }

/* ---------------- 登录页（固定浅色，不随控制台主题切换） ---------------- */
.auth-screen {
  min-height: 100vh; display: grid; place-items: center; position: relative; overflow: hidden;
  --bg-inset: #eef1f8;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.18);
  --text: #17203a;
  --muted: #64708c;
  --shadow: 0 18px 40px -22px rgba(30, 41, 89, 0.28);
  color: var(--text);
  background:
    radial-gradient(1000px 500px at 20% -10%, rgba(109, 124, 255, 0.16), transparent 60%),
    radial-gradient(800px 500px at 90% 110%, rgba(34, 211, 238, 0.14), transparent 60%),
    linear-gradient(180deg, #f7f9fe, #eef1f8);
}
.auth-card {
  width: min(400px, calc(100vw - 40px));
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px 32px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }
.auth-brand .mark { width: 44px; height: 44px; border-radius: 12px; box-shadow: 0 10px 24px -6px rgba(109, 124, 255, 0.55); }
.auth-brand h1 { margin: 0; font-size: 19px; }
.auth-brand p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.auth-card h2 { font-size: 15.5px; margin: 0 0 16px; font-weight: 600; }
.auth-err {
  color: var(--danger); font-size: 13px; margin-bottom: 12px;
  padding: 9px 12px; border-radius: 10px; background: var(--danger-soft);
  animation: shake 0.3s;
}
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.auth-foot { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 13px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--bg-inset); color: var(--text);
  font-size: 13.5px; outline: none; transition: border 0.15s, box-shadow 0.15s, background 0.15s;
}
textarea.input { height: auto; padding: 10px 13px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109, 124, 255, 0.2); }
.input::placeholder { color: var(--muted); opacity: 0.7; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------------- 按钮 ---------------- */
.btn {
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; font-size: 13.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: all 0.15s; white-space: nowrap; user-select: none;
}
.btn svg { width: 15px; height: 15px; }
.btn:active { transform: scale(0.98); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #5566f0); color: #fff; box-shadow: 0 6px 18px -6px rgba(109, 124, 255, 0.65); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--panel); border-color: var(--border-strong); color: var(--text); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.icon-btn {
  width: 30px; height: 30px; flex: none; display: inline-grid; place-items: center;
  border-radius: 8px; border: none; background: transparent; color: var(--muted);
  cursor: pointer; transition: all 0.14s;
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { background: var(--panel-hover); color: var(--text); }
.icon-btn.accent:hover { color: var(--accent); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------------- 布局骨架 ---------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 20px 14px;
  background: var(--bg-soft); border-right: 1px solid var(--border);
  z-index: 30;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.side-brand .mark { width: 34px; height: 34px; border-radius: 9px; }
.side-brand b { font-size: 14.5px; display: block; line-height: 1.25; }
.side-brand span { font-size: 11px; color: var(--muted); }
.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border-radius: 10px; color: var(--muted); font-weight: 550; font-size: 13.5px;
  cursor: pointer; transition: all 0.14s; border: 1px solid transparent;
}
.nav-item svg { width: 17px; height: 17px; }
.nav-item:hover { color: var(--text); background: var(--panel-hover); }
.nav-item.active {
  color: var(--text); background: var(--accent-soft);
  border-color: rgba(109, 124, 255, 0.25);
}
.nav-item.active svg { color: var(--accent); }
.side-foot { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  overflow: hidden;
}
.avatar img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.side-user .who { flex: 1; min-width: 0; }
.side-user .who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .who span { font-size: 11px; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 26px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.topbar h1 { margin: 0; font-size: 17px; font-weight: 700; flex: 1; }
.topbar .sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.content { padding: 22px 26px 40px; max-width: 1200px; width: 100%; margin: 0 auto; }

/* 菜单按钮（移动端） */
.menu-btn { display: none; }
.mobile-logout { display: none; }

/* 底部 tab 栏（仅窄屏显示） */
.tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 7px; font-size: 11px; color: var(--muted);
  text-decoration: none; position: relative;
}
.tab-item svg { width: 19px; height: 19px; }
.tab-item.active { color: var(--accent); font-weight: 600; }
.tab-item.active::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 28px; height: 2.5px; border-radius: 0 0 3px 3px; background: var(--accent);
}

/* ---------------- 卡片与统计 ---------------- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
}
.card h3 { margin: 0 0 14px; font-size: 13.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; align-items: center; gap: 14px;
  transition: all 0.18s; position: relative; overflow: hidden;
}
.stat:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.stat-ic {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 18px -6px rgba(109, 124, 255, 0.5);
}
.stat-ic svg { width: 19px; height: 19px; }
.stat-ic.alt { background: linear-gradient(135deg, #34d399, #22d3ee); box-shadow: 0 8px 18px -6px rgba(52, 211, 153, 0.5); }
.stat-ic.warn { background: linear-gradient(135deg, #fbbf24, #fb923c); box-shadow: 0 8px 18px -6px rgba(251, 191, 36, 0.5); }
.stat-ic.violet { background: linear-gradient(135deg, #a78bfa, #6d7cff); box-shadow: 0 8px 18px -6px rgba(167, 139, 250, 0.5); }
.stat b { display: block; font-size: 21px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } }

/* ---------------- 列表 / 表格 ---------------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.search-box { position: relative; width: min(280px, 100%); }
.search-box svg { position: absolute; left: 11px; top: 50%; translate: 0 -50%; width: 14px; height: 14px; color: var(--muted); }
.search-box .input { padding-left: 33px; height: 36px; }

.table-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; padding: 11px 16px; font-size: 11.5px; font-weight: 650;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr { transition: background 0.12s; }
.tbl tbody tr:hover { background: var(--panel-hover); }
.tbl tbody tr:last-child td { border-bottom: none; }
.cell-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.cell-title { min-width: 0; flex: 1 1 auto; }
.cell-icon {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border-radius: 9px; background: var(--bg-inset); border: 1px solid var(--border); color: var(--muted);
}
.cell-icon svg { width: 16px; height: 16px; }
.cell-icon.dir { color: #fbbf24; background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.28); }
.cell-icon.t-image { color: #34d399; background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.26); }
.cell-icon.t-video { color: #a78bfa; background: rgba(167, 139, 250, 0.13); border-color: rgba(167, 139, 250, 0.28); }
.cell-icon.t-audio { color: #f472b6; background: rgba(244, 114, 182, 0.12); border-color: rgba(244, 114, 182, 0.26); }
.cell-icon.t-archive { color: #fb923c; background: rgba(251, 146, 60, 0.12); border-color: rgba(251, 146, 60, 0.26); }
.cell-icon.t-doc { color: #60a5fa; background: rgba(96, 165, 250, 0.12); border-color: rgba(96, 165, 250, 0.26); }

/* 文件列表（大气版）：更宽的行、更大的图标与文件名 */
.tbl.files td { padding: 15px 18px; }
.tbl.files th { padding: 12px 18px; }
.tbl.files .cell-main { gap: 14px; }
.tbl.files .cell-icon { width: 42px; height: 42px; border-radius: 12px; }
.tbl.files .cell-icon svg { width: 19px; height: 19px; }
.tbl.files .cell-icon img { border-radius: 10px; }
.tbl.files .cell-title b { font-size: 14.5px; }
.tbl.files tbody tr:hover { background: var(--panel-hover); }
.tbl.files .row-acts .icon-btn { width: 32px; height: 32px; }
.tbl.files .row-acts .icon-btn svg { width: 16px; height: 16px; }
.cell-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.cell-title { min-width: 0; }
.cell-title b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-title span { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; }
.num { font-variant-numeric: tabular-nums; color: var(--muted); }
.row-acts { display: flex; gap: 2px; justify-content: flex-end; }

.code-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: "JetBrains Mono", Consolas, monospace; font-size: 12.5px;
  background: var(--bg-inset); border: 1px solid var(--border);
  padding: 4px 9px; border-radius: 8px; cursor: copy; transition: all 0.14s;
}
.code-chip:hover { border-color: var(--accent); color: var(--accent); }

/* 徽章 */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 650; padding: 3px 9px; border-radius: 999px;
}
.badge svg { width: 11px; height: 11px; }
.badge.ok { color: var(--ok); background: var(--ok-soft); }
.badge.warn { color: var(--warn); background: var(--warn-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.badge.muted { color: var(--muted); background: var(--panel); border: 1px solid var(--border); }
.badge.accent { color: var(--accent); background: var(--accent-soft); }

/* 筛选 tabs */
.tabs { display: inline-flex; gap: 4px; background: var(--bg-inset); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.tab {
  border: none; background: transparent; color: var(--muted);
  padding: 6px 13px; border-radius: 7px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: all 0.14s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--panel-solid); color: var(--text); box-shadow: 0 2px 8px -2px rgba(0,0,0,0.3); }

/* 空状态 / 加载 */
.empty {
  padding: 60px 20px; text-align: center; color: var(--muted);
}
.empty svg { width: 42px; height: 42px; opacity: 0.4; margin-bottom: 12px; }
.empty b { display: block; color: var(--text); font-size: 14.5px; margin-bottom: 6px; }
.empty p { margin: 0 0 16px; font-size: 13px; }
.loading { padding: 46px; text-align: center; color: var(--muted); font-size: 13px; }
.spinner {
  width: 22px; height: 22px; margin: 0 auto 10px;
  border: 2.5px solid var(--border-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 面包屑 */
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; font-weight: 600; }
.crumbs a { color: var(--muted); padding: 4px 7px; border-radius: 7px; transition: all 0.13s; }
.crumbs a:hover { color: var(--text); background: var(--panel-hover); }
.crumbs .cur { color: var(--text); padding: 4px 7px; }
.crumbs .sep { color: var(--muted); opacity: 0.45; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4, 6, 12, 0.62);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  opacity: 0; transition: opacity 0.18s;
}
.modal-mask.show { opacity: 1; }
.modal {
  width: min(460px, 100%); max-height: 86vh; overflow-y: auto;
  background: var(--panel-solid); border: 1px solid var(--border-strong);
  border-radius: 16px; box-shadow: var(--shadow);
  transform: translateY(10px) scale(0.98); transition: transform 0.18s;
}
.modal-mask.show .modal { transform: none; }
.modal.wide { width: min(560px, 100%); }
.modal-head { display: flex; align-items: center; padding: 18px 20px 0; }
.modal-head h3 { margin: 0; font-size: 15.5px; flex: 1; display: flex; align-items: center; gap: 8px; }
.modal-head h3 svg { width: 17px; height: 17px; color: var(--accent); }
.modal-body { padding: 16px 20px 4px; }
.modal-body p.plain { color: var(--muted); font-size: 13.5px; line-height: 1.65; margin: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px 18px; }

/* 直链结果卡 */
.link-result {
  background: var(--bg-inset); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; margin-bottom: 12px;
}
.link-result .url {
  font-family: "JetBrains Mono", Consolas, monospace; font-size: 12.5px;
  word-break: break-all; color: var(--accent-2); line-height: 1.55; margin-bottom: 10px;
}
.link-result .note { font-size: 12px; color: var(--warn); margin-top: 8px; }

/* ---------------- Toast ---------------- */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--panel-solid); border: 1px solid var(--border-strong);
  border-left: 3px solid var(--ok);
  border-radius: 11px; padding: 11px 15px; min-width: 220px; max-width: 360px;
  font-size: 13px; font-weight: 550; box-shadow: var(--shadow);
  animation: toast-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.err { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--accent); }
.toast.out { opacity: 0; translate: 12px 0; transition: all 0.25s; }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } }

/* 上传进度 */
.progress {
  height: 7px; background: var(--bg-inset); border-radius: 99px; overflow: hidden; margin-top: 10px;
}
.progress i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 99px; transition: width 0.2s;
}

/* 连接卡片 */
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.conn-card { display: flex; flex-direction: column; gap: 13px; }
.conn-top { display: flex; align-items: flex-start; gap: 11px; }
.conn-top .cell-icon { width: 40px; height: 40px; }
.conn-name { flex: 1; min-width: 0; }
.conn-name b { display: flex; align-items: center; gap: 7px; font-size: 14.5px; }
.conn-name span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.invalid { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.dot.unknown { background: var(--muted); }
.conn-meta { font-size: 12.5px; color: var(--muted); display: grid; gap: 5px; }
.conn-meta b { color: var(--text); font-weight: 600; }
.conn-acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* 接入的网盘（总览页） */
.drive-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 2px; border-bottom: 1px solid var(--border); font-size: 13px;
  cursor: pointer;
}
.drive-row:last-child { border-bottom: none; }
.drive-name { display: flex; align-items: center; gap: 7px; min-width: 120px; flex: none; }
.drive-name b { font-weight: 650; }
.drive-url {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); font-size: 12px;
}
.drive-user { flex: none; color: var(--muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) {
  .drive-user { display: none; }
}

/* 开关 */
.switch { position: relative; display: inline-block; width: 40px; height: 23px; flex: none; }
.switch input { display: none; }
.switch i {
  position: absolute; inset: 0; border-radius: 99px; cursor: pointer;
  background: var(--border-strong); transition: background 0.18s;
}
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px;
  border-radius: 50%; background: #fff; transition: transform 0.18s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(17px); }

/* 日志 */
.log-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.log-row:last-child { border-bottom: none; }
.log-row .t { color: var(--muted); width: 132px; flex: none; font-variant-numeric: tabular-nums; }
.log-row .code { width: 92px; flex: none; }
.log-row .ip { flex: 1; min-width: 0; font-family: "JetBrains Mono", Consolas, monospace; font-size: 12px; }
.log-row .ua { flex: 2; min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 长文本列的固有宽度不参与父级最小内容宽度计算，避免撑破栅格 */
.log-row > * { contain: inline-size; }

/* 批量选择与批量操作条 */
.tbl .ck { width: 38px; text-align: center; }
.tbl input[type="checkbox"] {
  accent-color: var(--accent); width: 15px; height: 15px;
  cursor: pointer; vertical-align: middle; margin: 0;
}
.batch-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--accent-soft);
  border: 1px solid rgba(109, 124, 255, 0.28);
  border-radius: 12px; padding: 9px 14px; margin-bottom: 14px;
  animation: rise 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.batch-bar > svg { width: 15px; height: 15px; color: var(--accent); flex: none; }
.batch-bar b { font-size: 13px; }
.batch-note { color: var(--muted); font-size: 12px; }
.batch-bar .spacer { flex: 1; }

/* 表格列宽（类名驱动，便于移动端隐藏） */
.col-size { width: 100px; white-space: nowrap; }
.col-time { width: 160px; white-space: nowrap; }
.col-parent { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-short { width: 150px; white-space: nowrap; }
.col-visits { width: 70px; white-space: nowrap; }
.col-exp { width: 150px; white-space: nowrap; }
.col-status { width: 170px; }
.col-acts { width: 210px; white-space: nowrap; }

/* 过期样式 */
.expired { opacity: 0.55; }

/* ---------------- 动效系统（Motion.Lab：fade-in-up 错落 / pop-in / count-up 配套） ---------------- */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-in-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
}

/* 错落入场：--i 为序号，min() 封顶避免长列表拖尾 */
.anim-in {
  animation: fade-in-up 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: min(calc(var(--i, 0) * 50ms), 0.55s);
}
.anim-pop {
  animation: pop-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: min(calc(var(--i, 0) * 45ms), 0.5s);
}

.dot.ok { animation: dot-pulse 2.4s ease-in-out infinite; }
.cell-icon img { animation: fade-in 0.35s both; }

/* 页面切换入场 */
#view > * { animation: fade-in-up 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }

/* 登录卡片内容错落 */
.auth-card > * { animation: fade-in-up 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.auth-card > :nth-child(1) { animation-delay: 0.05s; }
.auth-card > :nth-child(2) { animation-delay: 0.13s; }
.auth-card > :nth-child(3) { animation-delay: 0.21s; }
.auth-card > :nth-child(4) { animation-delay: 0.29s; }

/* 弹窗退出 */
.modal-mask.closing { opacity: 0; }
.modal-mask.closing .modal { transform: translateY(10px) scale(0.98); }

/* 减少动态偏好：全部动效降级 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  .shell { display: block; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); transition: transform 0.22s;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-grid; }
  .content { padding: 16px 14px 32px; }
  .topbar { padding: 14px 16px; }
  .field-row { grid-template-columns: 1fr; }
  .cell-title span { max-width: 180px; }
  .toolbar { gap: 8px; }
  .toolbar .search-box { flex: 1 1 150px; width: auto; min-width: 130px; }
  .col-exp { display: none; }
  .drive-user { display: none; }
}

@media (max-width: 640px) {
  /* 左侧抽屉改用底部 tab 栏 */
  .sidebar, .side-mask { display: none !important; }
  .menu-btn { display: none; }
  .mobile-logout { display: inline-grid; }
  .shell { padding-bottom: 56px; }
  .tabbar { display: flex; }
  .topbar h1 { font-size: 16px; }
  .content { padding: 13px 10px 28px; }
  .col-time, .col-visits, .col-parent { display: none; }
  .col-short { width: 104px; }
  .col-status { width: auto; }
  .col-acts { width: 148px; }
  .row-acts { gap: 0; }
  .tbl.files .row-acts .icon-btn { width: 29px; height: 29px; }
  .code-chip { font-size: 11px; padding: 3px 6px; gap: 4px; }
  .code-chip svg { width: 10px; height: 10px; }
  .cell-title span { max-width: 150px; }
  .drive-row { flex-wrap: wrap; row-gap: 6px; }
  .drive-url { display: none; }
  .batch-note { display: none; }
  .conn-acts .btn { flex: 1; justify-content: center; }
  .stat { padding: 13px 14px; }
  .stat b { font-size: 18px; }
  .stat-ic { width: 36px; height: 36px; border-radius: 10px; }
  .toasts { left: 12px; right: 12px; top: 12px; }
  .toast { max-width: none; }
  .auth-card { padding: 30px 22px 24px; }
  .modal-mask { padding: 12px; }
  .modal { width: 100%; }
  .card { padding: 15px 14px; }
  .log-row .ua { display: none; }
}
/* 文件表格移动端同样卡片化：名称单行省略，大小/时间/操作一行 */
@media (max-width: 640px) {
  /* 完全去表格化并禁用横向滚动：所有长文本单行省略 */
  .tbl.files, .tbl.files tbody, .tbl.links, .tbl.links tbody { display: block; }
  .table-wrap { overflow-x: hidden; }
  .tbl.files thead { display: none; }
  .tbl.files tbody tr {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 5px 12px;
    padding: 12px 12px 10px;
    border-bottom: 1px solid var(--border);
  }
  .tbl.files tbody tr:last-child { border-bottom: none; }
  .tbl.files td { display: block; border: none; padding: 0; width: auto; }
  .tbl.files tbody tr > td:nth-of-type(1) { flex: 1 1 100%; }
  .tbl.files .cell-title b, .tbl.links .cell-title b {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .tbl.files td.col-size, .tbl.files td.col-time { width: auto; white-space: nowrap; font-size: 12px; }
  /* 目录没有大小概念，卡片上隐藏占位横杠 */
  .tbl.files td.col-size.is-empty { display: none; }
  .tbl.files td.col-acts { margin-left: auto; }
  .tbl.files .row-acts { justify-content: flex-start; }
  .tbl.files tr.anim-in { animation-name: fade-in; transform: none; }
}
.side-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 25; }

/* 直链表格移动端卡片化：表头隐藏，每行变堆叠卡片 */
@media (max-width: 640px) {
  .tbl.links thead { display: none; }
  .tbl.links tbody tr {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 5px 12px;
    padding: 12px 12px 10px 46px;
    border-bottom: 1px solid var(--border);
  }
  .tbl.links tbody tr:last-child { border-bottom: none; }
  .tbl.links td { display: block; border: none; padding: 0; width: auto; }
  .tbl.links td.ck { position: absolute; left: 14px; top: 15px; width: auto; }
  .tbl.links td:nth-of-type(2) { flex: 1 1 auto; min-width: 0; }
  .tbl.links td.col-short { order: 1; flex: 0 0 auto; }
  .tbl.links td.col-status { order: 2; flex: 1 1 100%; }
  .tbl.links td.col-acts { order: 3; margin-top: 2px; }
  .tbl.links .row-acts { justify-content: flex-start; }
  .tbl.links .cell-title span { max-width: 100%; }
  .tbl.links tr.anim-in { animation-name: fade-in; transform: none; }
  .tbl td { padding: 12px 12px; }
  .tbl th { padding: 10px 12px; }
}

/* ------------------------------ API 密钥（连接设置页） ------------------------------ */

.key-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.key-row:last-child { border-bottom: none; }
.key-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.key-info b { font-weight: 600; }
.key-info .mono { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key-meta { font-size: 12px; color: var(--muted); flex: none; }
.modal-field-box {
  background: rgba(127,127,127,.1); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; font-size: 13px; word-break: break-all;
}

/* ------------------------------ 右键菜单 + 首页快捷入口 ------------------------------ */

.ctx-menu {
  position: fixed; z-index: 300;
  background: var(--card-bg, #fff); border: 1px solid var(--border);
  border-radius: 10px; padding: 5px; min-width: 150px;
  box-shadow: 0 8px 28px rgba(0,0,0,.14);
  animation: fade-in .12s ease;
}
.ctx-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: none; background: none; cursor: pointer;
  padding: 8px 10px; border-radius: 7px;
  font: inherit; font-size: 13px; color: var(--text); text-align: left;
}
.ctx-menu button:hover { background: rgba(127,127,127,.12); }
.ctx-menu svg { width: 15px; height: 15px; flex: none; }
.fav-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 13px; cursor: pointer; max-width: 100%; min-width: 0;
}
.fav-chip:hover { border-color: var(--accent, #6d7cff); }
.fav-chip .cell-icon { width: 34px; height: 34px; }
.fav-chip .cell-icon svg { width: 16px; height: 16px; }
.fav-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fav-info b { font-weight: 600; white-space: nowrap; }
.fav-path { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.fav-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; flex: none;
  border: none; border-radius: 6px; background: none; cursor: pointer; color: var(--muted);
}
.fav-x:hover { background: rgba(127,127,127,.14); color: var(--danger, #e5484d); }
.fav-x svg { width: 12px; height: 12px; }
