/* ============ 基础 ============ */
:root {
  --bg: #080b12;
  --bg-soft: #0c111b;
  --panel: rgba(17, 24, 38, .82);
  --panel-solid: #111826;
  --panel-2: #172033;
  --border: rgba(148, 163, 184, .14);
  --border-strong: rgba(148, 163, 184, .24);
  --text: #e8eefa;
  --muted: #8e9db5;
  --muted-2: #64748b;
  --accent: #4f8cff;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(79, 140, 255, .14);
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 20px 50px rgba(0, 0, 0, .45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; flex: none; }
[hidden] { display: none !important; }

::selection { background: rgba(79, 140, 255, .35); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, .22);
  border: 2px solid transparent;
  border-radius: 8px;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, .4); background-clip: padding-box; }

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .55;
}
.orb-a {
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(56, 116, 255, .45), transparent 68%);
  top: -220px; left: -140px;
}
.orb-b {
  width: 460px; height: 460px;
  background: radial-gradient(circle, rgba(124, 92, 255, .3), transparent 70%);
  bottom: -200px; right: -120px;
}
.grid-glow {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, .035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 20%, #000 0%, transparent 72%);
}

/* ============ 通用控件 ============ */
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 11px;
  background: linear-gradient(135deg, #4f8cff, #7c5cff);
  color: #fff;
  font-weight: 600;
  letter-spacing: .01em;
  box-shadow: 0 8px 24px rgba(79, 140, 255, .3), inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.primary-btn:hover { filter: brightness(1.07); box-shadow: 0 10px 30px rgba(79, 140, 255, .4); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn:disabled { opacity: .55; cursor: not-allowed; filter: none; }
.primary-btn.compact { padding: 9px 15px; border-radius: 9px; font-size: 13px; }
.primary-btn svg { width: 17px; height: 17px; }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, .06);
  color: #c8d4e8;
  font-size: 13px;
  font-weight: 500;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.ghost-btn:hover { background: rgba(148, 163, 184, .12); border-color: var(--border-strong); color: #fff; }
.ghost-btn svg { width: 16px; height: 16px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: var(--muted);
  transition: background .16s ease, color .16s ease;
}
.icon-btn:hover { background: rgba(148, 163, 184, .12); color: #fff; }
.icon-btn svg { width: 18px; height: 18px; }

.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner.large { width: 28px; height: 28px; border-width: 2.5px; border-color: rgba(79, 140, 255, .2); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 登录 ============ */
.login-view {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: min(390px, 100%);
  padding: 36px 34px 28px;
  background: linear-gradient(160deg, rgba(23, 32, 51, .92), rgba(13, 19, 31, .94));
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .05);
  backdrop-filter: blur(18px);
  text-align: center;
  animation: rise .45s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.brand-mark {
  width: 66px; height: 66px;
  margin: 0 auto 18px;
  border-radius: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, rgba(110, 168, 255, .28), rgba(79, 140, 255, .06));
  border: 1px solid rgba(110, 168, 255, .22);
  box-shadow: 0 12px 32px rgba(60, 110, 255, .2);
}
.brand-mark svg { width: 44px; height: 44px; }
.brand-mark.small {
  width: 40px; height: 40px;
  margin: 0;
  border-radius: 12px;
  box-shadow: none;
  background: linear-gradient(140deg, rgba(79, 140, 255, .2), rgba(124, 92, 255, .1));
}
.brand-mark.small svg { width: 26px; height: 26px; }

.login-card h1 {
  margin: 0;
  font-size: 23px;
  letter-spacing: .01em;
  font-weight: 650;
}
.login-sub {
  margin: 8px 0 28px;
  color: var(--muted);
  font-size: 13px;
}
.field { display: block; text-align: left; }
.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 550;
  color: #aab8cd;
  letter-spacing: .02em;
}
.password-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(7, 11, 18, .65);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.password-wrap:focus-within {
  border-color: rgba(79, 140, 255, .65);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, .14);
}
.password-wrap input {
  flex: 1;
  min-width: 0;
  padding: 13px 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
  letter-spacing: .06em;
}
.password-wrap input::placeholder { color: var(--muted-2); letter-spacing: 0; }
.eye-btn { width: 32px; height: 32px; }
.eye-btn.revealed { color: var(--accent); }

.form-error {
  min-height: 20px;
  margin: 10px 0 4px;
  color: var(--red);
  font-size: 12.5px;
  text-align: left;
}
.login-btn { width: 100%; margin-top: 4px; padding: 13px 18px; }
.login-btn.loading .btn-label { opacity: .7; }
.login-btn .spinner { display: none; }
.login-btn.loading .spinner { display: inline-block; }
.login-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 20px 0 0;
  color: var(--muted-2);
  font-size: 11.5px;
}
.login-note svg { width: 13px; height: 13px; }

/* ============ 应用骨架 ============ */
.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 22px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 2px 14px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 16px; font-weight: 650; letter-spacing: .01em; }
.brand-text span { color: var(--muted-2); font-size: 11.5px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.conn-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, .18);
  background: rgba(52, 211, 153, .07);
  color: #7fe3bd;
  font-size: 11.5px;
}
.conn-badge i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .16);
}

/* ============ 路径栏 ============ */
.pathbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
}
.home-btn { color: #8fb4ff; }
.breadcrumbs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 2px;
}
.breadcrumbs::-webkit-scrollbar { display: none; }
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  transition: background .14s ease, color .14s ease;
}
.crumb:hover { background: rgba(148, 163, 184, .1); color: #fff; }
.crumb.current { color: var(--text); font-weight: 550; }
.crumb-sep { color: #3d4a60; font-size: 12px; padding: 0 1px; user-select: none; }
.goto-form { flex: 1; display: flex; gap: 6px; min-width: 0; }
.goto-form input {
  flex: 1;
  min-width: 0;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid rgba(79, 140, 255, .4);
  background: rgba(7, 11, 18, .7);
  outline: 0;
  font-family: var(--mono);
  font-size: 12.5px;
}
.goto-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 140, 255, .12); }

/* ============ 工具栏 ============ */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px 12px;
  flex-wrap: wrap;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 9px; }
.toolbar-right { flex-wrap: wrap; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 240px;
  max-width: 46vw;
  padding: 0 11px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(13, 19, 31, .72);
  color: var(--muted-2);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.search:focus-within { border-color: rgba(79, 140, 255, .55); box-shadow: 0 0 0 3px rgba(79, 140, 255, .1); }
.search svg { width: 15px; height: 15px; }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12.5px;
  color: var(--text);
}
.search input::placeholder { color: var(--muted-2); }
.search input::-webkit-search-cancel-button { filter: invert(.6); }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(13, 19, 31, .72);
  cursor: pointer;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  width: 30px; height: 17px;
  border-radius: 999px;
  background: rgba(148, 163, 184, .22);
  position: relative;
  transition: background .18s ease;
}
.switch-track span {
  position: absolute;
  top: 2px; left: 2px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #c9d5e7;
  transition: transform .18s ease, background .18s ease;
}
.switch input:checked + .switch-track { background: rgba(79, 140, 255, .85); }
.switch input:checked + .switch-track span { transform: translateX(13px); background: #fff; }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(79, 140, 255, .25); }
.switch-label { font-size: 12.5px; color: var(--muted); }

/* ============ 内容与表格 ============ */
.content { flex: 1; display: flex; flex-direction: column; min-height: 0; padding-bottom: 18px; }
.table-shell {
  position: relative;
  flex: 1;
  min-height: 340px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .22);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.table-scroll { flex: 1; overflow: auto; min-height: 0; }
.file-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.file-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0;
  height: 42px;
  background: rgba(13, 19, 31, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-weight: 500;
  color: var(--muted-2);
  font-size: 11.5px;
  letter-spacing: .03em;
}
.file-table thead th:first-child { padding-left: 16px; }
.file-table thead th:last-child { padding-right: 16px; }
.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 0;
  color: inherit;
  font-size: inherit;
  letter-spacing: inherit;
}
.sort-btn:hover { color: #cbd7e8; }
.sort-btn.active { color: #a9c7ff; }
.sort-arrow { font-size: 10px; opacity: .8; }
.col-name { width: auto; }
.col-size { width: 108px; }
.col-time { width: 166px; }
.col-actions { width: 104px; text-align: right; }
.file-table td {
  height: 52px;
  padding: 6px 12px 6px 0;
  border-bottom: 1px solid rgba(148, 163, 184, .06);
  vertical-align: middle;
}
.file-table td:first-child { padding-left: 16px; }
.file-table td:last-child { padding-right: 16px; }
.file-table tbody tr { transition: background .12s ease; }
.file-table tbody tr:hover { background: rgba(79, 140, 255, .055); }
.file-table tbody tr:last-child td { border-bottom: 0; }

.cell-name { display: flex; align-items: center; gap: 11px; min-width: 0; }
.name-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  width: 100%;
  padding: 0;
  text-align: left;
}
.fname {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  color: #dbe4f3;
}
.name-btn:hover .fname { color: #fff; }
.fname.dir { font-weight: 540; color: #e9f0fc; }
.fsize, .ftime { color: var(--muted-2); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; opacity: .45; transition: opacity .12s ease; }
.file-table tbody tr:hover .row-actions { opacity: 1; }
.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 7px;
  color: var(--muted);
  transition: background .14s ease, color .14s ease;
}
.row-action:hover { background: rgba(79, 140, 255, .14); color: #bcd4ff; }
.row-action svg { width: 16px; height: 16px; }
.row-action.download:hover { background: rgba(52, 211, 153, .12); color: #7fe3bd; }

.ficon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  flex: none;
  background: rgba(148, 163, 184, .08);
  color: #a9b8ce;
}
.ficon svg { width: 19px; height: 19px; }
.ficon.folder { background: rgba(79, 140, 255, .12); color: #78a9ff; }
.ficon.image { background: rgba(167, 139, 250, .12); color: #b8a1ff; }
.ficon.video { background: rgba(244, 114, 182, .11); color: #f28bc4; }
.ficon.audio { background: rgba(52, 211, 153, .1); color: #5fe0b6; }
.ficon.code { background: rgba(56, 189, 248, .1); color: #63c8f7; }
.ficon.text { background: rgba(148, 163, 184, .1); color: #a9b8ce; }
.ficon.pdf { background: rgba(248, 113, 113, .11); color: #ff8f8f; }
.ficon.archive { background: rgba(251, 191, 36, .1); color: #f3c75a; }
.ficon.link { background: rgba(45, 212, 191, .1); color: #5fd9cb; }

.link-badge {
  flex: none;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(45, 212, 191, .1);
  border: 1px solid rgba(45, 212, 191, .18);
  color: #6fdccf;
  font-size: 10px;
  line-height: 1.6;
}

/* ============ 状态 ============ */
.state {
  flex: 1;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted-2);
  padding: 40px 20px;
  text-align: center;
}
.state p { margin: 0; font-size: 13px; }
.state svg { width: 42px; height: 42px; opacity: .35; }
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 4px 0;
  color: var(--muted-2);
  font-size: 11.5px;
  font-family: var(--mono);
  min-height: 26px;
}
#status-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ 拖拽 ============ */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 14, .72);
  backdrop-filter: blur(6px);
  animation: fade .15s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 42px 56px;
  border-radius: 20px;
  border: 1.5px dashed rgba(79, 140, 255, .6);
  background: rgba(17, 24, 38, .9);
  box-shadow: 0 0 0 8px rgba(79, 140, 255, .06), var(--shadow);
}
.drop-card svg { width: 38px; height: 38px; color: #7aa9ff; }
.drop-card strong { font-size: 16px; font-weight: 600; }
.drop-card span { color: var(--muted); font-size: 12px; font-family: var(--mono); max-width: 70vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ 上传面板 ============ */
.upload-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: rgba(15, 22, 35, .96);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise .22s ease both;
}
.upload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.upload-head strong { font-weight: 600; }
.upload-head span { color: var(--muted-2); font-family: var(--mono); font-size: 11px; }
.upload-list { max-height: 250px; overflow: auto; }
.upload-item { padding: 10px 14px; border-bottom: 1px solid rgba(148, 163, 184, .06); }
.upload-item:last-child { border-bottom: 0; }
.upload-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: #cfdaeb; }
.upload-pct { color: var(--muted-2); font-size: 11px; font-family: var(--mono); flex: none; }
.upload-bar { height: 3px; margin-top: 7px; border-radius: 3px; background: rgba(148, 163, 184, .12); overflow: hidden; }
.upload-bar span { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, #4f8cff, #8b5cf6); transition: width .18s ease; }
.upload-item.done .upload-bar span { background: var(--green); }
.upload-item.error .upload-name { color: var(--red); }
.upload-item.error .upload-bar span { background: var(--red); }

/* ============ Toast ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 70;
  transform: translate(-50%, 12px);
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(20, 28, 44, .97);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
  font-size: 12.5px;
  color: #dbe5f5;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  max-width: min(90vw, 520px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(248, 113, 113, .35); color: #ffc0c0; }
.toast.success { border-color: rgba(52, 211, 153, .3); color: #a6f3d6; }

/* ============ 对话框 ============ */
.dialog {
  width: min(400px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: #121a29;
  color: var(--text);
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(4, 7, 12, .7); backdrop-filter: blur(4px); }
.dialog form { padding: 22px; }
.dialog h2 { margin: 0; font-size: 16px; font-weight: 620; }
.dialog-sub { margin: 6px 0 16px; color: var(--muted-2); font-size: 12px; }
.dialog-sub code { color: #94b9ff; font-family: var(--mono); word-break: break-all; }
.dialog input[type="text"] {
  width: 100%;
  padding: 11px 13px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(7, 11, 18, .6);
  outline: 0;
  font-size: 13.5px;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.dialog input[type="text"]:focus { border-color: rgba(79, 140, 255, .6); box-shadow: 0 0 0 3px rgba(79, 140, 255, .12); }
.dialog .form-error { margin: 6px 0 2px; min-height: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* ============ 预览 ============ */
.preview {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}
.preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 11, .82);
  backdrop-filter: blur(8px);
  animation: fade .18s ease both;
}
.preview-window {
  position: relative;
  width: min(1120px, 100%);
  height: min(84vh, 900px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: #0d1320;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .65);
  overflow: hidden;
  animation: rise .22s cubic-bezier(.2, .8, .2, 1) both;
}
.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px 12px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(19, 27, 43, .8);
  flex: none;
}
.preview-title-wrap { display: flex; align-items: center; gap: 11px; min-width: 0; }
.preview-title-wrap > div { min-width: 0; }
.preview-title-wrap h2 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-title-wrap p { margin: 2px 0 0; color: var(--muted-2); font-size: 11px; font-family: var(--mono); }
.preview-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.preview-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background:
    linear-gradient(45deg, rgba(148, 163, 184, .025) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, .025) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, .025) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, .025) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.preview-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.preview-body video { max-width: 100%; max-height: 100%; outline: 0; background: #000; }
.preview-body audio { width: min(520px, 86%); }
.preview-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.preview-body pre {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 22px 24px;
  overflow: auto;
  background: #0a0f19;
  color: #c9d6ea;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  tab-size: 4;
  white-space: pre-wrap;
  word-break: break-word;
  align-self: stretch;
}
.preview-body .preview-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px;
  color: var(--muted);
  text-align: center;
}
.preview-body .preview-fallback svg { width: 48px; height: 48px; opacity: .4; }
.preview-body .preview-fallback p { margin: 0; font-size: 13px; }
.preview-note {
  flex: none;
  padding: 7px 18px;
  border-top: 1px solid var(--border);
  background: rgba(19, 27, 43, .7);
  color: var(--muted-2);
  font-size: 11px;
}
.preview-body::-webkit-scrollbar-track { background: transparent; }

/* ============ 响应式 ============ */
@media (max-width: 760px) {
  .app { padding: 0 12px; }
  .topbar { padding: 12px 2px 10px; }
  .brand-text span { display: none; }
  .conn-badge { display: none; }
  .toolbar { padding: 10px 2px; gap: 8px; }
  .search { width: 100%; max-width: none; order: 3; flex: 1 1 100%; }
  .toolbar-right { flex: 1; }
  .col-time { display: none; }
  .file-table td.ftime { display: none; }
  .col-size { width: 78px; }
  .col-actions { width: 76px; }
  .file-table thead th:first-child, .file-table td:first-child { padding-left: 12px; }
  .file-table thead th:last-child, .file-table td:last-child { padding-right: 12px; }
  .file-table td { height: 50px; }
  .fts { display: none; }
  .fsize, .ftime { font-size: 11.5px; }
  .preview { padding: 0; }
  .preview-window { width: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .preview-head { padding: 10px 10px 10px 14px; }
  .preview-actions .ghost-btn { padding: 8px 10px; }
  .upload-panel { right: 12px; bottom: 12px; }
  .statusbar { display: none; }
}

@media (max-width: 430px) {
  .login-card { padding: 30px 22px 24px; border-radius: 18px; }
  .toolbar-left { width: 100%; }
  .toolbar-left .ghost-btn, .toolbar-left .primary-btn { flex: 1; }
  .toolbar-right { width: 100%; }
  .switch { flex: none; }
  .col-size { width: 72px; }
  .col-actions { width: 76px; }
}

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