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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border: #334155;
  --success: #22c55e;
  --error: #ef4444;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* --- Navbar --- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
}

.nav-icon {
  width: 24px;
  height: 24px;
  color: var(--primary-light);
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* --- Container --- */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* --- Login --- */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.card-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--primary-light);
}

.logo-icon svg {
  width: 100%;
  height: 100%;
}

.card-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

/* --- Disk Warning --- */
.disk-warning {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius);
  margin-bottom: 20px;
  color: #fbbf24;
}

.disk-warning.critical {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.warning-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.warning-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}

.warning-text strong {
  font-size: 14px;
}

.warning-text span {
  font-size: 13px;
  opacity: 0.8;
}

.error-msg {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  text-align: center;
}

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

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

.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: var(--primary);
}

.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: white;
}

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

/* --- Drop Zone --- */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 60px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  background: var(--bg-card);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.drop-zone.drag-over {
  transform: scale(1.01);
}

.drop-icon {
  width: 56px;
  height: 56px;
  color: var(--primary-light);
  margin-bottom: 16px;
}

.drop-text {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.drop-subtext {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 12px;
}

.drop-hint {
  color: var(--text-dim);
  font-size: 12px;
  background: rgba(99, 102, 241, 0.1);
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* --- Upload Progress --- */
.upload-progress {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 28px;
}

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

.file-name {
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.file-size {
  color: var(--text-muted);
  font-size: 13px;
  flex-shrink: 0;
}

.progress-bar-container {
  position: relative;
  background: var(--bg);
  border-radius: 10px;
  height: 20px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 10px;
  transition: width 0.3s ease;
  position: relative;
}

.progress-bar-glow {
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2));
  animation: glow 1.5s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

.progress-percent {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.progress-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.stat {
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-value {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.upload-status {
  text-align: center;
  padding-top: 16px;
  font-weight: 600;
  font-size: 15px;
}

.upload-status.success {
  color: var(--success);
}

.upload-status.error {
  color: var(--error);
}

/* --- Recent Uploads --- */
.recent-uploads {
  margin-top: 32px;
}

.recent-uploads h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-muted);
}

.uploads-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.no-uploads {
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
  padding: 20px;
}

.upload-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.upload-item:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.upload-item-ext {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-light);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.upload-item-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.upload-item-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.upload-item-details {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.upload-item-detail {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-dim);
}

.upload-item-detail svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.6;
}

.btn-download {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  margin-left: auto;
}

.btn-download svg {
  width: 20px;
  height: 20px;
}

.btn-download:hover {
  color: var(--success);
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.1);
  transform: translateY(-1px);
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .card {
    padding: 28px 20px;
  }

  .progress-stats {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stat {
    display: flex;
    justify-content: space-between;
    text-align: left;
  }

  .navbar {
    padding: 12px 16px;
  }
}

/* ============================================
   EXPLORER (Esther)
   ============================================ */
.explorer-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 28px 60px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
}

.ex-main {
  min-width: 0;
}

/* Sidebar */
.ex-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
}
.ex-sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}
.ex-sidebar-header svg { flex-shrink: 0; color: var(--primary-light); }
.ex-sidebar-header span { flex: 1; }
.ex-sidebar-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  font-size: 18px;
  line-height: 1;
}
.ex-sidebar-btn:hover { background: var(--bg-hover); color: var(--text); }
.ex-sidebar-close { display: none; font-size: 22px; }
button.ex-sidebar-toggle { display: none; flex-shrink: 0; width: 44px; }

/* Tree */
.ex-tree {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.ex-tree-loading {
  padding: 20px;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}
.ex-tree-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px 6px 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  user-select: none;
  border-radius: 0;
  transition: background 0.1s;
  white-space: nowrap;
}
.ex-tree-item:hover { background: var(--bg-hover); }
.ex-tree-item.active {
  background: rgba(99, 102, 241, 0.18);
  color: var(--primary-light);
}
.ex-tree-item.dnd-file-over {
  background: rgba(34, 197, 94, 0.22);
  color: var(--success);
  outline: 1px solid var(--success);
  outline-offset: -1px;
}
.ex-tree-item.dnd-over {
  background: rgba(99, 102, 241, 0.25);
  outline: 1px solid var(--primary);
  outline-offset: -1px;
}
.ex-tree-chevron {
  width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: transform 0.15s;
  flex-shrink: 0;
}
.ex-tree-chevron.expanded { transform: rotate(90deg); }
.ex-tree-chevron:hover { color: var(--text); }
.ex-tree-icon {
  display: inline-flex;
  align-items: center;
  color: #fbbf24;
  flex-shrink: 0;
}
.ex-tree-icon svg { width: 16px; height: 16px; }
.ex-tree-item.is-root .ex-tree-icon { color: var(--primary-light); }
.ex-tree-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile overlay */
.ex-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(3px);
  z-index: 1400;
}
.ex-sidebar-overlay.visible { display: block; }

/* Right-side panel (Activity / Trash) */
.ex-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 92vw;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 40px rgba(0,0,0,0.4);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.ex-panel.open { transform: translateX(0); }
.ex-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
}
.ex-panel-actions {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ex-panel-actions:empty { display: none; }
.ex-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.ex-panel-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}
.ex-panel-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  padding: 10px 18px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.ex-panel-item:last-child { border-bottom: none; }
.ex-panel-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
  color: var(--primary-light);
  background: rgba(99, 102, 241, 0.12);
}
.ex-panel-item-icon svg { width: 14px; height: 14px; }
.ex-panel-item.action-delete .ex-panel-item-icon { color: var(--error); background: rgba(239, 68, 68, 0.12); }
.ex-panel-item.action-upload .ex-panel-item-icon { color: var(--success); background: rgba(34, 197, 94, 0.12); }
.ex-panel-item.action-move .ex-panel-item-icon { color: #fbbf24; background: rgba(251, 191, 36, 0.12); }
.ex-panel-item.action-mkdir .ex-panel-item-icon { color: var(--primary-light); }
.ex-panel-item.action-login .ex-panel-item-icon { color: #60a5fa; background: rgba(96, 165, 250, 0.12); }
.ex-panel-item.action-logout .ex-panel-item-icon { color: var(--text-muted); background: rgba(148, 163, 184, 0.12); }
.ex-panel-item.action-restore .ex-panel-item-icon { color: var(--success); background: rgba(34, 197, 94, 0.12); }
.ex-panel-item.action-purge .ex-panel-item-icon,
.ex-panel-item.action-purge-all .ex-panel-item-icon { color: var(--error); background: rgba(239, 68, 68, 0.12); }
.ex-panel-item-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ex-panel-item-main strong { font-weight: 600; }
.ex-panel-item-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ex-panel-item-meta {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  white-space: nowrap;
}
.ex-panel-item-actions {
  display: flex;
  gap: 4px;
  grid-column: 3;
}
.ex-panel-item-actions button {
  padding: 4px 8px;
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
}
.ex-panel-item-actions button:hover { background: var(--bg-hover); color: var(--text); }
.ex-panel-item-actions .btn-restore:hover { color: var(--success); border-color: var(--success); }
.ex-panel-item-actions .btn-purge:hover { color: var(--error); border-color: var(--error); }
@media (max-width: 540px) {
  .ex-panel { width: 100%; max-width: 100%; }
}

/* Responsive: sidebar becomes a slide-in panel on mobile/tablet */
@media (max-width: 900px) {
  .explorer-container {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .ex-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    max-height: none;
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 1500;
  }
  .ex-sidebar.open { transform: translateX(0); }
  .ex-sidebar-close { display: inline-flex; }
  button.ex-sidebar-toggle { display: inline-flex; }
}

.ex-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.ex-search-wrap {
  position: relative;
  flex: 1;
  min-width: 260px;
}

.ex-search-wrap input {
  width: 100%;
  padding: 12px 40px 12px 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.ex-search-wrap input:focus {
  border-color: var(--primary);
}

.ex-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  pointer-events: none;
}

.ex-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  border-radius: 6px;
}
.ex-search-clear:hover { background: var(--bg-hover); color: var(--text); }

.btn-ex {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-ex:hover { background: var(--bg-hover); border-color: var(--primary); }
.btn-ex svg { width: 16px; height: 16px; }

.btn-ex-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-ex-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-ex-danger {
  background: var(--error);
  border-color: var(--error);
  color: white;
}
.btn-ex-danger:hover { background: #dc2626; border-color: #dc2626; }

/* Breadcrumb */
.ex-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 14px;
  min-height: 44px;
}
.bc-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.bc-item:hover { background: var(--bg-hover); color: var(--text); }
.bc-item.dnd-over { background: rgba(99, 102, 241, 0.2); color: var(--primary-light); }
.bc-sep { color: var(--text-dim); padding: 0 2px; }

/* Nav row (Up + Breadcrumb) */
.ex-nav-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 12px;
}
.ex-nav-row .ex-breadcrumb { margin-bottom: 0; flex: 1; }

.btn-ex-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-ex-icon:hover { background: var(--bg-hover); border-color: var(--primary); color: var(--primary-light); }
.btn-ex-icon svg { width: 18px; height: 18px; }

/* Selection slot — sticky/fixed above search bar, doesn't push content */
.ex-selection-slot {
  position: sticky;
  top: 10px;
  z-index: 1200;
  height: 0;
  pointer-events: none;
  margin-bottom: 0;
}
.ex-selection-slot.active {
  pointer-events: auto;
}
.ex-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(30, 41, 59, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid var(--primary);
  border-radius: 10px;
  font-size: 14px;
  color: var(--primary-light);
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  transform: translateY(-20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.ex-selection-slot.active .ex-selection-bar {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.ex-selection-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ex-selection-actions .btn-ex { padding: 8px 14px; font-size: 13px; }

/* Checkbox */
.ex-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
  margin: 0;
}

/* List header */
.ex-header {
  display: grid;
  grid-template-columns: 40px 1fr 110px 160px 88px;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  font-weight: 600;
}
.ex-col-check {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ex-header .sortable { cursor: pointer; user-select: none; }
.ex-header .sortable:hover { color: var(--text); }
.sort-indicator { color: var(--primary-light); margin-left: 4px; }

/* File list */
.ex-list {
  border: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  background: var(--bg-card);
  overflow: hidden;
  min-height: 200px;
  position: relative;
}
.ex-list.dnd-files {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--primary);
  border-style: dashed;
}

/* Storage status bar at bottom — slim */
.ex-statusbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  background: rgba(30, 41, 59, 0.92);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--border);
  padding: 4px 16px;
  font-size: 11px;
  line-height: 1.3;
}
.ex-status-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ex-status-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
}
.ex-status-icon {
  width: 13px;
  height: 13px;
  color: var(--primary-light);
  flex-shrink: 0;
  opacity: 0.8;
}
.ex-status-text {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  white-space: nowrap;
}
#ex-status-label {
  color: var(--text);
}
#ex-status-label strong { font-weight: 600; }
.ex-status-detail {
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
}
.ex-status-detail::before {
  content: '· ';
  opacity: 0.6;
}
.ex-status-barwrap {
  flex: 1;
  height: 4px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
  min-width: 80px;
  max-width: 300px;
  margin-left: auto;
}
.ex-status-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.6s ease, background 0.3s;
}
.ex-status-bar.warn { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.ex-status-bar.danger { background: linear-gradient(90deg, var(--error), #f87171); }

/* Keep explorer content from hiding behind slim status bar */
.explorer-container { padding-bottom: 40px; }

@media (max-width: 700px) {
  .ex-status-detail { display: none; }
  .ex-status-barwrap { max-width: 120px; }
}

/* Small floating drop-target badge (non-blocking) */
#ex-drop-badge {
  position: fixed;
  top: 20px;
  right: 20px;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 2px solid var(--primary);
  color: var(--primary-light);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 3000;
  pointer-events: none;
  max-width: 400px;
}
#ex-drop-badge.active { display: inline-flex; }
#ex-drop-badge.on-folder {
  border-color: var(--success);
  color: var(--success);
  background: rgba(34, 197, 94, 0.12);
}
#ex-drop-badge svg { width: 16px; height: 16px; flex-shrink: 0; }
#ex-drop-badge span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Subtle ready-state highlight on list while dragging */
.ex-list.dnd-ready {
  box-shadow: 0 0 0 2px var(--primary) inset;
}

.ex-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}

.ex-row {
  display: grid;
  grid-template-columns: 40px 1fr 110px 160px 88px;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.ex-row:last-child { border-bottom: none; }
.ex-row:hover { background: var(--bg-hover); }
.ex-row.dragging { opacity: 0.5; }
.ex-row.selected { background: rgba(99, 102, 241, 0.1); }
.ex-row.selected:hover { background: rgba(99, 102, 241, 0.18); }

/* Parent ("..") row — like in classic file managers */
.ex-row.is-parent {
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
}
.ex-row.is-parent .ex-icon { color: var(--text-muted); }
.ex-row.is-parent .ex-name { color: var(--text-muted); font-weight: 600; }
.ex-row.is-parent:hover { background: var(--bg-hover); }
.ex-row.is-parent:hover .ex-name,
.ex-row.is-parent:hover .ex-icon { color: var(--primary-light); }
.ex-parent-hint {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-dim);
  margin-left: 6px;
}
.ex-row.dnd-over {
  background: rgba(99, 102, 241, 0.15);
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.ex-row.dnd-file-over {
  background: rgba(34, 197, 94, 0.18) !important;
  outline: 2px solid var(--success);
  outline-offset: -2px;
  position: relative;
  z-index: 3500;
}
.ex-row.dnd-file-over::after {
  content: '↓ Hier ablegen';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--success);
  font-weight: 700;
  font-size: 12px;
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--success);
}

.ex-col {
  font-size: 14px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ex-col-size, .ex-col-date { color: var(--text-dim); font-size: 13px; }

.ex-col-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.ex-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ex-icon svg { width: 20px; height: 20px; }
.is-dir .ex-icon { color: #fbbf24; }
.is-file .ex-icon { color: var(--primary-light); }

.ex-name { overflow: hidden; text-overflow: ellipsis; }
.is-dir .ex-name { font-weight: 600; }

.ex-ext-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ex-path-hint {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 400;
  margin-left: 8px;
}

.ex-col-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}
.ex-action {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.ex-action:hover {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}
.ex-action-delete:hover { color: var(--error); border-color: var(--error); }

/* Upload progress overlay */
.ex-progress {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  z-index: 1000;
}
.ex-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
}
.ex-progress-header span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}
.ex-progress-bar-wrap {
  background: var(--bg);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.ex-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.3s;
}
.ex-progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
}

/* Modal */
.ex-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
}
.ex-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
}
.ex-modal-card h3 {
  font-size: 18px;
  margin-bottom: 14px;
}
.ex-modal-card p {
  color: var(--text-muted);
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5;
}
.ex-modal-card input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  margin-bottom: 16px;
}
.ex-modal-card input:focus { border-color: var(--primary); }
.ex-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Responsive */
@media (max-width: 700px) {
  .explorer-container { padding: 16px; }
  .ex-header, .ex-row {
    grid-template-columns: 36px 1fr 80px 48px;
  }
  .ex-col-date { display: none; }
  .ex-toolbar .btn-ex span { display: none; }
  .ex-toolbar .btn-ex { padding: 10px; }
  .ex-selection-bar { flex-direction: column; align-items: stretch; }
}

/* === ⋮-Aktionsmenü: am Desktop versteckt, am Handy ersetzt es die Inline-Icons === */
.ex-action-more { display: none; }

@media (max-width: 700px) {
  /* Die drei kleinen Inline-Icons sind am Handy nicht antippbar — stattdessen EIN großes ⋮ */
  .ex-row .ex-col-actions .ex-action { display: none; }
  .ex-row .ex-col-actions .ex-action-more {
    display: flex;
    width: 42px;
    height: 42px;
  }
}

/* Bottom-Sheet für Datei-Aktionen */
.ex-sheet {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.ex-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.ex-sheet-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}
.ex-sheet-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ex-sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ex-sheet-btn {
  width: 100%;
  padding: 13px 14px;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}
.ex-sheet-btn:active { background: var(--bg-hover); }
.ex-sheet-btn.danger { color: var(--error); border-color: var(--error); }
.ex-sheet-cancel {
  width: 100%;
  margin-top: 12px;
  justify-content: center;
}

/* === Nur-Lese-Modus (Mandy): alle verändernden Aktionen ausblenden === */
body.ex-readonly #ex-upload,
body.ex-readonly #ex-upload-folder,
body.ex-readonly #ex-new-folder,
body.ex-readonly #ex-trash-purge-all,
body.ex-readonly .ex-action-rename,
body.ex-readonly .ex-action-delete,
body.ex-readonly .ex-action-extract,
body.ex-readonly .ex-trash-restore,
body.ex-readonly .ex-trash-purge {
  display: none !important;
}
