/* ============================================================================
   SERVIDOR CASA v1.1.0 — 3 LIVE-SWITCHABLE DESIGN SKINS + LIGHT/DARK THEMES
   Skins: .skin-obsidian | .skin-liquid | .skin-homeos
   ============================================================================ */

:root {
  --bg-page: #0a0b0f;
  --bg-surface: #13151c;
  --bg-elevated: #1b1e28;
  --bg-input: #0e1016;
  --bg-glass: rgba(20, 22, 30, 0.72);
  --border-color: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #f4f6fb;
  --text-secondary: #9aa3b5;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  --radius-sm: 10px;
  --blur: 18px;
}

body.theme-light {
  --bg-page: #eef2f8;
  --bg-surface: rgba(255, 255, 255, 0.88);
  --bg-elevated: rgba(248, 250, 255, 0.94);
  --bg-input: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.76);
  --border-color: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.18);
  --text-primary: #0f172a;
  --text-secondary: #526075;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.1);
}

/* ==================== SKIN 1: OBSIDIAN GLOW DOCK ==================== */
body.skin-obsidian {
  --radius: 16px;
  --radius-sm: 10px;
}
body.skin-obsidian .ambient-backdrop {
  background:
    radial-gradient(600px circle at 12% 10%, rgba(99, 102, 241, 0.14), transparent 60%),
    radial-gradient(520px circle at 88% 82%, rgba(6, 182, 212, 0.1), transparent 60%);
}
body.skin-obsidian.theme-light .ambient-backdrop {
  background:
    radial-gradient(600px circle at 12% 10%, rgba(99, 102, 241, 0.12), transparent 60%),
    radial-gradient(520px circle at 88% 82%, rgba(14, 165, 233, 0.1), transparent 60%);
}

/* ==================== SKIN 2: LIQUID GLASS BENTO ==================== */
body.skin-liquid {
  --radius: 24px;
  --radius-sm: 14px;
  --bg-surface: rgba(24, 28, 44, 0.62);
  --bg-elevated: rgba(34, 40, 62, 0.58);
  --bg-glass: rgba(24, 28, 46, 0.55);
  --border-color: rgba(255, 255, 255, 0.16);
}
body.skin-liquid.theme-light {
  --bg-page: #dce7f5;
  --bg-surface: rgba(255, 255, 255, 0.72);
  --bg-elevated: rgba(255, 255, 255, 0.84);
  --bg-glass: rgba(255, 255, 255, 0.68);
  --border-color: rgba(255, 255, 255, 0.75);
}
body.skin-liquid .ambient-backdrop {
  background:
    radial-gradient(800px circle at 15% 15%, rgba(129, 140, 248, 0.32), transparent 55%),
    radial-gradient(700px circle at 85% 20%, rgba(56, 189, 248, 0.28), transparent 55%),
    radial-gradient(680px circle at 50% 90%, rgba(244, 114, 182, 0.2), transparent 60%);
}
body.skin-liquid .sidebar,
body.skin-liquid .topbar,
body.skin-liquid .panel-card,
body.skin-liquid .file-card,
body.skin-liquid .storage-banner,
body.skin-liquid .auth-card {
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}
@media (min-width: 768px) {
  body.skin-liquid .sidebar {
    margin: 14px 0 14px 14px;
    height: calc(100dvh - 28px);
    border-radius: 26px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
  }
  body.skin-liquid .topbar {
    margin: 14px 20px 0;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    padding: 10px 20px;
  }
}

/* ==================== SKIN 3: HOME OS DESKTOP ==================== */
body.skin-homeos {
  --radius: 20px;
  --radius-sm: 12px;
  --bg-page: #0a2233;
  --bg-surface: rgba(14, 24, 36, 0.76);
  --bg-elevated: rgba(22, 36, 52, 0.78);
  --bg-glass: rgba(18, 32, 46, 0.68);
  --border-color: rgba(148, 210, 255, 0.18);
  --accent: #38bdf8;
  --accent-hover: #0ea5e9;
}
body.skin-homeos.theme-light {
  --bg-page: #b9d5e8;
  --bg-surface: rgba(255, 255, 255, 0.78);
  --bg-elevated: rgba(244, 249, 255, 0.86);
  --bg-glass: rgba(255, 255, 255, 0.72);
  --border-color: rgba(255, 255, 255, 0.75);
  --accent: #0284c7;
  --accent-hover: #0369a1;
}
body.skin-homeos .ambient-backdrop {
  background:
    linear-gradient(135deg, #0d3b56 0%, #0a1f30 48%, #07131e 100%),
    radial-gradient(650px circle at 75% 20%, rgba(56, 189, 248, 0.25), transparent 55%);
}
body.skin-homeos.theme-light .ambient-backdrop {
  background: linear-gradient(135deg, #9ec5df 0%, #cbe1f0 50%, #e6f0f8 100%);
}
body.skin-homeos .sidebar,
body.skin-homeos .topbar,
body.skin-homeos .panel-card,
body.skin-homeos .file-card,
body.skin-homeos .storage-banner {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
body.skin-homeos .floating-dock {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(160, 210, 245, 0.14) 55%, rgba(15, 25, 38, 0.55) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ==================== SKIN 4: LUNAR OASIS (from Estilos-Diseños) ==================== */
body.skin-lunar {
  --radius: 26px;
  --radius-sm: 14px;
  --bg-page: #0b0f19;
  --bg-surface: rgba(20, 25, 38, 0.78);
  --bg-elevated: rgba(29, 36, 54, 0.84);
  --bg-input: rgba(18, 24, 39, 0.92);
  --bg-glass: rgba(18, 24, 39, 0.68);
  --border-color: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(230, 157, 107, 0.42);
  --text-primary: #f4f6fb;
  --text-secondary: #b4bdd0;
  --accent: #262163;
  --accent-hover: #322b7d;
  --accent-glow: rgba(230, 157, 107, 0.34);
  --shadow: 0 28px 70px -18px rgba(0, 0, 0, 0.6);
}
body.skin-lunar.theme-light {
  --bg-page: #d8d4cc;
  --bg-surface: rgba(255, 255, 255, 0.84);
  --bg-elevated: rgba(245, 246, 248, 0.92);
  --bg-input: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.62);
  --border-color: rgba(255, 255, 255, 0.72);
  --border-strong: rgba(38, 33, 99, 0.22);
  --text-primary: #14171f;
  --text-secondary: #5a6170;
  --accent: #262163;
  --accent-hover: #322b7d;
  --shadow: 0 28px 70px -20px rgba(20, 26, 40, 0.22), 0 8px 24px -8px rgba(20, 26, 40, 0.1);
}
body.skin-lunar .ambient-backdrop {
  background:
    linear-gradient(155deg, #0b0f19 0%, #121826 52%, #192033 100%),
    radial-gradient(620px circle at 82% 18%, rgba(230, 157, 107, 0.2), transparent 55%);
}
body.skin-lunar.theme-light .ambient-backdrop {
  background:
    linear-gradient(155deg, #e7e4de 0%, #d8d4cc 52%, #cbc5ba 100%),
    radial-gradient(700px circle at 85% 15%, rgba(230, 157, 107, 0.22), transparent 55%);
}
body.skin-lunar .sidebar,
body.skin-lunar .topbar,
body.skin-lunar .panel-card,
body.skin-lunar .file-card,
body.skin-lunar .storage-banner,
body.skin-lunar .auth-card {
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}
body.skin-lunar .nav-item.active,
body.skin-lunar .dock-item.active {
  background: rgba(230, 157, 107, 0.18);
  border-color: #e69d6b;
}
body.skin-lunar .btn-primary {
  background: #262163;
  color: #ffffff;
  border-radius: 999px;
}
body.skin-lunar .btn-primary:hover {
  background: #322b7d;
  box-shadow: 0 8px 22px rgba(230, 157, 107, 0.35);
}
@media (min-width: 768px) {
  body.skin-lunar .sidebar {
    margin: 14px 0 14px 14px;
    height: calc(100dvh - 28px);
    border-radius: 28px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
  }
  body.skin-lunar .topbar {
    margin: 14px 20px 0;
    border-radius: 26px;
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.08);
  }
}

/* ==================== BASE LAYOUT & RESET ==================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

.ambient-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  transition: background 0.35s ease;
}

.auth-shell, .app-shell {
  position: relative;
  z-index: 1;
}

.hidden {
  display: none !important;
}

/* Inputs & anti-autofill */
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px var(--bg-input) inset !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* Buttons (min 44x44 touch target) */
.btn, .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.16s ease, transform 0.12s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.btn:active, .btn-icon:active { transform: scale(0.98); }

.btn-sm {
  min-height: 40px;
  padding: 0 13px;
  font-size: 0.84rem;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover { border-color: var(--accent); }

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}
.btn-ghost:hover { color: var(--text-primary); border-color: var(--accent); }

.btn-icon {
  padding: 0;
  width: 44px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-color);
  border-radius: 50%;
}
.btn-icon:hover { border-color: var(--accent); }

/* ==================== DUOTONE NEON GLOW SVG ICONS ==================== */
.duotone-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-primary);
}
.duotone-sm { width: 34px; height: 34px; }
.duotone-sm svg { width: 20px; height: 20px; position: relative; z-index: 2; }
.duotone-md { width: 44px; height: 44px; }
.duotone-md svg { width: 24px; height: 24px; position: relative; z-index: 2; }

.duotone-orb {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  right: 3px;
  bottom: 4px;
  z-index: 1;
  opacity: 0.85;
  filter: blur(4px);
}
.duotone-sm .duotone-orb { width: 18px; height: 18px; right: 2px; bottom: 2px; }

.duotone-folder .duotone-orb { background: #f59e0b; box-shadow: 0 0 14px rgba(245, 158, 11, 0.75); }
.duotone-media .duotone-orb { background: #22c55e; box-shadow: 0 0 14px rgba(34, 197, 94, 0.75); }
.duotone-audio .duotone-orb { background: #06b6d4; box-shadow: 0 0 14px rgba(6, 182, 212, 0.75); }
.duotone-doc .duotone-orb { background: #f43f5e; box-shadow: 0 0 14px rgba(244, 63, 94, 0.75); }
.duotone-file .duotone-orb { background: #a855f7; box-shadow: 0 0 14px rgba(168, 85, 247, 0.75); }
.duotone-drive .duotone-orb { background: #3b82f6; box-shadow: 0 0 14px rgba(59, 130, 246, 0.75); }
.duotone-quickdrop .duotone-orb { background: #06b6d4; box-shadow: 0 0 14px rgba(6, 182, 212, 0.8); }
.duotone-admin .duotone-orb { background: #6366f1; box-shadow: 0 0 14px rgba(99, 102, 241, 0.8); }
.duotone-home .duotone-orb { background: #38bdf8; box-shadow: 0 0 12px rgba(56, 189, 248, 0.75); }

/* ==================== SKIN SWITCHER POPOVER ==================== */
.skin-switcher-wrap {
  position: relative;
}

.skin-pill-btn {
  border-radius: 999px;
  padding: 0 14px;
}

.skin-swatch, .skin-preview-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.skin-preview-dot { width: 24px; height: 24px; }

.swatch-obsidian { background: linear-gradient(135deg, #181a24, #6366f1, #22c55e); }
.swatch-liquid { background: linear-gradient(135deg, #a5b4fc, #38bdf8, #f472b6); }
.swatch-homeos { background: linear-gradient(135deg, #0d3b56, #38bdf8, #e0f2fe); }
.swatch-lunar { background: linear-gradient(135deg, #e7e4de, #e69d6b, #262163); }
.swatch-mac { background: linear-gradient(135deg, #2b6b8f, #d8ecfa, #3b82f6); }
.swatch-oled { background: linear-gradient(135deg, #000000, #22c55e, #a855f7); }
.swatch-oasis { background: linear-gradient(135deg, #f7f4ee, #e69d6b, #262163); }

.skin-popover-divider {
  height: 1px;
  background: var(--border-color);
  margin: 6px 8px;
}

.skin-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 248px;
  padding: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  z-index: 70;
}

.skin-popover-title {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  padding: 4px 8px 8px;
}

.skin-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  min-height: 48px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.skin-option:hover { background: var(--bg-elevated); }
.skin-option.active {
  background: rgba(99, 102, 241, 0.16);
  border-color: var(--accent);
}
.skin-option strong { display: block; font-size: 0.88rem; }
.skin-option small { display: block; font-size: 0.75rem; color: var(--text-secondary); }

/* ==================== FLOATING GLASS DOCK ==================== */
.floating-dock {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 22px;
  background: var(--bg-glass);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
}

.dock-item {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.18s ease, border-color 0.18s ease;
}

.dock-item:hover {
  transform: translateY(-6px) scale(1.1);
  background: rgba(255, 255, 255, 0.08);
}

.dock-item.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.5);
}

.dock-item.active::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.dock-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 4px 10px;
  border-radius: 999px;
  background: #11131a;
  color: #f8fafc;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.dock-item:hover .dock-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.dock-divider {
  width: 1px;
  height: 28px;
  background: var(--border-strong);
  margin: 0 2px;
}

/* ==================== STORAGE RING HERO WIDGET ==================== */
.storage-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  margin-bottom: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.storage-banner-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.storage-ring-svg {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}

.storage-ring-track {
  fill: none;
  stroke: rgba(148, 163, 184, 0.18);
  stroke-width: 6;
}

.storage-ring-fill {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 38px 38px;
}

.storage-ring-text {
  fill: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
}

.storage-stats-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.storage-stats-sub {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

/* ==================== AUTH & PROFILE PICKER ==================== */
.auth-shell {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 80px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 30px 26px;
  box-shadow: var(--shadow);
}

.auth-card.wide { max-width: 740px; }

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-header h1 {
  margin: 8px 0 4px;
  font-size: 1.55rem;
}

.auth-header p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

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

.profiles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 20px 0;
}

@media (min-width: 540px) {
  .profiles-grid {
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  }
}

.profile-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  cursor: pointer;
  min-height: 140px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.profile-tile:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 10px 24px var(--accent-glow);
}

.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.profile-tile-name { font-weight: 700; font-size: 1rem; }
.profile-tile-badge {
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.18);
  color: var(--text-primary);
}

/* ==================== MAIN APP SHELL & SIDEBAR ==================== */
.app-shell {
  min-height: 100dvh;
  display: flex;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 276px;
  max-width: 84vw;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transform: translateX(-100%);
  transition: transform 0.22s ease;
}

.sidebar.open { transform: translateX(0); }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 35;
}

@media (min-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    transform: translateX(0);
    flex-shrink: 0;
  }
  .main-column {
    margin-left: 276px;
  }
  body.skin-liquid .main-column,
  body.skin-lunar .main-column {
    margin-left: 290px;
  }
  .sidebar-backdrop { display: none !important; }
  .mobile-only { display: none !important; }
}

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

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-title {
  font-weight: 700;
  font-size: 1.04rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
}

.nav-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: 12px 10px 6px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-align: left;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.nav-item:hover { background: var(--bg-elevated); }
.nav-item.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.45);
  font-weight: 600;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-color);
}

.active-profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.profile-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.profile-name { font-weight: 700; font-size: 0.9rem; }
.profile-role { font-size: 0.76rem; color: var(--text-secondary); }

.sidebar-footer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ==================== MAIN COLUMN & TOPBAR ==================== */
.main-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-title {
  margin: 0;
  font-size: 1.12rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zone-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.16);
  color: var(--success);
  text-transform: uppercase;
}

.main-content {
  flex: 1;
  padding: 18px 16px 116px;
}

@media (min-width: 768px) {
  .main-content {
    padding: 24px 28px 116px;
  }
}

/* ==================== EXPLORER, SEARCH & GRID/LIST ==================== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.explorer-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.search-pill-input {
  flex: 1;
  min-width: 200px;
  border-radius: 999px;
  padding-left: 16px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}

.crumb-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 6px 14px;
  min-height: 36px;
  cursor: pointer;
}
.crumb-btn:hover { border-color: var(--accent); }

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.files-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 640px) {
  .files-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
}

.files-grid.list-mode {
  grid-template-columns: 1fr;
  gap: 8px;
}

.file-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.file-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.files-grid.list-mode .file-card {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
}

.file-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.file-info { min-width: 0; flex: 1; }
.file-name { font-weight: 600; word-break: break-word; }
.file-meta { font-size: 0.78rem; color: var(--text-secondary); }
.file-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ==================== ADMIN & CARDS ==================== */
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}

.panel-card h2, .panel-card h3 { margin-top: 0; }

.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 640px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius);
}

/* Upload Progress Bar */
.upload-progress-bar {
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #06b6d4, #6366f1);
  transition: width 0.15s ease;
}

/* ==================== MODAL & TOASTS ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-dialog {
  width: 100%;
  max-width: 540px;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { margin: 0; }
.modal-body { padding: 18px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--border-color);
}

.toast-container {
  position: fixed;
  top: 72px;
  right: 16px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--accent); }

.error-boundary {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.error-boundary-card {
  max-width: 420px;
  text-align: center;
  background: var(--bg-surface);
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--danger);
}

/* ============================================================================
   3 NEW STRUCTURALLY DISTINCT SKINS (v1.3.0)
   .skin-mac-classic | .skin-neon-oled | .skin-oasis-arch
   ============================================================================ */

/* ==================== SKIN 5: MAC DOCK 3D (Ref. 1) ==================== */
body.skin-mac-classic {
  --bg-page: #184863;
  --bg-surface: rgba(20, 32, 44, 0.84);
  --bg-elevated: rgba(34, 52, 68, 0.85);
  --border-color: rgba(255, 255, 255, 0.2);
  --border-strong: rgba(255, 255, 255, 0.38);
  --accent: #3b82f6;
  --radius: 14px;
  --radius-sm: 8px;
}
body.skin-mac-classic.theme-light {
  --bg-page: #3b7ea1;
  --bg-surface: rgba(242, 246, 250, 0.9);
  --bg-elevated: rgba(255, 255, 255, 0.94);
  --text-primary: #111827;
  --text-secondary: #4b5563;
}
body.skin-mac-classic .ambient-backdrop {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0px, rgba(255,255,255,0.03) 2px, transparent 2px, transparent 10px),
    linear-gradient(180deg, #2f7093 0%, #1d4c68 55%, #123347 100%);
}
/* Classic macOS translucent menubar + window traffic lights */
body.skin-mac-classic .topbar {
  background: linear-gradient(180deg, rgba(255,255,255,0.22) 0%, rgba(180,210,235,0.14) 100%);
  border-bottom: 1px solid rgba(255,255,255,0.28);
  padding: 8px 18px;
}
body.skin-mac-classic .topbar-left::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff5f56;
  box-shadow: 18px 0 0 #ffbd2e, 36px 0 0 #27c93f;
  margin-right: 44px;
  flex-shrink: 0;
}
/* Iconic 3D perspective glass shelf with icons protruding UPWARD above the tray! */
body.skin-mac-classic .floating-dock {
  bottom: 10px;
  padding: 0 28px 8px;
  gap: 14px;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  overflow: visible;
}
body.skin-mac-classic .floating-dock::before {
  content: '';
  position: absolute;
  left: -14px;
  right: -14px;
  bottom: 0;
  height: 30px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, rgba(235, 246, 255, 0.72) 0%, rgba(190, 220, 240, 0.45) 55%, rgba(120, 165, 195, 0.6) 100%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-bottom: 3px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.5), inset 0 2px 3px rgba(255, 255, 255, 0.85);
  transform: perspective(360px) rotateX(32deg);
  transform-origin: bottom center;
  z-index: 0;
  pointer-events: none;
}
body.skin-mac-classic .floating-dock .dock-item {
  position: relative;
  z-index: 2;
  width: 56px;
  height: 56px;
  border-radius: 15px;
  transform: translateY(-16px);
  background: linear-gradient(180deg, rgba(255,255,255,0.28) 0%, rgba(20,36,52,0.75) 100%);
  border: 1px solid rgba(255,255,255,0.45);
  box-shadow: 0 12px 18px rgba(0,0,0,0.45), inset 0 1px 1px rgba(255,255,255,0.55);
}
body.skin-mac-classic .floating-dock .dock-item:hover {
  transform: translateY(-28px) scale(1.26);
}
body.skin-mac-classic .floating-dock .dock-divider {
  position: relative;
  z-index: 2;
  transform: translateY(-10px);
  background: rgba(255,255,255,0.65);
}
body.skin-mac-classic .floating-dock .dock-tooltip {
  background: rgba(20, 28, 36, 0.92);
  border: 1px solid rgba(255,255,255,0.25);
  bottom: calc(100% + 14px);
}

/* ==================== SKIN 6: OLED STORAGE PRO (Ref. 2) ==================== */
body.skin-neon-oled {
  --bg-page: #000000;
  --bg-surface: #0b0c0e;
  --bg-elevated: #141519;
  --bg-input: #08090b;
  --bg-glass: rgba(10, 11, 13, 0.9);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent: #22c55e;
  --accent-hover: #16a34a;
  --accent-glow: rgba(34, 197, 94, 0.35);
  --radius: 18px;
  --radius-sm: 12px;
}
body.skin-neon-oled .ambient-backdrop {
  background: #000000;
}
/* Signature OLED dot-matrix behind duotone glowing icons */
body.skin-neon-oled .duotone-icon {
  background-image: radial-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1px);
  background-size: 6px 6px;
  border-radius: 12px;
}
body.skin-neon-oled .duotone-orb {
  opacity: 0.95;
  filter: blur(6px);
}
body.skin-neon-oled .file-card {
  background: #0d0e11;
  border: 1px solid rgba(255, 255, 255, 0.07);
  position: relative;
  overflow: hidden;
}
body.skin-neon-oled .file-card::after {
  content: '';
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, #22c55e, #06b6d4, #a855f7, transparent);
  opacity: 0.55;
}
body.skin-neon-oled .btn-primary {
  background: #14161a;
  color: #f8fafc;
  border: 1px solid rgba(34, 197, 94, 0.65);
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.22);
}
body.skin-neon-oled .btn-primary:hover {
  background: rgba(34, 197, 94, 0.18);
}
/* OLED Storage Pro — High-Contrast Light Mode */
body.skin-neon-oled.theme-light {
  --bg-page: #f4f6fb;
  --bg-surface: #ffffff;
  --bg-elevated: #eef2f7;
  --bg-input: #f8fafc;
  --bg-glass: rgba(255, 255, 255, 0.92);
  --border-color: rgba(15, 23, 42, 0.12);
  --border-strong: rgba(15, 23, 42, 0.22);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --accent: #16a34a;
  --accent-hover: #15803d;
  --accent-glow: rgba(22, 163, 74, 0.24);
}
body.skin-neon-oled.theme-light .ambient-backdrop {
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}
body.skin-neon-oled.theme-light .duotone-icon {
  background-image: radial-gradient(rgba(15, 23, 42, 0.16) 1px, transparent 1px);
}
body.skin-neon-oled.theme-light .file-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.1);
}
body.skin-neon-oled.theme-light .btn-primary {
  background: #16a34a;
  color: #ffffff;
  border: 1px solid #15803d;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.25);
}
body.skin-neon-oled.theme-light .btn-primary:hover {
  background: #15803d;
}

/* Hidden on all non-Aetheria skins */
.aetheria-bg-layer,
.aetheria-only-btn {
  display: none;
}

/* ==================== SKIN 7: AETHERIA (Fiel a Estilos-Diseños) ==================== */
body.skin-aetheria {
  --aeth-frame: #ffffff;
  --aeth-wall: linear-gradient(155deg, #e7e4de 0%, #d8d4cc 52%, #cbc5ba 100%);
  --bg-page: #d8d4cc;
  --bg-surface: rgba(255, 255, 255, 0.78);
  --bg-elevated: rgba(255, 255, 255, 0.88);
  --bg-input: rgba(255, 255, 255, 0.9);
  --bg-glass: rgba(255, 255, 255, 0.68);
  --border-color: rgba(255, 255, 255, 0.62);
  --border-strong: rgba(38, 33, 99, 0.24);
  --text-primary: #14171f;
  --text-secondary: #4a5160;
  --accent: #262163;
  --accent-hover: #322b7d;
  --accent-warm: #e69d6b;
  --accent-glow: rgba(230, 157, 107, 0.4);
  --radius: 24px;
  --radius-sm: 16px;
  --shadow: 0 18px 42px -14px rgba(20, 26, 40, 0.2);
  background: var(--aeth-wall);
  padding: 10px;
}
body.skin-aetheria.theme-dark {
  --aeth-frame: #141926;
  --aeth-wall: linear-gradient(155deg, #0b0f19 0%, #121826 52%, #192033 100%);
  --bg-page: #0b0f19;
  --bg-surface: rgba(18, 24, 39, 0.74);
  --bg-elevated: rgba(26, 34, 54, 0.84);
  --bg-input: rgba(20, 26, 42, 0.88);
  --bg-glass: rgba(18, 24, 39, 0.68);
  --border-color: rgba(255, 255, 255, 0.16);
  --border-strong: rgba(230, 157, 107, 0.35);
  --text-primary: #f4f6fb;
  --text-secondary: #b8c2d6;
  --accent: #4f46e5;
  --accent-hover: #6366f1;
}
body.skin-aetheria .ambient-backdrop {
  background: var(--aeth-wall);
}

/* Outer Contained Rounded Frame — NEVER touches browser window edges */
body.skin-aetheria .app-shell {
  position: relative;
  width: 100%;
  max-width: 1440px;
  min-height: calc(100dvh - 20px);
  margin: 0 auto;
  background: var(--aeth-frame);
  border-radius: 30px;
  padding: 10px;
  box-shadow: 0 32px 80px -20px rgba(20, 26, 40, 0.32), 0 8px 24px -8px rgba(20, 26, 40, 0.14);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.skin-aetheria.theme-dark .app-shell {
  box-shadow: 0 34px 90px -18px rgba(0, 0, 0, 0.72);
}

/* Full-bleed Dynamic Wallpaper Layer inside the rounded inner stage */
body.skin-aetheria .aetheria-bg-layer {
  display: block;
  position: absolute;
  inset: 10px;
  border-radius: 22px;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
body.skin-aetheria .aetheria-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.015);
  opacity: 1;
  transition: opacity 420ms ease, transform 650ms cubic-bezier(0.22, 1, 0.36, 1);
}
body.skin-aetheria .aetheria-bg-img.is-transitioning {
  opacity: 0.38;
  transform: scale(1.05);
}
body.skin-aetheria .aetheria-bg-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(20, 32, 56, 0.14) 0%, rgba(20, 32, 56, 0.06) 40%, rgba(16, 24, 42, 0.24) 100%);
}
body.skin-aetheria.theme-dark .aetheria-bg-overlay {
  background:
    linear-gradient(180deg, rgba(8, 12, 24, 0.42) 0%, rgba(8, 12, 24, 0.34) 50%, rgba(8, 12, 24, 0.56) 100%);
}

/* Frosted glass surfaces over dynamic wallpaper */
body.skin-aetheria .file-card,
body.skin-aetheria .panel-card,
body.skin-aetheria .storage-banner,
body.skin-aetheria .empty-state {
  background: var(--bg-surface);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 200ms ease, background 200ms ease;
}
body.skin-aetheria .file-card:hover {
  transform: translateY(-2px);
}
body.skin-aetheria .btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(38, 33, 99, 0.28);
}
body.skin-aetheria .btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 0 2px var(--accent-warm);
}
body.skin-aetheria .btn-secondary,
body.skin-aetheria .btn-ghost {
  border-radius: 999px;
}
body.skin-aetheria .floating-dock {
  display: none;
}

/* Smooth Navigation Entrance Animation */
@keyframes aetheriaViewIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
body.skin-aetheria .aetheria-view-enter {
  animation: aetheriaViewIn 340ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Desktop Contained Frame + Inverted-Radius Top Notch + 3-Capsule Left Rail */
@media (min-width: 768px) {
  body.skin-aetheria {
    padding: 20px 26px;
    height: 100dvh;
    overflow: hidden;
  }
  body.skin-aetheria .app-shell {
    height: calc(100dvh - 40px);
    min-height: 0;
    border-radius: 36px;
    padding: 14px;
  }
  body.skin-aetheria .aetheria-bg-layer {
    inset: 14px;
    border-radius: 26px;
  }

  /* Left Floating 3-Capsule Vertical Rail INSIDE the rounded stage */
  body.skin-aetheria .sidebar {
    position: absolute;
    top: 86px;
    left: 24px;
    bottom: 24px;
    height: auto;
    width: 62px;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    z-index: 35;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    overflow: visible;
  }
  body.skin-aetheria .sidebar .sidebar-header,
  body.skin-aetheria .sidebar .nav-section-label,
  body.skin-aetheria .sidebar .profile-meta,
  body.skin-aetheria .sidebar .nav-item > span:last-child {
    display: none;
  }
  body.skin-aetheria .sidebar .sidebar-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 0;
    overflow: visible;
  }
  body.skin-aetheria .aetheria-only-btn {
    display: inline-flex;
  }
  body.skin-aetheria .sidebar .nav-item {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    margin: 0;
    border-radius: 999px;
    justify-content: center;
    background: rgba(255, 255, 255, 0.34);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.42);
    color: var(--text-primary);
    box-shadow: 0 6px 18px rgba(15, 22, 42, 0.14);
    transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), background 180ms ease;
  }
  body.skin-aetheria.theme-dark .sidebar .nav-item {
    background: rgba(20, 26, 42, 0.56);
    border-color: rgba(255, 255, 255, 0.22);
    color: #f4f6fb;
  }
  body.skin-aetheria .sidebar .nav-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.62);
  }
  body.skin-aetheria.theme-dark .sidebar .nav-item:hover {
    background: rgba(36, 46, 70, 0.8);
  }
  body.skin-aetheria .sidebar .nav-item.active {
    background: var(--aeth-frame);
    color: var(--text-primary);
    border-color: var(--aeth-frame);
    box-shadow: 0 8px 22px rgba(15, 22, 42, 0.22);
  }

  /* Libraries Floating Flyout Popover (opens beside Bibliotecas icon) */
  body.skin-aetheria .aetheria-lib-wrap {
    position: relative;
  }
  body.skin-aetheria #sidebar-libraries {
    display: none;
    position: absolute;
    left: 56px;
    top: -4px;
    min-width: 230px;
    max-height: 60dvh;
    overflow-y: auto;
    padding: 10px;
    border-radius: 20px;
    background: var(--aeth-frame);
    border: 1px solid var(--border-color);
    box-shadow: 0 24px 60px rgba(10, 14, 24, 0.28);
    z-index: 60;
    flex-direction: column;
    gap: 6px;
  }
  body.skin-aetheria .aetheria-lib-wrap.flyout-open #sidebar-libraries {
    display: flex;
    animation: aetheriaViewIn 180ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  body.skin-aetheria #sidebar-libraries .nav-item {
    width: 100%;
    height: auto;
    min-height: 40px;
    padding: 8px 12px;
    justify-content: flex-start;
    border-radius: 12px;
    background: transparent;
    border: 1px solid transparent;
    box-shadow: none;
    backdrop-filter: none;
  }
  body.skin-aetheria #sidebar-libraries .nav-item > span:last-child {
    display: inline;
  }
  body.skin-aetheria #sidebar-libraries .nav-item:hover {
    background: rgba(38, 33, 99, 0.08);
    transform: none;
  }
  body.skin-aetheria #sidebar-libraries .nav-item.active {
    background: rgba(38, 33, 99, 0.14);
    color: var(--accent);
    font-weight: 600;
  }

  /* Bottom White Profile & Actions Capsule on Left Rail */
  body.skin-aetheria .sidebar .sidebar-footer {
    border: none;
    padding: 8px 6px;
    border-radius: 999px;
    background: var(--aeth-frame);
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 54px;
  }
  body.skin-aetheria .sidebar .active-profile-card {
    padding: 0;
    justify-content: center;
    background: transparent;
    border: none;
  }
  body.skin-aetheria .sidebar .profile-dot {
    width: 34px;
    height: 34px;
  }
  body.skin-aetheria .sidebar .sidebar-footer-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
  }
  body.skin-aetheria .sidebar .sidebar-footer-actions .btn {
    padding: 4px 2px;
    min-height: 32px;
    font-size: 0.62rem;
    border-radius: 999px;
    width: 100%;
    text-align: center;
  }

  /* Main Column contained inside the rounded inner stage with internal scroll */
  body.skin-aetheria .main-column {
    position: relative;
    z-index: 10;
    margin: 0;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 26px;
  }

  /* Topbar with TRUE Concave Inverted-Radius Notch melted into top frame */
  body.skin-aetheria .topbar {
    position: relative;
    z-index: 30;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0 22px;
    min-height: 62px;
    align-items: flex-start;
    justify-content: space-between;
  }
  body.skin-aetheria .topbar-left {
    position: relative;
    margin: 0 auto;
    background: var(--aeth-frame);
    border-radius: 0 0 24px 24px;
    padding: 10px 28px 12px;
    min-width: 280px;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(17, 24, 39, 0.06);
  }
  body.skin-aetheria .topbar-left::before,
  body.skin-aetheria .topbar-left::after {
    content: '';
    position: absolute;
    top: 0;
    width: 24px;
    height: 24px;
    pointer-events: none;
  }
  body.skin-aetheria .topbar-left::before {
    left: -24px;
    background: radial-gradient(circle at 0 100%, transparent 24px, var(--aeth-frame) 24.5px);
  }
  body.skin-aetheria .topbar-left::after {
    right: -24px;
    background: radial-gradient(circle at 100% 100%, transparent 24px, var(--aeth-frame) 24.5px);
  }
  body.skin-aetheria .topbar-right {
    position: absolute;
    right: 22px;
    top: 12px;
  }
  body.skin-aetheria .skin-pill-btn,
  body.skin-aetheria #btn-toggle-theme {
    background: var(--aeth-frame);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 22px rgba(17, 24, 39, 0.12);
    border-radius: 999px;
  }

  /* Scroll happens strictly INSIDE the contained stage */
  body.skin-aetheria .main-content {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 28px 28px 94px;
  }
}

/* Mobile Aetheria: keeps contained outer frame + off-canvas drawer */
@media (max-width: 767px) {
  body.skin-aetheria .main-column {
    position: relative;
    z-index: 10;
    border-radius: 22px;
    overflow: hidden;
  }
  body.skin-aetheria .topbar {
    background: var(--aeth-frame);
    border-radius: 18px;
    margin: 8px 8px 0;
  }
  body.skin-aetheria .main-content {
    padding: 14px 12px 32px;
  }
}


/* ============================================================================
   v1.4.0 — Solid Skin Popover, Admin Skin Checkboxes, File Progress & Viewer
   ============================================================================ */

/* Higher opacity frosted skin popover so underlying buttons never bleed through */
.skin-popover {
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
}
body.theme-light .skin-popover,
body.skin-lunar .skin-popover,
body.skin-aetheria .skin-popover {
  background: rgba(255, 255, 255, 0.97);
}

/* Admin Panel: Visible Skins Selector Grid */
.admin-skins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.admin-skin-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.admin-skin-check:hover {
  border-color: var(--accent);
}
.admin-skin-check input[type='checkbox'] {
  width: 20px;
  min-height: 20px;
  margin-top: 2px;
  flex-shrink: 0;
}
.admin-skin-check span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.25;
}
.admin-skin-check small {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

/* File Card Progress Bar & Resume Chip */
.file-progress-wrap {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.file-progress-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--accent);
}
.file-progress-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
}
.file-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #22d3ee);
  transition: width 0.25s ease;
}

/* Wide & Fullscreen Modal Variants for Universal Viewer */
.modal-dialog.modal-wide {
  width: min(96vw, 1160px);
  max-width: 1160px;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
}
.modal-dialog.modal-wide .modal-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 12px 16px;
}
.modal-dialog.modal-fullscreen {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.modal-dialog.modal-fullscreen .modal-body {
  flex: 1 1 auto;
  overflow: auto;
}

/* Universal Viewer Shell & Controls */
.viewer-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.viewer-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.viewer-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.viewer-toolbar-right {
  margin-left: auto;
}
.viewer-counter {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0 4px;
}
.viewer-progress-pill {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.18);
  color: var(--text-primary);
  border: 1px solid rgba(99, 102, 241, 0.35);
}
.viewer-controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
}
.viewer-inline-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.viewer-compact-select {
  width: auto;
  min-width: 78px;
  min-height: 36px;
  padding: 4px 10px;
  font-size: 0.82rem;
}
.viewer-zoom-label {
  font-size: 0.82rem;
  font-weight: 600;
  min-width: 48px;
  text-align: center;
}
.viewer-sep {
  width: 1px;
  height: 22px;
  background: var(--border-color);
  margin: 0 4px;
}

/* Video & Audio Stages */
.viewer-video-stage {
  background: #000000;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.viewer-video-stage video {
  width: 100%;
  max-height: 66dvh;
  background: #000000;
  object-fit: contain;
}
.modal-fullscreen .viewer-video-stage video {
  max-height: 76dvh;
}
.viewer-audio-stage {
  padding: 20px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.viewer-audio-art {
  font-size: 2.8rem;
}
.viewer-audio-title {
  font-weight: 600;
  font-size: 0.96rem;
  word-break: break-word;
}

/* Image Stage */
.viewer-image-stage {
  max-height: 68dvh;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.55);
  border-radius: 10px;
  padding: 10px;
}
.viewer-image-stage img {
  max-width: 100%;
  max-height: 64dvh;
  border-radius: 8px;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.15s ease;
}

/* PDF.js Continuous Multi-Page Reader */
.viewer-pdf-page-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
}
.viewer-pdf-page-box input {
  width: 64px;
  min-height: 36px;
  padding: 4px 8px;
  text-align: center;
}
.viewer-pdf-container {
  height: 68dvh;
  overflow: auto;
  background: #1e293b;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.modal-fullscreen .viewer-pdf-container {
  height: 78dvh;
}
.viewer-pdf-loading {
  color: #cbd5e1;
  font-size: 0.92rem;
  padding: 32px 16px;
}
.pdf-page-wrapper {
  position: relative;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.pdf-page-placeholder {
  color: #64748b;
  font-size: 0.8rem;
  font-family: monospace;
}
.pdf-page-canvas {
  display: block;
}
.pdf-page-wrapper .textLayer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  line-height: 1;
  user-select: text;
  -webkit-user-select: text;
}
.pdf-page-wrapper .textLayer > span {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
}

/* Text / Code Reader */
.viewer-text-pre {
  max-height: 68dvh;
  overflow: auto;
  padding: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.86rem;
  line-height: 1.5;
}


/* ============================================================================
   v1.5.0 — Zero Double Scroll & Unified Single Bar for Universal Viewer
   ============================================================================ */
.modal-dialog.modal-viewer-mode {
  width: min(96vw, 1220px);
  max-width: 1220px;
  height: 92dvh;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-dialog.modal-viewer-mode .modal-header {
  display: none;
}
.modal-dialog.modal-viewer-mode .modal-body {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 6px 8px 8px;
}
.modal-dialog.modal-viewer-mode .modal-footer {
  display: none;
}
.modal-dialog.modal-viewer-mode.modal-fullscreen {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
}

.modal-viewer-mode .viewer-shell {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.viewer-unified-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}
.viewer-bar-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
  min-width: 0;
  flex: 0 1 260px;
}
.viewer-close-x {
  font-size: 1rem;
  font-weight: 700;
  min-width: 34px;
  padding: 0 8px;
}
@media (max-width: 639px) {
  .viewer-bar-title {
    max-width: calc(100% - 48px);
    flex: 1 1 140px;
    font-size: 0.8rem;
  }
  .viewer-unified-bar {
    gap: 4px;
    padding: 5px 6px;
  }
  .viewer-unified-bar .btn-sm {
    min-height: 32px;
    padding: 0 7px;
    font-size: 0.78rem;
  }
  .viewer-unified-bar .viewer-pdf-page-box input {
    min-height: 32px;
    width: 48px;
    padding: 2px 4px;
  }
  /* Mobile Dock: prevent horizontal overflow on narrow screens */
  .floating-dock {
    max-width: calc(100vw - 16px);
    padding: 6px 8px;
    gap: 4px;
    bottom: 10px;
  }
  .floating-dock .dock-item {
    width: 42px;
    height: 42px;
    flex-shrink: 1;
  }
  .floating-dock .dock-divider {
    height: 22px;
    margin: 0 1px;
  }
  body.skin-mac-classic .floating-dock {
    padding: 0 10px 6px;
    gap: 5px;
    max-width: calc(100vw - 20px);
  }
  body.skin-mac-classic .floating-dock::before {
    left: -6px;
    right: -6px;
    height: 24px;
  }
  body.skin-mac-classic .floating-dock .dock-item {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    transform: translateY(-10px);
  }
  body.skin-mac-classic .floating-dock .dock-item:hover {
    transform: translateY(-16px) scale(1.12);
  }
  body.skin-mac-classic .floating-dock .dock-divider {
    transform: translateY(-6px);
  }
}
.viewer-unified-bar .btn-sm {
  min-height: 34px;
  padding: 0 10px;
}
.viewer-unified-bar .viewer-compact-select {
  min-height: 34px;
}
.viewer-unified-bar .viewer-pdf-page-box input {
  min-height: 34px;
  width: 58px;
}

/* Flex-filling stages: ZERO outer scrollbar, 100% available height */
.modal-viewer-mode .viewer-pdf-container {
  flex: 1 1 0;
  min-height: 0;
  height: auto;
}
.modal-viewer-mode .viewer-video-stage {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  height: 100%;
}
.modal-viewer-mode .viewer-video-stage video {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
}
.modal-viewer-mode .viewer-image-stage {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
}
.modal-viewer-mode .viewer-image-stage img {
  max-height: 100%;
}
.modal-viewer-mode .viewer-text-pre {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  margin: 0;
}


/* ============================================================================
   v1.7.0 — Auth/Profile Skin Parity, Unified Duotone Rail & Mobile 60fps Fix
   ============================================================================ */

/* Unified Duotone SVG icons inside sidebar & Aetheria rail */
.sidebar .nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
body.skin-aetheria .sidebar .nav-item .duotone-icon {
  width: 24px;
  height: 24px;
}

/* Auth & Profile Picker (#auth-shell) — Full Skin Parity */
body.skin-aetheria .auth-shell {
  min-height: calc(100dvh - 20px);
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  border-radius: 30px;
  border: 10px solid var(--aeth-frame);
  background-image:
    linear-gradient(180deg, rgba(16, 24, 42, 0.22) 0%, rgba(16, 24, 42, 0.42) 100%),
    var(--aetheria-wp, url('/assets/wallpapers/wp-01.jpg'));
  background-size: cover;
  background-position: center;
  box-shadow: 0 32px 80px -20px rgba(20, 26, 40, 0.34);
  padding: 24px 16px;
}
@media (min-width: 768px) {
  body.skin-aetheria .auth-shell {
    min-height: calc(100dvh - 40px);
    border-radius: 36px;
    border-width: 14px;
  }
}
body.skin-aetheria .auth-card {
  background: var(--bg-surface);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--border-color);
  border-radius: 28px;
  box-shadow: 0 28px 64px rgba(10, 14, 24, 0.28);
}
body.skin-aetheria .profile-tile {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 20px;
}
body.skin-neon-oled .auth-card {
  background: #0b0c0e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 40px rgba(34, 197, 94, 0.12);
}
body.skin-neon-oled.theme-light .auth-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.1);
}
body.skin-mac-classic .auth-card {
  background: rgba(18, 32, 46, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.24);
}
body.skin-mac-classic.theme-light .auth-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.85);
}

/* ============================================================================
   v1.8.0 — Global Anti-Overflow Contract, Zero-Blank Cards & Mobile Bottom Sheet
   ============================================================================ */

/* Global flex/grid shrink safety so NO element can overflow sideways at any viewport */
.main-column,
.main-content,
.view-section,
.files-grid,
.file-card,
.file-card-top,
.file-info,
.panel-card,
.toolbar,
.toolbar-actions,
.breadcrumbs,
.explorer-search-row,
.topbar,
.topbar-left,
.topbar-right {
  min-width: 0;
  max-width: 100%;
}
.file-name,
.file-meta {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.files-grid {
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 640px) {
  .files-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  }
}
.search-pill-input {
  min-width: 0;
  flex: 1 1 140px;
}

/* Mobile-only bottom tray hidden on desktop */
.mobile-bottom-tray,
.mobile-sheet-handle {
  display: none;
}

/* Mobile & Small Screens (< 768px): Pull-Up Bottom Sheet + Compact Bottom Tray */
@media (max-width: 767px) {
  /* Hide desktop hamburger & old floating dock; bottom tray + sheet replace them cleanly */
  #btn-open-sidebar,
  .floating-dock {
    display: none !important;
  }

  /* Transform #app-sidebar into a solid Bottom Pull-Up Sheet (zero bleed-through) */
  .sidebar {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100vw;
    height: auto;
    max-height: 82dvh;
    border-right: none;
    border-top: 1px solid var(--border-strong);
    border-radius: 24px 24px 0 0;
    background: rgba(15, 23, 42, 0.98);
    transform: translateY(105%);
    transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.45);
    z-index: 90;
    overflow-y: auto;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  body.theme-light .sidebar,
  body.skin-lunar .sidebar,
  body.skin-aetheria:not(.theme-dark) .sidebar {
    background: rgba(255, 255, 255, 0.98);
    color: #0f172a;
  }
  .sidebar.open {
    transform: translateY(0);
  }
  .mobile-sheet-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 4px;
    flex-shrink: 0;
  }
  .mobile-sheet-handle span {
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-strong);
  }

  /* Anchored Bottom Tray (< 768px) — zero horizontal overflow even on 320px */
  .mobile-bottom-tray {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100vw;
    z-index: 65;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.32);
    padding: 4px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  body.theme-light .mobile-bottom-tray,
  body.skin-lunar .mobile-bottom-tray,
  body.skin-aetheria:not(.theme-dark) .mobile-bottom-tray {
    background: rgba(255, 255, 255, 0.96);
    color: #0f172a;
  }
  .mobile-tray-pull {
    width: 100%;
    min-height: 18px;
    padding: 4px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
  }
  .mobile-tray-pill {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-strong);
  }
  .mobile-tray-items {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    width: 100%;
    gap: 2px;
    min-width: 0;
  }
  .mobile-tray-btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 46px;
    padding: 4px 2px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
  }
  .mobile-tray-btn > span:last-child {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-tray-btn.active {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.35);
    color: var(--text-primary);
  }

  /* Reserve space above fixed bottom tray for non-Aetheria skins */
  .main-content {
    padding: 14px 12px 92px;
    overflow-x: hidden;
  }

  /* Strict Contained Aetheria Frame on Mobile: ZERO top/bottom/side overflow EVER */
  body.skin-aetheria {
    padding: 8px;
    height: 100dvh;
    overflow: hidden;
  }
  body.skin-aetheria .app-shell {
    height: calc(100dvh - 16px);
    min-height: 0;
    border-radius: 26px;
    padding: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  body.skin-aetheria .aetheria-bg-layer {
    position: absolute;
    inset: 8px;
    border-radius: 20px;
    z-index: 0;
    overflow: hidden;
  }
  body.skin-aetheria .main-column {
    position: relative;
    z-index: 10;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 20px;
  }
  body.skin-aetheria .topbar {
    position: relative;
    top: auto;
    flex-shrink: 0;
    margin: 0;
    border-radius: 20px 20px 0 0;
    padding: 8px 10px;
    gap: 6px;
  }
  body.skin-aetheria .main-content {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 10px 8px 16px;
  }
  body.skin-aetheria .mobile-bottom-tray {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    flex-shrink: 0;
    border-radius: 0 0 20px 20px;
    border-top: 1px solid var(--border-color);
  }

  /* Fast crisp cards on mobile (NO backdrop-filter GPU blur explosion, NO content-visibility blank boxes) */
  body.skin-aetheria .file-card,
  body.skin-liquid .file-card,
  body.skin-lunar .file-card,
  body.skin-mac-classic .file-card {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  body.skin-aetheria .file-card {
    background: rgba(255, 255, 255, 0.94);
  }
  body.skin-aetheria.theme-dark .file-card {
    background: rgba(18, 24, 39, 0.94);
  }

  /* Compact non-overflowing topbar on narrow screens */
  .topbar {
    gap: 6px;
    padding: 8px 10px;
  }
  .topbar-left {
    min-width: 0;
    flex: 1 1 auto;
    gap: 6px;
  }
  .topbar-right {
    flex-shrink: 0;
    gap: 6px;
  }
  .topbar-title {
    font-size: 0.92rem;
  }
  .skin-pill-btn {
    padding: 0 10px;
    max-width: 132px;
  }
  #active-skin-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}


/* ============================================================================
   v1.8.1 — 2-Level Mobile Pull-Up Drawer, Upward Libraries Popover & Per-Skin Styling
   ============================================================================ */
@media (max-width: 767px) {
  /* Proper internal scroll inside expanded bottom sheet (Admin never tucked behind footer) */
  .sidebar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .sidebar .sidebar-header {
    flex-shrink: 0;
    cursor: pointer;
  }
  .sidebar .sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 12px;
  }
  .sidebar .sidebar-footer {
    flex-shrink: 0;
  }
  .mobile-sheet-handle {
    cursor: pointer;
  }

  /* Collapsed by default: only a subtle slim bottom handle bar shows */
  .mobile-bottom-tray {
    padding: 0 6px env(safe-area-inset-bottom, 0px);
    transition: padding 220ms cubic-bezier(0.22, 1, 0.36, 1), background 220ms ease;
  }
  .mobile-bottom-tray[data-drawer-level='collapsed'] {
    background: transparent;
    border-top: none;
    box-shadow: none;
    pointer-events: none;
  }
  .mobile-bottom-tray[data-drawer-level='collapsed'] .mobile-tray-pull {
    pointer-events: auto;
    width: 112px;
    margin: 0 auto 6px;
    min-height: 22px;
    border-radius: 999px;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
  }
  .mobile-bottom-tray[data-drawer-level='collapsed'] .mobile-tray-items {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transform: translateY(8px);
  }
  .mobile-bottom-tray[data-drawer-level='tray'] {
    padding: 4px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    border-radius: 20px 20px 0 0;
  }
  .mobile-bottom-tray[data-drawer-level='tray'] .mobile-tray-items {
    max-height: 76px;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
  .mobile-bottom-tray[data-drawer-level='full'] {
    opacity: 0;
    pointer-events: none;
  }
  .mobile-tray-items {
    transition: max-height 240ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease, transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  /* Slimmer bottom reserve when tray is collapsed */
  .main-content {
    padding: 14px 12px 44px;
  }
  body.skin-aetheria .main-content {
    padding: 10px 8px 34px;
  }
  body.skin-aetheria .mobile-bottom-tray[data-drawer-level='collapsed'] {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    border-top: none;
  }
  body.skin-aetheria .mobile-bottom-tray[data-drawer-level='tray'] {
    position: relative;
    border-radius: 18px 18px 20px 20px;
  }

  /* Upward Compact Libraries Popover from Tray "Archivos" icon */
  .mobile-tray-libs-popover {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: calc(100% + 8px);
    max-height: 44dvh;
    overflow-y: auto;
    padding: 8px;
    border-radius: 18px;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    box-shadow: 0 -14px 36px rgba(0, 0, 0, 0.34);
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 75;
    animation: aetheriaViewIn 180ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .mobile-tray-libs-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    padding: 4px 10px 2px;
  }
  .mobile-tray-lib-item {
    width: 100%;
    min-height: 40px;
    padding: 6px 10px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
  }
  .mobile-tray-lib-item.active {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.35);
  }

  /* ==================== PER-SKIN MOBILE DRAWER & TRAY STYLING ==================== */
  /* Obsidian Glow */
  body.skin-obsidian .sidebar,
  body.skin-obsidian .mobile-bottom-tray[data-drawer-level='tray'],
  body.skin-obsidian .mobile-tray-libs-popover {
    background: rgba(11, 16, 32, 0.97);
    border-color: rgba(99, 102, 241, 0.32);
  }
  body.skin-obsidian.theme-light .sidebar,
  body.skin-obsidian.theme-light .mobile-bottom-tray[data-drawer-level='tray'],
  body.skin-obsidian.theme-light .mobile-tray-libs-popover {
    background: rgba(248, 250, 252, 0.98);
    border-color: rgba(99, 102, 241, 0.25);
  }

  /* Liquid Glass */
  body.skin-liquid .sidebar,
  body.skin-liquid .mobile-bottom-tray[data-drawer-level='tray'],
  body.skin-liquid .mobile-tray-libs-popover {
    background: rgba(24, 28, 44, 0.9);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    border-color: rgba(255, 255, 255, 0.22);
    border-radius: 28px 28px 0 0;
  }
  body.skin-liquid.theme-light .sidebar,
  body.skin-liquid.theme-light .mobile-bottom-tray[data-drawer-level='tray'],
  body.skin-liquid.theme-light .mobile-tray-libs-popover {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(255, 255, 255, 0.85);
  }

  /* Home OS */
  body.skin-homeos .sidebar,
  body.skin-homeos .mobile-bottom-tray[data-drawer-level='tray'],
  body.skin-homeos .mobile-tray-libs-popover {
    background: rgba(22, 30, 46, 0.96);
    border-color: rgba(56, 189, 248, 0.28);
  }
  body.skin-homeos.theme-light .sidebar,
  body.skin-homeos.theme-light .mobile-bottom-tray[data-drawer-level='tray'],
  body.skin-homeos.theme-light .mobile-tray-libs-popover {
    background: rgba(241, 245, 249, 0.98);
    border-color: rgba(14, 165, 233, 0.28);
  }

  /* Lunar Oasis */
  body.skin-lunar .sidebar,
  body.skin-lunar .mobile-bottom-tray[data-drawer-level='tray'],
  body.skin-lunar .mobile-tray-libs-popover {
    background: #fdfbf7;
    color: #14171f;
    border-color: rgba(38, 33, 99, 0.18);
  }
  body.skin-lunar.theme-dark .sidebar,
  body.skin-lunar.theme-dark .mobile-bottom-tray[data-drawer-level='tray'],
  body.skin-lunar.theme-dark .mobile-tray-libs-popover {
    background: #181e2f;
    color: #f4f6fb;
    border-color: rgba(230, 157, 107, 0.28);
  }

  /* Mac Dock 3D */
  body.skin-mac-classic .sidebar,
  body.skin-mac-classic .mobile-bottom-tray[data-drawer-level='tray'],
  body.skin-mac-classic .mobile-tray-libs-popover {
    background: linear-gradient(180deg, rgba(28, 52, 74, 0.96) 0%, rgba(15, 28, 42, 0.98) 100%);
    border-top: 2px solid rgba(255, 255, 255, 0.45);
    border-color: rgba(255, 255, 255, 0.32);
  }
  body.skin-mac-classic.theme-light .sidebar,
  body.skin-mac-classic.theme-light .mobile-bottom-tray[data-drawer-level='tray'],
  body.skin-mac-classic.theme-light .mobile-tray-libs-popover {
    background: linear-gradient(180deg, rgba(242, 248, 255, 0.97) 0%, rgba(224, 236, 248, 0.98) 100%);
    border-color: rgba(15, 23, 42, 0.16);
  }

  /* OLED Storage Pro */
  body.skin-neon-oled .sidebar,
  body.skin-neon-oled .mobile-bottom-tray[data-drawer-level='tray'],
  body.skin-neon-oled .mobile-tray-libs-popover {
    background: #000000;
    border-top: 2px solid #22c55e;
    border-color: rgba(34, 197, 94, 0.45);
    box-shadow: 0 -10px 30px rgba(34, 197, 94, 0.16);
  }
  body.skin-neon-oled .mobile-tray-pill,
  body.skin-neon-oled .mobile-sheet-handle span {
    background: #22c55e;
  }
  body.skin-neon-oled.theme-light .sidebar,
  body.skin-neon-oled.theme-light .mobile-bottom-tray[data-drawer-level='tray'],
  body.skin-neon-oled.theme-light .mobile-tray-libs-popover {
    background: #ffffff;
    border-top: 2px solid #16a34a;
    border-color: rgba(22, 163, 74, 0.35);
  }

  /* Aetheria */
  body.skin-aetheria .sidebar,
  body.skin-aetheria .mobile-bottom-tray[data-drawer-level='tray'],
  body.skin-aetheria .mobile-tray-libs-popover {
    background: var(--aeth-frame);
    color: var(--text-primary);
    border-color: var(--border-strong);
  }
  body.skin-aetheria .mobile-tray-pill,
  body.skin-aetheria .mobile-sheet-handle span {
    background: var(--accent-warm);
  }
  body.skin-aetheria .mobile-tray-btn.active,
  body.skin-aetheria .mobile-tray-lib-item.active {
    background: rgba(38, 33, 99, 0.14);
    border-color: var(--accent-warm);
    color: var(--text-primary);
  }
}


/* ============================================================================
   v1.8.2 — Interactive 1:1 Pointer Drag + True Per-Skin Structural Mobile Tray
   ============================================================================ */
@media (max-width: 767px) {
  /* Lock touch-action so tray/handle gestures NEVER scroll or bleed into background */
  .mobile-bottom-tray,
  .mobile-tray-pull,
  .mobile-sheet-handle,
  .sidebar .sidebar-header {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }
  .mobile-tray-pull,
  .mobile-sheet-handle,
  .sidebar .sidebar-header {
    cursor: grab;
  }
  .mobile-bottom-tray.is-dragging,
  .sidebar.is-dragging {
    transition: none !important;
    cursor: grabbing;
  }
  .mobile-bottom-tray {
    transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1), padding 220ms ease, background 220ms ease, opacity 180ms ease;
  }

  /* ==================== TRUE STRUCTURAL PER-SKIN MOBILE TRAY ==================== */

  /* 1. MAC DOCK 3D: Real 3D perspective glass shelf + icons physically protruding upward! */
  body.skin-mac-classic .mobile-bottom-tray[data-drawer-level='tray'] {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
    padding: 0 10px calc(8px + env(safe-area-inset-bottom, 0px));
    max-width: 100vw;
  }
  body.skin-mac-classic .mobile-bottom-tray[data-drawer-level='tray']::before {
    content: '';
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: calc(4px + env(safe-area-inset-bottom, 0px));
    height: 28px;
    border-radius: 10px 10px 4px 4px;
    background: linear-gradient(180deg, rgba(235, 246, 255, 0.72) 0%, rgba(190, 220, 240, 0.45) 55%, rgba(120, 165, 195, 0.62) 100%);
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-bottom: 3px solid rgba(255, 255, 255, 0.52);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.48), inset 0 2px 3px rgba(255, 255, 255, 0.85);
    transform: perspective(360px) rotateX(32deg);
    transform-origin: bottom center;
    z-index: 0;
    pointer-events: none;
  }
  body.skin-mac-classic .mobile-bottom-tray[data-drawer-level='tray'] .mobile-tray-pull {
    position: relative;
    z-index: 3;
    width: 72px;
    margin: 0 auto 2px;
    min-height: 14px;
    border-radius: 999px;
    background: rgba(20, 36, 52, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.35);
  }
  body.skin-mac-classic .mobile-bottom-tray[data-drawer-level='tray'] .mobile-tray-items {
    position: relative;
    z-index: 2;
    gap: 6px;
    max-height: 82px;
    overflow: visible;
    padding: 4px 4px 2px;
  }
  body.skin-mac-classic .mobile-bottom-tray[data-drawer-level='tray'] .mobile-tray-btn {
    transform: translateY(-8px);
    border-radius: 14px;
    min-height: 50px;
    padding: 5px 2px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, rgba(20, 36, 52, 0.82) 100%);
    border: 1px solid rgba(255, 255, 255, 0.48);
    box-shadow: 0 10px 16px rgba(0, 0, 0, 0.42), inset 0 1px 1px rgba(255, 255, 255, 0.6);
    color: #f8fafc;
    transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  body.skin-mac-classic .mobile-bottom-tray[data-drawer-level='tray'] .mobile-tray-btn.active,
  body.skin-mac-classic .mobile-bottom-tray[data-drawer-level='tray'] .mobile-tray-btn:active {
    transform: translateY(-14px) scale(1.06);
    border-color: rgba(255, 255, 255, 0.88);
    box-shadow: 0 14px 22px rgba(0, 0, 0, 0.5), 0 0 12px rgba(56, 189, 248, 0.35);
  }

  /* 2. OLED STORAGE PRO: Pure OLED black pill + dot-matrix icons + neon gradient accent bar */
  body.skin-neon-oled .mobile-bottom-tray[data-drawer-level='tray'] {
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    width: auto;
    border-radius: 22px;
    background: #000000;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.78), 0 0 22px rgba(34, 197, 94, 0.16);
    overflow: hidden;
  }
  body.skin-neon-oled .mobile-bottom-tray[data-drawer-level='tray']::after {
    content: '';
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, #22c55e, #06b6d4, #a855f7, #22c55e);
  }
  body.skin-neon-oled .mobile-bottom-tray[data-drawer-level='tray'] .duotone-icon {
    background-image: radial-gradient(rgba(255, 255, 255, 0.24) 1px, transparent 1px);
    background-size: 5px 5px;
    border-radius: 10px;
  }
  body.skin-neon-oled.theme-light .mobile-bottom-tray[data-drawer-level='tray'] {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.12);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  }
  body.skin-neon-oled.theme-light .mobile-bottom-tray[data-drawer-level='tray'] .duotone-icon {
    background-image: radial-gradient(rgba(15, 23, 42, 0.16) 1px, transparent 1px);
  }

  /* 3. AETHERIA: Floating circular glass orbs inside rounded capsule + terracotta ring */
  body.skin-aetheria .mobile-bottom-tray[data-drawer-level='tray'] {
    margin: 0 6px 6px;
    border-radius: 26px;
    background: var(--aeth-frame);
    border: 1px solid var(--border-strong);
    box-shadow: 0 12px 30px rgba(20, 26, 40, 0.22);
    padding: 4px 8px 8px;
  }
  body.skin-aetheria .mobile-bottom-tray[data-drawer-level='tray'] .mobile-tray-btn {
    border-radius: 999px;
    background: rgba(128, 138, 160, 0.1);
    border: 1px solid transparent;
    margin: 0 2px;
  }
  body.skin-aetheria .mobile-bottom-tray[data-drawer-level='tray'] .mobile-tray-btn.active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent-warm);
    box-shadow: 0 6px 16px rgba(38, 33, 99, 0.3);
  }

  /* 4. LIQUID GLASS: Curved floating frosted Bento island */
  body.skin-liquid .mobile-bottom-tray[data-drawer-level='tray'] {
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    width: auto;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 16px 40px rgba(10, 14, 30, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }

  /* 5. LUNAR OASIS: Warm sandstone pill with solid indigo active capsule */
  body.skin-lunar .mobile-bottom-tray[data-drawer-level='tray'] {
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    width: auto;
    border-radius: 28px;
    box-shadow: 0 14px 36px rgba(20, 26, 40, 0.18);
  }
  body.skin-lunar .mobile-bottom-tray[data-drawer-level='tray'] .mobile-tray-btn.active {
    background: #262163;
    color: #ffffff;
    border-radius: 999px;
  }

  /* 6. HOME OS & OBSIDIAN GLOW: Floating elevated glass dock pill */
  body.skin-homeos .mobile-bottom-tray[data-drawer-level='tray'],
  body.skin-obsidian .mobile-bottom-tray[data-drawer-level='tray'] {
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    width: auto;
    border-radius: 22px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
  }
}


/* v1.8.3 — Full-card primary click affordance */
.file-card-clickable {
  cursor: pointer;
}
.file-card-clickable:hover {
  border-color: var(--border-strong);
}
.file-card-clickable:active {
  transform: scale(0.992);
}
