/* ============================================================
   CloudNest 设计系统
   颜色全部走 CSS 变量，明暗主题自动切换
   ============================================================ */
:root {
  --bg: #f7f8fa;
  --bg-elev: #ffffff;
  --bg-hover: #f1f3f5;
  --bg-active: #e7ecf3;
  --bg-sunken: #eff1f4;
  --border: #e3e6ea;
  --border-strong: #cfd4da;
  --text: #1a1d21;
  --text-dim: #6b7280;
  --text-faint: #9aa1ab;
  --accent: #2f6df6;
  --accent-hover: #2560e0;
  --accent-soft: #e8f0ff;
  --danger: #dc3545;
  --danger-soft: #fdeced;
  --success: #17a673;
  --warn: #e8a317;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 4px 14px rgba(16, 24, 40, 0.1);
  --shadow-lg: 0 16px 48px rgba(16, 24, 40, 0.18);
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --sidebar-w: 236px;
  --header-h: 58px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --bg-elev: #1e2127;
    --bg-hover: #262a31;
    --bg-active: #2f343d;
    --bg-sunken: #121419;
    --border: #2c313a;
    --border-strong: #3d434e;
    --text: #e8eaed;
    --text-dim: #9aa1ab;
    --text-faint: #6b7280;
    --accent: #5b8cff;
    --accent-hover: #6f9bff;
    --accent-soft: #1c2740;
    --danger: #f26d75;
    --danger-soft: #3a1f22;
    --success: #35c08d;
    --warn: #f0b429;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ---------------- 通用控件 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.btn:hover { background: var(--bg-hover); border-color: var(--text-faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-sm { padding: 4px 9px; font-size: 13px; }
.btn-icon { padding: 7px; width: 34px; height: 34px; }

.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--text);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text-faint); }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; }
.field .hint { margin-top: 6px; font-size: 12px; color: var(--text-dim); }

.alert {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.alert-info { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.alert-warn { background: var(--warn-soft, #fff7e6); color: var(--warn, #b26a00); border-color: var(--warn, #d99b3d); }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 应用布局 ---------------- */
#app { height: 100%; }

.login-wrap {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(1000px 500px at 15% 10%, var(--accent-soft), transparent 60%),
    radial-gradient(800px 400px at 85% 90%, var(--accent-soft), transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px 28px;
}
.login-logo { display: flex; align-items: center; gap: 11px; margin-bottom: 6px; }
.login-logo .mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #7b5bff);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 19px;
  box-shadow: var(--shadow-sm);
}
.login-logo h1 { font-size: 21px; margin: 0; font-weight: 650; letter-spacing: -0.2px; }
.login-sub { color: var(--text-dim); font-size: 13px; margin: 0 0 26px; }
.login-tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-sunken); border-radius: var(--radius-sm); margin-bottom: 22px; }
.login-tabs button {
  flex: 1; padding: 8px; border: none; background: transparent;
  border-radius: 6px; cursor: pointer; font-weight: 500; color: var(--text-dim);
}
.login-tabs button.active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); }
.login-foot { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-faint); text-align: center; }

.shell { display: flex; height: 100%; overflow: hidden; }

/* 侧栏 */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  gap: 3px;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px 16px; font-weight: 650; font-size: 15.5px;
}
.sidebar .brand .mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #7b5bff);
  display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-dim); font-weight: 500;
  border: none; background: transparent; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--text-faint); }
.nav-sep { height: 1px; background: var(--border); margin: 10px 6px; }

.quota-box {
  margin: auto 4px 4px; padding: 12px;
  background: var(--bg-sunken); border-radius: var(--radius);
  font-size: 12px;
}
.quota-box .row { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--text-dim); }
.quota-box .row b { color: var(--text); font-weight: 600; }
.quota-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.quota-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.3s; }
.quota-fill.warn { background: var(--warn); }
.quota-fill.full { background: var(--danger); }

/* 主区 */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.header {
  height: var(--header-h);
  flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}
.crumbs { display: flex; align-items: center; gap: 3px; flex: 1; min-width: 0; overflow: hidden; }
.crumbs .crumb {
  padding: 5px 9px; border-radius: 6px; cursor: pointer;
  color: var(--text-dim); white-space: nowrap; border: none; background: transparent;
}
.crumbs .crumb:hover { background: var(--bg-hover); color: var(--text); }
.crumbs .crumb.current { color: var(--text); font-weight: 600; }
.crumbs .sep { color: var(--text-faint); }

.search-box { position: relative; width: 250px; }
.search-box .input { padding-left: 32px; }
.search-box .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }

.toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.toolbar .spacer { flex: 1; }
.sel-info { font-size: 13px; color: var(--text-dim); }

/* 选中项操作栏：默认隐藏，有选中时加 .show
   注意不要用 hidden 属性 + 内联 display，hidden 会被内联样式覆盖 */
.sel-bar {
  display: none;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}
.sel-bar.show { display: flex; }

/* 内容区 */
.content { flex: 1; overflow: auto; padding: 16px 20px; position: relative; }

/* 文件网格 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.tile {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.1s;
  position: relative;
  user-select: none;
}
.tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.tile.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
.tile .thumb {
  height: 92px; display: grid; place-items: center;
  margin-bottom: 10px; border-radius: var(--radius-sm);
  background: var(--bg-sunken); overflow: hidden; position: relative;
}
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile .thumb .icon { font-size: 34px; }
.tile .name {
  font-size: 13px; word-break: break-all; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile .meta { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }
.tile .badge {
  position: absolute; top: 8px; right: 8px;
  padding: 2px 7px; border-radius: 20px; font-size: 11px;
  background: var(--bg-elev); border: 1px solid var(--border);
}
.tile .badge.star { color: var(--warn); border-color: var(--warn); }

/* 文件列表 */
.list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-elev); }
.list-head, .list-row {
  display: grid;
  grid-template-columns: 34px 1fr 110px 150px 92px;
  gap: 10px; align-items: center;
  padding: 0 12px;
}
.list-head {
  height: 38px; background: var(--bg-sunken);
  font-size: 12px; color: var(--text-dim); font-weight: 600;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
}
.list-head .sortable { cursor: pointer; user-select: none; }
.list-head .sortable:hover { color: var(--text); }
.list-row { height: 44px; cursor: pointer; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--bg-hover); }
.list-row.selected { background: var(--accent-soft); }
.list-row .name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.list-row .name .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .dim { color: var(--text-dim); font-size: 12.5px; }
.list-row .thumb {
  width: 30px; height: 30px; border-radius: 5px; overflow: hidden;
  display: grid; place-items: center; background: var(--bg-sunken); flex-shrink: 0;
}
.list-row .thumb img { width: 100%; height: 100%; object-fit: cover; }

.checkbox {
  width: 16px; height: 16px; border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
}
.checkbox.checked { background: var(--accent); border-color: var(--accent); color: #fff; }
.checkbox.indeterminate { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 空状态 */
.empty {
  display: grid; place-items: center; padding: 70px 20px; text-align: center; color: var(--text-faint);
}
.empty .big { font-size: 46px; margin-bottom: 14px; opacity: 0.5; }
.empty h3 { margin: 0 0 6px; color: var(--text-dim); font-size: 15px; font-weight: 600; }
.empty p { margin: 0 0 18px; font-size: 13px; }

/* 拖放遮罩 */
.dropzone {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(47, 109, 246, 0.12);
  border: 3px dashed var(--accent);
  display: none; place-items: center;
  backdrop-filter: blur(2px);
}
.dropzone.active { display: grid; }
.dropzone .box {
  background: var(--bg-elev); padding: 26px 40px; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); text-align: center; font-weight: 600; font-size: 16px;
}

/* 上传队列 */
.uploads {
  position: fixed; right: 18px; bottom: 18px; z-index: 300;
  width: 330px; max-height: 420px; overflow: hidden;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.uploads .head {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px;
}
.uploads .list { overflow-y: auto; padding: 6px; }
.up-item { padding: 8px 9px; border-radius: var(--radius-sm); }
.up-item:hover { background: var(--bg-hover); }
.up-item .top { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.up-item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-item .pc { color: var(--text-dim); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.up-item .bar { height: 4px; background: var(--bg-sunken); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.up-item .fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.2s; }
.up-item .fill.err { background: var(--danger); }
.up-item .fill.done { background: var(--success); }
.up-item .err-msg { font-size: 11.5px; color: var(--danger); margin-top: 4px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0, 0, 0, 0.42);
  display: grid; place-items: center; padding: 20px;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--bg-elev); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 460px;
  max-height: 88vh; display: flex; flex-direction: column;
  border: 1px solid var(--border);
}
.modal.wide { max-width: 640px; }
/* 目录选择器要用到，左右留够空间 */
.modal.wide:has(.path-list) { max-width: 820px; }
.modal .m-head {
  padding: 17px 20px; border-bottom: 1px solid var(--border);
  font-weight: 650; font-size: 15.5px; display: flex; align-items: center; justify-content: space-between;
}
.modal .m-body { padding: 20px; overflow-y: auto; }
.modal .m-foot {
  padding: 13px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 9px;
}
.close-x {
  border: none; background: transparent; cursor: pointer;
  color: var(--text-faint); font-size: 22px; line-height: 1;
  padding: 3px 7px; border-radius: 6px;
}
.close-x:hover { background: var(--bg-hover); color: var(--text); }

.check-row { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.share-link-box {
  display: flex; gap: 8px; align-items: center;
  background: var(--bg-sunken); padding: 10px; border-radius: var(--radius-sm);
}
.share-link-box input {
  flex: 1; background: transparent; border: none; outline: none;
  font-family: var(--mono); font-size: 12.5px; color: var(--text);
}

/* 预览器 */
.viewer-mask {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0, 0, 0, 0.9);
  display: flex; flex-direction: column;
}
.viewer-head {
  height: 56px; display: flex; align-items: center; gap: 12px;
  padding: 0 18px; color: #fff; flex-shrink: 0;
}
.viewer-head .nm { font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-head .btn {
  background: rgba(255, 255, 255, 0.14); border-color: transparent; color: #fff;
}
.viewer-head .btn:hover { background: rgba(255, 255, 255, 0.24); }
.viewer-body { flex: 1; display: grid; place-items: center; overflow: auto; padding: 20px; }
.viewer-body img, .viewer-body video { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-body iframe, .viewer-body embed { width: 100%; height: 100%; border: none; background: #fff; }
.viewer-body .txt {
  width: 100%; height: 100%; overflow: auto; background: var(--bg-elev);
  color: var(--text); padding: 22px; border-radius: var(--radius);
  font-family: var(--mono); font-size: 13px; line-height: 1.65; white-space: pre-wrap;
}
.viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.16); border: none; color: #fff;
  font-size: 22px; cursor: pointer; display: grid; place-items: center;
}
.viewer-nav:hover { background: rgba(255, 255, 255, 0.28); }
.viewer-nav.prev { left: 18px; }
.viewer-nav.next { right: 18px; }

/* 右键菜单 */
.ctx-menu {
  position: fixed; z-index: 600;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 5px; min-width: 190px;
}
.ctx-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 11px; border-radius: 6px; cursor: pointer;
  font-size: 13.5px; width: 100%; border: none; background: transparent; text-align: left;
}
.ctx-item:hover { background: var(--bg-hover); }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger:hover { background: var(--danger-soft); }
.ctx-sep { height: 1px; background: var(--border); margin: 5px 0; }

/* 分享页 */
.share-page {
  min-height: 100%; display: flex; flex-direction: column;
  align-items: center; padding: 40px 20px;
}
.share-box {
  width: 100%; max-width: 620px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden;
}
.share-box .s-head { padding: 26px 28px; text-align: center; border-bottom: 1px solid var(--border); }
.share-box .s-icon { font-size: 46px; margin-bottom: 10px; }
.share-box .s-head h2 { margin: 0 0 6px; font-size: 18px; word-break: break-all; }
.share-box .s-head p { margin: 0; color: var(--text-dim); font-size: 13px; }
.share-box .s-body { padding: 20px 24px; }
.share-foot { margin-top: 18px; font-size: 12.5px; color: var(--text-faint); text-align: center; }

.share-table { width: 100%; border-collapse: collapse; }
.share-table th {
  text-align: left; padding: 9px 10px; font-size: 12px;
  color: var(--text-dim); font-weight: 600; border-bottom: 1px solid var(--border);
}
.share-table td { padding: 11px 10px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.share-table tr:last-child td { border-bottom: none; }
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 500;
}
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.off { background: var(--bg-sunken); color: var(--text-faint); }
.pill.warn { background: var(--danger-soft); color: var(--danger); }

.toast-wrap {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 700; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  padding: 10px 18px; border-radius: var(--radius);
  background: var(--bg-elev); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-size: 13.5px;
  display: flex; align-items: center; gap: 9px;
  animation: slidein 0.18s ease-out;
}
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.success { border-color: var(--success); }
@keyframes slidein { from { opacity: 0; transform: translateY(-10px); } }

@media (max-width: 760px) {
  .sidebar { position: fixed; z-index: 300; height: 100%; transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .search-box { width: 140px; }
  .list-head, .list-row { grid-template-columns: 30px 1fr 84px; }
  .list-head .col-optional, .list-row .col-optional { display: none; }
}
/* ---------------- 目录选择器 ---------------- */
.path-crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 7px 9px; margin-bottom: 8px;
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius-sm, 5px);
  font-size: 12.5px; font-family: var(--mono);
  min-height: 32px; align-content: flex-start;
}
.crumb {
  background: none; border: none; cursor: pointer;
  color: var(--accent); padding: 2px 5px; border-radius: 3px;
  font: inherit; font-family: var(--mono);
}
.crumb:hover { background: var(--bg-hover); }
.crumb.cur { color: var(--text); font-weight: 600; cursor: default; }
.crumb.cur:hover { background: none; }
.crumb.muted { color: var(--text-faint); cursor: default; }

.path-list {
  border: 1px solid var(--border); border-radius: var(--radius-sm, 5px);
  background: var(--bg-elev);
  max-height: 320px; min-height: 130px; overflow-y: auto;
}
.path-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 8px 12px;
  background: none; border: none; border-bottom: 1px solid var(--border);
  cursor: pointer; text-align: left; color: var(--text);
  font-size: 13px; font-family: inherit;
}
.path-row:last-child { border-bottom: none; }
.path-row:hover { background: var(--bg-hover); }
.path-row .nm {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.path-row .dim {
  font-size: 11.5px; color: var(--text-faint); flex-shrink: 0;
  font-family: var(--mono);
}
.path-row.up { background: var(--bg-sunken); font-weight: 500; }
.path-row.up:hover { background: var(--bg-hover); }
.path-row.drive { padding: 11px 12px; }
.path-row.drive .nm { font-size: 13.5px; }

.path-empty {
  padding: 26px 16px; text-align: center;
  color: var(--text-faint); font-size: 12.5px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* ---------------- 预览器增强 ---------------- */

/* 头部：文件名后面跟类型标签和大小，用 spacer 推到右侧 */
.viewer-head .nm { flex: none; max-width: 42%; }
.viewer-tag {
  padding: 2px 8px; border-radius: 10px; font-size: 11.5px;
  background: rgba(255, 255, 255, 0.16); color: rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
}

/* 各类内容按需居中或左对齐 */
.viewer-body.kind-text,
.viewer-body.kind-code,
.viewer-body.kind-markdown,
.viewer-body.kind-csv { place-items: stretch; padding: 0; }

.viewer-note {
  padding: 8px 18px; font-size: 12px;
  color: var(--text-dim); background: var(--bg-sunken);
  border-bottom: 1px solid var(--border);
}

/* 图片点击放大 */
.viewer-body img.zoomed { max-width: none; max-height: none; cursor: zoom-out; }
.viewer-body img { cursor: zoom-in; }

/* 音频 */
.audio-box { display: flex; flex-direction: column; align-items: center; gap: 16px; color: #fff; }
.audio-box .big { font-size: 64px; }
.audio-box .nm { font-size: 15px; opacity: 0.85; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-box audio { width: min(560px, 80vw); }

/* 文本 / 代码 */
.viewer-body .txt {
  width: 100%; height: 100%; overflow: auto; margin: 0;
  padding: 18px 20px; font-size: 13px; line-height: 1.75;
  font-family: var(--mono); white-space: pre-wrap; word-break: break-word;
  color: var(--text); background: var(--bg); text-align: left;
}
.viewer-body .txt pre { margin: 0; white-space: pre-wrap; word-break: break-word; }
.viewer-body .txt .spinner { margin: 40px auto; display: block; }
.code-lang {
  position: sticky; top: 0; z-index: 1;
  padding: 6px 20px; font-size: 11px; font-family: var(--mono);
  color: var(--text-faint); background: var(--bg-sunken);
  border-bottom: 1px solid var(--border);
}

/* CSV 表格 */
.viewer-body .csv-wrap { overflow: auto; height: 100%; }
.csv-table { border-collapse: collapse; font-size: 12.5px; width: max-content; min-width: 100%; }
.csv-table th, .csv-table td {
  border: 1px solid var(--border); padding: 6px 11px; text-align: left;
  white-space: nowrap; max-width: 420px; overflow: hidden; text-overflow: ellipsis;
}
.csv-table th { background: var(--bg-sunken); font-weight: 600; position: sticky; top: 0; z-index: 1; }
.csv-table tbody tr:nth-child(even) { background: var(--bg-sunken); }
.csv-table tbody tr:hover { background: var(--bg-hover); }

/* Markdown 渲染 */
.viewer-body .txt.md {
  white-space: normal; font-family: inherit; font-size: 14px; line-height: 1.8;
  padding: 0; max-width: 860px; margin: 0 auto;
}
.md-body { padding: 28px 32px 48px; color: var(--text); }
.md-body h1, .md-body h2, .md-body h3,
.md-body h4, .md-body h5, .md-body h6 {
  margin: 1.5em 0 0.6em; line-height: 1.3; font-weight: 650;
}
.md-body h1 { font-size: 1.75em; padding-bottom: 0.3em; border-bottom: 1px solid var(--border); }
.md-body h2 { font-size: 1.4em; padding-bottom: 0.25em; border-bottom: 1px solid var(--border); }
.md-body h3 { font-size: 1.18em; }
.md-body h4, .md-body h5, .md-body h6 { font-size: 1em; color: var(--text-dim); }
.md-body > *:first-child { margin-top: 0; }
.md-body p { margin: 0.9em 0; }
.md-body ul, .md-body ol { margin: 0.8em 0; padding-left: 1.8em; }
.md-body li { margin: 0.3em 0; }
.md-body code {
  padding: 2px 6px; border-radius: 4px; font-size: 0.88em;
  font-family: var(--mono); background: var(--bg-sunken); color: var(--accent);
}
.md-body pre.md-code {
  margin: 1em 0; padding: 14px 16px; overflow-x: auto;
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm, 5px);
}
.md-body pre.md-code code { padding: 0; background: none; color: var(--text); font-size: 12.5px; }
.md-body blockquote {
  margin: 1em 0; padding: 0.5em 1em; border-left: 3px solid var(--accent);
  background: var(--bg-sunken); color: var(--text-dim);
}
.md-body hr { margin: 1.8em 0; border: none; border-top: 1px solid var(--border); }
.md-body a { color: var(--accent); }
.md-body .md-img { max-width: 100%; border-radius: var(--radius-sm, 5px); }
.md-table { border-collapse: collapse; margin: 1em 0; font-size: 13px; display: block; overflow-x: auto; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 7px 13px; text-align: left; }
.md-table th { background: var(--bg-sunken); font-weight: 600; }

/* 不支持预览的提示 */
.viewer-notice {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: #fff; text-align: center; padding: 30px;
}
.viewer-notice .big { font-size: 56px; }
.viewer-notice h3 { margin: 0; font-size: 17px; }
.viewer-notice p { margin: 0; opacity: 0.75; font-size: 13.5px; line-height: 1.7; }
.viewer-notice code {
  padding: 2px 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.14); font-size: 12.5px;
}
.viewer-size { font-size: 12.5px; opacity: 0.6; flex-shrink: 0; }
