/* ══════════════════════════════════════════════════════════════
   INSTAGRAM CASERO — DARK / LIGHT THEME
   ══════════════════════════════════════════════════════════════ */

/* ── Theme tokens ─────────────────────────────────────────────── */
:root {
  --bg:           #000000;
  --bg2:          #000000;
  --surface:      #000000;
  --sidebar-bg:   #000000;
  --card:         #0a0a0f;
  --panel:        #000000;
  --text:         #e4e4ed;
  --text-soft:    #9898b0;
  --muted:        #50506a;
  --line:         transparent;
  --line-hard:    #1e1e2e;
  --accent:       #6c8cff;
  --accent-dk:    #5570e0;
  --accent-lt:    rgba(108,140,255,0.12);
  --accent-glow:  rgba(108,140,255,0.2);
  --amber:        #f0a030;
  --danger:       #f87171;
  --danger-dk:    #dc2626;
  --success:      #4ade80;
  --radius-sm:    6px;
  --radius-md:    10px;
  --radius-lg:    14px;
  --radius-xl:    20px;
  --shadow-sm:    0 1px 4px rgba(0,0,0,0.4);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.6);
  --t:            0.2s cubic-bezier(0.4,0,0.2,1);
  --font:         -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bottom-nav-h: 52px;
  color-scheme:   dark;
}

[data-theme="light"] {
  --bg:           #f4f4f8;
  --bg2:          #eeeef4;
  --surface:      #ffffff;
  --sidebar-bg:   #fafafe;
  --card:         #ffffff;
  --panel:        rgba(255,255,255,0.98);
  --text:         #1a1a2e;
  --text-soft:    #4a4a6a;
  --muted:        #8888a8;
  --line:         rgba(0,0,0,0.06);
  --line-hard:    rgba(0,0,0,0.12);
  --accent:       #4c6ef5;
  --accent-dk:    #3b5bdb;
  --accent-lt:    rgba(76,110,245,0.1);
  --accent-glow:  rgba(76,110,245,0.15);
  --danger:       #dc2626;
  --danger-dk:    #991b1b;
  --shadow-sm:    0 1px 4px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.05);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.13);
  color-scheme:   light;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80vw 50vh at 50% 0%, var(--bg2) 0%, transparent 70%);
  overflow: hidden;
}

body.auth-locked {
  overflow: hidden;
}

/* ── Scrollbars ─────────────────────────────────────────────────── */
::-webkit-scrollbar              { width: 4px; height: 4px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: var(--line-hard); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover  { background: var(--muted); }

/* ── App shell ──────────────────────────────────────────────────── */
.app-shell {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: row;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR (escritorio)
   ═══════════════════════════════════════════════════════════════ */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.45rem 0.4rem 0.45rem;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  gap: 0.25rem;
  height: 100vh;
  width: 200px;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  overflow: hidden;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--accent);
  padding: 0.2rem 0.4rem 0.4rem;
  margin-bottom: 0.15rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
}

.sidebar-categories {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  min-height: 0;
}

/* Category row */
.category-row {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: row;
  flex-direction: row;
  -webkit-align-items: center;
  align-items: center;
  gap: 0.15rem;
}

.category-inspect-btn {
  width: 20px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 0.65rem;
  cursor: pointer;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  transition: color var(--t);
  flex-shrink: 0;
  opacity: 0.5;
}
.category-inspect-btn:hover { color: var(--accent); opacity: 1; }

.category-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Sidebar footer ─────────────────────────────────────────────── */
.sidebar-footer {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0 0.15rem;
  margin-top: auto;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

.sidebar-action {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sidebar-action:hover { color: var(--text); }

.sidebar-action .gear-svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  transition: transform 0.4s ease;
}

.sidebar-action:hover .gear-svg {
  transform: rotate(45deg);
}

.action-toast {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent);
  min-height: 1rem;
  transition: opacity var(--t);
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════════
   FEED WRAPPER + VIDEO PANEL
   ═══════════════════════════════════════════════════════════════ */
.feed-wrapper {
  display: -webkit-flex;
  display: flex;
  -webkit-flex: 1;
  flex: 1;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-align-items: stretch;
  align-items: stretch;
  padding: 8px;
  overflow: hidden;
  height: 100vh;
  min-width: 0;
}

.video-panel {
  width: min(560px, 100%);
  height: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--line);
  position: relative;
}

[data-theme="dark"] .video-panel {
  box-shadow:
    var(--shadow-lg),
    0 0 60px rgba(20,224,200,0.04);
}

.video-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  position: relative;
}

/* ── Video display ──────────────────────────────────────────────── */
.video-display {
  height: 100%;
  overflow: hidden;
  background: #000;
  position: relative;
  border-radius: var(--radius-xl);
}

.video-area,
.video-card {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}


/* Suprimir controles nativos de video en iOS Safari */
video::-webkit-media-controls,
video::-webkit-media-controls-enclosure,
video::-webkit-media-controls-panel { display: none !important; }
.video-card video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
  pointer-events: none;
}

/* Overlay transparente que captura taps y swipes en mobile sin que el
   elemento <video> intercepte los eventos touch */
.video-touch-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: pointer;
}

/* ── Barra de progreso ───────────────────────────────────────────── */
.video-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: transparent;
  cursor: pointer;
  z-index: 5;
}
.video-progress::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: rgba(255,255,255,0.15);
}

.video-progress-fill {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  width: 0%;
  background: rgba(255,255,255,0.88);
  pointer-events: none;
}

/* Loader */
.video-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  border-radius: inherit;
}
.video-loader.active { opacity: 1; }
.video-loader span {
  width: 38px; height: 38px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

/* Feed note — bottom pill */
.feed-note {
  height: 28px;
  flex-shrink: 0;
  font-size: 0.73rem;
  color: var(--text-soft);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  border-top: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  letter-spacing: 0.01em;
}

/* ═══════════════════════════════════════════════════════════════
   CONTROLS COLUMN (Premium Glassmorphic Floating TikTok-Style)
   ═══════════════════════════════════════════════════════════════ */
.controls-column {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  gap: 1.1rem;
  z-index: 10;
  pointer-events: none; /* Let clicks pass through empty spaces */
  width: auto;
}

.controls-column > * {
  pointer-events: auto; /* Re-enable pointer events on interactive controls */
}

/* ── Nav arrows ─────────────────────────────────────────────────── */
.nav-arrows {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  gap: 0.65rem;
  width: auto;
  order: 4;
  margin-top: 1.8rem;
}

.nav-arrow {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 0;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.nav-arrow::before {
  content: '';
  display: block;
  width: 18px;
  height: 18px;
  transition: all 0.25s ease;
}

#prev-video::before {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'/%3E%3C/svg%3E") no-repeat center/contain;
}

#prev-video:hover:not(:disabled)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2314e0c8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'/%3E%3C/svg%3E");
}

#next-video::before {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat center/contain;
}

#next-video:hover:not(:disabled)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2314e0c8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.nav-arrow:hover:not(:disabled) {
  background: rgba(20, 224, 200, 0.25);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
  transform: scale(1.1);
}

.nav-arrow:active:not(:disabled) {
  transform: scale(0.9);
  box-shadow: none;
}

.nav-arrow:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* ── Rating ─────────────────────────────────────────────────────── */
.rating-row {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: auto;
  order: 1;
}

.mood-button {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 1.35rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.mood-button:hover {
  background: rgba(20, 224, 200, 0.25);
  border-color: var(--accent);
  transform: scale(1.1);
  box-shadow: 0 0 16px var(--accent-glow);
}

.mood-button:active {
  transform: scale(0.9);
}

.mood-button.filled {
  color: var(--accent) !important;
  background: rgba(20, 224, 200, 0.35);
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* ── Play & Sound ───────────────────────────────────────────────── */
.sound-section {
  width: auto;
  order: 3;
}

.sound-button {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 0 !important;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.sound-button::before {
  content: '';
  display: block;
  width: 20px;
  height: 20px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'/%3E%3Cline x1='23' y1='9' x2='17' y2='15'/%3E%3Cline x1='17' y1='9' x2='23' y2='15'/%3E%3C/svg%3E") no-repeat center/contain;
  transition: background-image 0.25s ease;
}

.sound-button:hover::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2314e0c8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'/%3E%3Cline x1='23' y1='9' x2='17' y2='15'/%3E%3Cline x1='17' y1='9' x2='23' y2='15'/%3E%3C/svg%3E");
}

.sound-button.active::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'/%3E%3Cpath d='M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07'/%3E%3C/svg%3E");
}

.sound-button.active:hover::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2314e0c8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'/%3E%3Cpath d='M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07'/%3E%3C/svg%3E");
}

.sound-button:hover {
  background: rgba(20, 224, 200, 0.25);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.1);
  box-shadow: 0 0 16px var(--accent-glow);
}

.sound-button:active {
  transform: scale(0.9);
}


/* ═══════════════════════════════════════════════════════════════
   SETTINGS PANEL
   ═══════════════════════════════════════════════════════════════ */
.settings-panel {
  position: fixed;
  top: 0; right: 0;
  width: min(380px, 96vw);
  height: 100vh;
  transform: translateX(105%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  border-left: 1px solid var(--line);
  background: var(--surface);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
  z-index: 50;
  box-shadow: -12px 0 48px rgba(0,0,0,0.4);
}
.settings-panel.open { transform: translateX(0); }

.settings-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.65rem;
  background: var(--surface);
  margin: -1rem -1rem 0;
  padding: 1rem 1rem 0.65rem;
}

.close-button {
  width: 32px; height: 32px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-soft);
  transition: background var(--t), color var(--t), border-color var(--t);
}
.close-button:hover { background: rgba(248,113,113,0.12); color: var(--danger); border-color: var(--danger); }

/* ── Settings tabs ───────────────────────────────────────────── */
.settings-tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0.75rem 0 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}
.settings-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.45rem 0.25rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--t), border-color var(--t);
  border-radius: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.settings-tab:hover { color: var(--text); }
.settings-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.settings-tab-panel { display: none; padding-top: 0.85rem; }
.settings-tab-panel.active { display: block; }

.settings-panel form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.settings-panel label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.settings-panel input,
.settings-panel textarea,
.gallery-select {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.83rem;
  padding: 0.42rem 0.55rem;
  transition: border-color var(--t);
}
.settings-panel input:focus,
.settings-panel textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2.5px var(--accent-lt);
}

.settings-panel button,
.gallery-button {
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dk) 100%);
  color: #000;
  font: inherit;
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.42rem 0.65rem;
  transition: filter var(--t), transform var(--t);
}
.settings-panel button:hover,
.gallery-button:hover { filter: brightness(1.1); }
.settings-panel button:active { transform: scale(0.97); }

#delete-category-button {
  background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dk) 100%);
  color: #fff;
}

.notification {
  font-size: 0.76rem;
  color: var(--text-soft);
  min-height: 0.9rem;
}

/* ── Auth overlay ─────────────────────────────────────────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  background:
    radial-gradient(circle at top, rgba(20,224,200,0.16), transparent 32%),
    radial-gradient(circle at bottom right, rgba(248,113,113,0.16), transparent 28%),
    rgba(4, 8, 16, 0.94);
  backdrop-filter: blur(12px);
}
.auth-overlay.open { display: flex; }
.auth-card {
  width: min(420px, 100%);
  border: 1px solid var(--line-hard);
  border-radius: calc(var(--radius-lg) + 2px);
  background: linear-gradient(180deg, rgba(15,23,42,0.98), rgba(7,12,24,0.98));
  box-shadow: 0 28px 70px rgba(0,0,0,0.55);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.auth-brand {
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.auth-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.auth-form label {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.auth-form input {
  border: 1px solid var(--line-hard);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  padding: 0.62rem 0.7rem;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2.5px var(--accent-lt);
}
.auth-form button {
  margin-top: 0.2rem;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dk) 100%);
  color: #000;
  font: inherit;
  font-weight: 900;
  padding: 0.62rem 0.8rem;
  cursor: pointer;
}
.auth-feedback {
  min-height: 1rem;
}

/* ── Session tools ───────────────────────────────────────────── */
.session-panel {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.session-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.session-row span {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
}
.session-row button {
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dk) 100%);
  color: #fff;
  font-weight: 800;
  padding: 0.44rem 0.7rem;
  cursor: pointer;
}
.session-panel form {
  padding: 0;
  background: transparent;
  border: 0;
}

/* ── Upload dropzone ───────────────────────────────────────────── */
.upload-dropzone {
  position: relative;
  border: 2px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  cursor: pointer;
  transition: border-color var(--t), background var(--t), transform var(--t);
}
.upload-dropzone:hover { border-color: var(--accent); }
.upload-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-lt);
  transform: translateY(-1px);
}
.upload-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.upload-dropzone-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.9rem;
}
.upload-dropzone-text strong { font-size: 1rem; }
.upload-dropzone-hint {
  font-size: 0.8rem;
  color: var(--muted);
}
.upload-progress {
  margin-top: 0.35rem;
  position: relative;
  background: var(--card);
  border-radius: 999px;
  height: 10px;
  border: 1px solid var(--line);
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dk));
  transition: width 0.2s ease-out;
}
.upload-progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--text-soft);
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════
   CATEGORY MODAL
   ═══════════════════════════════════════════════════════════════ */
.category-modal,
.playlist-modal,
.playlist-videos-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 1rem;
  backdrop-filter: blur(6px);
}
.category-modal.open,
.playlist-modal.open,
.playlist-videos-modal.open { display: flex; }

/* ── Playlist modal card (reutiliza category-modal-card) ─────── */
.playlist-modal-card {
  width: min(600px, 96vw);
  max-height: 88vh;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.playlist-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.65rem;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 0.95rem;
  background: var(--surface);
  flex-shrink: 0;
}
.playlist-create-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem 0;
  flex-shrink: 0;
}
.playlist-create-row input {
  flex: 1;
  font-size: 0.82rem;
  padding: 0.38rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
}
.playlist-create-row button {
  font-size: 0.8rem;
  padding: 0.38rem 0.9rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: filter var(--t);
}
.playlist-create-row button:hover { filter: brightness(1.15); }
.playlist-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1rem 1rem;
}
.playlist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}
.playlist-row:last-child { border-bottom: none; }
.playlist-row.muted,
.playlist-row.error { color: var(--muted); font-size: 0.8rem; justify-content: flex-start; }
.playlist-row-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.playlist-row-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.playlist-row-count { font-size: 0.7rem; color: var(--muted); }
.playlist-row-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}
.playlist-btn {
  font-size: 0.72rem;
  padding: 0.22rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: background var(--t);
}
.playlist-btn:hover { background: var(--surface-2, var(--card)); filter: brightness(1.1); }
.playlist-btn-danger { border-color: var(--danger); color: var(--danger); }
.playlist-btn-danger:hover { background: rgba(248,113,113,0.1); }
.playlist-btn-add { border-color: var(--accent); color: var(--accent); }
.playlist-btn-add:hover { background: var(--accent-lt, rgba(79,195,247,0.12)); }

.category-modal-card {
  width: min(1600px, 96vw);
  height: 90vh;
  max-height: 90vh;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.category-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line);
}
.category-modal-header strong { font-size: 0.95rem; }

#category-modal-search {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.42rem 0.65rem;
  font: inherit;
  font-size: 0.83rem;
  width: 100%;
  background: var(--card);
  color: var(--text);
}
#category-modal-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2.5px var(--accent-lt);
}

.category-modal-fav-filter {
  font-size: 0.78rem;
  color: var(--muted);
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  cursor: pointer;
}

.category-modal-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  align-items: stretch;
  gap: 0.55rem;
  padding-right: 0.2rem;
}

/* ═══════════════════════════════════════════════════════════════
   FAVORITES GRID — Clean cards, selection mode
   ═══════════════════════════════════════════════════════════════ */

.category-modal-list.fav-grid {
  grid-template-columns: repeat(auto-fill, minmax(67px, 1fr));
  gap: 0.5rem;
  align-content: start;
  padding-bottom: 1rem;
}

/* Alto derivado del ancho vía padding-top (9:16 = 177.78%), no de
   aspect-ratio: ese calculo depende solo del ancho ya resuelto por el
   grid, sin importar cuantas filas/items haya -- evita la dependencia
   circular ancho-columna<->alto-fila que aspect-ratio + align-items:
   stretch produce en grids con auto-fill/1fr. */
.fav-grid-card {
  position: relative;
  width: 100%;
  height: 0;
  padding-top: 177.78%;
  border: 2px solid transparent;
  border-radius: 4px;
  background: var(--card);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.fav-grid-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-hard);
}

.fav-grid-card:active {
  transform: translateY(-1px);
}

.gallery-inline-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
}

.fav-grid-card-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--bg);
}

/* ── Pagination ────────────────────────────────────────────────── */
.gallery-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.75rem 0.5rem 0.25rem;
  flex-wrap: wrap;
}

.gallery-page-btn {
  min-width: 32px;
  height: 30px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0 6px;
}

.gallery-page-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.gallery-page-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
}

.gallery-page-btn:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.gallery-page-info {
  font-size: 0.7rem;
  color: var(--text-soft);
  margin: 0 0.35rem;
}

/* ── Inline video player in gallery ───────────────────────────── */
.gallery-inline-player {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #000;
  display: none;
  z-index: 2;
  border-radius: 0;
}

.gallery-inline-player.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-inline-player video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* Hover overlay — actions */
.fav-grid-card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 6px;
  pointer-events: none;
  z-index: 3;
}

.fav-grid-card:hover .fav-grid-card-overlay,
.fav-grid-card:focus-within .fav-grid-card-overlay {
  opacity: 1;
}

/* Checkbox para modo selección */
.fav-grid-card-checkbox {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.45);
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  pointer-events: none;
}

.fav-grid-card.selectable .fav-grid-card-checkbox {
  opacity: 1;
}

.fav-grid-card.selectable:hover .fav-grid-card-checkbox {
  border-color: var(--accent);
  background: rgba(20,224,200,0.15);
}

.fav-grid-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-lt), var(--shadow-sm);
}

.fav-grid-card.selected .fav-grid-card-checkbox {
  opacity: 1;
  background: var(--accent);
  border-color: var(--accent);
}

.fav-grid-card.selected .fav-grid-card-checkbox::after {
  content: '✓';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #000;
  font-size: 0.7rem;
  font-weight: 900;
}

/* Reordenar arrastrando (solo galerías con allowReorder, ej. playlists) */
.fav-grid-card[draggable="true"] {
  cursor: grab;
}
.fav-grid-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

/* Wrapper del botón Seleccionar + buscador — siempre visible debajo de la grid */
.fav-select-mode-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem 0;
}
.fav-select-mode-wrap #category-modal-search {
  flex: 1;
  min-width: 0;
}

/* Botón "Seleccionar" */
.fav-select-btn {
  font-size: 0.72rem;
  padding: 0.22rem 0.65rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  font-weight: 700;
  white-space: nowrap;
}

.fav-select-btn:hover {
  background: var(--accent-lt);
}

/* Toolbar inferior para modo selección */
.fav-selection-toolbar {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0 0;
  border-top: 1px solid var(--line);
  margin-top: 0.15rem;
  flex-shrink: 0;
}

#fav-selected-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  min-width: 6rem;
}

#fav-playlist-select {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
}

#fav-add-to-playlist-btn {
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #000;
  font-weight: 800;
  cursor: pointer;
  transition: filter 0.2s ease;
  white-space: nowrap;
}

#fav-add-to-playlist-btn:hover:not(:disabled) {
  filter: brightness(1.15);
}

#fav-add-to-playlist-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.fav-cancel-btn {
  font-size: 0.72rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.fav-cancel-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* ── Category card overlay (gallery + playlist) ──────────────────── */
.cat-card-action-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  pointer-events: auto;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.15s ease;
}

.cat-card-action-btn:hover {
  transform: scale(1.15);
}

/* ── Misc ───────────────────────────────────────────────────────── */
.placeholder { color: var(--muted); font-size: 0.85rem; letter-spacing: 0.03em; }

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

/* Focus ring */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (641px – 1080px)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: auto;
  }
  body { overflow: auto; }

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 0.45rem 0.7rem;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 40;
    gap: 0.4rem;
    backdrop-filter: blur(12px);
  }

  .sidebar-brand { font-size: 0.95rem; flex-shrink: 0; }

  .sidebar-categories {
    flex-direction: row;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0;
  }

  .category-row { grid-template-columns: 0 auto; }
  .category-inspect-btn { display: none; }

  .sidebar-footer { display: none; }

  .feed-wrapper { padding: 0.5rem; height: calc(100vh - 52px); }
  .video-panel { width: 100%; height: 100%; }
}


/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — MÓVIL (≤ 640px)
   DISEÑO: Pantalla completa + controles superpuestos + nav inferior
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  body { overflow: hidden; }

  /* ── App shell: columna, altura dinámica ── */
  .app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height para móvil */
    grid-template-columns: unset;
    overflow: hidden;
  }

  /* ── Sidebar → Nav inferior ─────────────────────── */
  .sidebar {
    order: 2;
    flex-shrink: 0;
    flex-direction: row;
    align-items: center;
    padding: 0 6px;
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 6px);
    height: auto;
    min-height: var(--bottom-nav-h);
    border-right: none;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: none;
    z-index: 40;
    gap: 0;
    position: relative;
    top: unset;
    backdrop-filter: none;
  }

  .sidebar-brand { display: none; }

  .sidebar-categories {
    flex-direction: row;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 0;
    /* Ocultar barra de desplazamiento pero mantener funcionalidad */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .sidebar-categories::-webkit-scrollbar { display: none; }

  .sidebar-footer { display: none; }

  /* Category pills en el nav inferior */
  .category-row { grid-template-columns: 0 auto; }
  .category-inspect-btn { display: none; }

  /* Botones de sidebar-controls: touch targets mínimos 44px */
  .sidebar-action {
    width: 40px;
    height: 40px;
    border-radius: 50%;
  }

  /* ── Feed: ocupa todo el espacio disponible ── */
  .feed-wrapper {
    order: 1;
    flex: 1;
    min-height: 0;
    padding: 0;
    height: auto;
    align-items: stretch;
    justify-content: stretch;
  }

  .video-panel {
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
    box-shadow: none;
    background: #000;
  }

  /* ── Video stage: video ocupa todo, controles superpuestos ── */
  .video-stage {
    grid-template-columns: 1fr; /* Controls sale del grid */
    height: 100%;
  }

  .video-display {
    border-radius: 0;
    height: 100%;
  }

  /* ── Controles: panel superpuesto encima del video ── */
  .controls-column {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    z-index: 10;
    pointer-events: none; /* swipes pasan al video */
    /* Resetear flex del escritorio */
    justify-content: flex-start;
    align-items: stretch;
    gap: 0;
    overflow: visible;
  }

  /* Re-habilitar interacción en cada botón */
  .controls-column > * { pointer-events: auto; }

  /* ── Flechas de navegación: izquierda, centradas verticalmente ── */
  .nav-arrows {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
    gap: 10px;
    width: auto;
    margin: 0;
    order: unset;
  }

  .nav-arrow {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.78);
    border-color: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 2px 20px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.12);
  }
  .nav-arrow:hover:not(:disabled) {
    background: rgba(20, 224, 200, 0.25);
    border-color: var(--accent);
    box-shadow: 0 0 16px var(--accent-glow);
  }

  /* ── Rating: derecha, centrado verticalmente ── */
  .rating-row {
    position: absolute;
    right: 12px;
    top: 44%;
    transform: translateY(-50%);
    flex-direction: column;
    gap: 10px;
    width: auto;
    order: unset;
  }

  .mood-button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.55);
    font-size: 1.5rem;
    box-shadow: 0 2px 20px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.12);
  }
  .mood-button.filled {
    background: rgba(20, 224, 200, 0.25);
    box-shadow: inset 0 0 0 1.5px var(--accent);
  }

  /* ── Sonido: esquina superior derecha, icono ── */
  .sound-section {
    position: absolute;
    top: calc(env(safe-area-inset-top, 14px) + 6px);
    right: 12px;
    width: auto;
    order: unset;
  }

  .sound-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 2px 20px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.12);
    font-size: 0; /* ocultar texto */
    color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* ── Feed note: overlay encima de la barra de progreso ── */
  .feed-note {
    position: absolute;
    bottom: 20px; /* encima de la barra de progreso */
    left: 0;
    right: 0;
    z-index: 8;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 0;
    border-top: none;
    font-size: 0.7rem;
    height: auto;
    min-height: 0;
    padding: 5px 12px;
    pointer-events: none;
  }
  .feed-note:empty { display: none; }

  /* La barra de progreso se queda en el fondo */
  .video-progress { z-index: 9; }

  /* ── Panel de ajustes: pantalla completa en móvil ── */
  .settings-panel {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
  }

  /* ── Modal de categoría: pantalla completa en móvil ── */
  .category-modal {
    padding: 0;
    align-items: stretch;
  }
  .category-modal-card {
    width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
  }
  .category-modal-list {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .category-modal-list.fav-grid {
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 0.35rem;
  }

  .fav-selection-toolbar {
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  #fav-selected-count {
    font-size: 0.7rem;
    min-width: auto;
    width: 100%;
    text-align: center;
  }

  #fav-playlist-select {
    flex: 1;
    min-width: 80px;
    font-size: 0.72rem;
  }

  #fav-add-to-playlist-btn,
  .fav-cancel-btn {
    font-size: 0.7rem;
    padding: 0.3rem 0.55rem;
  }

} /* fin @media móvil */

/* === Category Tree Sidebar ============================================== */

#sidebar-total {
  font-size: 0.65rem;
  font-weight: 500;
}

#ingest-stats {
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--muted);
}

.gallery-row {
  font-size: 0.78rem;
  color: var(--text-soft);
  text-align: center;
  padding: 1rem 0;
}

.category-parent-row {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  margin: 1px 2px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--text-soft, #9898b8);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.category-parent-row:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.category-expand-icon {
  font-size: 9px;
  width: 12px;
  text-align: center;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  color: var(--muted, #55557a);
  transition: transform 0.2s;
}

.category-parent-label {
  -webkit-flex: 1;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-children {
  margin-left: 4px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding-left: 2px;
}

.category-children .category-row {
  padding-left: 12px;
}

.subcategory-pill {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  width: 100%;
  padding: 3px 6px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-soft, #9898b8);
  cursor: pointer;
  font-size: 0.68rem;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.subcategory-pill:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.subcategory-pill.active {
  background: var(--accent-lt);
  color: var(--accent);
}

.subcategory-pill .category-label {
  -webkit-flex: 1;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Quick controls en sidebar ───────────────────────────────────── */
.sidebar-quick-row {
  display: -webkit-flex;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

/* Cada fila ocupa el ancho completo */
.sidebar-quick-row-line {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.sidebar-quick-row select,
.sidebar-quick-row input {
  -webkit-flex: 1;
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.4rem;
  font-size: 0.78rem;
  border-radius: 6px;
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  background: var(--surface2, rgba(255,255,255,0.05));
  color: var(--text);
}

/* ── User management (Settings > Cuenta) ────────────────────────── */
#user-management {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border, rgba(255,255,255,0.08));
  padding-top: 1rem;
}

.users-list {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.user-row {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  background: var(--surface2, rgba(255,255,255,0.04));
  border-radius: 6px;
  font-size: 0.82rem;
}

.user-row-info {
  color: var(--text);
  -webkit-flex: 1;
  flex: 1;
}

.user-row-actions {
  display: -webkit-flex;
  display: flex;
  gap: 0.35rem;
}

.create-user-form {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.create-user-form input,
.create-user-form select {
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  background: var(--surface2, rgba(255,255,255,0.05));
  color: var(--text);
  font-size: 0.85rem;
}

/* ── Category management ─────────────────────────────────────── */
.cat-manage-row {
  display: flex; gap: 0.4rem; margin-bottom: 0.5rem; align-items: center;
}
.cat-manage-row select, .cat-manage-row input {
  flex: 1; padding: 0.4rem 0.6rem; border-radius: 6px;
  border: 1px solid var(--line-hard); background: var(--surface); color: var(--text); font-size: 0.85rem;
}
.cat-manage-actions {
  display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.6rem;
}
.cat-manage-actions button {
  padding: 0.35rem 0.65rem; border-radius: 6px; border: 1px solid var(--line-hard);
  background: var(--card); color: var(--text); font-size: 0.8rem; cursor: pointer;
}
.cat-manage-actions button:hover { border-color: var(--accent); }
.cat-manage-actions .danger-btn { border-color: var(--danger); color: var(--danger); }
.cat-manage-actions .danger-btn:hover { background: var(--danger); color: #fff; }

.tools-grid {
  display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem;
}
.tools-grid button {
  padding: 0.4rem 0.8rem; border-radius: 6px; border: 1px solid var(--line-hard);
  background: var(--card); color: var(--accent); font-size: 0.82rem; cursor: pointer;
}
.tools-grid button:hover { background: var(--accent-lt); }

/* ── Mobile: gallery card actions bigger touch targets ── */
@media (max-width: 600px) {
  .cat-card-action-btn {
    width: 36px; height: 36px; font-size: 1rem;
  }
  /* Sidebar: compact on mobile */
  .sidebar {
    width: 100vw; height: auto; flex-direction: row;
    padding: 0.4rem 0.6rem; gap: 0.4rem; overflow-x: auto;
    flex-shrink: 0; position: sticky; top: 0; z-index: 20;
  }
  .sidebar-brand { font-size: 0.85rem; white-space: nowrap; }
  .sidebar-footer { flex-direction: row; gap: 0.3rem; }
  .sidebar-action { width: 36px; height: 36px; }
}

/* ── Compact sidebar footer ──────────────────────────────────── */
.sidebar-footer-row {
  display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap;
}
.sidebar-footer-row .sidebar-action {
  font-size: 0.75rem; padding: 0.2rem 0.35rem; white-space: nowrap;
}
.sidebar-total {
  font-size: 0.7rem; color: var(--muted); padding: 0 0.3rem; white-space: nowrap;
}
.ingest-stats {
  font-size: 0.65rem; color: var(--muted); white-space: nowrap;
}
.sidebar-quick-row {
  display: flex; flex-direction: column; gap: 0.2rem; margin-top: 0.25rem;
}
.sidebar-quick-row-line {
  display: flex; gap: 0.2rem; align-items: center;
}
.sidebar-quick-row select, .sidebar-quick-row input {
  flex: 1; min-width: 0; padding: 0.2rem 0.3rem; font-size: 0.7rem;
  border-radius: 4px; border: 1px solid var(--line-hard);
  background: var(--surface); color: var(--text);
}
.sidebar-quick-row button {
  padding: 0.2rem 0.4rem; font-size: 0.7rem; white-space: nowrap;
  border-radius: 4px; border: 1px solid var(--line-hard);
  background: var(--card); color: var(--accent); cursor: pointer;
}
