[hidden] { display: none !important; }

/* ============================================================
   Design tokens — "Ember" dark theme
   ============================================================ */
:root {
  --bg: #0b0b0e;
  --bg-deep: #08080a;
  --surface: #141418;
  --surface-soft: #1c1c22;
  --surface-hover: #232329;
  --border: #26262e;
  --border-strong: #34343d;
  --text: #ece7de;
  --text-soft: #a5a096;
  --muted: #6d695f;
  --primary: #f0a43a;
  --primary-hover: #ffb45c;
  --primary-contrast: #1a1104;
  --primary-soft: rgba(240, 164, 58, 0.12);
  --primary-ring: rgba(240, 164, 58, 0.24);
  --danger: #ff6d6d;
  --danger-hover: #ff8f8f;
  --danger-soft: rgba(255, 109, 109, 0.12);
  --success: #4ade80;
  --row-hover: rgba(255, 255, 255, 0.035);
  --row-selected: rgba(240, 164, 58, 0.09);
  --sidebar-w: 252px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6), 0 8px 20px rgba(0, 0, 0, 0.4);
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4 { font-weight: 650; margin: 0; letter-spacing: -0.015em; }

.muted { color: var(--muted); }

::selection { background: var(--primary-ring); color: #fff; }

/* Scrollbars */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #33333c; border-radius: 7px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #454550; background-clip: content-box; }

/* ============================================================
   Botones
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s, border-color 0.16s, color 0.16s, box-shadow 0.16s, transform 0.06s;
  user-select: none;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--border-strong); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-contrast);
  box-shadow: 0 2px 14px rgba(240, 164, 58, 0.25);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-contrast); }

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #1c0505;
  box-shadow: 0 2px 14px rgba(255, 109, 109, 0.2);
}
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); border-color: var(--danger-hover); color: #1c0505; }

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

.btn-small { padding: 5px 12px; font-size: 12.5px; border-radius: 999px; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ============================================================
   Formularios
   ============================================================ */
input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 9px 13px;
  margin: 5px 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  background: var(--bg-deep);
  color: var(--text);
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
input:hover, select:hover { border-color: #41414b; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-deep);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
label { display: block; font-size: 12.5px; font-weight: 600; margin-top: 10px; color: var(--text-soft); letter-spacing: 0.02em; }
input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }

/* ============================================================
   Alertas y toasts
   ============================================================ */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin: 14px 0;
  font-size: 13.5px;
}
.alert-error { background: var(--danger-soft); border: 1px solid rgba(255, 109, 109, 0.3); color: #ffb4b4; }

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  padding: 11px 22px;
  border-radius: 999px;
  background: rgba(28, 28, 34, 0.9);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 550;
  box-shadow: var(--shadow-md);
  z-index: 1200;
  opacity: 0;
  transition: opacity 0.22s, transform 0.22s;
  pointer-events: none;
  backdrop-filter: blur(10px);
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(255, 109, 109, 0.4); color: #ffb4b4; }
.toast.success { border-color: rgba(74, 222, 128, 0.4); color: #b6f5cd; }

/* ============================================================
   Auth / Compartir
   ============================================================ */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(240, 164, 58, 0.09), transparent 60%),
    radial-gradient(700px 400px at 110% 110%, rgba(240, 164, 58, 0.05), transparent 55%),
    linear-gradient(180deg, #0d0d11 0%, var(--bg) 100%);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: rgba(20, 20, 24, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 38px 36px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
}
.auth-brand {
  font-weight: 700; font-size: 16px; margin-bottom: 6px;
  display: flex; align-items: center; gap: 11px;
  color: var(--text);
}
.auth-title { font-size: 22px; margin-bottom: 5px; }
.auth-sub { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.auth-foot { margin-top: 20px; font-size: 13.5px; text-align: center; color: var(--muted); }
.auth-foot a { font-weight: 550; }

/* Tarjeta ancha para la vista de compartidos (carpetas con tabla de archivos) */
.share-card { max-width: 800px; padding: 34px 32px; }
.share-card .share-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.share-card .share-head h1 { font-size: 20px; line-height: 1.3; word-break: break-word; }
.share-card .btn-block { margin-top: 4px; }

/* Tabla de archivos en la vista compartida */
.share-table { table-layout: auto; width: 100%; }
.share-table th, .share-table td { white-space: normal; vertical-align: middle; }
.share-table td:first-child { word-break: break-word; min-width: 140px; }
.share-table td:last-child { text-align: right; }
.share-table td:last-child .btn { white-space: nowrap; }
.share-table tr > td:last-child { width: 1%; }

.logo {
  width: 33px;
  height: 33px;
  border-radius: 10px;
  background: linear-gradient(140deg, #ffb45c 0%, #e08c1e 55%, #c9761a 100%);
  color: #1a1104;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(240, 164, 58, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.share-meta {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 14px 0;
  font-size: 14px;
  font-family: var(--font-mono);
  color: var(--text-soft);
}

/* ============================================================
   Layout (sidebar + main)
   ============================================================ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-deep);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  padding: 2px 8px 22px;
  color: var(--text);
}

.user-card {
  background: linear-gradient(160deg, rgba(240, 164, 58, 0.08), transparent 60%), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 20px;
}
.user-card .uc-top { display: flex; align-items: center; gap: 12px; }
.user-card .uc-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(140deg, #ffb45c, #d8831f);
  color: #1a1104;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(240, 164, 58, 0.35);
}
.user-card .uc-name { font-weight: 650; font-size: 13.5px; line-height: 1.2; }
.user-card .uc-role { font-size: 12px; color: var(--muted); }
.user-card .uc-meter { margin-top: 13px; }
.user-card .uc-meter .label { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; font-family: var(--font-mono); letter-spacing: 0.03em; }
.user-card .uc-meter .label span:last-child { color: var(--text-soft); }
.user-card .meter-track { height: 5px; background: #2a2a31; border-radius: 4px; margin-top: 7px; overflow: hidden; }
.user-card .meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffb45c, #e08c1e);
  border-radius: 4px;
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.3, 1);
  box-shadow: 0 0 8px rgba(240, 164, 58, 0.5);
}

.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-nav a, .side-nav button, .side-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
  text-align: left;
  transition: background 0.14s, color 0.14s;
}
.side-nav a:hover, .side-nav button:hover { background: var(--row-hover); color: var(--text); }
.side-nav .nav-item { cursor: default; }
.side-nav .nav-active, .side-nav .nav-active:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.side-nav .nav-icon { width: 18px; text-align: center; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); transition: color 0.14s; }
.side-nav a:hover .nav-icon, .side-nav button:hover .nav-icon { color: var(--primary); }
.side-nav .nav-active .nav-icon { color: var(--primary); }
.side-nav .nav-icon svg { width: 17px; height: 17px; }

.logout {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--danger);
  cursor: pointer;
  text-align: left;
  transition: background 0.14s, color 0.14s;
}
.logout .nav-icon { width: 18px; display: inline-flex; align-items: center; justify-content: center; color: var(--danger); }
.logout .nav-icon svg { width: 17px; height: 17px; }
.logout:hover { background: var(--danger-soft); color: var(--danger-hover); }

.side-foot {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}

.side-main {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  background:
    radial-gradient(1100px 500px at 80% -10%, rgba(240, 164, 58, 0.045), transparent 60%),
    var(--bg);
}

.content { flex: 1; padding: 26px 34px 56px; max-width: 1120px; width: 100%; }

/* ============================================================
   Topbar estilo Drive (breadcrumb + busqueda + toggle vista)
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 34px;
  background: rgba(11, 11, 14, 0.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.topbar .crumbs { margin: 0; flex: 1; min-width: 0; margin-bottom: 0; }
.topbar-sep { flex: 1; }
.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 340px;
}
.topbar-search svg {
  position: absolute;
  left: 13px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.topbar-search input {
  margin: 0;
  padding: 8px 13px 8px 38px;
  border-radius: 999px;
  background: var(--surface);
  font-size: 13.5px;
}
.topbar-search input:focus { background: var(--surface); }

.view-toggle {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--row-hover); color: var(--text); }
.icon-btn.active { background: var(--primary); color: var(--primary-contrast); }
.icon-btn.active:hover { background: var(--primary-hover); color: var(--primary-contrast); }

.page-title { font-size: 19px; letter-spacing: -0.01em; }

/* ============================================================
   Pie del sidebar estilo Drive (usuario + almacenamiento + salir)
   ============================================================ */
.side-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.side-bottom .user-card { margin-bottom: 0; }
.side-bottom .logout { margin-top: 2px; }
.uc-info { min-width: 0; }

/* ============================================================
   Toolbar y breadcrumbs
   ============================================================ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar-sep { flex: 1; }
.toolbar .group { display: flex; gap: 8px; flex-wrap: wrap; }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin-bottom: 20px;
  font-size: 14px;
}
.crumb {
  cursor: pointer;
  color: var(--muted);
  padding: 4px 9px;
  border-radius: 7px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.crumb:hover { background: var(--row-hover); color: var(--primary); }
.crumb.current { color: var(--text); font-weight: 600; cursor: default; }
.crumb-sep { color: #4a4a54; margin: 0 4px; font-weight: 400; }

/* ============================================================
   Cuadricula de archivos
   ============================================================ */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 14px;
}
.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: box-shadow 0.18s, border-color 0.18s, transform 0.1s, background 0.18s;
  animation: card-in 0.2s ease-out;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
.file-card:hover {
  border-color: #3a3a44;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.file-card.selected {
  border-color: var(--primary);
  background: var(--row-selected);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow-sm);
}
.file-card .fc-more {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  z-index: 2;
  transition: opacity 0.13s, background 0.13s, color 0.13s;
}
.file-card .fc-more svg { width: 17px; height: 17px; }
.file-card:hover .fc-more, .file-card.selected .fc-more { opacity: 1; }
.file-card .fc-more:hover { background: var(--row-hover); color: var(--text); }

.fc-thumb {
  width: 100%;
  height: 84px;
  border-radius: 10px;
  background: radial-gradient(140px 80px at 50% 0%, rgba(240, 164, 58, 0.07), transparent 70%), var(--surface-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 13px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.fc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fc-thumb .fc-icon { font-size: 34px; line-height: 1; }

/* Emojis de archivo -> monocromo acorde al tema */
.fc-icon { filter: grayscale(1) brightness(1.75); opacity: 0.9; }
.file-card.folder .fc-icon {
  filter: grayscale(1) sepia(1) saturate(4) hue-rotate(-12deg) brightness(1.25);
  opacity: 1;
}

.file-card .fc-name {
  font-size: 13px;
  font-weight: 550;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: break-all;
  line-height: 1.35;
}
.file-card.folder .fc-name { color: var(--primary); }
.file-card .fc-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; font-family: var(--font-mono); }

/* Vista lista (estilo Drive) */
.file-grid.list-view { display: flex; flex-direction: column; gap: 6px; }
.file-grid.list-view .file-card {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 9px 14px;
  text-align: left;
  animation: none;
}
.file-grid.list-view .fc-thumb {
  width: 44px;
  height: 44px;
  margin: 0;
  flex-shrink: 0;
  border-radius: 9px;
}
.file-grid.list-view .fc-thumb .fc-icon { font-size: 21px; }
.file-grid.list-view .fc-name { flex: 1; }
.file-grid.list-view .fc-meta { margin-top: 0; min-width: 70px; text-align: right; }
.file-grid.list-view .fc-more { position: static; opacity: 1; margin-left: 6px; flex-shrink: 0; }
.file-grid.list-view .empty { width: 100%; }

/* ============================================================
   Menu contextual (⋮)
   ============================================================ */
.ctx-menu {
  position: fixed;
  z-index: 1300;
  min-width: 205px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  box-shadow: var(--shadow-lg);
  animation: ctx-in 0.13s ease-out;
}
@keyframes ctx-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.ctx-menu button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 11px;
  border: none;
  background: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.ctx-menu button svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; transition: color 0.12s; }
.ctx-menu button:hover { background: var(--row-hover); }
.ctx-menu button:hover svg { color: var(--primary); }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu button.danger svg { color: var(--danger); }
.ctx-menu button.danger:hover { background: var(--danger-soft); }

/* ============================================================
   Barra de seleccion
   ============================================================ */
.sel-bar {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: rgba(28, 28, 34, 0.92);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  z-index: 1100;
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  animation: sel-in 0.16s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes sel-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.sel-bar .btn { margin: 0; }

.empty {
  grid-column: 1 / -1;
  padding: 80px 20px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty .empty-icon { font-size: 42px; margin-bottom: 14px; opacity: 0.6; filter: grayscale(1) brightness(1.6); }
.empty .empty-title { font-size: 16px; font-weight: 600; color: var(--text-soft); margin-bottom: 5px; }
.empty .empty-sub { font-size: 13px; }

/* Skeleton de carga */
.skeleton {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.skeleton .sk-thumb {
  width: 100%;
  height: 84px;
  border-radius: 10px;
  margin-bottom: 13px;
  background: linear-gradient(90deg, #1a1a20 25%, #22222a 40%, #1a1a20 60%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}
.skeleton .sk-line {
  height: 12px;
  width: 70%;
  border-radius: 6px;
  background: linear-gradient(90deg, #1a1a20 25%, #22222a 40%, #1a1a20 60%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}
.skeleton .sk-line.sk-short { width: 45%; margin-top: 8px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============================================================
   Tablas (admin / compartir)
   ============================================================ */
.list-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow-xs);
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  white-space: nowrap;
}
.table th {
  background: var(--surface-soft);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.1s; }
.table tbody tr:hover { background: var(--row-hover); }
.table td { color: var(--text-soft); }
.table td:first-child { color: var(--text); font-weight: 500; }
.empty-row td { padding: 44px; text-align: center; color: var(--muted); }

/* ============================================================
   Subidas
   ============================================================ */
.uploads { margin-top: 22px; display: flex; flex-direction: column; gap: 9px; }
.upload-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 15px;
  font-size: 13px;
  box-shadow: var(--shadow-xs);
  animation: card-in 0.16s ease-out;
}
.upload-item .up-head { display: flex; justify-content: space-between; margin-bottom: 8px; gap: 10px; }
.upload-item .up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.upload-item .up-pct { color: var(--muted); font-weight: 500; font-family: var(--font-mono); }
.progress { height: 5px; background: #2a2a31; border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, #ffb45c, #e08c1e); width: 0%; transition: width 0.18s; }
.progress.done > div { background: var(--success); }

/* ============================================================
   Modales
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 8, 0.65);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 90px 16px 16px;
  z-index: 1000;
  backdrop-filter: blur(8px);
  animation: fade-in 0.15s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  max-height: 82vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.18s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes modal-in {
  from { transform: translateY(12px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-wide { max-width: 700px; }
#preview-modal { max-width: 1000px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-close {
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 8px;
  transition: background 0.12s, color 0.12s;
}
.modal-close:hover { background: var(--row-hover); color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 14px; }
.modal-actions .btn { min-width: 96px; justify-content: center; }
.modal-note { margin: 6px 0 4px; font-size: 14px; }

.share-link-box { display: flex; gap: 9px; align-items: center; margin: 12px 0; }
.share-link-box input { flex: 1; margin: 0; }

.share-list-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  margin-bottom: 9px;
  background: var(--bg-deep);
  transition: border-color 0.13s;
}
.share-list-item:hover { border-color: var(--border-strong); }
.share-list-item .sl-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; font-size: 13px; gap: 8px; }
.share-list-item .sl-link { display: flex; gap: 7px; align-items: center; }
.share-list-item .sl-link input { margin: 0; font-size: 12px; font-family: var(--font-mono); background: var(--surface); }

/* Pagina "Mis enlaces" */
.share-list { display: flex; flex-direction: column; gap: 12px; }
.share-card-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.14s, box-shadow 0.14s;
  animation: card-in 0.2s ease-out;
}
.share-card-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.sc-icon {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120px 60px at 50% 0%, rgba(240, 164, 58, 0.06), transparent 70%), var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 22px;
}
.sc-icon .sc-emoji { filter: grayscale(1) brightness(1.75); opacity: 0.9; }
.sc-icon.folder .sc-emoji { filter: grayscale(1) sepia(1) saturate(4) hue-rotate(-12deg) brightness(1.25); opacity: 1; }
.sc-main { flex: 1; min-width: 0; }
.sc-name {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sc-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.sc-url { display: flex; align-items: center; gap: 8px; margin-top: 11px; flex-wrap: wrap; }
.sc-url input {
  margin: 0;
  flex: 1;
  min-width: 200px;
  font-size: 12.5px;
  font-family: var(--font-mono);
  background: var(--bg-deep);
}

/* ============================================================
   Preview
   ============================================================ */
#preview-body img {
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  padding: 8px;
}
#preview-body .pv-media {
  width: 100%;
  max-height: 72vh;
  border-radius: var(--radius-sm);
  background: #000;
  border: 1px solid var(--border);
}
#preview-body audio.pv-media { height: 60px; background: var(--surface-soft); }
#preview-body .pv-none {
  text-align: center;
  padding: 46px 20px;
  color: var(--muted);
}
#preview-body .pv-none-icon { font-size: 46px; margin-bottom: 14px; filter: grayscale(1) brightness(1.6); }
#preview-body .pv-none-title { font-size: 16px; font-weight: 600; color: var(--text-soft); margin-bottom: 5px; }
#preview-body .pv-none p { margin: 4px 0; font-size: 13px; }
.preview-meta {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 15px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
}
#preview-body pre {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 15px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  overflow: auto;
  max-height: 50vh;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-soft);
}

/* ============================================================
   Admin
   ============================================================ */
.admin-main { padding: 30px 34px 56px; max-width: 1120px; }
.admin-main section { margin-bottom: 40px; }
.admin-main h2 { font-size: 17px; margin-bottom: 16px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    padding: 14px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-brand { padding-bottom: 12px; }
  .user-card { margin-bottom: 12px; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-nav .logout { margin-top: 0; margin-left: auto; }
  .content, .admin-main { padding: 18px; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 11px; }
  .topbar { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .topbar .crumbs { flex-basis: 100%; order: 2; }
  .topbar-search { max-width: none; flex: 1; }
  .view-toggle { flex-shrink: 0; }
}
