:root {
  --bg-primary: #0f0f13;
  --bg-secondary: #17171e;
  --bg-tertiary: #1e1e28;
  --bg-hover: #252530;
  --bg-active: #2a2a38;
  --border: #2a2a38;
  --border-light: #33334a;
  --text-primary: #e8e8f0;
  --text-secondary: #8888a8;
  --text-muted: #55556a;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-dim: #6366f120;
  --danger: #ef4444;
  --danger-hover: #f87171;
  --success: #22c55e;
  --warning: #f59e0b;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
}

/* ── LOGIN ─────────────────────────────────── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 60% 0%, #1a1a2e 0%, var(--bg-primary) 60%);
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 48px 40px;
  width: 380px;
  box-shadow: var(--shadow), 0 0 80px rgba(99,102,241,0.08);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.login-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.login-sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }

.error-msg {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger-hover);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* ── LAYOUT ─────────────────────────────────── */
#main-app {
  display: flex;
  height: 100vh;
}

/* ── SIDEBAR ────────────────────────────────── */
.sidebar {
  width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  padding: 4px 8px 20px;
  letter-spacing: -0.3px;
}

.upload-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 20px;
  transition: background 0.2s;
  width: 100%;
}

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

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--accent-hover); }

.sidebar-section {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 16px 12px 6px;
}

.sidebar-bottom { margin-top: auto; }

.storage-info { padding: 12px; }

.storage-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.storage-bar {
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
}

.storage-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.5s;
}

.storage-fill.warning { background: var(--warning); }
.storage-fill.danger { background: var(--danger); }

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.user-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.user-details span:first-child {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-details span:last-child {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.logout-btn:hover { color: var(--danger); }

/* ── MAIN CONTENT ───────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.crumb {
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}

.crumb:hover { background: var(--bg-hover); color: var(--text-primary); }
.crumb:last-child { color: var(--text-primary); font-weight: 500; cursor: default; }
.crumb:last-child:hover { background: none; }
.crumb-sep { color: var(--text-muted); }

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

.icon-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 7px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}

.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-hover); }

.view-toggle { display: flex; gap: 2px; }
.view-toggle .icon-btn { padding: 7px 9px; }

.file-browser {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ── GRID VIEW ──────────────────────────────── */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.file-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 12px 12px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  position: relative;
}

.file-card:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.file-card .card-icon {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  font-size: 26px;
}

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

.file-card .card-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.file-card .card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
}

/* ── LIST VIEW ──────────────────────────────── */
.file-list { display: flex; flex-direction: column; gap: 2px; }

.file-list-header {
  display: grid;
  grid-template-columns: 1fr 120px 100px 80px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.file-row {
  display: grid;
  grid-template-columns: 1fr 120px 100px 80px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}

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

.file-row-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  overflow: hidden;
}

.file-row-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row-size, .file-row-date, .file-row-actions {
  font-size: 13px;
  color: var(--text-secondary);
}

.file-row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.15s;
}

.file-row:hover .file-row-actions { opacity: 1; }

/* ── FILE ICONS ─────────────────────────────── */
.icon-folder { background: rgba(99,102,241,0.15); color: #818cf8; }
.icon-folder-shared { background: rgba(34,197,94,0.15); color: #4ade80; }
.icon-image { background: rgba(236,72,153,0.15); color: #f472b6; }
.icon-video { background: rgba(239,68,68,0.15); color: #f87171; }
.icon-pdf { background: rgba(249,115,22,0.15); color: #fb923c; }
.icon-audio { background: rgba(168,85,247,0.15); color: #c084fc; }
.icon-code { background: rgba(6,182,212,0.15); color: #22d3ee; }
.icon-archive { background: rgba(245,158,11,0.15); color: #fbbf24; }
.icon-doc { background: rgba(59,130,246,0.15); color: #60a5fa; }
.icon-generic { background: var(--bg-tertiary); color: var(--text-muted); }

.shared-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(34,197,94,0.15);
  color: #4ade80;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── SECTION HEADERS ────────────────────────── */
.section-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 8px 0;
  margin-bottom: 8px;
}

/* ── EMPTY STATE ────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--text-muted);
  gap: 12px;
}

.empty-state svg { opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* ── CONTEXT MENU ───────────────────────────── */
#context-menu {
  position: fixed;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 6px;
  z-index: 1000;
  box-shadow: var(--shadow);
  min-width: 180px;
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-primary);
  transition: background 0.1s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: 'DM Sans', sans-serif;
}

.ctx-item:hover { background: var(--bg-hover); }
.ctx-item.danger { color: var(--danger-hover); }
.ctx-item.danger:hover { background: rgba(239,68,68,0.1); }
.ctx-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── MODAL ──────────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 0;
  width: 440px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 16px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.15s;
}

.modal-close:hover { color: var(--text-primary); }

#modal-body { padding: 24px; }

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

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 10px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  width: auto;
}

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

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--danger-hover);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 10px;
  padding: 10px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  width: auto;
}

.btn-danger:hover { background: rgba(239,68,68,0.25); }

/* ── SHARE LINK ─────────────────────────────── */
.share-link-box {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.share-link-input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text-secondary);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  outline: none;
}

.copy-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s;
}

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

/* ── PREVIEW ────────────────────────────────── */
#preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-modal {
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-close {
  position: absolute;
  top: -44px;
  right: 0;
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  cursor: pointer;
  font-size: 18px;
  padding: 8px 14px;
  border-radius: 8px;
  transition: background 0.15s;
}

.preview-close:hover { background: rgba(255,255,255,0.2); }

#preview-content img, #preview-content video {
  max-width: 88vw;
  max-height: 80vh;
  border-radius: 8px;
  object-fit: contain;
}

#preview-content iframe {
  width: 80vw;
  height: 80vh;
  border: none;
  border-radius: 8px;
  background: white;
}

.preview-name {
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  margin-top: 12px;
}

/* ── DROP OVERLAY ───────────────────────────── */
#drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(99,102,241,0.12);
  border: 3px dashed var(--accent);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--accent-hover);
  font-size: 20px;
  font-weight: 600;
}

/* ── LOADING ────────────────────────────────── */
.loading {
  color: var(--text-muted);
  font-size: 14px;
  padding: 48px;
  text-align: center;
}

/* ── ADMIN ──────────────────────────────────── */
#admin-panel {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.admin-header h2 { font-size: 20px; font-weight: 600; }
.admin-header .btn-primary { width: auto; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 4px; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.admin-table tr:hover td { background: var(--bg-hover); }

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-admin { background: rgba(99,102,241,0.2); color: #818cf8; }
.role-user { background: var(--bg-tertiary); color: var(--text-muted); }

.table-actions { display: flex; gap: 6px; }

.table-actions button {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 5px 10px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}

.table-actions button:hover { background: var(--bg-hover); color: var(--text-primary); }
.table-actions button.danger { color: var(--danger-hover); }
.table-actions button.danger:hover { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); }

/* ── TOAST ──────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  z-index: 2000;
  box-shadow: var(--shadow);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.25s;
}

#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { border-color: rgba(34,197,94,0.4); color: #4ade80; }
#toast.error { border-color: rgba(239,68,68,0.4); color: var(--danger-hover); }

/* ── UPLOAD PROGRESS ────────────────────────── */
.upload-progress {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 16px 20px;
  min-width: 300px;
  box-shadow: var(--shadow);
  z-index: 2000;
}

.upload-progress-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.upload-progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.upload-progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.2s; }

/* ── SCROLLBAR ──────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── CHECKBOX ───────────────────────────────── */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  margin-top: 12px;
}

.checkbox-row input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

/* ── SELECTION BAR ──────────────────────────────────── */
.selection-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  z-index: 500;
  white-space: nowrap;
  font-size: 14px;
}

.selection-bar button {
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  transition: all 0.15s;
}

.selection-bar button:hover { background: var(--bg-active); }
.selection-bar button.danger { color: var(--danger-hover); }
.selection-bar button.danger:hover { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.3); }

/* ── SELECTED STATE ─────────────────────────────────── */
.file-card.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.file-card.selected .card-select-cb input { accent-color: var(--accent); }

.file-row.selected { background: var(--accent-dim); }

/* ── CARD SELECT CHECKBOX ───────────────────────────── */
.card-select-cb {
  position: absolute;
  top: 8px;
  left: 8px;
  opacity: 0;
  transition: opacity 0.15s;
}

.file-card:hover .card-select-cb,
.file-card.selected .card-select-cb { opacity: 1; }

.card-select-cb input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── DRAG STATES ────────────────────────────────────── */
.file-card.dragging,
.file-row.dragging { opacity: 0.4; }

.file-card.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 2px var(--accent);
}

.file-row.drag-over { background: var(--accent-dim); }

#breadcrumb.drag-over-bc {
  background: var(--accent-dim);
  border-radius: 8px;
  padding: 4px 8px;
}

/* ── MOVE DIALOG ────────────────────────────────────── */
.move-folder-list {
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 4px;
}

.move-folder-item {
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  border-radius: 6px;
  margin: 2px 4px;
  transition: background 0.1s;
}

.move-folder-item:hover { background: var(--bg-hover); }
.move-folder-item.active { background: var(--accent-dim); color: var(--accent-hover); font-weight: 600; }

/* ══════════════════════════════════════════════
   MOBILE TOPBAR
══════════════════════════════════════════════ */
.mobile-topbar {
  display: none;
}

/* ══════════════════════════════════════════════
   DRAWER (mobile sidebar)
══════════════════════════════════════════════ */
.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  backdrop-filter: blur(2px);
}

.drawer-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  margin-left: auto;
  padding: 4px 8px;
  border-radius: 6px;
}

.drawer-close:hover { color: var(--text-primary); }

/* ══════════════════════════════════════════════
   RESPONSIVE BREAKPOINT — 768px
══════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── BODY / LAYOUT ── */
  body { overflow: auto; }

  #main-app {
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }

  /* ── MOBILE TOPBAR ── */
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    height: 56px;
    min-height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    flex-shrink: 0;
  }

  .mobile-hamburger {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .mobile-hamburger:active { background: var(--bg-hover); }

  .mobile-topbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    flex: 1;
  }

  .mobile-upload-btn {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
  }

  .mobile-upload-btn:active { background: var(--accent-hover); transform: scale(0.95); }

  /* ── SIDEBAR → DRAWER ── */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    z-index: 300;
    border-right: 1px solid var(--border-light);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0,0,0,0.5);
  }

  .drawer-backdrop.open {
    display: block;
  }

  .drawer-close {
    display: block;
  }

  /* Hide the upload button inside drawer — we use mobile-upload-btn instead */
  .sidebar .upload-btn {
    display: flex; /* keep it, useful in drawer */
  }

  /* ── MAIN CONTENT ── */
  .main-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  /* ── TOOLBAR ── */
  .toolbar {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
    min-height: unset;
  }

  .breadcrumb {
    font-size: 13px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .crumb { padding: 3px 5px; font-size: 13px; }

  .toolbar-actions { gap: 6px; }

  /* Hide text label on "Nieuwe map" button, keep icon */
  .btn-label { display: none; }
  .icon-btn { padding: 7px 9px; }

  /* ── FILE BROWSER ── */
  .file-browser {
    padding: 12px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── GRID ── */
  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
  }

  .file-card {
    padding: 14px 10px 10px;
  }

  .file-card .card-icon {
    width: 44px;
    height: 44px;
    font-size: 22px;
    margin-bottom: 8px;
  }

  .file-card .card-name { font-size: 12px; }
  .file-card .card-meta { font-size: 10px; }

  /* ── LIST VIEW ── */
  .file-list-header { display: none; }

  .file-row {
    grid-template-columns: 1fr auto;
    gap: 0;
    padding: 12px 8px;
  }

  .file-row-size,
  .file-row-date { display: none; }

  .file-row-actions { opacity: 1; } /* always visible on mobile */
  .file-row-name { font-size: 13px; gap: 8px; }

  /* ── SECTION HEADER ── */
  .section-header { font-size: 11px; padding: 6px 0; margin-bottom: 6px; }

  /* ── EMPTY STATE ── */
  .empty-state { height: 220px; }
  .empty-state svg { width: 48px; height: 48px; }

  /* ── MODAL ── */
  #modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-header { padding: 16px 20px; }
  #modal-body { padding: 16px 20px 32px; }

  /* ── CONTEXT MENU ── */
  #context-menu {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 8px 8px 24px;
    border: none;
    border-top: 1px solid var(--border-light);
  }

  .ctx-item {
    padding: 14px 16px;
    font-size: 15px;
    border-radius: 10px;
  }

  /* ── PREVIEW ── */
  #preview-overlay { padding: 0; }

  .preview-modal {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    justify-content: center;
  }

  .preview-close {
    position: fixed;
    top: 16px;
    right: 16px;
  }

  #preview-content img,
  #preview-content video {
    max-width: 100vw;
    max-height: 80vh;
    border-radius: 0;
  }

  #preview-content iframe {
    width: 100vw;
    height: 85vh;
    border-radius: 0;
  }

  /* ── SELECTION BAR ── */
  .selection-bar {
    bottom: 12px;
    left: 12px;
    right: 12px;
    transform: none;
    font-size: 13px;
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .selection-bar button { font-size: 12px; padding: 6px 10px; }

  /* ── ADMIN PANEL ── */
  #admin-panel { padding: 12px; }

  .admin-header { flex-wrap: wrap; gap: 10px; }
  .admin-header h2 { font-size: 16px; }
  .admin-header .btn-primary { width: auto; font-size: 13px; padding: 8px 14px; }

  .admin-stats { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 18px; }

  .admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-table { min-width: 520px; font-size: 13px; }
  .admin-table th, .admin-table td { padding: 10px 10px; }

  /* ── LOGIN ── */
  .login-card {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    min-height: 100vh;
    padding: 48px 28px;
    border: none;
    box-shadow: none;
    justify-content: center;
    display: flex;
    flex-direction: column;
  }

  /* ── UPLOAD PROGRESS ── */
  .upload-progress {
    left: 12px;
    right: 12px;
    bottom: 12px;
    transform: none;
    min-width: unset;
  }

  /* ── MOVE DIALOG ── */
  .move-folder-list { max-height: 200px; }

  /* ── STORAGE ── */
  .storage-info { padding: 8px 12px; }

  /* ── FORM INPUTS larger touch targets ── */
  .form-group input,
  .form-group select {
    padding: 13px 14px;
    font-size: 16px; /* prevents iOS zoom */
  }

  /* ── CHECKBOX ROWS ── */
  .checkbox-row { padding: 6px 0; }
  .checkbox-row input[type=checkbox] { width: 18px; height: 18px; }
}

/* Extra small phones */
@media (max-width: 380px) {
  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }

  .file-card .card-icon { width: 38px; height: 38px; font-size: 20px; }
}

/* ══════════════════════════════════════════════
   SEARCH BAR
══════════════════════════════════════════════ */
.search-bar {
  padding: 10px 24px 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0 12px;
  gap: 8px;
  transition: border-color 0.2s;
}

.search-input-wrap:focus-within {
  border-color: var(--accent);
}

.search-icon { color: var(--text-muted); flex-shrink: 0; }

.search-input-wrap input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 10px 0;
}

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

.search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
}
.search-clear:hover { color: var(--text-primary); }

.search-filters {
  display: flex;
  gap: 6px;
  padding: 8px 0 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.search-filters::-webkit-scrollbar { display: none; }

.filter-chip {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}
.filter-chip:hover { background: var(--bg-hover); color: var(--text-primary); }
.filter-chip.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-hover); }

/* ── SEARCH RESULTS ── */
.search-results-header { font-weight: 600; }

.search-result-row .search-path {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.file-list-header.search-results-header {
  grid-template-columns: 1fr 160px 100px 80px;
}

.search-result-row {
  grid-template-columns: 1fr 160px 100px 80px;
}

/* ══════════════════════════════════════════════
   UPLOAD BUTTON GROUP
══════════════════════════════════════════════ */
.upload-btn-group {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}

.upload-btn-group .upload-btn {
  flex: 1;
  margin-bottom: 0;
  font-size: 13px;
  padding: 9px 12px;
  justify-content: center;
}

.upload-btn-folder {
  background: var(--bg-tertiary) !important;
  border: 1px solid var(--border-light) !important;
  color: var(--text-secondary) !important;
}
.upload-btn-folder:hover {
  background: var(--bg-hover) !important;
  color: var(--text-primary) !important;
}

/* ══════════════════════════════════════════════
   STORAGE LIMIT NOTIFICATION
══════════════════════════════════════════════ */
#storage-notification {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.storage-notif-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
}

.storage-notif-box {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 40px 36px 28px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5);
  text-align: center;
  animation: notifSlideIn 0.3s ease-out;
}

@keyframes notifSlideIn {
  from { opacity: 0; transform: scale(0.92) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.storage-notif-icon {
  font-size: 48px;
  margin-bottom: 12px;
  line-height: 1;
}

.storage-notif-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.storage-notif-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.storage-notif-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 14px;
}

.storage-notif-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.storage-notif-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.storage-notif-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
}

.storage-notif-bar {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 24px;
}

.storage-notif-fill {
  height: 100%;
  background: var(--danger);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.storage-notif-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 32px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.storage-notif-btn:hover { background: var(--accent-hover); }
.storage-notif-btn:active { transform: scale(0.97); }

@media (max-width: 768px) {
  .storage-notif-box {
    padding: 32px 24px 24px;
    width: 90vw;
    margin: 0 12px;
  }

  .storage-notif-icon { font-size: 40px; }
  .storage-notif-title { font-size: 18px; }
  .storage-notif-stat-value { font-size: 16px; }
}

/* ══════════════════════════════════════════════
   MOBILE: search + upload adjustments
══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .search-bar { padding: 8px 12px 0; }
  .search-input-wrap input { font-size: 16px; } /* prevent iOS zoom */
  .search-filters { gap: 5px; padding: 7px 0 9px; }
  .filter-chip { font-size: 11px; padding: 4px 10px; }

  .search-result-row,
  .file-list-header.search-results-header {
    grid-template-columns: 1fr auto;
  }
  .search-result-row .search-path { display: none; }
  .search-result-row .file-row-date { display: none; }

  .upload-btn-group { gap: 5px; }
  .upload-btn-group .upload-btn { font-size: 12px; padding: 8px 10px; }
}
