:root {
  --bg: #0b0d11;
  --surface: #12161e;
  --surface-2: #181e29;
  --surface-3: #202836;
  --border: #242d3d;
  --border-strong: #354259;
  --text: #e8edf5;
  --text-2: #97a4ba;
  --text-3: #66738a;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --folder: #f59e0b;
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.48);
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

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

button, input, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: transparent;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}
.btn:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--border-strong);
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: transparent;
  color: var(--text);
}

.btn-icon {
  width: 34px;
  padding: 0;
}
.btn-sm {
  height: 28px;
  padding: 0 9px;
  font-size: 12px;
}
.btn-sm.btn-icon { width: 28px; padding: 0; }

/* --- Inputs --- */
.input, .select {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.select { width: auto; height: 34px; padding-right: 26px; background: var(--surface-2); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* --- Auth / Lock Screen --- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(600px 300px at 50% 0%, rgba(59, 130, 246, 0.08), transparent 70%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 390px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.auth-brand .brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  display: grid;
  place-items: center;
}
.auth-brand h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -0.02em; }
.auth-sub { margin: 0 0 20px; color: var(--text-2); font-size: 13px; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.auth-tab {
  height: 30px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
}
.auth-tab.active {
  background: var(--surface-2);
  color: var(--text);
}

.form-error {
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 12.5px;
  margin-bottom: 14px;
}

/* --- Main App Shell --- */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 58px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(18, 22, 30, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.015em;
  color: var(--text);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.brand-btn:hover { background: var(--surface-2); }
.brand-btn svg { width: 20px; height: 20px; color: var(--accent-hover); }

.disk-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
  flex-shrink: 0;
}
.disk-bar {
  width: 66px;
  height: 6px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}
.disk-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.3s ease;
}
.disk-bar-fill.warn { background: var(--warning); }
.disk-bar-fill.crit { background: var(--danger); }

.search-wrap {
  flex: 1;
  max-width: 460px;
  margin-left: auto;
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap .search-icon {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--text-3);
  pointer-events: none;
}
.search-input {
  width: 100%;
  height: 34px;
  padding: 0 74px 0 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 13px;
  outline: none;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-actions {
  position: absolute;
  right: 5px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.search-scope-btn {
  height: 24px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  border: 1px solid transparent;
}
.search-scope-btn.active {
  color: var(--accent-hover);
  background: var(--accent-soft);
  border-color: rgba(59, 130, 246, 0.3);
}
.search-clear {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: var(--text-2);
}
.search-clear:hover { background: var(--surface-3); color: var(--text); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* --- Sub-Toolbar (Breadcrumbs + Actions) --- */
.toolbar {
  position: sticky;
  top: 58px;
  z-index: 25;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(11, 13, 17, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  min-width: 0;
  padding: 2px 0;
  scrollbar-width: none;
}
.breadcrumbs::-webkit-scrollbar { display: none; }
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.crumb:hover { background: var(--surface-2); color: var(--text); }
.crumb.current { color: var(--text); font-weight: 600; }
.crumb-sep { color: var(--text-3); font-size: 12px; user-select: none; }

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}
.segmented button {
  height: 28px;
  width: 30px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: var(--text-2);
}
.segmented button.active {
  background: var(--surface-3);
  color: var(--text);
}
.segmented button svg { width: 15px; height: 15px; }

/* --- Batch Selection Bar --- */
.batch-bar {
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: rgba(59, 130, 246, 0.1);
  border-bottom: 1px solid rgba(59, 130, 246, 0.3);
}
.batch-left { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500; }
.batch-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

/* --- Search Status Banner --- */
.search-banner {
  padding: 8px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  padding: 14px 18px 80px;
  max-width: 1520px;
  width: 100%;
  margin: 0 auto;
}

/* --- List View --- */
.file-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.list-header {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 110px 150px 124px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  user-select: none;
}
.list-header.no-select {
  grid-template-columns: minmax(0, 1fr) 110px 150px 124px;
}
.list-header button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
}
.list-header button:hover { color: var(--text); }
.col-right { text-align: right; justify-content: flex-end; }

.file-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 110px 150px 124px;
  align-items: center;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(36, 45, 61, 0.55);
  transition: background 0.1s;
}
.file-row.no-select {
  grid-template-columns: minmax(0, 1fr) 110px 150px 124px;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--surface-2); }
.file-row.selected { background: rgba(59, 130, 246, 0.12); }

.row-check {
  display: flex;
  align-items: center;
  justify-content: center;
}
.row-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.row-name-cell {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  cursor: pointer;
  padding: 2px 0;
}

.entry-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  color: var(--text-2);
}
.entry-icon svg { width: 17px; height: 17px; }
.entry-icon.kind-dir { color: var(--folder); background: rgba(245, 158, 11, 0.12); }
.entry-icon.kind-image { color: #38bdf8; background: rgba(56, 189, 248, 0.12); }
.entry-icon.kind-video { color: #a78bfa; background: rgba(167, 139, 250, 0.12); }
.entry-icon.kind-audio { color: #f472b6; background: rgba(244, 114, 182, 0.12); }
.entry-icon.kind-pdf { color: #fb7185; background: rgba(251, 113, 133, 0.12); }
.entry-icon.kind-text { color: #4ade80; background: rgba(74, 222, 128, 0.12); }
.entry-icon.kind-archive { color: #fbbf24; background: rgba(251, 191, 36, 0.12); }
.entry-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }

.name-stack { min-width: 0; display: flex; flex-direction: column; }
.entry-name {
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entry-subpath {
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entry-mobile-meta {
  display: none;
  font-size: 11.5px;
  color: var(--text-3);
}

.row-size, .row-date {
  font-size: 12.5px;
  color: var(--text-2);
  text-align: right;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

/* --- Grid View --- */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 12px;
}

.grid-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.14s, transform 0.14s, background 0.14s;
}
.grid-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.grid-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.grid-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg);
  display: grid;
  place-items: center;
  cursor: pointer;
  overflow: hidden;
  border-bottom: 1px solid rgba(36, 45, 61, 0.6);
}
.grid-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.grid-thumb .grid-big-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.grid-thumb .grid-big-icon svg { width: 38px; height: 38px; }
.grid-thumb .ext-badge {
  font-size: 10.5px;
  font-weight: 650;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.grid-card-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: rgba(11, 13, 17, 0.78);
  display: grid;
  place-items: center;
}
.grid-card-check input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

.grid-card-menu {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(11, 13, 17, 0.76);
  color: var(--text);
  display: grid;
  place-items: center;
}
.grid-card-menu:hover { background: var(--surface-3); }

.grid-info {
  padding: 9px 10px;
  cursor: pointer;
}
.grid-name {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grid-meta {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-3);
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

/* --- Dropdown Menu --- */
.context-menu {
  position: fixed;
  z-index: 120;
  min-width: 185px;
  padding: 5px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  box-shadow: var(--shadow);
}
.context-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  text-align: left;
}
.context-item:hover { background: var(--surface-3); }
.context-item.danger { color: #f87171; }
.context-item.danger:hover { background: var(--danger-soft); }
.context-item svg { width: 15px; height: 15px; color: var(--text-2); flex-shrink: 0; }
.context-item.danger svg { color: #f87171; }
.context-sep { height: 1px; background: var(--border); margin: 4px 2px; }

/* --- Empty State --- */
.empty-state {
  padding: 64px 20px;
  text-align: center;
  color: var(--text-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: rgba(18, 22, 30, 0.45);
}
.empty-state svg { width: 42px; height: 42px; color: var(--text-3); margin-bottom: 12px; }
.empty-state h3 { margin: 0 0 6px; font-size: 15px; color: var(--text); }
.empty-state p { margin: 0; font-size: 13px; color: var(--text-3); }

/* --- Drag & Drop Overlay --- */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(11, 13, 17, 0.84);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}
.drop-box {
  width: 100%;
  max-width: 480px;
  padding: 46px 28px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  background: rgba(59, 130, 246, 0.08);
  text-align: center;
}
.drop-box svg { width: 46px; height: 46px; color: var(--accent-hover); margin-bottom: 10px; }
.drop-box h2 { margin: 0 0 6px; font-size: 18px; }
.drop-box p { margin: 0; color: var(--text-2); font-size: 13px; }

/* --- Floating Upload Drawer --- */
.upload-drawer {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  width: 420px;
  max-width: calc(100vw - 24px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.upload-drawer-head {
  padding: 11px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.upload-drawer-title {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.upload-drawer-sub {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-2);
}
.upload-drawer-list {
  max-height: 310px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.upload-item {
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}
.upload-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.upload-item-name {
  font-size: 12.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-item-controls { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.progress-track {
  height: 5px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.15s linear;
}
.progress-fill.done { background: var(--success); }
.progress-fill.paused { background: var(--warning); }
.progress-fill.error { background: var(--danger); }

.upload-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-2);
}
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-2);
}
.status-badge.ok { background: rgba(34, 197, 94, 0.14); color: #86efac; }
.status-badge.warn { background: rgba(234, 179, 8, 0.15); color: #fde047; }
.status-badge.err { background: var(--danger-soft); color: #fca5a5; }
.status-badge.accent { background: var(--accent-soft); color: #93c5fd; }

/* --- Modals & Preview Lightbox --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(5, 7, 10, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal {
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal.modal-lg { max-width: 680px; }
.modal.modal-preview {
  max-width: 1080px;
  width: 96vw;
  height: 88vh;
  max-height: 88vh;
}

.modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
}
.modal-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-head-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  background: var(--surface-2);
}

/* Preview Body */
.preview-stage {
  padding: 0;
  background: #07090d;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: auto;
}
.preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: zoom-in;
  transition: transform 0.15s;
}
.preview-img.zoomed {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}
.preview-video {
  width: 100%;
  height: 100%;
  max-height: 100%;
  background: #000;
  outline: none;
}
.preview-pdf {
  width: 100%;
  height: 100%;
  border: none;
  background: #1a1d24;
}
.preview-audio-card, .preview-fallback {
  padding: 32px 24px;
  text-align: center;
  max-width: 460px;
  width: 100%;
}
.preview-audio-card audio { width: 100%; margin-top: 16px; }

.preview-text-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #0d1117;
}
.preview-text-notice {
  padding: 8px 14px;
  background: rgba(234, 179, 8, 0.12);
  border-bottom: 1px solid rgba(234, 179, 8, 0.25);
  color: #fde047;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.preview-code {
  margin: 0;
  padding: 16px 18px;
  flex: 1;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: #dbe4f3;
  white-space: pre;
  tab-size: 4;
}

.preview-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(18, 22, 30, 0.82);
  border: 1px solid var(--border-strong);
  color: var(--text);
  display: grid;
  place-items: center;
}
.preview-nav-btn:hover { background: var(--surface-3); }
.preview-nav-prev { left: 12px; }
.preview-nav-next { right: 12px; }

/* Move Folder Tree */
.dir-picker-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  max-height: 270px;
  overflow-y: auto;
  margin-top: 10px;
}
.dir-picker-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(36, 45, 61, 0.5);
  text-align: left;
  color: var(--text);
}
.dir-picker-item:last-child { border-bottom: none; }
.dir-picker-item:hover { background: var(--surface-2); }
.dir-picker-item svg { width: 16px; height: 16px; color: var(--folder); flex-shrink: 0; }

/* Danger Delete Box */
.danger-box {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
  font-size: 13px;
  margin-bottom: 14px;
}
.confirm-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  color: var(--text);
  margin: 12px 0;
  cursor: pointer;
}
.confirm-check input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--danger); }

/* Share List & Result Box */
.share-result-box {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid rgba(34, 197, 94, 0.4);
  margin-top: 12px;
}
.copy-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.share-list-item {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.share-list-meta { min-width: 0; }
.share-list-path {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-list-sub {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 3px;
}

/* Public Single File Card */
.share-file-shell {
  max-width: 960px;
  margin: 24px auto;
  padding: 0 18px;
}
.share-file-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.share-file-preview {
  min-height: 320px;
  max-height: 70vh;
  background: #07090d;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}
.share-file-bar {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
}

/* --- Toasts --- */
.toast-container {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 250;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: toastIn 0.16s ease-out;
}
.toast.ok { border-color: rgba(34, 197, 94, 0.5); }
.toast.err { border-color: rgba(239, 68, 68, 0.55); background: #2a1418; color: #fecaca; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Responsive Mobile --- */
@media (max-width: 820px) {
  .topbar {
    height: auto;
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .disk-pill { display: none; }
  .search-wrap {
    order: 3;
    max-width: none;
    flex-basis: 100%;
    margin-left: 0;
  }
  .topbar-right { margin-left: auto; }
  .toolbar {
    top: 0;
    position: static;
    padding: 10px 12px;
  }
  .main-content { padding: 10px 12px 90px; }

  .list-header { display: none; }
  .file-row, .file-row.no-select {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    padding: 10px 10px;
  }
  .file-row.no-select {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .row-size, .row-date { display: none; }
  .entry-mobile-meta { display: block; margin-top: 2px; }
  .row-actions .desktop-only { display: none; }

  .file-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .upload-drawer {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-width: none;
  }

  .modal.modal-preview {
    width: 100vw;
    height: 94vh;
    max-height: 94vh;
    border-radius: var(--radius);
  }
  .btn .btn-label-hide-sm { display: none; }
}
