/* ══════════════════════════════════════════════════
   Evas Diskstasjon — macOS Finder-style CSS
   ══════════════════════════════════════════════════ */

/* ── CSS Custom Properties ── */
:root {
  --font: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
  --bg-grid: rgba(0, 122, 255, 0.04);
  --bg-grad: #EBF3FC;

  /* Light mode */
  --bg: #F5F5F7;
  --bg-sidebar: rgba(246, 246, 246, 0.72);
  --bg-content: #FFFFFF;
  --bg-toolbar: rgba(246, 246, 246, 0.9);
  --bg-hover: rgba(0, 0, 0, 0.04);
  --bg-selected: #007AFF;
  --bg-selected-unfocused: rgba(0, 0, 0, 0.06);
  --bg-alt-row: rgba(0, 0, 0, 0.02);
  --bg-context: rgba(252, 252, 252, 0.95);

  --border: rgba(0, 0, 0, 0.1);
  --border-light: rgba(0, 0, 0, 0.06);
  --border-sidebar: rgba(0, 0, 0, 0.08);

  --text-primary: #1D1D1F;
  --text-secondary: #6E6E73;
  --text-tertiary: #AEAEB2;
  --text-selected: #FFFFFF;

  --accent: #007AFF;
  --accent-hover: #0066D6;
  --folder-blue: #3B9FE8;
  --danger: #FF3B30;
  --danger-hover: #D62D23;
  --success: #34C759;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.15);
  --shadow-context: 0 6px 20px rgba(0,0,0,0.15), 0 0 0 0.5px rgba(0,0,0,0.1);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --sidebar-width: 220px;
  --toolbar-height: 52px;
  --header-height: 28px;
  --row-height: 32px;
  --status-height: 24px;

  /* v13 Nebula — Apple spring motion physics */
  --spring: cubic-bezier(0.23, 1, 0.32, 1);
  --spring-soft: cubic-bezier(0.25, 1, 0.5, 1);
  --transition: 220ms var(--spring-soft);
  --transition-fast: 150ms var(--spring-soft);
  --transition-sheet: 420ms var(--spring);

  /* v13 Nebula — glass + hairline tokens */
  --hairline: 1px solid rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(22, 24, 35, 0.7);
  --glass-blur: blur(25px);
}

/* ── Dark Mode ── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121315;
    --bg-grid: rgba(255, 255, 255, 0.03);
    --bg-grad: #1C1E22;
    --bg-sidebar: rgba(42, 42, 42, 0.72);
    --bg-content: #232323;
    --bg-toolbar: rgba(42, 42, 42, 0.9);
    --bg-hover: rgba(255, 255, 255, 0.06);
    --bg-selected: #0A84FF;
    --bg-selected-unfocused: rgba(255, 255, 255, 0.08);
    --bg-alt-row: rgba(255, 255, 255, 0.02);
    --bg-context: rgba(44, 44, 46, 0.95);

    --border: rgba(255, 255, 255, 0.1);
    --border-light: rgba(255, 255, 255, 0.06);
    --border-sidebar: rgba(255, 255, 255, 0.08);

    --text-primary: #F5F5F7;
    --text-secondary: #A1A1A6;
    --text-tertiary: #636366;

    --accent: #0A84FF;
    --accent-hover: #409CFF;
    --folder-blue: #56AAF2;
    --danger: #FF453A;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
    --shadow-context: 0 6px 20px rgba(0,0,0,0.4), 0 0 0 0.5px rgba(255,255,255,0.1);
  }
}

/* ── Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg);
  background-image: 
    radial-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-grad) 100%);
  background-size: 24px 24px, 100% 100%;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
}

.hidden { display: none !important; }

/* ══════════════════════════════════════════════════
   LOGIN SCREEN (macOS Sonoma Style)
   ══════════════════════════════════════════════════ */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image: 
    radial-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-grad) 100%);
  background-size: 24px 24px, 100% 100%;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-screen.fade-out {
  opacity: 0;
  transform: scale(1.08);
  pointer-events: none;
}

/* Finder Login Window */
.finder-login-window {
  width: 440px;
  background: var(--bg-context);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: loginAppear 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginAppear {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.finder-titlebar {
  height: 28px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 10px;
  position: relative;
}

.finder-window-controls {
  display: flex;
  gap: 6px;
  position: absolute;
  left: 10px;
}

.window-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.dot-red { background: #ff5f56; border: 0.5px solid #e0443e; }
.dot-yellow { background: #ffbd2e; border: 0.5px solid #dea123; }
.dot-green { background: #27c93f; border: 0.5px solid #1aab29; }

.finder-title {
  width: 100%;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.finder-login-body {
  display: flex;
  padding: 24px;
  gap: 20px;
}

.finder-login-icon {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}

.finder-login-form-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.finder-service-desc {
  margin-bottom: 18px;
  text-align: left;
}

.finder-service-desc strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}

.finder-service-desc p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 4px;
}

.finder-radio-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.finder-radio-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.finder-radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.finder-radio-option input[type="radio"] {
  accent-color: var(--accent);
}

.finder-radio-option label {
  color: var(--text-primary);
  cursor: pointer;
}

.finder-radio-option label.disabled-label {
  color: var(--text-muted);
  cursor: not-allowed;
}

.finder-input-group {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  font-size: 12px;
  text-align: left;
}

.finder-input-group label {
  width: 70px;
  color: var(--text-secondary);
}

.finder-input-group input {
  flex: 1;
  height: 24px;
  padding: 0 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  font-family: var(--font);
}

.finder-input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.15);
}

.finder-input-group input[readonly] {
  background: transparent;
  border-color: transparent;
  padding-left: 0;
  color: var(--text-muted);
  pointer-events: none;
}

.finder-login-error {
  color: var(--error);
  font-size: 11px;
  min-height: 16px;
  margin-top: 4px;
  margin-bottom: 12px;
  text-align: left;
}

.finder-login-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.finder-btn {
  height: 22px;
  min-width: 76px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  transition: background var(--transition);
}

.finder-btn:hover {
  background: var(--border-light);
}

.finder-btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.finder-btn-primary:hover {
  opacity: 0.9;
}

/* Shake Animation for Wrong Password */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.finder-login-window.shake {
  animation: shake 0.35s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.shake {
  animation: shake 0.35s ease-in-out;
}

/* ══════════════════════════════════════════════════
   APP LAYOUT
   ══════════════════════════════════════════════════ */
.app {
  display: flex;
  height: 100vh;
  height: 100dvh;   /* dynamic viewport: keeps the bottom transfer panel + status
                       bar visible when mobile browser chrome shows/hides */
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
}

.app.visible {
  opacity: 1;
}

/* ── Sidebar ── */
.sidebar {
  position: relative;
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  background: var(--bg-sidebar);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border-right: 1px solid var(--border-sidebar);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition);
}
/* While dragging we kill the width transition so the edge tracks the pointer. */
.sidebar.resizing { transition: none; }

/* Drag handle on the sidebar's right edge (desktop only). */
.sidebar-resize {
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  z-index: 60;
  background: transparent;
}
.sidebar-resize::after {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 2px;
  height: 100%;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.sidebar-resize:hover::after,
.sidebar.resizing .sidebar-resize::after { opacity: 0.6; }
body.sidebar-resizing { cursor: col-resize; user-select: none; -webkit-user-select: none; }
@media (max-width: 768px) { .sidebar-resize { display: none; } }

.sidebar-inner {
  flex: 1;
  padding: 12px 12px 8px;
  overflow-y: auto;
  padding-top: env(safe-area-inset-top, 12px);
}

.sidebar-section-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: -0.01em;
  padding: 8px 8px 6px;
  margin-top: 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 400;
}

.sidebar-item:hover {
  background: var(--bg-hover);
}

.sidebar-item.active {
  background: var(--bg-selected);
  color: var(--text-selected);
}

.sidebar-item.active .sidebar-icon {
  opacity: 1;
}

.sidebar-icon {
  flex-shrink: 0;
  opacity: 0.8;
}

/* Disk Usage */
.sidebar-disk-usage {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border-light);
}

.disk-usage-label {
  font-size: 10px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.disk-usage-bar-track {
  height: 4px;
  background: var(--bg-hover);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

/* Indeterminate "swoosh" while usage is being fetched. */
.disk-usage-bar-track.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.5) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: ndUsageSwoosh 1.15s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes ndUsageSwoosh {
  to { transform: translateX(100%); }
}

.disk-usage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #41a0ff);
  border-radius: 2px;
  /* smooth spring fill once the real value lands */
  transition: width 1s cubic-bezier(0.22, 1, 0.36, 1), background 0.4s ease;
}
.disk-usage-bar-track.loading .disk-usage-bar-fill {
  opacity: 0.4;
}

.disk-usage-bar-fill.warning {
  background: #FF9500;
}

.disk-usage-bar-fill.critical {
  background: var(--danger);
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-content);
  min-width: 0;
}

/* ── Toolbar ── */
.toolbar {
  height: var(--toolbar-height);
  min-height: var(--toolbar-height);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  background: var(--bg-toolbar);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Hamburger toggles the sidebar everywhere: collapse on desktop, drawer on
   mobile. Higher specificity than .toolbar-btn so it actually shows. */
.toolbar-btn.toolbar-btn-menu { display: flex; }
.sidebar-backdrop { display: none; }

/* Compact actions menu: hidden on desktop, replaces the button clusters on
   small screens. */
.actions-wrap { position: relative; display: none; }
.toolbar-btn.toolbar-btn-actions { display: flex; }

/* Desktop: collapse the sidebar to nothing (smoothly). */
.app.sidebar-collapsed .sidebar {
  width: 0 !important;
  min-width: 0 !important;
  border-right: none;
  opacity: 0;
}

.toolbar-btn {
  width: 32px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.toolbar-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.toolbar-btn:active:not(:disabled) {
  transform: scale(0.92);
}

.toolbar-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.toolbar-btn.active {
  color: var(--accent);
}

.toolbar-separator {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}

/* Breadcrumbs */
.toolbar-breadcrumbs {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 8px;
  min-width: 0;
}

.toolbar-breadcrumbs::-webkit-scrollbar { display: none; }

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  flex-shrink: 0;
}

.breadcrumb-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.breadcrumb-item.current {
  color: var(--text-primary);
  font-weight: 600;
  cursor: default;
}

.breadcrumb-item.current:hover {
  background: transparent;
}

.breadcrumb-sep {
  color: var(--text-tertiary);
  font-size: 11px;
  flex-shrink: 0;
}

/* Search */
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  /* was flex-shrink:0 which let the rightmost buttons overflow into the
     clipped main-content and become unclickable. Now it gives way and scrolls
     so every action stays reachable. */
  flex-shrink: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.toolbar-right::-webkit-scrollbar { display: none; }

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 200px;            /* always visible & clickable (no collapse trap) */
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.search-wrap.expanded {
  width: 200px;
}

.search-icon {
  position: absolute;
  left: 9px;
  color: var(--text-secondary);
  pointer-events: none;
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  height: 28px;
  padding: 0 10px 0 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font);
  outline: none;
  opacity: 1;
  transition: all 0.25s ease;
}

.search-wrap.expanded .search-input {
  opacity: 1;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

.search-input::placeholder {
  color: var(--text-tertiary);
}

.toolbar-pfp {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  transition: all var(--transition);
  border: 1.5px solid var(--border);
  flex-shrink: 0;
}

.toolbar-pfp:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

/* ── Column Headers ── */
.column-headers {
  display: flex;
  height: var(--header-height);
  min-height: var(--header-height);
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--bg-content);
  padding: 0 16px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.col-header {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 0;
  transition: color var(--transition);
}

.col-header:hover {
  color: var(--text-primary);
}

.col-header.active {
  color: var(--text-primary);
}

.col-header .sort-arrow {
  transition: transform var(--transition);
  opacity: 0;
}

.col-header.active .sort-arrow {
  opacity: 1;
}

.col-header.active.desc .sort-arrow {
  transform: rotate(180deg);
}

.col-name {
  flex: 1;
  min-width: 0;
}

.col-type {
  width: 120px;
  justify-content: flex-start;
  text-align: left;
}

.col-size {
  width: 90px;
  justify-content: flex-end;
  text-align: right;
}

.col-modified {
  width: 160px;
  justify-content: flex-end;
  text-align: right;
}

.col-disk {
  width: 58px;
  justify-content: center;
  text-align: center;
}
.file-disk {
  width: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.disk-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 5px;
  letter-spacing: 0.02em;
}
.disk-chip.buffer { color: #ff9f0a; background: rgba(255,159,10,0.15); border: 1px solid rgba(255,159,10,0.32); }
.disk-chip.main   { color: #30d158; background: rgba(48,209,88,0.14); border: 1px solid rgba(48,209,88,0.3); }
.disk-chip.empty  { color: var(--text-tertiary); border: 1px solid transparent; }

/* ── File List ── */
.file-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.file-row {
  display: flex;
  align-items: center;
  height: var(--row-height);
  padding: 0 16px;
  cursor: default;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border-light);
}

.file-row:nth-child(even) {
  background: var(--bg-alt-row);
}

.file-row:hover {
  background: var(--bg-hover);
}

.file-row.selected {
  background: var(--bg-selected) !important;
  color: var(--text-selected);
}

.file-row.selected .file-size,
.file-row.selected .file-modified,
.file-row.selected .file-type {
  color: rgba(255, 255, 255, 0.75);
}

.file-row.selected .file-icon-folder svg {
  fill: #FFFFFF;
}

.file-row.selected .file-icon-file svg {
  stroke: rgba(255, 255, 255, 0.8);
  fill: rgba(255, 255, 255, 0.15);
}

.file-name-cell {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.file-icon-folder, .file-icon-file, .file-icon-wrapper {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  position: relative;
}

.grid-icon-wrapper {
  position: relative;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  z-index: 5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  background: var(--bg-content);
}

.grid-icon-wrapper .file-thumbnail {
  border-radius: 5px;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.file-type {
  width: 120px;
  text-align: left;
  color: var(--text-secondary);
  font-size: 12px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  width: 90px;
  text-align: right;
  color: var(--text-secondary);
  font-size: 12px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.file-modified {
  width: 160px;
  text-align: right;
  color: var(--text-secondary);
  font-size: 12px;
  flex-shrink: 0;
}

/* ── Grid View ── */
.file-grid {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 16px;
  align-content: start;
}

.grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--radius-md);
  cursor: default;
  transition: all var(--transition);
}

.grid-item:hover {
  background: var(--bg-hover);
}

.grid-item.selected {
  background: var(--bg-selected);
  color: var(--text-selected);
}

.grid-item.selected .grid-icon svg {
  fill: #FFFFFF;
}

.grid-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-name {
  font-size: 11px;
  text-align: center;
  word-break: break-word;
  line-height: 1.3;
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Empty State ── */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-tertiary);
  font-size: 14px;
}

/* ── Loading ── */
.loading-indicator {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Status Bar ── */
.status-bar {
  height: var(--status-height);
  min-height: var(--status-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-top: 1px solid var(--border-light);
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-content);
}

/* ══════════════════════════════════════════════════
   CONTEXT MENU
   ══════════════════════════════════════════════════ */
.context-menu {
  position: fixed;
  z-index: 10000;
  min-width: 200px;
  /* Liquid glass — luminous top sheen over a translucent tint + strong frosted
     blur (renders in every browser). SVG refraction is layered on for Firefox
     only via the @supports block below, so Chromium keeps a real glass look. */
  background:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.02) 40%, rgba(255,255,255,0)),
    rgba(24, 26, 33, 0.86);
  -webkit-backdrop-filter: blur(34px) saturate(195%) brightness(1.1);
  backdrop-filter: blur(34px) saturate(195%) brightness(1.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28),
              inset 0 0 18px rgba(255, 255, 255, 0.05),
              0 16px 44px rgba(0, 0, 0, 0.5);
  padding: 4px;
  animation: contextAppear 0.12s ease-out;
}
html.light-theme .context-menu {
  background: rgba(250, 250, 253, 0.92);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 0 2px 1px rgba(255, 255, 255, 0.5) inset,
              0 12px 30px rgba(0, 0, 0, 0.18);
}

@keyframes contextAppear {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* Firefox-only progressive enhancement: real SVG refraction in the backdrop.
   Chromium can't resolve url() in backdrop-filter and would render NOTHING if
   it were the active value, so it's scoped here (this query matches Firefox)
   to keep the cross-browser frosted glass intact everywhere else. */
@supports (-moz-appearance: none) {
  .context-menu,
  .avatar-menu,
  .modal-card {
    backdrop-filter: url(#glass-displacement) saturate(190%) brightness(1.12);
  }
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition);
  color: var(--text-primary);
}

.context-menu-item:hover {
  background: var(--accent);
  color: #FFFFFF;
}

.context-menu-item:hover svg {
  stroke: #FFFFFF;
}

.context-menu-item.danger:hover {
  background: var(--danger);
}

.context-menu-separator {
  height: 1px;
  background: var(--border-light);
  margin: 4px 8px;
}

.context-menu-header {
  padding: 7px 12px 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

/* Drag-to-select rubber band */
.marquee-box {
  position: absolute;
  z-index: 60;
  border: 1px solid var(--accent);
  background: rgba(10, 132, 255, 0.14);
  border-radius: 2px;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════
   UPLOAD OVERLAY
   ══════════════════════════════════════════════════ */
.upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.upload-dropzone {
  width: 420px;
  padding: 48px 32px;
  border: 2px dashed var(--accent);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: contextAppear 0.2s ease-out;
}

.upload-title {
  font-size: 18px;
  font-weight: 600;
  color: #FFFFFF;
}

.upload-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

.upload-browse-btn {
  display: inline-block;
  padding: 10px 24px;
  background: var(--accent);
  color: #FFFFFF;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.upload-browse-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* Upload Progress */
.upload-progress {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9000;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.upload-progress-inner {
  width: 300px;
  background: var(--bg-context);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
}

.upload-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 500;
}

.upload-progress-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}

.upload-progress-bar-track {
  height: 4px;
  background: var(--bg-hover);
  border-radius: 2px;
  overflow: hidden;
}

.upload-progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s ease;
}

/* ══════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 11vh 14px 24px;     /* side + bottom gutters so cards never touch edges */
  overflow-y: auto;             /* tall modals scroll instead of overflowing */
  opacity: 1;
  transition: opacity 0.26s cubic-bezier(0.23, 1, 0.32, 1);
}
/* Animated open/close: keep it laid out (not display:none) so it can fade. */
.modal-overlay.hidden {
  display: flex !important;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}
.modal-overlay.hidden .modal-card {
  transform: translateY(-20px) scale(0.95);
  opacity: 0;
}

.modal-card {
  width: 360px;
  max-width: 92vw;              /* never wider than the screen */
  max-height: 84vh;
  max-height: 84dvh;            /* tall content scrolls inside the card */
  overflow-y: auto;
  /* Liquid glass — luminous sheen + strong frosted blur (works everywhere);
     SVG refraction is a progressive enhancement. */
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.012) 38%, rgba(255,255,255,0)),
    rgba(24, 26, 34, 0.58);
  -webkit-backdrop-filter: blur(30px) saturate(190%) brightness(1.1);
  backdrop-filter: blur(30px) saturate(190%) brightness(1.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26),
              inset 0 0 22px rgba(255, 255, 255, 0.04),
              0 22px 56px rgba(0, 0, 0, 0.5);
  padding: 24px;
  transform-origin: top center;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: transform 0.36s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.28s ease;
}
html.light-theme .modal-card {
  background: rgba(250, 250, 252, 0.82);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 0 2px 1px rgba(255, 255, 255, 0.55) inset,
              0 20px 50px rgba(0, 0, 0, 0.2);
}

/* v13 Nebula — Apple sheet slide-down from top-center */
@keyframes sheetSlideDown {
  from { opacity: 0; transform: translateY(-24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.modal-message {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  margin-bottom: 20px;
  transition: all var(--transition);
}

.modal-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-btn {
  padding: 7px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}

.modal-btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.modal-btn-secondary:hover {
  background: var(--border);
}

.modal-btn-primary {
  background: var(--accent);
  color: #FFFFFF;
}

.modal-btn-primary:hover {
  background: var(--accent-hover);
}

.modal-btn-danger {
  background: var(--danger);
  color: #FFFFFF;
}

.modal-btn-danger:hover {
  background: var(--danger-hover);
}

/* ══════════════════════════════════════════════════
   INFO PANEL
   ══════════════════════════════════════════════════ */
.info-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  background: var(--bg-sidebar);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border-left: 1px solid var(--border-sidebar);
  z-index: 7000;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.info-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-light);
}

.info-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.info-panel-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  font-size: 12px;
}

.info-icon-large {
  text-align: center;
  margin-bottom: 16px;
  padding: 12px 0;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
}

.info-label {
  color: var(--text-secondary);
}

.info-value {
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════
   DRAG HIGHLIGHT
   ══════════════════════════════════════════════════ */
.drag-over {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: rgba(0, 122, 255, 0.04) !important;
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .col-modified, .file-modified, .col-type, .file-type,
  .col-disk, .file-disk {
    display: none !important;
  }

  .search-wrap, .search-wrap.expanded {
    width: 140px;
  }

  .toolbar-breadcrumbs {
    padding: 0 4px;
    font-size: 11px;
  }

  .upload-dropzone {
    width: calc(100vw - 40px);
    max-width: 420px;
  }

  .info-panel {
    width: 100%;
  }

  /* ── Off-canvas sidebar drawer ───────────────────────────── */
  .toolbar-btn-menu { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: 82vw;
    max-width: 320px;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.34s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    will-change: transform;
  }
  .app.sidebar-open .sidebar { transform: translateX(0); }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .app.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }

  /* main content fills the screen; sidebar is an overlay now */
  .main-content { width: 100%; }

  /* ── Touch-friendly toolbar ──────────────────────────────── */
  .toolbar {
    gap: 4px;
    padding: 0 8px;
    padding-top: env(safe-area-inset-top, 0);
    height: auto;
    min-height: var(--toolbar-height);
  }
  .toolbar-right {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }
  .toolbar-right::-webkit-scrollbar { display: none; }
  .toolbar-btn {
    width: 38px;
    height: 38px;
  }

  /* ── Simpler mobile header: fold the button clusters into one
     "⋯ Handlinger" menu. Keep only search, actions and avatar. ── */
  .toolbar-right > .toolbar-group,
  .toolbar-right > .toolbar-separator,
  #nq-pill { display: none !important; }
  .actions-wrap { display: inline-flex; }

  /* ── Bigger tap targets in the file list ─────────────────── */
  .file-row {
    min-height: 46px;
  }
  .sidebar-item { padding: 10px 8px; font-size: 14px; }

  /* respect the iPhone home-indicator / notch */
  .status-bar { padding-bottom: env(safe-area-inset-bottom, 0); }
}

@media (max-width: 600px) {
  /* Hide RAID Volum text and show icon only on small screens to save space */
  .toolbar-breadcrumbs .breadcrumb-item:first-child {
    font-size: 0 !important;
    padding: 4px !important;
  }
  .toolbar-breadcrumbs .breadcrumb-item:first-child svg {
    margin-right: 0 !important;
    width: 14px;
    height: 14px;
  }
  
  .toolbar-pfp {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .col-size, .file-size {
    display: none !important;
  }

  /* Hide view controls on small mobile to fit upload/download buttons */
  #btn-view-list, #btn-view-grid, #btn-info {
    display: none !important;
  }

  .toolbar {
    padding: 0 8px;
    gap: 4px;
  }

  .modal-card {
    width: 92%;
    padding: 20px 16px;
    max-height: 88dvh;
  }
  .modal-overlay { padding: 6vh 10px 16px; }
}

/* ══════════════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.3);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(128, 128, 128, 0.5);
  background-clip: content-box;
}

/* ══════════════════════════════════════════════════
   SELECTION RING FOR KEYBOARD NAV
   ══════════════════════════════════════════════════ */
.file-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Double-click hint */
.file-row.dir-row {
  cursor: pointer;
}

/* Inline rename */
.inline-rename-input {
  background: var(--bg-content);
  border: 2px solid var(--accent);
  border-radius: 3px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-primary);
  padding: 1px 4px;
  outline: none;
  min-width: 120px;
}

/* ══════════════════════════════════════════════════
   QUICK LOOK (Spacebar Preview)
   ══════════════════════════════════════════════════ */
.quick-look-overlay {
  position: fixed;
  inset: 0;
  z-index: 9800;
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.24s cubic-bezier(0.23, 1, 0.32, 1);
}
.quick-look-overlay.hidden {
  display: flex !important;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}
.quick-look-overlay.hidden .quick-look-window {
  transform: scale(0.94);
  opacity: 0;
}

.quick-look-window {
  width: 75vw;
  height: 75vh;
  max-width: 850px;
  max-height: 600px;
  background: rgba(30, 30, 30, 0.72);
  -webkit-backdrop-filter: blur(35px) saturate(180%);
  backdrop-filter: blur(35px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #FFFFFF;
  opacity: 1;
  transform: scale(1);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.24s ease;
}

@media (max-width: 768px) {
  .quick-look-window {
    width: 92vw;
    height: 80vh;
  }
}

.quick-look-header {
  height: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.08);
}

.quick-look-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.quick-look-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.2);
}

.quick-look-dot.close {
  background: #FF5F56;
  cursor: pointer;
  position: relative;
}

.quick-look-dot.close:hover::before {
  content: '×';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(0, 0, 0, 0.7);
  font-size: 10px;
  font-weight: 700;
}

.quick-look-dot.minimize { background: #FFBD2E; }
.quick-look-dot.maximize { background: #27C93F; }

/* Single red close (×) button — replaces the macOS traffic lights */
.quick-look-close-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: #ff5f57;
  color: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s ease, transform 0.15s ease;
}
.quick-look-close-btn:hover { background: #ff453a; color: #fff; }
.quick-look-close-btn:active { transform: scale(0.9); }

.quick-look-title {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.9;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-look-action-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  color: #FFFFFF;
  font-size: 11px;
  font-family: var(--font);
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.quick-look-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.quick-look-body {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.1);
}

.quick-look-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.quick-look-body video {
  max-width: 100%;
  max-height: 100%;
  outline: none;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.quick-look-body audio {
  width: 80%;
  max-width: 400px;
  outline: none;
}

/* Robust media container for the Quick Look player */
.ql-media-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ql-media-wrap video {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
  border-radius: 6px;
  outline: none;
}
/* Buffering spinner overlay (shown while the player is actually waiting) */
.ql-buffering {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
}

.quick-look-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #FFFFFF;
  border-radius: 4px;
}

.quick-look-text-container {
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 16px;
  overflow: auto;
  text-align: left;
}

.quick-look-text-container pre {
  margin: 0;
  font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #E5E5EA;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: text;
  -webkit-user-select: text;
}

.quick-look-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.quick-look-fallback-icon {
  margin-bottom: 8px;
}

.quick-look-fallback-name {
  font-size: 15px;
  font-weight: 500;
}

.quick-look-fallback-meta {
  font-size: 12px;
  opacity: 0.6;
  margin-top: -6px;
}

.quick-look-fallback-btn {
  margin-top: 8px;
  background: var(--accent);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s;
}

.quick-look-fallback-btn:hover {
  background: var(--accent-hover);
}

/* ══════════════════════════════════════════════════
   SPEED TEST MODAL
   ══════════════════════════════════════════════════ */
.speedtest-card {
  width: 380px;
  max-width: 90%;
}

.speedtest-gauges {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: var(--radius-md);
  padding: 16px;
}

@media (prefers-color-scheme: dark) {
  .speedtest-gauges {
    background: rgba(255, 255, 255, 0.03);
  }
}

.speedtest-gauge-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.speedtest-gauge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.speedtest-gauge-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.speedtest-gauge-val {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.speedtest-progress-bar-track {
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.speedtest-progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  transition: width 0.1s linear;
}

.speedtest-progress-bar-fill.download {
  background: linear-gradient(90deg, #34C759, #30B0C7);
}

.speedtest-progress-bar-fill.upload {
  background: linear-gradient(90deg, #5856D6, #AF52DE);
}

.speedtest-actions {
  margin-top: 0;
}

/* Theme Toggle Manual Overrides */
:root.light-theme {
  --bg: #F5F5F7;
  --bg-sidebar: rgba(246, 246, 246, 0.72);
  --bg-content: #FFFFFF;
  --bg-toolbar: rgba(246, 246, 246, 0.9);
  --bg-hover: rgba(0, 0, 0, 0.04);
  --bg-selected: #007AFF;
  --bg-selected-unfocused: rgba(0, 0, 0, 0.06);
  --bg-alt-row: rgba(0, 0, 0, 0.02);
  --bg-context: rgba(252, 252, 252, 0.95);
  --border: rgba(0, 0, 0, 0.1);
  --border-light: rgba(0, 0, 0, 0.06);
  --border-sidebar: rgba(0, 0, 0, 0.08);
  --text-primary: #1D1D1F;
  --text-secondary: #6E6E73;
  --text-tertiary: #AEAEB2;
  --text-selected: #FFFFFF;
  --accent: #007AFF;
  --accent-hover: #0066D6;
  --folder-blue: #3B9FE8;
  --danger: #FF3B30;
}
:root.dark-theme {
  --bg: #1E1E1E;
  --bg-sidebar: rgba(42, 42, 42, 0.72);
  --bg-content: #232323;
  --bg-toolbar: rgba(42, 42, 42, 0.9);
  --bg-hover: rgba(255, 255, 255, 0.06);
  --bg-selected: #0A84FF;
  --bg-selected-unfocused: rgba(255, 255, 255, 0.08);
  --bg-alt-row: rgba(255, 255, 255, 0.02);
  --bg-context: rgba(44, 44, 46, 0.95);
  --border: rgba(255, 255, 255, 0.1);
  --border-light: rgba(255, 255, 255, 0.06);
  --border-sidebar: rgba(255, 255, 255, 0.08);
  --text-primary: #F5F5F7;
  --text-secondary: #A1A1A6;
  --text-tertiary: #636366;
  --accent: #0A84FF;
  --accent-hover: #409CFF;
  --folder-blue: #56AAF2;
  --danger: #FF453A;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
  --shadow-context: 0 6px 20px rgba(0,0,0,0.4), 0 0 0 0.5px rgba(255,255,255,0.1);
}

/* Sidebar Brand Header */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 8px 16px;
  font-size: 15px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 8px;
}
.brand-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 5px;
  flex-shrink: 0;
}
.brand-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* File Tree in Sidebar */
.file-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 4px;
}
.tree-node {
  display: flex;
  flex-direction: column;
}
.tree-node-content {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  transition: background var(--transition);
  color: var(--text-primary);
}
.tree-node-content:hover {
  background: var(--bg-hover);
}
.tree-node-content.active {
  background: var(--bg-selected);
  color: var(--text-selected) !important;
}
.tree-arrow {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.tree-node-content.active .tree-arrow {
  color: var(--text-selected);
}
.tree-arrow.expanded {
  transform: rotate(90deg);
}
.tree-arrow.empty {
  opacity: 0;
  cursor: default;
}
.tree-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tree-icon svg {
  width: 100%;
  height: 100%;
}
.tree-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-children {
  padding-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Favorites and Recents lists */
.favorites-list, .recents-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-subitem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-primary);
  transition: background var(--transition);
}
.sidebar-subitem:hover {
  background: var(--bg-hover);
}
.sidebar-subitem.active {
  background: var(--bg-selected);
  color: var(--text-selected);
}
.sidebar-section {
  margin-bottom: 16px;
}

/* Favourite rows: name truncates, ••• action button reveals on hover. */
.fav-subitem .fav-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fav-menu-btn {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  border-radius: 5px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
}
.fav-subitem:hover .fav-menu-btn,
.fav-subitem.active .fav-menu-btn { opacity: 1; }
.fav-menu-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
@media (hover: none) {
  .fav-menu-btn { opacity: 1; }
}
.fav-action-menu { min-width: 188px; }

/* Reveal-in-folder flash highlight. */
@keyframes revealFlash {
  0%, 100% { background: transparent; }
  15%, 55% { background: var(--bg-selected); }
}
.reveal-flash { animation: revealFlash 1.5s ease-in-out; }

/* ── Share manager: built-in file picker ── */
.nd-ns-hint { color: var(--text-secondary); font-size: 13px; margin: 0 0 12px; line-height: 1.45; }
.nd-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; min-height: 8px; }
.nd-chips-empty { font-size: 12px; color: var(--text-tertiary); }
.nd-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(10, 132, 255, 0.14); color: var(--accent);
  border: 1px solid rgba(10, 132, 255, 0.28);
  border-radius: 8px; padding: 4px 5px 4px 9px; font-size: 12px; font-weight: 500;
  max-width: 230px;
}
.nd-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nd-chip-x {
  border: none; background: none; color: var(--accent); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 2px; opacity: 0.75;
}
.nd-chip-x:hover { opacity: 1; }
.nd-pick-browser {
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  margin-bottom: 4px; background: var(--bg-content);
}
.nd-crumbs {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  padding: 7px 10px; font-size: 12px; background: var(--bg-hover);
  border-bottom: 1px solid var(--border-light);
}
.nd-crumb { border: none; background: none; color: var(--accent); cursor: pointer; font-size: 12px; padding: 2px 5px; border-radius: 5px; }
.nd-crumb:hover { background: rgba(10, 132, 255, 0.12); }
.nd-crumb-sep { color: var(--text-tertiary); }
.nd-pick-list { max-height: 230px; overflow-y: auto; }
.nd-pick-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  cursor: pointer; border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
.nd-pick-row:last-child { border-bottom: none; }
.nd-pick-row:hover { background: var(--bg-hover); }
.nd-pick-row.sel { background: rgba(10, 132, 255, 0.10); }
.nd-pick-check {
  width: 18px; height: 18px; flex-shrink: 0; border-radius: 5px;
  border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center;
}
.nd-pick-row.sel .nd-pick-check {
  background: var(--accent); border-color: var(--accent);
}
.nd-pick-row.sel .nd-pick-check::after {
  content: '✓'; color: #fff; font-size: 12px; font-weight: 700; line-height: 1;
}
.nd-pick-ico { flex-shrink: 0; }
.nd-pick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.nd-pick-open { border: none; background: none; color: var(--text-secondary); cursor: pointer; font-size: 12px; flex-shrink: 0; padding: 2px 5px; border-radius: 5px; }
.nd-pick-open:hover { color: var(--accent); background: rgba(10, 132, 255, 0.10); }

/* ── Share manager: multi-select + bulk recall ── */
.nd-share-bulkbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 10px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-context);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.nd-share-selall {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-secondary); cursor: pointer; user-select: none;
}
.nd-share-selall input,
.nd-share-cb { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.nd-share-selcount { font-size: 12px; color: var(--accent); font-weight: 600; }
.nd-share-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--border-light);
  border-radius: 8px;
  transition: background var(--transition);
}
.nd-share-row:hover { background: var(--bg-hover); }
.nd-share-row.sel { background: rgba(10, 132, 255, 0.10); }

/* Disk Usage Sidebar tweaks */
.disk-usage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.disk-usage-label-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}
.disk-usage-pct {
  font-size: 10.5px;
  font-weight: bold;
  color: var(--text-secondary);
}

/* Upload Queue Panel styling */
.upload-queue-panel {
  position: relative;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0) 42%),
    var(--bg-toolbar);
  -webkit-backdrop-filter: blur(28px) saturate(185%);
  backdrop-filter: blur(28px) saturate(185%);
  transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
  overflow: hidden;
}
.upload-queue-panel.collapsed { max-height: 44px; }
.upload-queue-panel.expanded { max-height: 304px; }
.upload-queue-panel.uq-empty {
  max-height: 0;
  opacity: 0;
  border-top-color: transparent;
  pointer-events: none;
}
.upload-queue-header {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  cursor: pointer;
  user-select: none;
}
.upload-queue-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}
.uq-title-icon { display: flex; color: var(--accent); }
.upload-queue-title .badge {
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
}
.upload-queue-speed {
  flex: 1;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}
.upload-queue-actions { display: flex; align-items: center; gap: 4px; }
.queue-action-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition), opacity var(--transition);
}
.queue-action-btn svg { width: 15px; height: 15px; }
.queue-action-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }
.queue-action-btn:disabled { opacity: 0.28; cursor: default; }
.uq-toggle svg { transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.upload-queue-panel.collapsed .uq-toggle svg { transform: rotate(180deg); }

.upload-queue-body {
  max-height: 260px;
  overflow-y: auto;
  padding: 4px 10px 12px;
}
.upload-queue-list { display: flex; flex-direction: column; gap: 3px; }
.uq-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 12px;
  transition: background var(--transition);
  animation: uqRowIn 0.28s cubic-bezier(0.23, 1, 0.32, 1);
}
.uq-row:hover { background: var(--bg-hover); }
@keyframes uqRowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.uq-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  color: var(--text-secondary);
}
.uq-icon svg { width: 16px; height: 16px; }
.uq-icon.active { background: rgba(10, 132, 255, 0.15); color: var(--accent); }
.uq-icon.done { background: rgba(52, 199, 89, 0.16); color: #34c759; }
.uq-icon.fail { background: rgba(255, 59, 48, 0.16); color: #ff3b30; }
.uq-icon.cancel { color: var(--text-tertiary); }
.uq-main { flex: 1; min-width: 0; }
.uq-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.uq-sub { display: flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap; }
.uq-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--bg-hover);
  color: var(--text-secondary);
}
.uq-pill.active { background: rgba(10, 132, 255, 0.15); color: var(--accent); }
.uq-pill.done { background: rgba(52, 199, 89, 0.16); color: #34c759; }
.uq-pill.fail { background: rgba(255, 59, 48, 0.16); color: #ff3b30; }
.uq-pill.cancel { color: var(--text-tertiary); }
.uq-meta { font-size: 11.5px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.uq-tier {
  font-size: 10.5px;
  font-weight: 600;
  color: #ff9f0a;
  background: rgba(255, 159, 10, 0.14);
  padding: 1px 7px;
  border-radius: 6px;
}
.uq-track {
  height: 5px;
  margin-top: 7px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
}
.uq-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #5e9eff);
  border-radius: 3px;
  transition: width 0.2s ease;
}
.uq-fill.indeterminate {
  width: 40% !important;
  animation: uqIndet 1.2s infinite ease-in-out;
}
@keyframes uqIndet { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.uq-action { flex-shrink: 0; }
.uq-act-btn {
  background: none;
  border: none;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.uq-act-btn svg { width: 15px; height: 15px; }
.uq-act-btn:hover { background: rgba(255, 59, 48, 0.14); color: #ff3b30; }
.uq-act-btn.retry:hover { background: rgba(10, 132, 255, 0.14); color: var(--accent); }
@media (max-width: 600px) {
  .upload-queue-panel.expanded { max-height: 60vh; }
  .upload-queue-body { max-height: calc(60vh - 44px); }
  .upload-queue-speed { display: none; }
}

/* Bulk Action Toolbar */
.bulk-toolbar {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-context);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  backdrop-filter: blur(25px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 10px 20px;
  box-shadow: var(--shadow-lg);
  z-index: 8000;
  display: flex;
  align-items: center;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp {
  from { transform: translate(-50%, 100px); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}
.bulk-toolbar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
}
#bulk-count {
  font-weight: 600;
  color: var(--text-primary);
}
.bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bulk-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-hover);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-family: var(--font);
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
}
.bulk-btn:hover {
  background: var(--border);
}
.bulk-btn.danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.bulk-btn-secondary {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  padding: 6px 10px;
  transition: color var(--transition);
}
.bulk-btn-secondary:hover {
  color: var(--text-primary);
}

/* Activity Log Modal */
.activity-card {
  width: 650px;
  max-width: 90%;
  display: flex;
  flex-direction: column;
}
.activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 12px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
  margin: -4px -4px -4px 0;   /* nudge into the top-right corner */
  transition: background 0.15s ease, color 0.15s ease;
}
.modal-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.modal-close-btn:active { transform: scale(0.9); }
.activity-body {
  max-height: 400px;
  overflow-y: auto;
}
.activity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}
.activity-table th {
  padding: 10px 8px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-light);
  font-weight: 600;
}
.activity-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

/* Scrollbar tweaks */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}
:root.dark-theme ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* Properties Sidebar Info Row styling */
.info-row-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 10.5px;
  cursor: pointer;
  transition: background 0.15s;
  font-family: var(--font);
}
.info-row-btn:hover {
  background: var(--accent-hover);
}
.info-hash-val {
  font-family: monospace;
  font-size: 10.5px;
  word-break: break-all;
  user-select: text;
  -webkit-user-select: text;
  text-align: right;
  max-width: 180px;
}

/* Multi-select row styles */
.file-row.selected-sibling {
  background: rgba(0, 122, 255, 0.1);
}
:root.dark-theme .file-row.selected-sibling {
  background: rgba(10, 132, 255, 0.15);
}
.grid-item.selected-sibling {
  background: rgba(0, 122, 255, 0.1);
}
:root.dark-theme .grid-item.selected-sibling {
  background: rgba(10, 132, 255, 0.15);
}
.properties-pane-title {
  font-size: 14px;
  font-weight: 600;
  margin: 12px 0 8px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 4px;
  color: var(--text-primary);
}
.sidebar-subitem svg {
  flex-shrink: 0;
  opacity: 0.8;
}
.sidebar-subitem.active svg {
  opacity: 1;
}
.tree-node-content:hover .tree-arrow {
  color: var(--text-primary);
}
.tree-node-content.active:hover .tree-arrow {
  color: var(--text-selected);
}

/* Indeterminate pulsing progress for native browser downloads */
@keyframes progressPulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}
.queue-progress-bar-fill.indeterminate {
  background: var(--accent);
  width: 100% !important;
  animation: progressPulse 1.5s infinite ease-in-out;
}

/* Device Manager Modal Styling */
.device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  gap: 12px;
  transition: background var(--transition), border-color var(--transition);
}

.device-item:hover {
  background: var(--border-light);
  border-color: var(--border);
}

.device-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.device-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.device-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: left;
}

.device-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-meta {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.device-unlink-btn {
  background: transparent;
  border: none;
  color: var(--danger);
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  flex-shrink: 0;
}

.device-unlink-btn:hover {
  background: rgba(255, 69, 58, 0.1);
}



/* ══════════ TOAST NOTIFICATIONS (macOS-style) ══════════ */
#nd-toast-host {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.nd-toast {
  pointer-events: auto;
  min-width: 220px;
  max-width: 420px;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary, #fff);
  background: rgba(30, 32, 42, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  opacity: 0;
  transform: translateY(-12px) scale(0.96);
  transition: opacity 0.26s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}
.nd-toast.nd-toast-in { opacity: 1; transform: translateY(0) scale(1); }
.nd-toast-success { border-left: 3px solid #34c759; }
.nd-toast-error   { border-left: 3px solid #ff3b30; }
.nd-toast-info    { border-left: 3px solid var(--accent, #007aff); }

/* ══════════════════════════════════════════════════
   v13 NEBULA — Fluid macOS motion engine & polish
   ══════════════════════════════════════════════════ */

/* Spring-driven selection / hover tracks */
.sidebar-item,
.file-row,
.grid-item,
.tree-item,
.toolbar-btn,
.context-menu-item,
.modal-btn,
.breadcrumb-item {
  transition: background-color var(--transition-fast),
              color var(--transition-fast),
              border-color var(--transition-fast),
              box-shadow var(--transition-fast),
              transform var(--transition-fast);
}

/* Precise scale-down micro-interaction on active click */
.sidebar-item:active,
.file-row:active,
.grid-item:active,
.toolbar-btn:active:not(:disabled),
.modal-btn:active,
.context-menu-item:active {
  transform: scale(0.97);
}

/* Directory tree expand/collapse with Apple spring */
.tree-children,
.tree-item .tree-toggle svg {
  transition: transform var(--transition), opacity var(--transition);
}

/* Smooth grid-to-list / layout transitions */
.file-grid,
.file-list,
.file-row,
.grid-item {
  transition: background-color var(--transition-fast),
              transform var(--transition-fast),
              opacity 260ms var(--spring-soft);
}

/* Skeleton loader shimmer for directory reads */
.nd-skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(127, 127, 127, 0.10);
  border-radius: var(--radius-sm);
}
.nd-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.10) 50%,
    transparent 100%
  );
  animation: ndShimmer 1.25s var(--spring-soft) infinite;
}
@keyframes ndShimmer {
  100% { transform: translateX(100%); }
}

/* Drag overlay for items being moved into folders */
.grid-item.nd-dragging,
.file-row.nd-dragging {
  opacity: 0.55;
  transform: scale(0.96);
}
.grid-item.nd-drop-target,
.file-row.nd-drop-target,
.sidebar-item.nd-drop-target {
  box-shadow: inset 0 0 0 2px var(--accent);
  background: rgba(0, 122, 255, 0.10);
}

/* Standardized container hairlines + glass density */
.context-menu,
.info-panel,
.upload-queue-panel {
  border-color: var(--border-light);
}

/* ══════════════════════════════════════════════════
   v13 Nebula — toolbar grouping, account avatar menu,
   sidebar upgrade link
   ══════════════════════════════════════════════════ */

/* Grouped toolbar buttons sit in a subtle segmented container */
.toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
}
.toolbar-group .toolbar-btn {
  width: 30px;
  height: 30px;
}
.toolbar-group .toolbar-btn.active {
  background: var(--bg-content);
  box-shadow: var(--shadow-sm);
}
.toolbar-right { gap: 8px; }

/* Account avatar + dropdown */
.avatar-wrap { position: relative; display: inline-flex; }
.avatar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
}
.avatar-fallback {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-selected);
  color: #fff;
  border: 1.5px solid var(--border);
}
.avatar-fallback.hidden { display: none !important; }

.avatar-menu {
  /* fixed (not absolute) so the toolbar's overflow:auto can't clip it;
     JS positions it under the trigger button on open. */
  position: fixed;
  top: 60px;
  right: 12px;
  min-width: 232px;
  padding: 6px;
  /* Liquid glass: a luminous top sheen over a translucent tint, strong blur +
     brightness for the frosted glow (works in every browser); the SVG
     refraction is a progressive enhancement for browsers that support it. */
  background:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.02) 40%, rgba(255,255,255,0)),
    rgba(24, 26, 33, 0.86);
  -webkit-backdrop-filter: blur(34px) saturate(195%) brightness(1.1);
  backdrop-filter: blur(34px) saturate(195%) brightness(1.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28),
              inset 0 0 18px rgba(255, 255, 255, 0.05),
              0 16px 44px rgba(0, 0, 0, 0.5);
  z-index: 10050;
  transform-origin: top right;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.2s ease, transform 0.28s cubic-bezier(0.23, 1, 0.32, 1);
  /* tall menus (the mobile actions list) must scroll, not run off-screen */
  max-height: 76vh;
  max-height: 76dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
html.light-theme .avatar-menu {
  background: rgba(250, 250, 253, 0.92);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 0 2px 1px rgba(255, 255, 255, 0.5) inset,
              0 12px 30px rgba(0, 0, 0, 0.18);
}
.avatar-menu.hidden {
  opacity: 0;
  transform: translateY(-10px) scale(0.96);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}
.avatar-menu-head {
  padding: 8px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.avatar-menu-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
}
.avatar-menu-sub { font-size: 11px; color: var(--text-secondary); }
.avatar-menu-sep {
  height: 1px;
  background: var(--border-light);
  margin: 4px 6px;
}
.avatar-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  touch-action: manipulation;   /* kill the 300ms tap delay on mobile */
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}
@media (max-width: 768px) {
  .avatar-menu-item { padding: 12px 12px; font-size: 15px; }   /* bigger tap targets */
  .avatar-menu { min-width: 248px; }
}
.avatar-menu-item:hover { background: var(--bg-hover); }
.avatar-menu-item:active { transform: scale(0.98); }
.avatar-menu-item svg { color: var(--text-secondary); flex-shrink: 0; }
.avatar-menu-item.danger { color: var(--danger); }
.avatar-menu-item.danger svg { color: var(--danger); }
.avatar-menu-item.danger:hover { background: rgba(255, 59, 48, 0.10); }

/* Sidebar "Upgrade Space" link under disk usage */
.disk-usage-upgrade {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  background: rgba(0, 122, 255, 0.10);
  border: 1px solid rgba(0, 122, 255, 0.20);
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}
.disk-usage-upgrade:hover { background: rgba(0, 122, 255, 0.18); }
.disk-usage-upgrade:active { transform: scale(0.98); }

/* ── E2E secure-channel splash — minimal Apple-style + themed logo swoosh ── */
.e2e-splash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  opacity: 1;
  transition: opacity 0.5s ease;
  /* theme tokens — dark defaults */
  --e2e-bg1: #0a0c10;
  --e2e-bg2: #050709;
  --e2e-fg: #f5f7fa;
  --e2e-muted: rgba(235, 240, 250, 0.42);
  --e2e-track: rgba(255, 255, 255, 0.10);
  --e2e-accent: #0a84ff;
  --e2e-glow: rgba(10, 132, 255, 0.55);
  background: radial-gradient(125% 125% at 50% 32%, var(--e2e-bg1), var(--e2e-bg2));
}
html.light-theme .e2e-splash {
  --e2e-bg1: #ffffff;
  --e2e-bg2: #eceff4;
  --e2e-fg: #1d1d1f;
  --e2e-muted: rgba(0, 0, 0, 0.4);
  --e2e-track: rgba(0, 0, 0, 0.08);
  --e2e-accent: #0071e3;
  --e2e-glow: rgba(0, 113, 227, 0.4);
}
.e2e-splash.hidden { display: none; }
.e2e-splash.fade-out { opacity: 0; pointer-events: none; }

.e2e-secure,
.e2e-logo-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Stage 1 — secure handshake */
.e2e-secure {
  gap: 24px;
  transition: opacity 0.45s ease, transform 0.45s ease;
  animation: e2eFadeUp 0.55s cubic-bezier(0.23, 1, 0.32, 1);
}
.e2e-splash.show-logo .e2e-secure {
  opacity: 0;
  transform: translate(-50%, -54%) scale(0.96);
  pointer-events: none;
}
@keyframes e2eFadeUp { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }

.e2e-ring { position: relative; width: 92px; height: 92px; }
.e2e-ring-svg { width: 92px; height: 92px; transform: rotate(-90deg); }
.e2e-ring-bg { fill: none; stroke: var(--e2e-track); stroke-width: 2.5; }
.e2e-ring-fg {
  fill: none; stroke: var(--e2e-accent); stroke-width: 2.5; stroke-linecap: round;
  transition: stroke-dashoffset 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 0 5px var(--e2e-glow));
}
.e2e-lock {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--e2e-accent);
}
.e2e-lock svg { width: 30px; height: 30px; }
.e2e-status {
  font-size: 15px; font-weight: 500; color: var(--e2e-fg);
  letter-spacing: -0.01em; text-align: center;
  opacity: 0; transform: translateY(5px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.e2e-status.in { opacity: 1; transform: none; }
.e2e-fp {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 10.5px; letter-spacing: 0.5px; color: var(--e2e-muted);
  min-height: 13px; opacity: 0; transition: opacity 0.4s ease;
}
.e2e-fp.in { opacity: 1; }

/* Stage 2 — themed NordCore logo swoosh */
.e2e-logo-stage { opacity: 0; pointer-events: none; }
.e2e-splash.show-logo .e2e-logo-stage { opacity: 1; }
.e2e-logo-stage::before {
  content: '';
  position: absolute; left: 50%; top: 50%; z-index: 0;
  width: 340px; height: 340px;
  transform: translate(-50%, -50%) scale(0.4);
  border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, var(--e2e-glow), transparent 62%);
  pointer-events: none;
}
.e2e-logo-stage.go::before { animation: e2eBurst 1.1s ease-out forwards; }
@keyframes e2eBurst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  35% { opacity: 0.85; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.75); }
}
.e2e-logo-wrap {
  position: relative; z-index: 1;
  display: inline-block; overflow: hidden; border-radius: 10px;
}
.e2e-logo { display: block; width: clamp(150px, 34vw, 240px); height: auto; opacity: 0; }
.e2e-logo-stage.go .e2e-logo { animation: e2eLogoSwoosh 0.95s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes e2eLogoSwoosh {
  0% { opacity: 0; transform: translateX(-72px) scale(0.8); filter: blur(10px); }
  55% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: translateX(0) scale(1); filter: blur(0); }
}
.e2e-logo-shine {
  position: absolute; top: 0; bottom: 0; left: 0; width: 55%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: translateX(-185%) skewX(-16deg);
  opacity: 0; pointer-events: none;
}
html.light-theme .e2e-logo-shine { background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.85), transparent); }
.e2e-logo-stage.go .e2e-logo-shine { animation: e2eShine 0.9s ease-in-out 0.35s forwards; }
@keyframes e2eShine {
  0% { opacity: 0; transform: translateX(-185%) skewX(-16deg); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translateX(230%) skewX(-16deg); }
}
/* ══════════════════════════════════════════════════════════════════
   NORDDROP-V14-ENHANCE — consumer onboarding + Apple polish (2026-07-03)
   ══════════════════════════════════════════════════════════════════ */

/* ─────────── Consumer onboarding ─────────── */
#onb {
  position: fixed; inset: 0; z-index: 10001;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px;
  background:
    radial-gradient(1200px 640px at 50% -12%, rgba(0,122,255,0.14), transparent 62%),
    radial-gradient(900px 520px at 50% 112%, rgba(88,86,214,0.12), transparent 60%),
    var(--bg);
  animation: onbFade .5s ease;
}
@keyframes onbFade { from { opacity: 0; } to { opacity: 1; } }

.onb-card {
  position: relative;
  width: 380px; max-width: calc(100vw - 40px);
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.80));
  -webkit-backdrop-filter: blur(44px) saturate(180%);
  backdrop-filter: blur(44px) saturate(180%);
  border: 1px solid var(--border-light);
  border-radius: 26px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.55);
  padding: 40px 34px 30px; text-align: center; overflow: hidden;
  animation: onbPop .55s var(--spring);
}
@media (prefers-color-scheme: dark) {
  .onb-card {
    background: linear-gradient(180deg, rgba(40,42,54,0.94), rgba(28,30,40,0.88));
    box-shadow: 0 30px 80px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.06);
  }
}
@keyframes onbPop { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }

.onb-view { animation: onbView .42s var(--spring); }
.onb-view.hidden { display: none; }
@keyframes onbView { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

.onb-logo {
  width: 76px; height: 76px; margin: 0 auto 20px; border-radius: 22px;
  background: linear-gradient(145deg, #2E9BFF, #0066FF 55%, #5A5AE6);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 14px 34px rgba(0,102,255,0.45), inset 0 1px 0 rgba(255,255,255,0.4);
  animation: onbFloat 5s ease-in-out infinite;
}
.onb-logo-sm { width: 56px; height: 56px; border-radius: 17px; margin-bottom: 14px; }
@keyframes onbFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

.onb-title { font-size: 23px; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); margin: 0 0 6px; }
.onb-title-sm { font-size: 20px; }
.onb-sub { font-size: 13.5px; line-height: 1.5; color: var(--text-secondary); margin: 0 auto 22px; max-width: 282px; }

.onb-btn {
  width: 100%; height: 48px; border-radius: 14px; border: none; cursor: pointer;
  font-family: var(--font); font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  transition: transform .18s var(--spring), box-shadow .25s var(--spring), background .25s, opacity .2s, filter .2s;
}
.onb-btn:active { transform: scale(0.968); }
.onb-btn:disabled { opacity: 0.55; cursor: default; }
.onb-btn-primary { color: #fff; background: linear-gradient(180deg, #1f8bff, #0071f3); box-shadow: 0 8px 22px rgba(0,113,243,0.4); }
.onb-btn-primary:hover:not(:disabled) { box-shadow: 0 10px 30px rgba(0,113,243,0.52); filter: brightness(1.05); }
.onb-btn-secondary { color: var(--accent); background: rgba(0,122,255,0.10); }
.onb-btn-secondary:hover { background: rgba(0,122,255,0.16); }
.onb-btn + .onb-btn { margin-top: 10px; }
.onb-btn.is-loading { pointer-events: none; }
.onb-btn.is-loading::before {
  content: ""; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
  animation: onbSpin .7s linear infinite;
}
.onb-btn-secondary.is-loading::before { border-color: rgba(0,122,255,0.35); border-top-color: var(--accent); }
@keyframes onbSpin { to { transform: rotate(360deg); } }

.onb-divider { display: flex; align-items: center; gap: 10px; margin: 16px 2px 12px; color: var(--text-tertiary); font-size: 11px; }
.onb-divider::before, .onb-divider::after { content: ""; flex: 1; height: 1px; background: var(--border-light); }

.onb-textlink { display: block; width: 100%; margin-top: 14px; background: none; border: none; cursor: pointer;
  color: var(--text-secondary); font-family: var(--font); font-size: 12.5px; transition: color .2s; }
.onb-textlink:hover { color: var(--accent); }

.onb-badge { margin-top: 18px; display: inline-block; padding: 5px 12px; border-radius: 999px;
  background: rgba(0,122,255,0.10); color: var(--accent); font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; }

.onb-back { position: absolute; top: 16px; left: 14px; display: flex; align-items: center; gap: 2px;
  background: none; border: none; cursor: pointer; color: var(--text-secondary); font-family: var(--font);
  font-size: 13px; padding: 6px 8px; border-radius: 9px; transition: color .2s, background .2s; }
.onb-back:hover { color: var(--accent); background: var(--bg-hover); }

.onb-field { position: relative; margin-bottom: 11px; }
.onb-field input {
  width: 100%; height: 46px; padding: 0 40px 0 15px; border-radius: 13px;
  border: 1px solid var(--border); background: var(--bg-hover); color: var(--text-primary);
  font-family: var(--font); font-size: 15px; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.onb-field input::placeholder { color: var(--text-tertiary); }
.onb-field input:focus { border-color: var(--accent); background: var(--bg-content); box-shadow: 0 0 0 4px rgba(0,122,255,0.14); }
.onb-fieldcheck { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 15px; line-height: 1; }

.onb-error { color: var(--danger); font-size: 12.5px; min-height: 16px; margin: 6px 0 0; }
.onb-foot { font-size: 11px; color: var(--text-tertiary); text-align: center; max-width: 320px; }

/* ─────────── File-browser polish ─────────── */
/* Grid: hover lift + luminous selection */
.grid-item:hover { transform: translateY(-1px); }
.grid-item:active { transform: scale(0.97); }
.grid-item.selected { box-shadow: inset 0 0 0 2px var(--accent), 0 6px 18px rgba(0,122,255,0.22); }

/* Staggered content reveal on folder change (grid + list) */
@keyframes ndRowIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.file-grid .grid-item { animation: ndRowIn .34s var(--spring-soft) both; }
.file-grid .grid-item:nth-child(1){animation-delay:.00s}
.file-grid .grid-item:nth-child(2){animation-delay:.02s}
.file-grid .grid-item:nth-child(3){animation-delay:.04s}
.file-grid .grid-item:nth-child(4){animation-delay:.06s}
.file-grid .grid-item:nth-child(5){animation-delay:.08s}
.file-grid .grid-item:nth-child(6){animation-delay:.10s}
.file-grid .grid-item:nth-child(7){animation-delay:.12s}
.file-grid .grid-item:nth-child(8){animation-delay:.14s}
.file-grid .grid-item:nth-child(9){animation-delay:.16s}
.file-grid .grid-item:nth-child(n+10){animation-delay:.18s}

/* Toolbar buttons: rounder, springier press */
.toolbar-btn { border-radius: 8px; }
.toolbar-btn:active { transform: scale(0.9); }

/* Context menu entrance */
@keyframes ndCtxIn { from { opacity: 0; transform: scale(0.96) translateY(-4px); } to { opacity: 1; transform: none; } }
.context-menu { animation: ndCtxIn .16s var(--spring); transform-origin: top left; }

/* Breadcrumb hover chips */
.breadcrumb-item { border-radius: 6px; padding: 2px 6px; transition: background .18s, color .18s; }
.breadcrumb-item:hover { background: var(--bg-hover); }

/* Slimmer, Apple-style overlay scrollbars */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(140,140,150,0.42); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(140,140,150,0.62); border: 3px solid transparent; background-clip: padding-box; }

/* Honour reduced-motion */
@media (prefers-reduced-motion: reduce) {
  #onb, .onb-card, .onb-view, .onb-logo, .file-grid .grid-item, .context-menu { animation: none !important; }
}

/* ══════════════════════════════════════════════════
   v17 Liquid — aurora desktop + floating glass window
   (matches nordcore.site landing / share / downloader)
   ══════════════════════════════════════════════════ */
#nc-aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}
html.nc-desk body {
  background: none;
}
/* static desktop when WebGL is unavailable */
html.nc-no-aurora body {
  background:
    radial-gradient(1100px 750px at 18% 12%, rgba(147, 197, 253, 0.5), transparent 60%),
    radial-gradient(1000px 800px at 85% 85%, rgba(253, 164, 175, 0.42), transparent 62%),
    radial-gradient(800px 600px at 70% 20%, rgba(199, 210, 254, 0.45), transparent 60%),
    #eef2f9;
  background-attachment: fixed;
}
:root.dark-theme.nc-no-aurora body {
  background:
    radial-gradient(1100px 750px at 18% 12%, rgba(29, 78, 216, 0.4), transparent 60%),
    radial-gradient(1000px 800px at 85% 85%, rgba(159, 18, 57, 0.35), transparent 62%),
    radial-gradient(800px 600px at 70% 20%, rgba(124, 58, 237, 0.3), transparent 60%),
    #0d1017;
  background-attachment: fixed;
}
@media (prefers-color-scheme: dark) {
  html.nc-no-aurora:not(.light-theme) body {
    background:
      radial-gradient(1100px 750px at 18% 12%, rgba(29, 78, 216, 0.4), transparent 60%),
      radial-gradient(1000px 800px at 85% 85%, rgba(159, 18, 57, 0.35), transparent 62%),
      radial-gradient(800px 600px at 70% 20%, rgba(124, 58, 237, 0.3), transparent 60%),
      #0d1017;
    background-attachment: fixed;
  }
}
html.nc-desk .login-screen {
  background: transparent;
}

/* v18 Wrap — full-bleed glass chrome; the sidebar wraps around an inset main panel */
html.nc-desk .app {
  position: relative;
  margin: 0;
  height: 100vh;
  height: 100dvh;
  border-radius: 0;
  border: none;
  box-shadow: none;
  background: color-mix(in srgb, var(--bg-sidebar) 55%, transparent);
  -webkit-backdrop-filter: blur(40px) saturate(1.7);
  backdrop-filter: blur(40px) saturate(1.7);
}
html.nc-desk .app::after { display: none; }

html.nc-desk .app .sidebar,
html.nc-desk .app.sidebar-collapsed .sidebar {
  height: 100%;
}

/* the sidebar dissolves into the chrome — no pane edges of its own */
html.nc-desk .sidebar {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-right: none;
}
html.nc-desk .toolbar {
  background: color-mix(in srgb, var(--bg-toolbar) 76%, transparent);
}

/* the main panel floats inside the chrome, wrapped on all sides */
html.nc-desk .main-content {
  margin: 12px 14px 12px 6px;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  background: color-mix(in srgb, var(--bg-content) 92%, transparent) !important;
  -webkit-backdrop-filter: blur(30px) saturate(1.5);
  backdrop-filter: blur(30px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow:
    0 18px 50px -18px rgba(0, 0, 0, 0.3),
    0 4px 16px -8px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
/* identical framing weight in dark — the panel rim never disappears on theme toggle */
:root.dark-theme html.nc-desk .main-content,
html.nc-desk:root.dark-theme .main-content {
  background: color-mix(in srgb, var(--bg-content) 95%, transparent) !important;
  border-color: rgba(255, 255, 255, 0.17);
  box-shadow:
    0 18px 50px -18px rgba(0, 0, 0, 0.6),
    0 4px 16px -8px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
@media (prefers-color-scheme: dark) {
  html.nc-desk:not(.light-theme) .main-content {
    background: color-mix(in srgb, var(--bg-content) 95%, transparent) !important;
    border-color: rgba(255, 255, 255, 0.17);
    box-shadow:
      0 18px 50px -18px rgba(0, 0, 0, 0.6),
      0 4px 16px -8px rgba(0, 0, 0, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.12);
  }
}

/* full-bleed on small screens (mobile app feel) */
@media (max-width: 768px) {
  html.nc-desk .main-content {
    margin: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  #nc-aurora { display: none; }
  html.nc-aurora-on body {
    background-image:
      radial-gradient(var(--bg-grid) 1px, transparent 1px),
      linear-gradient(135deg, var(--bg) 0%, var(--bg-grad) 100%);
  }
}

/* v17 frosted pane folded into the v18 wrap panel above */
html.nc-desk .file-list,
html.nc-desk .file-row {
  background-color: transparent;
}
html.nc-desk .file-row:hover { background: var(--bg-hover); }
html.nc-desk .file-row.selected { background: var(--bg-selected); }

/* ── v18.3: drag-to-move + responsive polish ── */
body.nd-dragging .upload-overlay,
body.nd-dragging #upload-overlay { display: none !important; }
body.nd-dragging, body.nd-dragging * { cursor: grabbing !important; }
.file-row.drop-target,
.grid-item.drop-target {
  background: rgba(59, 130, 246, 0.16) !important;
  box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.55);
  border-radius: 10px;
}
.file-row[draggable="true"]:active { opacity: 0.85; }

@media (max-width: 1150px) {
  .search-wrap { max-width: 210px; }
  .toolbar { gap: 6px; }
}
@media (max-width: 950px) {
  .search-wrap { max-width: 160px; }
}
@media (pointer: coarse) {
  .file-row { min-height: 48px; }
  .toolbar-btn { min-width: 40px; min-height: 40px; }
  .breadcrumb-item { padding: 8px 10px; }
}

/* ── v18.4: light-mode legibility ── */
/* stronger secondary text over the milky aurora */
html.nc-desk:not(.dark-theme) {
  --text-tertiary: #5b6b80;
  --text-secondary: #44546a;
}
/* theme-aware brand logo: white glyph on dark, full-colour glyph on light */
.brand-logo-light { display: none; }
html.nc-desk:not(.dark-theme) .brand-logo-dark { display: none; }
html.nc-desk:not(.dark-theme) .brand-logo-light { display: block; }
/* visible panel definition on a white desktop */
html.nc-desk:not(.dark-theme) .main-content {
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow:
    0 18px 50px -18px rgba(15, 23, 42, 0.22),
    0 4px 16px -8px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
/* slightly more solid chrome so sidebar text always has backing */
html.nc-desk:not(.dark-theme) .app {
  background: color-mix(in srgb, var(--bg-sidebar) 72%, transparent);
}
html.nc-desk:not(.dark-theme) .search-input::placeholder { color: #64748b; }

/* ── v18 Supra: NordCore logo on the auth window ── */
.finder-login-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 13px;
  filter: drop-shadow(0 4px 10px rgba(15, 23, 42, 0.18));
}

/* ═══════════ NordDrop v19 features ═══════════ */
.nd-chips {
  display: flex; gap: 7px; align-items: center;
  padding: 9px 16px; overflow-x: auto;
  border-bottom: 1px solid var(--border-light, rgba(120,130,150,0.14));
  scrollbar-width: none;
}
.nd-chips::-webkit-scrollbar { display: none; }
html.nc-desk .nd-chips { background: color-mix(in srgb, var(--bg-toolbar) 60%, transparent); }
.nd-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--border-light, rgba(120,130,150,0.18));
  background: transparent; color: var(--text-secondary);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}
.nd-chip:hover { background: var(--bg-hover); color: var(--text-primary, var(--text)); }
.nd-chip.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--accent) 70%, transparent);
}
.nd-chip svg { opacity: .85; }

.nd-sort { position: relative; display: inline-flex; }
.nd-sort-pop {
  position: fixed; z-index: 10000;
  min-width: 200px; padding: 6px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.02) 40%, rgba(255,255,255,0)),
    rgba(26, 28, 36, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 14px;
  -webkit-backdrop-filter: blur(34px) saturate(195%) brightness(1.1);
  backdrop-filter: blur(34px) saturate(195%) brightness(1.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), 0 16px 44px rgba(0,0,0,0.5);
}
html.light-theme .nd-sort-pop {
  color: #1d1d1f;
  background: rgba(252, 252, 254, 1);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 0 2px 1px rgba(255,255,255,0.5) inset, 0 14px 34px rgba(0,0,0,0.2);
}
.nd-sort-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  padding: 9px 12px; border: 0; border-radius: 9px; background: transparent;
  color: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; text-align: left;
}
.nd-sort-item:hover { background: var(--bg-hover); }
.nd-sort-item.active { color: var(--accent); font-weight: 650; }
.nd-sort-dir { margin-top: 4px; border-top: 1px solid var(--border-light, rgba(120,130,150,0.16)); border-radius: 0 0 9px 9px; color: var(--text-secondary); }

.nd-sheet-backdrop {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(10,14,20,0.5);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: ndFade .18s ease;
}
@keyframes ndFade { from { opacity: 0; } to { opacity: 1; } }
.nd-sheet {
  width: min(680px, 100%); max-height: 84vh; overflow: auto;
  background: var(--bg-content, #fff); color: var(--text-primary, var(--text));
  border: 1px solid var(--border-light, rgba(120,130,150,0.2)); border-radius: 22px;
  box-shadow: 0 40px 90px -30px rgba(0,0,0,0.6);
  animation: ndPop .22s cubic-bezier(.2,.7,.3,1.2);
}
@keyframes ndPop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
.nd-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 6px; }
.nd-sheet-head h3 { margin: 0; font-size: 20px; font-weight: 700; }
.nd-sheet-x { border: 0; background: transparent; color: var(--text-secondary); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 6px; }
.nd-sheet-x:hover { color: var(--text-primary, var(--text)); }
.nd-sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 28px; padding: 12px 24px 26px; }
.nd-sheet-group h4 { margin: 12px 0 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-tertiary, var(--text-secondary)); }
.nd-sheet-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.nd-sheet-row kbd {
  min-width: 78px; text-align: center; padding: 4px 8px; border-radius: 7px;
  background: var(--bg-hover); border: 1px solid var(--border-light, rgba(120,130,150,0.2));
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 600;
}
.nd-sheet-row span { font-size: 13.5px; color: var(--text-secondary); }
@media (max-width: 560px) { .nd-sheet-grid { grid-template-columns: 1fr; } }

/* v19 Buster: sort button open-state feedback */
.nd-sort-btn.active { background: var(--bg-hover); color: var(--accent); }
