/* ==========================================================================
   SSH 文件管家 — design tokens
   ========================================================================== */
:root {
  --font-sans: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;

  --bg: #080b10;
  --bg-soft: #0b1017;
  --panel: #10161f;
  --panel-soft: #131b26;
  --panel-hover: #172130;
  --panel-raised: #1a2433;
  --sidebar: rgba(10, 15, 22, 0.92);
  --topbar: rgba(9, 13, 19, 0.76);
  --border: rgba(148, 170, 200, 0.13);
  --border-strong: rgba(148, 170, 200, 0.22);
  --text: #e8eef7;
  --text-soft: #c0ccdb;
  --muted: #7d8ca1;
  --faint: #556579;
  --accent: #5b8cff;
  --accent-strong: #3c74f2;
  --accent-soft: rgba(91, 140, 255, 0.14);
  --accent-glow: rgba(91, 140, 255, 0.3);
  --violet: #9b7cff;
  --cyan: #4fd1c5;
  --success: #43d19a;
  --success-soft: rgba(67, 209, 154, 0.13);
  --warning: #f2c14e;
  --warning-soft: rgba(242, 193, 78, 0.13);
  --danger: #ff6b78;
  --danger-soft: rgba(255, 107, 120, 0.12);
  --folder: #f4bd4f;
  --folder-soft: rgba(244, 189, 79, 0.12);
  --file: #8fa4bf;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 14px 34px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.48);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --sidebar-width: 286px;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #eef2f7;
  --bg-soft: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f7f9fc;
  --panel-hover: #eef3fa;
  --panel-raised: #ffffff;
  --sidebar: rgba(248, 250, 253, 0.94);
  --topbar: rgba(251, 252, 255, 0.82);
  --border: rgba(35, 55, 85, 0.1);
  --border-strong: rgba(35, 55, 85, 0.18);
  --text: #162033;
  --text-soft: #344257;
  --muted: #66758c;
  --faint: #96a3b8;
  --accent: #2f6bed;
  --accent-strong: #2057cf;
  --accent-soft: rgba(47, 107, 237, 0.09);
  --accent-glow: rgba(47, 107, 237, 0.2);
  --violet: #7454e8;
  --cyan: #0d9488;
  --success: #0f9f6e;
  --success-soft: rgba(15, 159, 110, 0.1);
  --warning: #b7791f;
  --warning-soft: rgba(183, 121, 31, 0.1);
  --danger: #dc3545;
  --danger-soft: rgba(220, 53, 69, 0.08);
  --folder: #d99514;
  --folder-soft: rgba(217, 149, 20, 0.11);
  --file: #64748b;
  --shadow-sm: 0 1px 2px rgba(31, 45, 61, 0.06);
  --shadow-md: 0 16px 36px rgba(31, 45, 61, 0.1);
  --shadow-lg: 0 30px 80px rgba(31, 45, 61, 0.16);
  color-scheme: light;
}

/* ==========================================================================
   Base
   ========================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

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

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--accent); }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.mono { font-family: var(--font-mono); }
kbd {
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  font: 10px/1.5 var(--font-mono);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--faint); border: 3px solid transparent; background-clip: padding-box; }

/* ==========================================================================
   Shell & sidebar
   ========================================================================== */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

.sidebar {
  position: relative;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 22px 14px 14px;
  background:
    radial-gradient(600px 280px at -30% -10%, rgba(91, 140, 255, 0.1), transparent 70%),
    var(--sidebar);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(22px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 6px;
  margin-bottom: 22px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(145deg, #6d9bff, #3e6cf0 60%, #7a5cff);
  box-shadow: 0 8px 22px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  flex: none;
}
.brand-mark svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-copy strong { font-size: 15px; font-weight: 700; letter-spacing: -0.015em; }
.brand-copy span { margin-top: 1px; font: 9px/1.2 var(--font-mono); letter-spacing: 0.16em; color: var(--faint); }
.sidebar-close { display: none; margin-left: auto; }

.add-server-btn { justify-content: flex-start; height: 42px; margin-bottom: 26px; }
.add-server-btn kbd { margin-left: auto; color: rgba(255, 255, 255, 0.68); border-color: rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.08); }

.sidebar-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  margin-bottom: 9px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.count-chip {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--panel-hover);
  color: var(--muted);
  font: 10px/1 var(--font-mono);
  letter-spacing: 0;
}

.server-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 2px 8px;
  margin: 0 -2px;
}
.server-list-skeleton { display: flex; flex-direction: column; gap: 8px; padding: 4px; }
.server-list-skeleton span {
  height: 58px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--panel-soft), var(--panel-hover), var(--panel-soft));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.server-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 9px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.server-item:hover { background: var(--panel-soft); border-color: var(--border); }
.server-item.active {
  background: linear-gradient(100deg, var(--accent-soft), rgba(91, 140, 255, 0.03));
  border-color: rgba(91, 140, 255, 0.26);
}
.server-item.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 15px;
  bottom: 15px;
  width: 2px;
  border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}
.server-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex: none;
  overflow: hidden;
  white-space: nowrap;
  letter-spacing: -0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.server-avatar .status-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--bg);
}
.server-item-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.server-item-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-item-host { margin-top: 2px; font: 10.5px/1.4 var(--font-mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-item-more {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  opacity: 0;
  transition: opacity .15s, background .15s;
}
.server-item:hover .server-item-more, .server-item-more:focus-visible { opacity: 1; }
.server-item-more:hover { background: var(--panel-hover); color: var(--text); }

.server-list-empty {
  padding: 22px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.sidebar-bottom { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.sidebar-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 550;
  text-align: left;
}
.sidebar-nav-btn:hover { background: var(--panel-soft); }
.sidebar-nav-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}
.sidebar-nav-label { flex: 1; }
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font: 10px/1 var(--font-mono);
  box-shadow: 0 3px 8px var(--accent-glow);
}
.sidebar-footer { display: flex; align-items: center; justify-content: space-between; padding: 13px 8px 1px; }
.theme-switch { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; color: var(--muted); font-size: 11.5px; padding: 2px 0; }
.theme-switch:hover { color: var(--text-soft); }
.theme-switch-track {
  position: relative;
  width: 30px;
  height: 17px;
  border-radius: 99px;
  background: var(--panel-hover);
  border: 1px solid var(--border-strong);
  transition: background .2s;
}
.theme-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .2s ease, background .2s;
}
html[data-theme="light"] .theme-switch-thumb { transform: translateX(13px); background: var(--accent); }
.app-version { color: var(--faint); font: 9.5px/1 var(--font-mono); letter-spacing: .06em; }

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(3, 7, 12, 0.6);
  backdrop-filter: blur(3px);
}

/* ==========================================================================
   Topbar
   ========================================================================== */
.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(900px 420px at 95% -18%, rgba(91, 140, 255, 0.08), transparent 65%),
    radial-gradient(700px 380px at 0% 100%, rgba(155, 124, 255, 0.05), transparent 65%),
    var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 72px;
  flex: 0 0 72px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar);
  backdrop-filter: blur(18px);
  z-index: 20;
}
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-left { flex: 1; }
.server-identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
  transition: background .2s, box-shadow .2s;
}
.status-dot[data-state="online"] { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft), 0 0 12px rgba(67, 209, 154, .45); }
.status-dot[data-state="connecting"] { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); animation: pulse 1.2s infinite; }
.status-dot[data-state="offline"] { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
@keyframes pulse { 50% { opacity: .35; } }
.server-identity-copy { min-width: 0; }
.server-name-row { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
#currentServerName { font-size: 14px; font-weight: 650; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connection-state { font-size: 10.5px; color: var(--faint); flex: none; }
.current-path { margin-top: 1px; font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: min(650px, 58vw); }

.topbar-badge {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  margin-left: 1px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font: 9px/1 var(--font-mono);
}
.topbar-btn { height: 34px; padding: 0 10px; }
.theme-icon-light { display: none; }
html[data-theme="light"] .theme-icon-dark { display: none; }
html[data-theme="light"] .theme-icon-light { display: block; }
.mobile-only { display: none !important; }

/* ==========================================================================
   Buttons / controls
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 560;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .08s, box-shadow .15s;
}
.btn:hover { background: var(--panel-hover); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .42; pointer-events: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary {
  background: linear-gradient(180deg, #6698ff, #4678f0);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 16px rgba(60, 116, 242, .26), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.btn-primary:hover { background: linear-gradient(180deg, #79a6ff, #5181f5); color: #fff; box-shadow: 0 8px 22px rgba(60, 116, 242, .35); }
.btn-ghost { border-color: transparent; }
.btn-ghost:hover { border-color: var(--border); }
.btn-bordered { border-color: var(--border); background: var(--panel-soft); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 6px 16px rgba(255, 80, 100, .2); }
.btn-danger:hover { background: #ff5263; color: #fff; }
.btn-block { width: 100%; }
.btn-sm { height: 29px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 18px; border-radius: 11px; font-size: 13.5px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--panel-hover); color: var(--text); }
.icon-btn.bordered { border-color: var(--border); background: var(--panel-soft); }
.icon-btn:disabled { opacity: .32; pointer-events: none; }
.icon-btn .icon { width: 16.5px; height: 16.5px; }

/* ==========================================================================
   Welcome
   ========================================================================== */
.welcome-view {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 42px 40px;
}
.welcome-glow {
  position: absolute;
  width: 680px;
  height: 680px;
  top: 46%;
  left: 53%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(91, 140, 255, .12), transparent 62%);
  pointer-events: none;
  filter: blur(20px);
}
.welcome-card {
  position: relative;
  width: min(860px, 100%);
  padding: 48px 52px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .035), transparent 45%),
    var(--panel);
  box-shadow: var(--shadow-lg);
  animation: rise .55s cubic-bezier(.2,.8,.2,1) both;
}
.welcome-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: .16;
  mask-image: linear-gradient(135deg, #000, transparent 55%);
}
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.985); } }
.welcome-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 9.5px/1 var(--font-mono);
  letter-spacing: .18em;
  color: var(--accent);
}
.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px var(--accent-soft);
  animation: pulse 1.6s infinite;
}
.welcome-card h1 {
  margin: 22px 0 18px;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.18;
  letter-spacing: -.045em;
  font-weight: 720;
}
.welcome-card h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--accent), var(--violet) 70%, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.welcome-card > p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}
.welcome-actions { display: flex; gap: 10px; margin: 28px 0 36px; }
.welcome-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.welcome-feature {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--panel-soft);
}
.feature-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; flex: none; }
.feature-icon.folder { color: var(--folder); background: var(--folder-soft); }
.feature-icon.transfer { color: var(--accent); background: var(--accent-soft); }
.feature-icon.terminal { color: var(--violet); background: rgba(155, 124, 255, .12); }
.welcome-feature div { display: flex; flex-direction: column; min-width: 0; }
.welcome-feature strong { font-size: 12px; font-weight: 620; }
.welcome-feature span { margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.welcome-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 11px;
  line-height: 1.6;
}
.welcome-tip .icon { width: 14px; height: 14px; margin-top: 2px; }

/* ==========================================================================
   Browser toolbar
   ========================================================================== */
.browser-view {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 11px;
  padding: 17px 22px 20px;
  animation: fadein .25s ease both;
}
@keyframes fadein { from { opacity: 0; } }
.browser-toolbar { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.toolbar-group { display: flex; align-items: center; gap: 4px; }
.nav-group { flex: none; }
.actions-group { margin-left: auto; gap: 7px; }
.pathbar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 120px;
  height: 34px;
  padding: 0 4px 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-soft);
  transition: border-color .15s, box-shadow .15s;
}
.pathbar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
  height: 100%;
}
.breadcrumbs::-webkit-scrollbar { display: none; }
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 25px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: 11.5px/1 var(--font-mono);
  white-space: nowrap;
}
.crumb:hover { background: var(--panel-hover); color: var(--text); }
.crumb.current { color: var(--text); font-weight: 600; }
.crumb .icon { width: 13px; height: 13px; }
.crumb-sep { color: var(--faint); font: 11px/1 var(--font-mono); padding: 0 1px; }
.path-edit-trigger {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
}
.path-edit-trigger:hover { background: var(--panel-hover); color: var(--text); }
.path-edit-trigger .icon { width: 13px; height: 13px; }

.filter-box {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 158px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--faint);
  transition: border-color .15s, width .2s;
}
.filter-box:focus-within { border-color: var(--accent); width: 190px; }
.filter-box .icon { width: 14px; height: 14px; }
.filter-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 11.5px; color: var(--text); }
.filter-box input::placeholder { color: var(--faint); }
.split-btn { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-soft); overflow: hidden; }
.split-btn .btn { height: 32px; border: 0; border-radius: 0; }
.upload-main { padding-right: 8px; }
.upload-caret { padding: 0 6px; border-left: 1px solid var(--border) !important; }
.view-toggle .icon { width: 16px; height: 16px; }
.path-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
  animation: fadein .15s ease;
}
.path-edit-prefix { display: grid; place-items: center; color: var(--violet); }
.path-edit-row input {
  flex: 1;
  min-width: 0;
  height: 30px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}

/* ==========================================================================
   Disk strip
   ========================================================================== */
.disk-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
  animation: fadein .2s ease;
}
.disk-strip-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}
.disk-strip-icon .icon { width: 14px; height: 14px; }
.disk-strip-copy { flex: 1; min-width: 0; }
.disk-strip-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.disk-strip-head #diskFilesystem { font-size: 9.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; }
.disk-strip-head #diskText { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.disk-track { height: 4px; margin-top: 5px; overflow: hidden; border-radius: 99px; background: var(--panel-hover); }
.disk-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  box-shadow: 0 0 8px var(--accent-glow);
  transition: width .5s ease, background .2s;
}
.disk-fill.warning { background: linear-gradient(90deg, var(--warning), #f28e4e); box-shadow: 0 0 8px rgba(242, 193, 78, .3); }
.disk-fill.danger { background: linear-gradient(90deg, var(--danger), #ff995c); box-shadow: 0 0 8px rgba(255, 107, 120, .3); }
.disk-percent { font: 10px/1 var(--font-mono); color: var(--muted); flex: none; }

/* ==========================================================================
   File area / list
   ========================================================================== */
.file-area {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  background: rgba(8, 11, 16, .5);
  backdrop-filter: blur(3px);
}
html[data-theme="light"] .loading-overlay { background: rgba(255, 255, 255, .55); }
.loading-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-md);
  color: var(--muted);
  font-size: 12px;
}

/* 删除进度：删除大量文件时给出可读的进度，而不是静默等待 */
.delete-overlay {
  position: absolute;
  inset: 0;
  z-index: 14;
  display: grid;
  place-items: center;
  background: rgba(8, 11, 16, .5);
  backdrop-filter: blur(3px);
}
html[data-theme="light"] .delete-overlay { background: rgba(255, 255, 255, .6); }
.delete-card {
  width: min(330px, 86%);
  padding: 18px 20px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}
.delete-card-head { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 12.5px; }
.delete-card-head strong { font-weight: 600; }
.delete-card-count { margin: 11px 0 7px; color: var(--text-soft); font-size: 12px; letter-spacing: .02em; }
.delete-track { height: 4px; border-radius: 99px; background: var(--panel-hover); overflow: hidden; }
.delete-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--danger), #ff995c);
  transition: width .18s ease;
}
.delete-card-hint { margin-top: 9px; color: var(--muted); font-size: 10.5px; }
.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 24px;
  text-align: center;
}
.empty-art {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 7px;
  border-radius: 18px;
  background: var(--folder-soft);
  color: var(--folder);
}
.empty-art .icon { width: 29px; height: 29px; stroke-width: 1.4; }
.empty-art.small { width: 48px; height: 48px; border-radius: 14px; }
.empty-art.small .icon { width: 23px; height: 23px; }
.empty-state strong { font-size: 13.5px; font-weight: 620; }
.empty-state span { max-width: 320px; color: var(--muted); font-size: 11.5px; }
.empty-state .btn { margin-top: 12px; }

.list-view { display: flex; flex-direction: column; height: 100%; }
.file-table-head {
  display: grid;
  grid-template-columns: 46px minmax(150px, 1fr) 102px 162px 86px 52px;
  align-items: center;
  height: 42px;
  flex: 0 0 42px;
  padding: 0 8px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--faint);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.checkbox-cell { display: flex; align-items: center; justify-content: center; height: 100%; cursor: pointer; }
.checkbox-cell input { position: absolute; opacity: 0; pointer-events: none; }
.checkbox-ui {
  position: relative;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: var(--panel);
  transition: background .12s, border-color .12s;
}
.checkbox-cell input:checked + .checkbox-ui { background: var(--accent); border-color: var(--accent); }
.checkbox-cell input:checked + .checkbox-ui::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.7px 1.7px 0;
  transform: rotate(45deg);
}
.checkbox-cell input:indeterminate + .checkbox-ui { background: var(--accent); border-color: var(--accent); }
.checkbox-cell input:indeterminate + .checkbox-ui::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 6px;
  width: 7px;
  height: 1.5px;
  background: #fff;
  border-radius: 2px;
}
.checkbox-cell input:focus-visible + .checkbox-ui { box-shadow: 0 0 0 3px var(--accent-soft); }

.head-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  letter-spacing: inherit;
  text-transform: inherit;
}
.head-cell.sortable:hover { color: var(--text-soft); }
.head-cell.name-cell { padding-left: 10px; }
.size-cell { justify-content: flex-end; }
.actions-cell { justify-content: center; }
.sort-indicator {
  width: 0;
  height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-bottom: 5px solid currentColor;
  opacity: 0;
  transition: opacity .15s, transform .15s;
}
.head-cell.sorted-asc .sort-indicator { opacity: .9; }
.head-cell.sorted-desc .sort-indicator { opacity: .9; transform: rotate(180deg); }

.file-rows { flex: 1; min-height: 0; overflow-y: auto; padding: 3px 0 12px; }
.file-row {
  display: grid;
  grid-template-columns: 46px minmax(150px, 1fr) 102px 162px 86px 52px;
  align-items: center;
  height: 48px;
  margin: 1px 6px;
  padding: 0 2px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--text-soft);
  cursor: default;
  user-select: none;
  transition: background .1s, border-color .1s;
}
.file-row:hover { background: var(--panel-soft); border-color: var(--border); }
.file-row.selected { background: var(--accent-soft); border-color: rgba(91, 140, 255, .22); }
.file-row.selected:hover { background: rgba(91, 140, 255, .17); }
.file-row.focused { border-color: rgba(91, 140, 255, .5); }
.file-row.drop-target { background: var(--folder-soft); border-color: var(--folder); box-shadow: inset 0 0 0 1px var(--folder); }
.file-row.error-row { background: var(--danger-soft); border-color: rgba(255, 107, 120, .32); }
.file-row .checkbox-cell { justify-content: center; }
.file-row .checkbox-ui { opacity: 0; transition: opacity .1s; }
.file-row:hover .checkbox-ui, .file-row.selected .checkbox-ui, .file-row .checkbox-cell input:focus-visible + .checkbox-ui { opacity: 1; }
.file-name-cell { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0 10px 0 4px; }
.file-type-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex: none;
  background: var(--panel-soft);
  color: var(--file);
}
.file-type-icon .icon { width: 16.5px; height: 16.5px; stroke-width: 1.6; }
.file-type-icon.directory { background: var(--folder-soft); color: var(--folder); }
.file-type-icon.image { background: rgba(79, 209, 197, .11); color: var(--cyan); }
.file-type-icon.code { background: rgba(155, 124, 255, .12); color: var(--violet); }
.file-type-icon.archive { background: var(--warning-soft); color: var(--warning); }
.file-name-wrap { display: flex; flex-direction: column; min-width: 0; }
.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--text);
}
.file-sub { margin-top: 1px; color: var(--faint); font-size: 9.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { padding: 0 8px; color: var(--muted); font: 10.5px/1.4 var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta.size-cell { text-align: right; }
.file-meta.mode-cell { color: var(--faint); }
.error-reason { color: var(--danger); }
.row-actions { display: flex; align-items: center; justify-content: center; opacity: 0; }
.file-row:hover .row-actions, .file-row.selected .row-actions { opacity: 1; }
.row-action-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
.row-action-btn:hover { background: var(--panel-hover); color: var(--text); }
.row-action-btn .icon { width: 14px; height: 14px; }

/* Grid view */
.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  align-content: start;
  gap: 8px;
  height: 100%;
  overflow-y: auto;
  padding: 14px;
}
.grid-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 122px;
  padding: 17px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-soft);
  cursor: default;
  user-select: none;
  transition: background .12s, border-color .12s, transform .12s;
}
.grid-card:hover { background: var(--panel-hover); border-color: var(--border-strong); transform: translateY(-1px); }
.grid-card.selected { background: var(--accent-soft); border-color: rgba(91, 140, 255, .38); }
.grid-card.drop-target { background: var(--folder-soft); border-color: var(--folder); }
.grid-card.error-row { border-color: rgba(255, 107, 120, .4); background: var(--danger-soft); }
.grid-card .checkbox-cell { position: absolute; top: 7px; left: 7px; width: 22px; height: 22px; opacity: 0; }
.grid-card:hover .checkbox-cell, .grid-card.selected .checkbox-cell { opacity: 1; }
.grid-card-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 13px;
  color: var(--file);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.grid-card-icon .icon { width: 25px; height: 25px; stroke-width: 1.45; }
.grid-card-icon.directory { color: var(--folder); background: var(--folder-soft); }
.grid-card-icon.image { color: var(--cyan); background: rgba(79, 209, 197, .1); }
.grid-card-icon.code { color: var(--violet); background: rgba(155, 124, 255, .1); }
.grid-card-icon.archive { color: var(--warning); background: var(--warning-soft); }
.grid-card-name { width: 100%; font-size: 11.5px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-card-meta { color: var(--faint); font: 9.5px/1.3 var(--font-mono); text-align: center; }
.grid-card .row-actions { position: absolute; right: 6px; top: 6px; opacity: 0; }
.grid-card:hover .row-actions { opacity: 1; }

/* Selection bar */
.selection-bar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 46px;
  padding: 0 7px 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: rgba(20, 28, 39, .9);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
  animation: selection-in .22s cubic-bezier(.2,.8,.2,1) both;
}
html[data-theme="light"] .selection-bar { background: rgba(255, 255, 255, .94); }
@keyframes selection-in { from { opacity: 0; transform: translate(-50%, 8px); } }
.selection-pill { display: flex; align-items: center; gap: 6px; padding: 0 8px 0 3px; color: var(--text); font-size: 11.5px; font-weight: 550; white-space: nowrap; }
.selection-pill .icon { width: 15px; height: 15px; color: var(--accent); }
.selection-divider { width: 1px; height: 20px; background: var(--border-strong); margin: 0 3px; }
.selection-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font-size: 11.5px;
}
.selection-btn:hover { background: var(--panel-hover); color: var(--text); }
.selection-btn.danger { color: var(--danger); }
.selection-btn.danger:hover { background: var(--danger-soft); }
.selection-btn .icon { width: 14px; height: 14px; }
.selection-clear {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--faint);
}
.selection-clear:hover { background: var(--panel-hover); color: var(--text); }
.selection-clear .icon { width: 14px; height: 14px; }

/* Drop overlay */
.drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 12, 19, .68);
  backdrop-filter: blur(6px);
  pointer-events: none;
}
html[data-theme="light"] .drop-overlay { background: rgba(238, 242, 247, .7); }
.drop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: min(420px, 92%);
  padding: 34px 24px;
  border: 1.5px dashed var(--accent);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 0 0 8px var(--accent-soft), var(--shadow-lg);
  text-align: center;
}
.drop-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 6px;
  border-radius: 15px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px var(--accent-glow);
}
.drop-icon .icon { width: 25px; height: 25px; }
.drop-card strong { font-size: 15px; }
.drop-card span { color: var(--text-soft); font: 11px/1.5 var(--font-mono); }
.drop-card small { color: var(--muted); font-size: 10.5px; }

/* ==========================================================================
   Drawer / transfer center
   ========================================================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  /* 传输抽屉必须盖住终端停靠层（90），否则会遮住任务卡片。 */
  z-index: 100;
  background: rgba(3, 7, 12, .52);
  backdrop-filter: blur(3px);
  animation: fadein .18s ease;
}
.transfer-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 110;
  display: flex;
  flex-direction: column;
  width: 448px;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  border-left: 1px solid var(--border-strong);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  transform: translateX(103%);
  transition: transform .26s cubic-bezier(.3,.8,.3,1);
}
.transfer-drawer.open { transform: translateX(0); }
.transfer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 18px 16px 22px;
  border-bottom: 1px solid var(--border);
}
.drawer-eyebrow { font: 9px/1 var(--font-mono); letter-spacing: .18em; color: var(--accent); }
.transfer-header h2 { margin: 5px 0 0; font-size: 19px; letter-spacing: -.025em; }
.transfer-header-actions { display: flex; align-items: center; gap: 2px; }
.live-status { display: inline-flex; align-items: center; gap: 6px; margin-right: 4px; color: var(--success); font-size: 9.5px; font-family: var(--font-mono); }
.live-status.offline { color: var(--danger); }
.live-status.offline .pulse-dot { animation: none; opacity: .5; }
.transfer-summary {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 8px;
  padding: 15px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-soft);
}
.summary-block { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.summary-label { font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.summary-block strong { font: 14px/1.4 var(--font-mono); font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.concurrency-block { align-items: flex-start; }
.mini-select {
  width: 66px;
  height: 25px;
  margin-top: 1px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: 0;
  background: var(--panel);
  color: var(--text-soft);
  font: 11px/1 var(--font-mono);
}
.transfer-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 11px 18px 0;
  border-bottom: 1px solid var(--border);
}
.transfer-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 9px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
}
.transfer-tab:hover { color: var(--text-soft); }
.transfer-tab.active { color: var(--text); }
.transfer-tab.active::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
}
.transfer-tab span { color: var(--faint); font: 9.5px/1 var(--font-mono); }
.history-clear { margin-left: auto; border: 0; background: transparent; color: var(--faint); font-size: 10.5px; padding: 4px 6px; }
.history-clear:hover { color: var(--danger); }
.transfer-content { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 13px 24px; }
.transfer-cards { display: flex; flex-direction: column; gap: 9px; }
.transfer-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 250px; padding: 30px; text-align: center; color: var(--muted); }
.transfer-empty strong { margin-top: 8px; color: var(--text-soft); font-size: 13px; }
.transfer-empty span { font-size: 11px; }
.transfer-empty .empty-art { background: var(--accent-soft); color: var(--accent); }

.transfer-card {
  position: relative;
  padding: 13px 13px 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-soft);
  overflow: hidden;
  animation: card-in .22s ease both;
}
@keyframes card-in { from { opacity: 0; transform: translateY(5px); } }
.transfer-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 2px;
  border-radius: 3px;
  background: var(--accent);
}
.transfer-card[data-status="paused"]::before { background: var(--warning); }
.transfer-card[data-status="failed"]::before { background: var(--danger); }
.transfer-card[data-status="completed"]::before { background: var(--success); }
.transfer-card-head { display: flex; align-items: flex-start; gap: 9px; }
.transfer-direction {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex: none;
  background: var(--accent-soft);
  color: var(--accent);
}
.transfer-direction.download { color: var(--cyan); background: rgba(79, 209, 197, .1); }
.transfer-direction .icon { width: 15px; height: 15px; }
.transfer-title-wrap { flex: 1; min-width: 0; }
.transfer-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 570; color: var(--text); }
.transfer-path { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 9.5px/1.4 var(--font-mono); color: var(--faint); }
.transfer-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  height: 20px;
  padding: 0 7px;
  border-radius: 99px;
  background: var(--panel-hover);
  color: var(--muted);
  font: 9.5px/1 var(--font-mono);
}
.transfer-status::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.transfer-status[data-status="transferring"] { color: var(--accent); background: var(--accent-soft); }
.transfer-status[data-status="queued"] { color: var(--warning); background: var(--warning-soft); }
.transfer-status[data-status="paused"] { color: var(--warning); background: var(--warning-soft); }
.transfer-status[data-status="failed"] { color: var(--danger); background: var(--danger-soft); }
.transfer-status[data-status="completed"] { color: var(--success); background: var(--success-soft); }
.transfer-progress { margin-top: 12px; }
.transfer-progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 5px; color: var(--faint); font: 9.5px/1 var(--font-mono); }
.transfer-progress-head strong { color: var(--text-soft); font-weight: 500; }
.transfer-progress-track { height: 5px; border-radius: 99px; background: var(--panel-hover); overflow: hidden; }
.transfer-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  box-shadow: 0 0 8px var(--accent-glow);
  transition: background .2s;
}
.transfer-card[data-status="paused"] .transfer-progress-fill { background: linear-gradient(90deg, var(--warning), #f2a54e); box-shadow: none; }
.transfer-card[data-status="failed"] .transfer-progress-fill { background: var(--danger); box-shadow: none; }
.transfer-card[data-status="completed"] .transfer-progress-fill { background: var(--success); box-shadow: none; }
.transfer-footer { display: flex; align-items: center; gap: 8px; margin-top: 8px; min-height: 25px; }
.transfer-speed { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; color: var(--muted); font: 9.5px/1 var(--font-mono); }
.transfer-speed .sep { color: var(--faint); }
.transfer-actions { display: flex; align-items: center; gap: 2px; opacity: .9; }
.transfer-action {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
.transfer-action:hover { background: var(--panel-hover); color: var(--text); }
.transfer-action.danger:hover { background: var(--danger-soft); color: var(--danger); }
.transfer-action:disabled { opacity: .28; pointer-events: none; }
.transfer-action .icon { width: 14px; height: 14px; }
.transfer-error {
  margin-top: 7px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 10px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* History */
.history-rows { display: flex; flex-direction: column; gap: 2px; }
.history-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
}
.history-row:last-child { border-bottom: 0; }
.history-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 7px;
  flex: none;
  background: var(--panel-soft);
  color: var(--muted);
}
.history-row[data-status="completed"] .history-icon { color: var(--success); background: var(--success-soft); }
.history-row[data-status="failed"] .history-icon { color: var(--danger); background: var(--danger-soft); }
.history-icon .icon { width: 14px; height: 14px; }
.history-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.history-title { font-size: 11.5px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-meta { margin-top: 2px; color: var(--faint); font: 9px/1.4 var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-error { margin-top: 2px; color: var(--danger); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-size { flex: none; color: var(--faint); font: 9px/1 var(--font-mono); }

/* ==========================================================================
   Terminal dock
   ========================================================================== */
.terminal-dock {
  position: fixed;
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  height: 44vh;
  min-height: 230px;
  max-height: calc(100vh - 70px);
  border-top: 1px solid rgba(130, 160, 200, .22);
  background: #070a0f;
  box-shadow: 0 -20px 50px rgba(0, 0, 0, .42);
  animation: dock-in .22s cubic-bezier(.3,.8,.3,1);
}
@keyframes dock-in { from { transform: translateY(30px); opacity: .4; } }
.terminal-dock.maximized { left: 0; top: 0; bottom: 0; height: 100vh !important; max-height: none; z-index: 110; border-top: 0; }
.terminal-dock.maximized .terminal-resize-handle { display: none; }
.terminal-resize-handle {
  position: absolute;
  top: -5px;
  left: 0;
  right: 0;
  height: 10px;
  cursor: row-resize;
  z-index: 3;
}
.terminal-resize-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 4px;
  width: 38px;
  height: 3px;
  border-radius: 99px;
  background: rgba(150, 170, 200, .28);
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity .15s;
}
.terminal-dock:hover .terminal-resize-handle::after { opacity: 1; }
.terminal-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  flex: 0 0 38px;
  padding: 0 8px 0 5px;
  background: #0b1017;
  border-bottom: 1px solid rgba(130, 160, 200, .1);
}
.terminal-tabs { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; flex: 1; }
.terminal-tabs::-webkit-scrollbar { display: none; }
.terminal-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 29px;
  padding: 0 6px 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #7f8ea4;
  font-size: 10.5px;
  white-space: nowrap;
  max-width: 190px;
}
.terminal-tab:hover { background: rgba(255, 255, 255, .05); color: #d7e2f0; }
.terminal-tab.active { background: rgba(91, 140, 255, .14); color: #dfe9f8; }
.terminal-tab-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.terminal-tab-dot[data-state="online"] { background: var(--success); box-shadow: 0 0 6px rgba(67, 209, 154, .55); }
.terminal-tab-dot[data-state="offline"] { background: var(--danger); }
.terminal-tab-dot[data-state="connecting"] { background: var(--warning); animation: pulse 1.2s infinite; }
.terminal-tab span { overflow: hidden; text-overflow: ellipsis; }
.terminal-tab-close { display: grid; place-items: center; width: 18px; height: 18px; margin-left: 2px; border: 0; border-radius: 4px; color: #728096; background: transparent; }
.terminal-tab-close:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.terminal-tab-close .icon { width: 11px; height: 11px; }
.terminal-actions { display: flex; align-items: center; gap: 1px; flex: none; }
.terminal-hint { margin-right: 7px; color: #566579; font: 8.5px/1 var(--font-mono); }
.terminal-btn { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: #7c8ba0; }
.terminal-btn:hover { background: rgba(255, 255, 255, .07); color: #e5edf8; }
.terminal-btn .icon { width: 14px; height: 14px; }
.terminal-panes { position: relative; flex: 1; min-height: 0; padding: 8px 10px; background: #070a0f; }
.terminal-pane { position: absolute; inset: 8px 10px; display: none; }
.terminal-pane.active { display: block; }
.terminal-pane .xterm { height: 100%; padding: 0; }
.terminal-pane .xterm-viewport { background-color: transparent !important; }
.terminal-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; height: 100%; color: #506078; }
.terminal-empty .icon { width: 28px; height: 28px; margin-bottom: 5px; opacity: .6; }
.terminal-empty strong { color: #8b9bb0; font-size: 12px; }
.terminal-empty span { font-size: 10.5px; }

/* ==========================================================================
   Modal / forms
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 7, 12, .62);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .18s ease;
}
.modal-overlay.visible { opacity: 1; }
.modal-card {
  display: flex;
  flex-direction: column;
  width: min(540px, 100%);
  max-height: min(88vh, 820px);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(.99);
  transition: transform .2s cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
}
.modal-overlay.visible .modal-card { transform: none; }
.modal-card.wide { width: min(760px, 100%); }
.modal-card.preview-modal { width: min(980px, 100%); height: min(82vh, 760px); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 21px 22px 0; }
.modal-head-copy { flex: 1; min-width: 0; }
.modal-eyebrow { font: 8.5px/1 var(--font-mono); letter-spacing: .16em; color: var(--accent); text-transform: uppercase; }
.modal-title { margin: 5px 0 0; font-size: 18px; letter-spacing: -.025em; font-weight: 680; }
.modal-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.55; }
.modal-close { flex: none; }
.modal-body { padding: 18px 22px 4px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 15px 22px 19px; }
.modal-foot .left { margin-right: auto; display: flex; gap: 8px; }
.modal-error { margin: 0 0 12px; padding: 8px 10px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 11px; line-height: 1.5; }
.modal-note { display: flex; gap: 7px; padding: 9px 11px; border-radius: 8px; background: var(--panel-soft); color: var(--muted); font-size: 10.5px; line-height: 1.6; }
.modal-note .icon { width: 14px; height: 14px; flex: none; margin-top: 1px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.form-field.full { grid-column: 1 / -1; }
.form-field > label, .form-label { font-size: 10.5px; font-weight: 580; color: var(--text-soft); }
.form-hint { color: var(--faint); font-size: 9.5px; line-height: 1.5; }
.form-input, .form-textarea, .form-select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: 0;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--faint); }
.form-input:focus, .form-textarea:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-textarea { height: auto; min-height: 110px; padding: 9px 10px; resize: vertical; font: 10.5px/1.6 var(--font-mono); }
.form-select { appearance: none; }
.input-with-action { display: flex; gap: 7px; }
.input-with-action .form-input { flex: 1; }
.input-with-action .btn { flex: none; }

.segmented { display: flex; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-soft); }
.segmented label { flex: 1; position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 29px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.segmented input:checked + span { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented .icon { width: 14px; height: 14px; }
.form-section { padding: 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--panel-soft); }
.form-section-title { display: flex; align-items: center; gap: 6px; margin-bottom: 11px; color: var(--text-soft); font-size: 10.5px; font-weight: 620; }
.form-section-title .icon { width: 14px; height: 14px; color: var(--accent); }
.drag-divider { display: flex; align-items: center; gap: 9px; margin: 2px 0 15px; color: var(--faint); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.drag-divider::before, .drag-divider::after { content: ""; height: 1px; background: var(--border); flex: 1; }
.test-result { display: flex; align-items: flex-start; gap: 7px; margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; font-size: 10.5px; line-height: 1.5; }
.test-result.success { color: var(--success); background: var(--success-soft); }
.test-result.error { color: var(--danger); background: var(--danger-soft); }
.test-result.info { color: var(--muted); background: var(--panel-soft); }
.test-result .icon { width: 14px; height: 14px; flex: none; margin-top: 1px; }

/* Permission editor */
.perm-grid { display: grid; grid-template-columns: 90px repeat(3, 1fr); gap: 7px; align-items: center; }
.perm-grid .perm-head { color: var(--faint); font: 9px/1 var(--font-mono); text-align: center; }
.perm-grid .perm-rowlabel { color: var(--text-soft); font-size: 10.5px; }
.perm-cell { position: relative; display: flex; align-items: center; justify-content: center; height: 31px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel-soft); cursor: pointer; }
.perm-cell input { position: absolute; opacity: 0; }
.perm-cell span { font: 11px/1 var(--font-mono); color: var(--faint); }
.perm-cell input:checked + span { color: var(--accent); }
.perm-cell:has(input:checked) { background: var(--accent-soft); border-color: rgba(91, 140, 255, .36); }
.perm-octal { display: flex; align-items: center; gap: 9px; margin-top: 14px; }
.perm-octal label { color: var(--muted); font-size: 10.5px; }
.perm-octal input { width: 90px; font-family: var(--font-mono); letter-spacing: .12em; }

/* Preview */
.preview-body { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 0 0 14px; }
.preview-toolbar { display: flex; align-items: center; gap: 8px; padding: 9px 20px; border-bottom: 1px solid var(--border); color: var(--faint); font: 9.5px/1.4 var(--font-mono); }
.preview-toolbar .spacer { flex: 1; }
.preview-code {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 16px 20px 24px;
  overflow: auto;
  background: #090d13;
  color: #c8d6e8;
  font: 11.5px/1.75 var(--font-mono);
  tab-size: 2;
  white-space: pre;
}
html[data-theme="light"] .preview-code { background: #f7f9fc; color: #2b3a4f; }
.preview-code .tok-comment { color: #61708a; font-style: italic; }
.preview-code .tok-string { color: #9ccf7a; }
.preview-code .tok-number { color: #e8b96a; }
.preview-code .tok-keyword { color: #8aa8ff; }
.preview-code .tok-bool { color: #d39cff; }
.preview-image-wrap { flex: 1; min-height: 0; display: grid; place-items: center; padding: 22px; overflow: auto; background: repeating-conic-gradient(var(--panel-soft) 0 25%, var(--panel) 0 50%) 0 0 / 20px 20px; }
.preview-image-wrap img { max-width: 100%; max-height: 100%; border-radius: 4px; box-shadow: var(--shadow-md); }

/* Confirm list */
.delete-list { margin: 10px 0 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-soft); list-style: none; }
.delete-list li { display: flex; align-items: center; gap: 7px; padding: 3px 0; color: var(--text-soft); font: 10.5px/1.5 var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.delete-list li .icon { width: 13px; height: 13px; color: var(--muted); flex: none; }
.delete-list li.more { color: var(--muted); font-family: var(--font-sans); }

/* Properties */
.props-list { display: flex; flex-direction: column; gap: 0; }
.props-row { display: grid; grid-template-columns: 98px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 11px; }
.props-row:last-child { border-bottom: 0; }
.props-row dt { color: var(--faint); }
.props-row dd { margin: 0; color: var(--text-soft); font-family: var(--font-mono); overflow-wrap: anywhere; }

/* ==========================================================================
   Context menu / toasts
   ========================================================================== */
.context-menu {
  position: fixed;
  z-index: 300;
  min-width: 216px;
  max-width: 290px;
  padding: 5px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  animation: menu-in .12s ease both;
}
@keyframes menu-in { from { opacity: 0; transform: scale(.97) translateY(-3px); } }
.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-soft);
  font-size: 11.5px;
  text-align: left;
  white-space: nowrap;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--panel-hover); color: var(--text); outline: 0; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }
.menu-item:disabled { color: var(--faint); pointer-events: none; }
.menu-item .icon { width: 14px; height: 14px; color: var(--muted); }
.menu-item.danger .icon { color: var(--danger); }
.menu-item-label { flex: 1; }
.menu-shortcut { color: var(--faint); font: 9px/1 var(--font-mono); }
.menu-sep { height: 1px; margin: 4px 7px; background: var(--border); }
.menu-heading { padding: 7px 9px 5px; color: var(--faint); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }

.toast-root { position: fixed; top: 84px; right: 24px; z-index: 400; display: flex; flex-direction: column; gap: 9px; width: min(380px, calc(100vw - 32px)); pointer-events: none; transition: right .2s ease; }
/* 传输抽屉打开时把通知左移，避免遮住抽屉的统计区和任务卡片。 */
body.drawer-open .toast-root { right: 472px; }
@media (max-width: 960px) {
  body.drawer-open .toast-root { right: 444px; }
}
@media (max-width: 760px) {
  body.drawer-open .toast-root { right: 12px; top: 74px; }
}
.toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 12px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  overflow: hidden;
  animation: toast-in .25s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(14px); } }
.toast.leaving { animation: toast-out .2s ease forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(14px); } }
.toast::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.toast[data-type="success"]::after { background: var(--success); }
.toast[data-type="error"]::after { background: var(--danger); }
.toast[data-type="warning"]::after { background: var(--warning); }
.toast-icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; flex: none; background: var(--accent-soft); color: var(--accent); }
.toast[data-type="success"] .toast-icon { color: var(--success); background: var(--success-soft); }
.toast[data-type="error"] .toast-icon { color: var(--danger); background: var(--danger-soft); }
.toast[data-type="warning"] .toast-icon { color: var(--warning); background: var(--warning-soft); }
.toast-icon .icon { width: 14px; height: 14px; }
.toast-copy { flex: 1; min-width: 0; }
.toast-title { font-size: 11.5px; font-weight: 600; color: var(--text); line-height: 1.45; }
.toast-message { margin-top: 2px; color: var(--muted); font-size: 10.5px; line-height: 1.55; overflow-wrap: anywhere; }
.toast-close { display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 5px; background: transparent; color: var(--faint); flex: none; }
.toast-close:hover { background: var(--panel-hover); color: var(--text); }
.toast-close .icon { width: 12px; height: 12px; }
.toast-timer { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: currentColor; opacity: .35; transform-origin: left; animation: toast-timer linear forwards; }
@keyframes toast-timer { to { transform: scaleX(0); } }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1240px) {
  .filter-box { width: 130px; }
  .filter-box:focus-within { width: 160px; }
  .file-table-head, .file-row { grid-template-columns: 46px minmax(140px, 1fr) 92px 142px 78px 48px; }
}
@media (max-width: 1080px) {
  .actions-group .btn span { display: none; }
  .actions-group .btn { padding: 0 9px; }
  #newFolderBtn span { display: inline; }
  .file-table-head, .file-row { grid-template-columns: 44px minmax(140px, 1fr) 88px 132px 48px; }
  .mode-cell { display: none; }
}
@media (max-width: 960px) {
  :root { --sidebar-width: 0px; }
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 286px;
    transform: translateX(-102%);
    transition: transform .24s cubic-bezier(.3,.8,.3,1);
    z-index: 45;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .sidebar-close { display: grid; }
  .mobile-only { display: inline-grid !important; }
  .terminal-dock { left: 0; }
  .transfer-drawer { width: 420px; }
  .current-path { max-width: 52vw; }
  .browser-view { padding: 14px 16px 16px; }
  .topbar { padding: 0 16px; }
  .welcome-card { padding: 38px 32px 30px; }
}
@media (max-width: 760px) {
  .topbar-actions .topbar-btn span { display: none; }
  .topbar-actions .topbar-btn { padding: 0 8px; }
  .topbar { gap: 8px; height: 64px; flex-basis: 64px; }
  .server-name-row { gap: 6px; }
  .connection-state { display: none; }
  .current-path { max-width: 45vw; }
  .browser-toolbar { flex-wrap: wrap; }
  .pathbar { order: 3; width: 100%; flex-basis: 100%; }
  .actions-group { margin-left: auto; }
  .filter-box { display: none; }
  .disk-strip-head #diskFilesystem { display: none; }
  .disk-strip { padding: 6px 9px; }
  .file-table-head, .file-row { grid-template-columns: 40px minmax(120px, 1fr) 76px 42px; }
  .time-cell, .mode-cell { display: none; }
  .file-row { height: 45px; }
  .file-name { font-size: 12px; }
  .grid-view { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
  .welcome-view { padding: 20px 16px; }
  .welcome-card { padding: 30px 22px 24px; }
  .welcome-features { grid-template-columns: 1fr; }
  .welcome-actions { flex-direction: column; align-items: stretch; }
  .transfer-drawer { width: 100%; }
  .terminal-hint { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .selection-bar { bottom: 10px; max-width: calc(100% - 20px); }
  .selection-btn span { display: none; }
  .modal-overlay { padding: 12px; }
  .modal-card { max-height: 94vh; }
  .toast-root { top: 74px; right: 12px; }
}
@media (max-width: 480px) {
  .selection-pill { padding-right: 2px; }
  .selection-divider { margin: 0 1px; }
  .selection-btn { padding: 0 7px; }
  .size-cell { display: none; }
  .file-table-head, .file-row { grid-template-columns: 38px minmax(100px, 1fr) 38px; }
  .row-actions { display: none; }
  .grid-view { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .terminal-chrome { padding-right: 4px; }
  .terminal-tab { max-width: 132px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
