:root {
  --bg-app: #eef1f5;
  --bg-main: #ffffff;
  --bg-subtle: #f4f6fa;
  --bg-hover: #eaeef5;
  --bg-active: #dfe8fa;
  --bg-elevated: #ffffff;
  --bg-recessed: #e8ecf2;
  --text-1: #161b26;
  --text-2: #525d70;
  --text-3: #838ea2;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.11);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.10);
  --ok: #16a34a;
  --warn: #d97706;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.11);
  --shadow-lg: 0 20px 54px rgba(15, 23, 42, 0.18);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-w: 248px;
  --inspector-w: 332px;
  --font-sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg-app: #101318;
  --bg-main: #171b22;
  --bg-subtle: #1e232d;
  --bg-hover: #252b37;
  --bg-active: #203152;
  --bg-elevated: #222733;
  --bg-recessed: #13161d;
  --text-1: #edf1f8;
  --text-2: #9ca7ba;
  --text-3: #687387;
  --accent: #5b93ff;
  --accent-hover: #76a6ff;
  --accent-soft: rgba(91, 147, 255, 0.16);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.15);
  --ok: #4ade80;
  --warn: #fbbf24;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 12px 34px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.56);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-app);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
}

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }

.ic {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  display: inline-block;
}
.ic-sm { width: 15px; height: 15px; }
.ic-lg { width: 22px; height: 22px; }
.ic-xl { width: 38px; height: 38px; }
.ic-dir { color: #3b82f6; }
.ic-img { color: #10b981; }
.ic-vid { color: #8b5cf6; }
.ic-aud { color: #ec4899; }
.ic-pdf { color: #ef4444; }
.ic-txt { color: #64748b; }
.ic-arc { color: #f59e0b; }
.ic-link { color: #06b6d4; }
.ic-file { color: var(--text-3); }

/* Auth Screen */
.auth-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg-app);
}
.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-main);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.auth-logo { width: 42px; height: 42px; border-radius: 12px; }
.auth-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.auth-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.auth-field input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  outline: none;
  transition: background 0.15s, box-shadow 0.15s;
}
.auth-field input:focus {
  background: var(--bg-main);
  box-shadow: 0 0 0 2px var(--accent);
}
.auth-error {
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
}

/* Shared Buttons & Controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.14s, transform 0.1s, opacity 0.14s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn-full { width: 100%; height: 42px; font-size: 14px; border-radius: var(--radius-md); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-soft { background: var(--bg-subtle); color: var(--text-1); }
.btn-soft:hover { background: var(--bg-hover); }
.btn-accent-soft { background: var(--accent-soft); color: var(--accent); }
.btn-accent-soft:hover { filter: brightness(0.96); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger-soft:hover { filter: brightness(0.95); }
.btn-ghost { color: var(--text-2); background: transparent; }
.btn-ghost:hover { background: var(--bg-subtle); color: var(--text-1); }
.btn-soft-dark { background: rgba(255, 255, 255, 0.14); color: #fff; }
.btn-soft-dark:hover { background: rgba(255, 255, 255, 0.24); }

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: background 0.14s, color 0.14s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-1); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent); }
.icon-btn:disabled { opacity: 0.35; pointer-events: none; }
.icon-btn-dark { color: #fff; }
.icon-btn-dark:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }

.icon-btn-sm {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: background 0.14s, color 0.14s;
}
.icon-btn-sm:hover { background: var(--bg-hover); color: var(--text-1); }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 12px;
  color: var(--text-2);
  transition: background 0.14s, color 0.14s;
}
.ghost-btn:hover { background: var(--bg-hover); color: var(--text-1); }

.flat-select {
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-1);
  font-size: 12.5px;
  outline: none;
  cursor: pointer;
}
.flat-select:hover { background: var(--bg-hover); }
.flat-select-sm { height: 26px; padding: 0 8px; font-size: 12px; }

.flat-input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  outline: none;
}
.flat-input:focus {
  background: var(--bg-main);
  box-shadow: 0 0 0 2px var(--accent);
}

.flat-textarea {
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
}
.flat-textarea:focus {
  background: var(--bg-main);
  box-shadow: 0 0 0 2px var(--accent);
}

/* App Shell Layout */
.app {
  display: flex;
  height: 100%;
  width: 100%;
  padding: 8px;
  gap: 8px;
  background: var(--bg-app);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
  padding: 4px 2px;
  user-select: none;
}
.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand-logo { width: 26px; height: 26px; border-radius: 7px; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.sidebar-top-actions { display: flex; align-items: center; gap: 4px; }

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 2px 4px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.nav-heading {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  padding: 0 10px 5px;
  letter-spacing: 0.02em;
}
.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.13s, color 0.13s;
  position: relative;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-1); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.drop-target {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
  color: var(--accent);
}
.nav-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.nav-item-del {
  opacity: 0;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
}
.nav-item:hover .nav-item-del { opacity: 1; }
.nav-item-del:hover { background: var(--danger-soft); color: var(--danger); }

/* Directory Tree */
.dir-tree {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tree-row {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding-right: 8px;
  border-radius: 7px;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.tree-row:hover { background: var(--bg-hover); color: var(--text-1); }
.tree-row.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.tree-row.drop-target {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.tree-twist {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  flex-shrink: 0;
  border-radius: 4px;
}
.tree-twist:hover { background: var(--bg-recessed); color: var(--text-1); }
.tree-twist.empty { visibility: hidden; }
.tree-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer {
  padding: 10px 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.disk-box {
  background: var(--bg-main);
  padding: 10px 11px;
  border-radius: var(--radius-md);
}
.disk-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-2);
  margin-bottom: 6px;
}
.disk-bar {
  height: 5px;
  background: var(--bg-recessed);
  border-radius: 99px;
  overflow: hidden;
}
.disk-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.3s ease;
}
.sidebar-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}
.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
}
.toggle-chip input { accent-color: var(--accent); }

/* Main Pane */
.main-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-main);
  flex-shrink: 0;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.history-btns {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  flex: 1;
  max-width: 680px;
  height: 32px;
}
.breadcrumbs::-webkit-scrollbar { display: none; }
.crumb {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.crumb:hover { background: var(--bg-hover); color: var(--text-1); }
.crumb.current { color: var(--text-1); font-weight: 600; }
.crumb.drop-target { background: var(--accent-soft); color: var(--accent); }
.crumb-sep { color: var(--text-3); display: inline-flex; flex-shrink: 0; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px 0 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  width: 210px;
  transition: width 0.2s, background 0.15s, box-shadow 0.15s;
}
.search-box:focus-within {
  width: 255px;
  background: var(--bg-main);
  box-shadow: 0 0 0 2px var(--accent);
}
.search-ic { color: var(--text-3); display: inline-flex; }
.search-box input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 13px;
}

/* Actionbar */
.actionbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 14px 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.actionbar-left, .actionbar-right, .sort-controls, .trash-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-banner {
  margin: 0 14px 8px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* File Viewport */
.file-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 0 14px 72px;
  outline: none;
}

/* List View */
.file-table {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.file-thead {
  display: grid;
  grid-template-columns: 32px minmax(180px, 1fr) 96px 150px 84px;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  position: sticky;
  top: 0;
  background: var(--bg-main);
  z-index: 2;
  user-select: none;
}
.file-row {
  display: grid;
  grid-template-columns: 32px minmax(180px, 1fr) 96px 150px 84px;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
  user-select: none;
  cursor: default;
}
.file-row:hover { background: var(--bg-subtle); }
.file-row.selected { background: var(--accent-soft); }
.file-row.drop-target {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.file-check-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}
.row-check {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.12s;
}
.file-row:hover .row-check,
.file-row.selected .row-check,
.has-selection .row-check { opacity: 1; }

.file-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.file-name-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.file-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 450;
}
.file-subpath {
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-size-cell, .file-mtime-cell {
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
}
.file-size-cell { text-align: right; font-family: var(--font-mono); }
.file-mtime-cell { text-align: right; font-family: var(--font-mono); font-size: 12px; }
.file-ops-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.12s;
}
.file-row:hover .file-ops-cell,
.file-row.selected .file-ops-cell { opacity: 1; }

/* Grid View */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(144px, 1fr));
  gap: 10px;
  padding-top: 4px;
}
.grid-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  gap: 8px;
  user-select: none;
  transition: background 0.13s, transform 0.12s;
}
.grid-card:hover { background: var(--bg-hover); }
.grid-card.selected {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.grid-card.drop-target {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.grid-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  opacity: 0;
  cursor: pointer;
}
.grid-card:hover .grid-check,
.grid-card.selected .grid-check,
.has-selection .grid-check { opacity: 1; }
.grid-thumb {
  height: 98px;
  border-radius: var(--radius-sm);
  background: var(--bg-main);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.grid-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.grid-name {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grid-meta {
  font-size: 11.5px;
  color: var(--text-3);
  display: flex;
  justify-content: space-between;
}

/* Empty State */
.empty-state {
  margin: 36px auto;
  max-width: 360px;
  padding: 32px 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
}
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text-1); }
.empty-state-sub { font-size: 12.5px; color: var(--text-3); }
.empty-state-actions { display: flex; gap: 8px; margin-top: 6px; }

/* Floating Selection Bar */
.selection-bar {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px 7px 16px;
  background: var(--text-1);
  color: var(--bg-main);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  z-index: 15;
  max-width: calc(100% - 24px);
}
.selection-count { font-size: 13px; font-weight: 600; white-space: nowrap; }
.selection-actions { display: flex; align-items: center; gap: 4px; }
.sel-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12.5px;
  color: inherit;
  white-space: nowrap;
}
.sel-btn:hover { background: rgba(255, 255, 255, 0.14); }
.sel-danger { color: #fca5a5; }
.sel-danger:hover { background: rgba(239, 68, 68, 0.22); }

/* Right Inspector */
.inspector {
  width: var(--inspector-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
}
.inspector-title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inspector-header-actions { display: flex; gap: 4px; }
.inspector-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.preview-box {
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  min-height: 150px;
  max-height: 290px;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.preview-box img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  cursor: zoom-in;
}
.preview-box video, .preview-box audio { width: 100%; max-height: 280px; }
.preview-box iframe { width: 100%; height: 280px; border: 0; background: #fff; }
.preview-code-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.preview-code {
  margin: 0;
  padding: 12px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.preview-editor {
  width: 100%;
  min-height: 240px;
  padding: 12px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  outline: none;
  resize: vertical;
}
.preview-editor:focus { box-shadow: 0 0 0 2px var(--accent); }

.meta-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-subtle);
  padding: 12px;
  border-radius: var(--radius-md);
}
.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}
.meta-k { color: var(--text-3); flex-shrink: 0; }
.meta-v { color: var(--text-1); text-align: right; word-break: break-all; }
.path-copy-box {
  background: var(--bg-subtle);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.path-copy-text {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-2);
  word-break: break-all;
}
.inspector-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* External Drag Overlay */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(37, 99, 235, 0.14);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  pointer-events: none;
}
.drop-overlay-card {
  background: var(--bg-elevated);
  padding: 32px 44px;
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.drop-overlay-ic {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
}
.drop-overlay-title { font-size: 17px; font-weight: 700; }
.drop-overlay-sub { font-size: 13px; color: var(--text-2); }

/* Upload Queue Tray */
.upload-tray {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 400px;
  max-width: calc(100vw - 24px);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 40;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.upload-tray.collapsed .upload-list { display: none; }
.upload-tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
}
.upload-tray-summary { display: flex; flex-direction: column; min-width: 0; }
.upload-tray-title { font-size: 13.5px; font-weight: 600; }
.upload-tray-stats { font-size: 11.5px; color: var(--text-2); }
.upload-tray-controls { display: flex; align-items: center; gap: 4px; }
.upload-overall-bar {
  height: 3px;
  background: var(--bg-subtle);
}
.upload-overall-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s linear;
}
.upload-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.upload-row {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.upload-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.upload-row-name {
  font-size: 12.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-row-btns { display: flex; gap: 2px; flex-shrink: 0; }
.upload-row-bar {
  height: 4px;
  border-radius: 99px;
  background: var(--bg-recessed);
  overflow: hidden;
}
.upload-row-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.15s linear;
}
.upload-row-fill.done { background: var(--ok); }
.upload-row-fill.error { background: var(--danger); }
.upload-row-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-2);
}

/* Context Menu */
.context-menu {
  position: fixed;
  z-index: 60;
  min-width: 184px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ctx-item {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 33px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text-1);
  text-align: left;
  width: 100%;
}
.ctx-item:hover { background: var(--bg-subtle); }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger:hover { background: var(--danger-soft); }
.ctx-sep { height: 1px; background: var(--bg-subtle); margin: 4px 6px; }

/* Sheets (Quick Text & Prompt) */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 16px;
}
.sheet-panel {
  width: 100%;
  max-width: 560px;
  background: var(--bg-elevated);
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sheet-panel-sm { max-width: 380px; }
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sheet-title { font-size: 15.5px; font-weight: 700; }
.sheet-desc { font-size: 13px; color: var(--text-2); }
.sheet-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sheet-row .flat-input { flex: 1; min-width: 180px; }
.ext-chips { display: flex; gap: 4px; }
.chip {
  height: 30px;
  padding: 0 9px;
  border-radius: 7px;
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 12px;
  font-family: var(--font-mono);
}
.chip:hover { background: var(--bg-hover); color: var(--text-1); }
.sheet-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}
.sheet-footer-end { justify-content: flex-end; }
.sheet-footer-right { display: flex; gap: 8px; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(10, 12, 18, 0.92);
  display: flex;
  flex-direction: column;
  color: #fff;
}
.lightbox-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  gap: 12px;
}
.lightbox-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lightbox-actions { display: flex; align-items: center; gap: 8px; }
.lightbox-stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 16px 64px 28px;
  overflow: auto;
}
.lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.lightbox-stage video { max-width: 100%; max-height: 100%; border-radius: 8px; }
.lightbox-stage audio { width: min(520px, 90%); }
.lightbox-stage iframe { width: min(1000px, 100%); height: 100%; border: 0; border-radius: 10px; background: #fff; }
.lightbox-stage pre {
  width: min(920px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 20px;
  border-radius: 12px;
  background: #171b22;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.lb-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  display: grid;
  place-items: center;
}
.lb-nav:hover { background: rgba(255, 255, 255, 0.25); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }

/* Toast */
.toast-wrap {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
.toast {
  padding: 8px 15px;
  border-radius: 999px;
  background: var(--text-1);
  color: var(--bg-main);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.18s ease;
}
.toast.error { background: var(--danger); color: #fff; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile Bar & Responsive */
.mobile-only { display: none; }
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 25;
}
.mobile-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(58px + env(safe-area-inset-bottom, 0px));
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-main);
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  gap: 6px;
  z-index: 20;
}
.mob-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 10px;
  background: var(--bg-subtle);
  color: var(--text-1);
  font-size: 12.5px;
  font-weight: 500;
  position: relative;
}
.mob-btn.mob-primary { background: var(--accent); color: #fff; }
.badge {
  position: absolute;
  top: 4px;
  right: 6px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

@media (max-width: 860px) {
  .mobile-only { display: inline-flex; }
  .mobile-bar.mobile-only { display: grid; }
  .desktop-inline { display: none; }
  .app { padding: 0; gap: 0; }
  .main-pane { border-radius: 0; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 276px;
    max-width: 84vw;
    background: var(--bg-app);
    z-index: 30;
    padding: 10px 8px;
    transform: translateX(-104%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .inspector {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(360px, 92vw);
    border-radius: 16px 0 0 16px;
    z-index: 35;
    box-shadow: var(--shadow-lg);
  }
  .history-btns { display: none; }
  .search-box { width: 132px; }
  .search-box:focus-within { width: 170px; }
  .actionbar { padding: 0 12px 8px; }
  .file-viewport { padding: 0 10px 128px; }
  .file-thead { grid-template-columns: 28px minmax(120px, 1fr) 76px 36px; }
  .file-row { grid-template-columns: 28px minmax(120px, 1fr) 76px 36px; }
  .file-mtime-cell, .col-mtime { display: none; }
  .file-ops-cell { opacity: 1; }
  .selection-bar { bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
  .upload-tray {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  }
  .lightbox-stage { padding: 12px; }
  .lb-nav { width: 36px; height: 36px; }
}
