/* ═══════════════════════════════════════════════════════════════
   COMPONENTES — Design System Desktop (basado en ui-audit)
   ═══════════════════════════════════════════════════════════════ */

/* ── Botones ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--r-md);
  font-family: var(--font); font-size: 13px; font-weight: 600;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); cursor: pointer;
  transition: filter .12s, background .12s, box-shadow .12s;
  white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--surface2); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--grad-primary); border: none; color: #fff;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover { background: var(--grad-primary); filter: brightness(1.1); box-shadow: var(--shadow-accent-hover); }

.btn-gradient-green-blue {
  background: linear-gradient(135deg, #30d158 0%, #0a84ff 100%) !important;
  border: none !important; color: #fff !important;
  box-shadow: 0 4px 14px rgba(48,209,88,.28) !important;
  text-decoration: none !important;
}
.btn-gradient-green-blue:hover {
  background: linear-gradient(135deg, #28be4f 0%, #0071e3 100%) !important;
  filter: brightness(1.08) !important;
  box-shadow: 0 6px 20px rgba(10,132,255,.42) !important;
  transform: translateY(-1px);
  color: #fff !important;
  text-decoration: none !important;
}

.btn-danger { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.3); color: var(--red-danger); }
.btn-danger:hover { background: rgba(239,68,68,.2); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted2); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }

.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 9px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: var(--r-md);
  background: transparent; border: 1px solid transparent;
  color: var(--muted2); cursor: pointer; transition: all .12s;
}
.icon-btn:hover { background: var(--surface); color: var(--text); border-color: var(--border); }
.icon-btn.danger:hover { background: rgba(239,68,68,.12); color: var(--red-danger); border-color: rgba(239,68,68,.3); }

/* ── Inputs ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block; font-size: 10px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.input, .select, .textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 9px 13px;
  color: var(--text); font-size: 13px; font-family: var(--font);
  outline: none; transition: border-color .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--red); }
.form-error { font-size: 11px; color: var(--red); margin-top: 5px; }

/* Switch */
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 99px;
  background: var(--surface2); border: 1px solid var(--border); transition: background .15s;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s;
}
.switch input:checked + .track { background: var(--green); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(18px); }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px;
}
.card-solid { background: var(--surface-solid); }

.card-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card-grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.card-grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
@media (min-width: 1024px) {
  .card-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .card-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .card-grid.cols-3 { grid-template-columns: 1fr; }
}
.card-grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* KPI / stat card */
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 14px; min-width: 0;
}
.stat-card .stat-value { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.stat-card .stat-label { font-size: 11px; color: var(--muted); margin-top: 2px; }
.stat-card .stat-icon { float: right; color: var(--muted); }

/* Category / access card (home, hubs) */
.cat-card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 18px;
  cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s;
  color: var(--text); position: relative; overflow: hidden;
}
.cat-card:hover { transform: translateY(-2px); border-color: var(--hint); text-decoration: none; box-shadow: var(--shadow-card); }
.cat-card .cat-icon {
  width: 42px; height: 42px; border-radius: var(--r-md);
  display: grid; place-items: center; color: #fff; flex-shrink: 0;
}
.cat-card .cat-title { font-size: 15px; font-weight: 700; }
.cat-card .cat-desc { font-size: 12px; color: var(--muted2); line-height: 1.4; }
.cat-card .cat-meta { font-size: 11px; color: var(--muted); margin-top: auto; }

/* Variante horizontal compacta (desktop: botones en fila, no cajas grandes) */
.cat-card-h {
  display: flex; flex-direction: row; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 10px 14px;
  cursor: pointer; transition: border-color .12s, background .12s;
  color: var(--text); text-align: left;
}
.cat-card-h:hover { border-color: var(--hint); background: var(--surface2); text-decoration: none; }
.cat-card-h .cat-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; color: #fff; flex-shrink: 0;
}
.cat-card-h .cat-body { flex: 1; min-width: 0; }
.cat-card-h .cat-title { font-size: 13px; font-weight: 700; }
.cat-card-h .cat-desc {
  font-size: 11px; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.cat-card-h .cat-arrow { color: var(--muted); flex-shrink: 0; }
.cat-grid-h { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ── Secciones con título estilo PWA (Tendencias, Mundos…) ────── */
.desc-section { margin-bottom: 28px; }
.desc-section-title {
  font-size: 17px; font-weight: 800; color: var(--text);
  margin: 6px 0 14px; display: flex; align-items: center; gap: 10px;
}
.desc-section-title::before {
  content: ''; width: 4px; height: 20px; border-radius: 3px;
  background: var(--accent); flex-shrink: 0;
}
.desc-section-title::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
}

/* Cat-cards con imagen de fondo (Tendencias / Mundos / Infinito) */
.cat-img-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.cat-img-card {
  position: relative; aspect-ratio: 3/4; border-radius: 14px;
  overflow: hidden; cursor: pointer; background: var(--surface);
  border: 1px solid var(--border);
  transition: transform .18s, box-shadow .18s;
}
.cat-img-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); }
.cat-img-card .cc-bg {
  position: absolute; inset: 0; background-size: cover; background-position: center;
}
.cat-img-card .cc-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  justify-content: flex-end; padding: 12px;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.82));
}
.cat-img-card .cc-title { font-size: 14px; font-weight: 800; color: #fff; }
.cat-img-card .cc-sub { font-size: 11px; color: rgba(255,255,255,.75); margin-top: 2px; }
.cat-img-card .cc-dots {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0,0,0,.45); color: #fff; font-size: 16px;
  cursor: pointer; backdrop-filter: blur(6px); border: none;
}
.cat-img-card .cc-dots:hover { background: rgba(0,0,0,.65); }

/* ── Saludo fiel PWA (sf-greeting) ───────────────────────────── */
.sf-greeting { padding: 8px 4px 6px; flex-shrink: 0; margin-bottom: 16px; }
.sf-greeting-hello { font-size: 26px; font-weight: 800; letter-spacing: -.4px; color: var(--text); line-height: 1.15; }
.sf-greeting-name {
  background: linear-gradient(90deg, #0a84ff, #30d158);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.sf-greeting-sub { font-size: 13.5px; color: var(--muted); margin-top: 4px; font-weight: 500; }

/* ── Hero slider (tendencias, como la PWA) ────────────────────── */
.hero-slider {
  position: relative; width: 100%; aspect-ratio: 24/7; min-height: 220px;
  overflow: hidden; border-radius: var(--r-xl); background: #0c0f17;
  border: 1px solid var(--border); cursor: pointer;
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
}
.hero-slide {
  position: absolute; inset: 0; opacity: 0; transition: opacity .6s ease;
  pointer-events: none;
}
.hero-slide.active { opacity: 1; pointer-events: auto; }
.hero-slide-bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.hero-slide-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.1) 0%, rgba(0,0,0,.35) 40%, rgba(5,7,12,.92) 100%);
}
.hero-slide-content {
  position: absolute; left: 24px; right: 60px; bottom: 20px;
  display: flex; flex-direction: column; gap: 4px; z-index: 2;
}
.hero-slide-badge {
  align-self: flex-start; font-size: 10.5px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  background: rgba(10,132,255,.3); border: 1px solid rgba(10,132,255,.5);
  color: #fff; border-radius: 99px; padding: 2.5px 11px; backdrop-filter: blur(10px);
}
.hero-slide-title { font-size: 25px; font-weight: 800; color: #fff; letter-spacing: -.4px; line-height: 1.2; text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.hero-slide-desc { font-size: 13px; color: rgba(255,255,255,.8); max-width: 720px; text-shadow: 0 1px 4px rgba(0,0,0,.7); }

.hero-pb-row {
  position: absolute; top: 12px; left: 16px; right: 16px;
  display: flex; gap: 6px; z-index: 3;
}
.hero-pb { flex: 1; height: 3.5px; border-radius: 99px; background: rgba(255,255,255,.22); overflow: hidden; }
.hero-pb-fill { height: 100%; width: 0; background: #fff; border-radius: 99px; }

/* Controles manuales de navegación para el slider */
.hero-nav-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 4;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,.45); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.18); color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity .2s, background .2s, transform .2s;
}
.hero-slider:hover .hero-nav-arrow { opacity: 1; }
.hero-nav-arrow:hover { background: rgba(0,0,0,.8); transform: translateY(-50%) scale(1.08); border-color: rgba(255,255,255,.35); }
.hero-nav-arrow.prev { left: 14px; }
.hero-nav-arrow.next { right: 14px; }

/* ── Hero Cards de Serie (estilo cinemático con degradado superior) ── */
.serie-hero-box {
  display: block; position: relative; border-radius: var(--r-xl);
  overflow: hidden; border: 1px solid var(--border); aspect-ratio: 16/9;
  background: #0c0f17; box-shadow: 0 8px 24px rgba(0,0,0,.35);
  text-decoration: none; color: inherit;
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.serie-hero-box:hover {
  transform: translateY(-3px);
  border-color: var(--hint);
  box-shadow: 0 14px 34px rgba(0,0,0,.55);
}
.serie-hero-box img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s ease;
}
.serie-hero-box:hover img {
  transform: scale(1.04);
}
.serie-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.38) 45%, rgba(5,7,12,0.95) 100%);
  z-index: 2;
  pointer-events: none;
}
.serie-hero-content {
  position: absolute; left: 18px; right: 18px; bottom: 14px; z-index: 3;
  display: flex; flex-direction: column; gap: 4px; pointer-events: none;
}
.serie-hero-title {
  font-size: 18px; font-weight: 800; color: #fff; letter-spacing: -.35px;
  line-height: 1.22; margin: 0; text-shadow: 0 2px 10px rgba(0,0,0,.85);
}
.serie-hero-desc {
  font-size: 12.5px; color: rgba(255,255,255,.84); margin: 0; line-height: 1.38;
  text-shadow: 0 1px 4px rgba(0,0,0,.85);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ── Categorías y Burbujas (PWA Mode Selector Fiel) ──────────── */
.ms-cat-header {
  padding: 24px 4px 10px; display: flex; align-items: center; justify-content: space-between;
}
.ms-cat-title {
  font-size: 18px; font-weight: 800; letter-spacing: -.4px; color: var(--text);
}
.ms-cat-scroll {
  display: flex; gap: 14px; overflow-x: auto; padding: 4px 4px 16px;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.cat-bub-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; flex-shrink: 0; width: 100px;
  background: none; border: none; padding: 0; font-family: inherit; color: inherit;
  text-decoration: none; transition: transform .14s ease;
}
.cat-bub-wrap:hover { transform: translateY(-3px); text-decoration: none; }
.cat-bub-wrap:active { transform: scale(.95); }
.cat-bub {
  width: 100px; height: 72px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.45);
  transition: transform .12s, box-shadow .12s;
  position: relative; overflow: hidden; background-size: cover; background-position: center;
}
.cat-bub-em {
  font-size: 30px; line-height: 1; position: relative; z-index: 1;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,.5));
}
.cat-bub-lbl {
  font-size: 11.5px; font-weight: 700; color: var(--text);
  text-align: center; line-height: 1.25; max-width: 100px;
  padding: 0 2px;
}

/* ── Secciones En Curso estilo PWA ───────────────────────────── */
.pwa-sec-wrap { margin-top: 18px; margin-bottom: 24px; }
.pwa-sec-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 0 4px;
}
.pwa-sec-title {
  font-size: 18px; font-weight: 800; letter-spacing: -.4px; color: var(--text); flex-shrink: 0;
}
.pwa-sec-line {
  flex: 1; height: 2px; border-radius: 2px;
}
.pwa-sec-all {
  font-size: 12px; font-weight: 700; cursor: pointer; flex-shrink: 0;
  text-decoration: none; transition: opacity .15s;
}
.pwa-sec-all:hover { opacity: .8; text-decoration: underline; }

.pwa-sec-row {
  display: flex; gap: 14px; overflow-x: auto; padding: 4px 4px 12px;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.pwa-card-item {
  flex-shrink: 0; width: 220px; cursor: pointer; border-radius: 13px;
  overflow: hidden; border: 1px solid var(--border); background: var(--surface);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.pwa-card-item:hover {
  transform: translateY(-3px); border-color: var(--hint);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.pwa-card-thumb {
  height: 140px; position: relative; overflow: hidden; display: flex;
  align-items: center; justify-content: center; background: #111;
}
.pwa-card-thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.pwa-card-badge {
  position: absolute; bottom: 8px; left: 8px; font-size: 10px; font-weight: 700;
  color: #fff; border-radius: 5px; padding: 2px 7px; z-index: 2;
}
.pwa-card-auto {
  position: absolute; top: 6px; right: 6px; display: flex; align-items: center;
  background: linear-gradient(135deg,#30d158,#0a84ff); border-radius: 6px;
  padding: 2px 6px; font-size: 14px; font-weight: 800; color: #fff;
  backdrop-filter: blur(10px); box-shadow: 0 2px 6px rgba(0,0,0,.7); z-index: 2;
}
.pwa-card-foot {
  padding: 8px 10px; background: rgba(128,128,128,.1); border-top: 1px solid var(--border);
}
.pwa-card-name {
  font-size: 11.5px; font-weight: 600; color: var(--text); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}



/* ── Tablas ───────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
}
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 10px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0;
  white-space: nowrap; user-select: none;
}
.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--text); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface2); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr.clickable { cursor: pointer; }
.table .cell-main { font-weight: 600; color: var(--text); }
.table .cell-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }

/* ── Badges ───────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: .03em;
  border-radius: 99px; padding: 3px 9px; white-space: nowrap;
  background: var(--surface2); color: var(--muted2);
  border: 1px solid var(--border);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.b-green  { background: rgba(48,209,88,.12);  color: var(--green);  border-color: rgba(48,209,88,.25); }
.badge.b-blue   { background: rgba(10,132,255,.12); color: var(--blue);   border-color: rgba(10,132,255,.25); }
.badge.b-yellow { background: rgba(255,159,10,.12); color: var(--yellow); border-color: rgba(255,159,10,.25); }
.badge.b-red    { background: rgba(255,69,58,.12);  color: var(--red);    border-color: rgba(255,69,58,.25); }
.badge.b-purple { background: rgba(168,85,247,.12); color: var(--purple); border-color: rgba(168,85,247,.25); }
.badge.b-teal   { background: rgba(100,210,255,.12); color: var(--teal);  border-color: rgba(100,210,255,.25); }

/* Chips de filtro horizontales */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted2); cursor: pointer; transition: all .12s;
}
.chip:hover { color: var(--text); border-color: var(--hint); }
.chip.active { background: rgba(10,132,255,.14); border-color: var(--accent); color: var(--accent); }

/* ── Tabs ─────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border);
  margin-bottom: 20px; overflow-x: auto;
}
.tab {
  padding: 10px 16px; font-size: 14.5px; font-weight: 700;
  color: var(--muted2); background: none; border: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap; font-family: var(--font);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Modal / Drawer ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  background: var(--surface-solid); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-modal);
  width: 100%; max-width: 520px; max-height: 85dvh;
  display: flex; flex-direction: column;
}
.modal.modal-lg { max-width: 860px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--border);
}

/* ── Toast ────────────────────────────────────────────────────── */
.toast-root {
  position: fixed; bottom: 24px; right: 24px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px; max-width: 380px;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface-solid); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 16px;
  font-size: 13px; box-shadow: var(--shadow-modal);
  animation: sfd-toast-in .18s ease;
}
@keyframes sfd-toast-in { from { opacity: 0; transform: translateY(8px); } }
.toast.t-success { border-left: 3px solid var(--green-success); }
.toast.t-error   { border-left: 3px solid var(--red-danger); }
.toast.t-info    { border-left: 3px solid var(--accent); }

/* ── Alert ────────────────────────────────────────────────────── */
.alert {
  border-radius: var(--r-md); padding: 11px 14px; font-size: 13px;
  border: 1px solid var(--border); background: var(--surface);
  display: flex; gap: 10px; align-items: flex-start;
}
.alert-error   { background: rgba(239,68,68,.1);  border-color: rgba(239,68,68,.3);  color: var(--red); }
.alert-success { background: rgba(34,197,94,.1);  border-color: rgba(34,197,94,.3);  color: var(--green-success); }
.alert-warn    { background: rgba(255,159,10,.1); border-color: rgba(255,159,10,.3); color: var(--yellow); }
.alert-info    { background: rgba(10,132,255,.1); border-color: rgba(10,132,255,.3); color: var(--blue); }

/* ── Estados: empty / loading / skeleton ──────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 64px 24px; text-align: center; color: var(--muted);
}
.empty-state .empty-icon { color: var(--muted); opacity: .6; margin-bottom: 6px; }
.empty-state .empty-title { font-size: 15px; font-weight: 700; color: var(--muted2); }
.empty-state .empty-desc { font-size: 13px; max-width: 380px; }

.loading-state { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px; color: var(--muted); font-size: 13px; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--surface2); border-top-color: var(--accent);
  animation: sfd-spin .7s linear infinite; flex-shrink: 0;
}

.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
  background-size: 800px 100%;
  animation: sfd-shimmer 1.3s infinite linear;
}

/* ── Progreso ─────────────────────────────────────────────────── */
.progress {
  height: 6px; border-radius: 99px; background: var(--surface2); overflow: hidden;
}
.progress > div {
  height: 100%; border-radius: 99px;
  background: var(--grad-primary); transition: width .3s;
}

/* ── Tooltip ──────────────────────────────────────────────────── */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
  background: var(--surface-solid); border: 1px solid var(--border);
  color: var(--text); font-size: 11px; font-weight: 500;
  padding: 5px 9px; border-radius: 7px; white-space: nowrap;
  box-shadow: var(--shadow-card); z-index: 400; pointer-events: none;
}

/* ── Menú desplegable ─────────────────────────────────────────── */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 150;
  min-width: 190px; padding: 6px;
  background: var(--surface-solid); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-modal);
  display: flex; flex-direction: column;
}
.dropdown-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 11px; border-radius: 8px; border: none; background: none;
  font-size: 13px; font-family: var(--font); color: var(--text);
  cursor: pointer; text-align: left; width: 100%;
}
.dropdown-item:hover { background: var(--surface); }
.dropdown-item.danger { color: var(--red); }
.dropdown-sep { height: 1px; background: var(--border); margin: 5px 4px; }

/* ── Media ────────────────────────────────────────────────────── */
.thumb {
  width: 100%; aspect-ratio: 16/9; object-fit: cover;
  border-radius: var(--r-sm); background: var(--surface2);
}
.thumb-square { aspect-ratio: 1; }
.audio-player { width: 100%; height: 36px; border-radius: var(--r-sm); }
.video-frame {
  width: 100%; border-radius: var(--r-md); background: #000;
  border: 1px solid var(--border);
}

/* ── Panel lateral derecho (detalle) ──────────────────────────── */
.split {
  display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start;
}
@media (max-width: 1200px) { .split { grid-template-columns: 1fr; } }
.side-panel { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; }

/* ── Cabecera de serie (imagen izq + stats/desc der) ──────────── */
.serie-hero {
  display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: stretch;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 16px;
}
.serie-hero .serie-cover {
  width: 100%; height: 100%; min-height: 180px; object-fit: cover;
  border-radius: var(--r-md); background: var(--surface2);
}
.serie-hero .serie-info { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.serie-hero .serie-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.serie-hero .serie-desc { font-size: 13px; color: var(--muted2); line-height: 1.55; }
@media (max-width: 900px) { .serie-hero { grid-template-columns: 1fr; } }

/* ── Detalle de historia (fases) ──────────────────────────────── */
.story-hero {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 16px;
}
.story-hero img.story-thumb {
  width: 220px; aspect-ratio: 16/9; object-fit: cover;
  border-radius: var(--r-md); background: var(--surface2); flex-shrink: 0;
}
.story-hero .story-hero-body { flex: 1; min-width: 0; }

/* Texto de capítulo (tab Historia) */
.cap-text { background: var(--surface2); border-radius: var(--r-md); padding: 18px 20px; }
.cap-text p { margin: 0 0 12px; font-size: 14px; line-height: 2; color: var(--text); }
.cap-text p.dialogo {
  padding-left: 14px; border-left: 2px solid rgba(10,132,255,.4);
  margin-bottom: 8px;
}
.moraleja {
  margin-top: 20px; padding: 14px 18px;
  background: linear-gradient(135deg, rgba(255,200,50,.12), rgba(255,160,0,.08));
  border-left: 4px solid var(--yellow); border-radius: 0 var(--r-md) var(--r-md) 0;
  font-size: 14px; line-height: 1.9; font-style: italic;
}

/* Navegación entre elementos (capítulo N/M) */
.pager {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin-top: 14px;
}
.pager-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--surface2);
  color: var(--text); font-size: 19px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.pager-btn:disabled { opacity: .35; cursor: default; }
.pager-label { font-size: 12px; color: var(--muted); min-width: 60px; text-align: center; }

/* Cards de pipeline (clips, montaje) */
.pipe-card {
  display: flex; align-items: stretch; position: relative;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden; cursor: pointer;
  transition: opacity .15s, box-shadow .15s; margin-bottom: 8px;
}
.pipe-card:hover { opacity: .85; box-shadow: var(--shadow-card); }
.pipe-card img {
  width: 34%; flex-shrink: 0; object-fit: cover;
  display: block; background: var(--surface); min-height: 90px;
}
.pipe-card .pipe-body {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  padding: 12px 14px; gap: 4px; min-width: 0;
}
.pipe-card .pipe-title { font-size: 15px; font-weight: 700; }
.pipe-card .pipe-sub { font-size: 11px; color: var(--muted); }
.pipe-card .pipe-bar {
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: rgba(255,255,255,.08);
}
.pipe-card .pipe-bar > div { height: 100%; background: var(--accent); border-radius: 0 2px 0 0; }
.pipe-check {
  position: absolute; top: 8px; right: 10px; width: 22px; height: 22px;
  border-radius: 50%; background: rgba(34,197,94,.2);
  border: 1.5px solid rgba(34,197,94,.45);
  display: flex; align-items: center; justify-content: center;
  color: var(--green-success); font-size: 11px; font-weight: 800;
}

/* ── Cards de Shorts ───────────────────────────────────────────────────── */
.card-thumb {
  overflow: hidden;
  border-radius: 8px;
  background: var(--card-bg);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.thumb-wrapper {
  position: relative;
  padding-top: 177.78%; /* 9:16 aspect ratio for vertical videos */
  overflow: hidden;
}

.thumb-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--muted);
  font-size: 32px;
}

.thumb-title {
  padding: 8px;
  font-size: 14px;
  text-align: center;
}

/* ── Settings Module Components ─────────────────────────────────────── */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 20px;
}
.settings-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.settings-section-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.settings-section-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* Filas con switch de configuración */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.toggle-row:last-child {
  border-bottom: none;
  padding-bottom: 4px;
}
.toggle-row:first-child {
  padding-top: 4px;
}
.toggle-info {
  flex: 1;
  min-width: 0;
}
.toggle-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.toggle-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* Tarjeta de proveedor de IA */
.provider-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color .15s;
}
.provider-card.active {
  border-color: rgba(10, 132, 255, 0.45);
  box-shadow: 0 0 0 1px rgba(10, 132, 255, 0.15);
}
.provider-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.provider-name {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Tarjetas de Reglas */
.rule-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity .15s, border-color .15s;
}
.rule-card.inactive {
  opacity: .55;
  border-style: dashed;
}
.rule-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.rule-id {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(10, 132, 255, 0.1);
  padding: 2px 7px;
  border-radius: 6px;
}
.rule-textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  color: var(--text);
  font-size: 12.5px;
  font-family: var(--font);
  line-height: 1.45;
  resize: vertical;
  min-height: 52px;
}
.rule-textarea:focus {
  border-color: var(--accent);
  outline: none;
}

/* Componentes y chips */
.comp-category-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 14px;
}
.comp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all .12s;
  user-select: none;
}
.comp-chip.active {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--green-success);
}
.comp-chip.inactive {
  opacity: .45;
  background: var(--surface2);
  border-style: dashed;
  color: var(--muted);
}
.comp-chip-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 10px;
  color: var(--muted);
  cursor: pointer;
  margin-left: 2px;
}
.comp-chip-del:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--red);
}

/* Range input wrapper */
.range-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.range-wrap input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}
.range-val {
  min-width: 44px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  color: var(--muted2);
}

/* ── Profile Module Components ────────────────────────────── */
.profile-hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(90, 180, 205, 0.06) 100%), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px 28px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.profile-hero-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--grad-forge);
}
.profile-hero-left {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}
.profile-avatar-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  background: var(--grad-primary);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.15);
  transition: transform .15s ease, border-color .15s ease;
}
.profile-avatar-wrap:hover {
  transform: scale(1.03);
  border-color: var(--accent);
}
.profile-avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.profile-avatar-initial {
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  user-select: none;
}
.profile-avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  opacity: 0;
  transition: opacity .15s ease;
  backdrop-filter: blur(2px);
}
.profile-avatar-wrap:hover .profile-avatar-overlay {
  opacity: 1;
}
.profile-avatar-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.profile-meta-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.profile-user-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.3px;
  color: var(--text);
}
.profile-user-handle {
  font-size: 13px;
  color: var(--muted2);
  margin-top: 3px;
}
.profile-badges-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* Redes Sociales Grid & Cards */
.social-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  transition: border-color .15s, box-shadow .15s;
  min-height: 220px;
}
.social-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}
.social-card-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.social-card-brand-group {
  display: flex;
  align-items: center;
  gap: 16px;
}
.social-card-brand-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.social-brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.social-brand-tiktok {
  background: rgba(255, 0, 80, 0.12);
  color: #ff0050;
  border: 1px solid rgba(255, 0, 80, 0.25);
}
.social-brand-youtube {
  background: rgba(255, 0, 0, 0.12);
  color: #ff0000;
  border: 1px solid rgba(255, 0, 0, 0.25);
}
.social-brand-instagram {
  background: linear-gradient(135deg, rgba(225, 48, 108, 0.15), rgba(253, 29, 29, 0.15));
  color: #e1306c;
  border: 1px solid rgba(225, 48, 108, 0.25);
}
.social-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 14px 0;
}
.social-metric-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 4px;
  text-align: center;
}
.social-metric-val {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.2px;
}
.social-metric-lbl {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: .04em;
  margin-top: 2px;
}

/* Secret & Token Box */
.secret-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}
.secret-val {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* PIN Keypad Modal */
.pin-dialog-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
}
.pin-dots {
  display: flex;
  gap: 14px;
  margin: 16px 0 24px;
}
.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-hover);
  background: transparent;
  transition: all .15s ease;
}
.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(10, 132, 255, 0.5);
  transform: scale(1.1);
}
.pin-dot.error {
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}
.pin-grid {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  gap: 12px;
}
.pin-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font);
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
  transition: background .12s, transform .08s;
}
.pin-btn:hover {
  background: var(--surface2);
  border-color: var(--border-hover);
}
.pin-btn:active {
  transform: scale(.92);
}
.pin-btn.empty {
  visibility: hidden;
}

/* ── Grupo 2: Series Animadas Components ───────────────────── */
/* Wizard de Creación de Serie */
.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.wizard-step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}
.wizard-step-item.active {
  color: var(--accent);
}
.wizard-step-item.completed {
  color: var(--green-success);
}
.wizard-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface2);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}
.wizard-step-item.active .wizard-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 10px rgba(10, 132, 255, 0.4);
}
.wizard-step-item.completed .wizard-dot {
  background: var(--green-success);
  border-color: var(--green-success);
  color: #fff;
}
.wizard-sep {
  width: 32px;
  height: 1px;
  background: var(--border);
}

/* Grid de Historias 16:9 */
.story-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}
.story-card-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  cursor: pointer;
}
.story-card-item:hover {
  transform: translateY(-3px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}
.story-card-thumb-wrap {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--surface2);
  position: relative;
  overflow: hidden;
}
.story-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.story-card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  backdrop-filter: blur(6px);
}
.story-card-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(0,0,0,0.4);
}
.story-card-progress-fill {
  height: 100%;
  background: var(--grad-forge);
  transition: width .2s ease;
}
.story-card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.story-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.story-card-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Personajes: Retratos y Cards Desktop Redesign */
.char-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: all .15s ease;
}
.char-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}
.char-card-main {
  display: flex;
  align-items: flex-start;
  gap: 16px; /* Espaciado cómodo y equilibrado para 3 columnas */
}
.char-portrait-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  min-width: 96px;
  border-radius: 12px;
  background: var(--surface2);
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.22);
  cursor: pointer;
}
.char-portrait-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .25s ease;
}
.char-card:hover .char-portrait-wrap img {
  transform: scale(1.04);
}
.char-portrait-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  color: var(--muted);
  gap: 4px;
  padding: 8px;
  text-align: center;
}
.char-fallback-icon {
  font-size: 24px;
  line-height: 1;
}
.char-fallback-hint {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 3px;
}
.char-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.char-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}
.char-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.25;
}
.char-badges {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.char-badge-principal {
  background: rgba(245, 200, 66, 0.15);
  border: 1px solid rgba(245, 200, 66, 0.45);
  color: #ffb323;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 0.02em;
}
.char-species {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 7px;
  display: block;
}
.char-traits {
  font-size: 13px;
  color: var(--muted2);
  line-height: 1.55;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.char-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* Narradores: Cards Desktop Redesign */
.narr-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: all .15s ease;
  min-height: 175px;
}
.narr-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}
.narr-card-default {
  border-color: rgba(48, 209, 88, 0.35);
  background: linear-gradient(180deg, rgba(48, 209, 88, 0.05) 0%, var(--surface) 100%);
  box-shadow: 0 2px 14px rgba(48, 209, 88, 0.08);
}
.narr-card-header {
  display: flex;
  align-items: center;
  gap: 16px; /* Espaciado generoso entre icono y texto */
  margin-bottom: 14px;
}
.narr-avatar {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 13px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all .2s ease;
}
.narr-avatar.active {
  background: rgba(48, 209, 88, 0.14);
  border-color: rgba(48, 209, 88, 0.35);
  color: #30d158;
}
.narr-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.narr-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.narr-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.25;
}
.narr-stem {
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--font-mono, monospace);
  opacity: .85;
}
.narr-audio-wrap {
  margin-bottom: 14px;
}
.narr-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  gap: 8px;
}
.narr-status-active {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: #30d158;
}

/* Zona Dropzone para audios y carátulas */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 28px 16px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: all .15s ease;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: rgba(10, 132, 255, 0.04);
}
.dropzone-icon {
  font-size: 32px;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ── Ideas Selector & Chips (PWA Fiel) ───────────────────────── */
.ideas-selector {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 18px 20px; margin-bottom: 20px;
}
.ideas-sel-section { margin-bottom: 16px; }
.ideas-sel-section:last-child { margin-bottom: 0; }
.ideas-sel-title { font-size: 13.5px; font-weight: 800; color: var(--text); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.ideas-sel-cat { margin-bottom: 10px; }
.ideas-sel-cat-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.ideas-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ideas-chip {
  padding: 6px 14px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  cursor: pointer; transition: all .14s ease; user-select: none;
}
.ideas-chip:hover { border-color: var(--hint); background: var(--surface3, rgba(255,255,255,.08)); }
.ideas-chip.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 2px 10px rgba(10,132,255,.35);
}
.ideas-formato-row { display: flex; gap: 10px; flex-wrap: wrap; }
.ideas-formato-card {
  flex: 1; min-width: 110px; max-width: 160px; padding: 10px;
  border-radius: var(--r-md); border: 1.5px solid var(--border); background: var(--surface2);
  display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; transition: all .15s ease;
}
.ideas-formato-card:hover { border-color: var(--hint); }
.ideas-formato-card.active { border-color: var(--accent); background: rgba(10,132,255,.1); }
.ideas-formato-icon { width: 36px; height: 36px; border: 1.5px dashed var(--muted); border-radius: 6px; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: var(--muted); }
.ideas-formato-card.active .ideas-formato-icon { border-color: var(--accent); color: var(--accent); }
.ideas-formato-lbl { font-size: 11px; font-weight: 700; color: var(--text); }

.ideas-input-row { display: flex; gap: 10px; margin-top: 14px; }
.ideas-input-row input {
  flex: 1; padding: 10px 16px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13px;
}
.ideas-input-row input:focus { border-color: var(--accent); outline: none; }

/* Grid de Ideas Generadas */
.ideas-res-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); margin-top: 18px; }
.ideas-res-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 16px; display: flex; flex-direction: column; gap: 8px; transition: all .16s ease;
}
.ideas-res-card:hover { border-color: var(--hint); box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.ideas-res-title { font-size: 14px; font-weight: 800; color: var(--text); }
.ideas-res-desc { font-size: 12px; color: var(--muted); line-height: 1.4; flex: 1; }
.ideas-res-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }

/* ── Detalle de Videoclip (Modal / Vista) ────────────────────── */
.videoclip-detail-view { display: flex; flex-direction: column; gap: 20px; }
.videoclip-detail-header {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 20px 24px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap;
}
.videoclip-beats-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.videoclip-beat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; display: flex; flex-direction: column;
}
.videoclip-beat-media {
  width: 100%; aspect-ratio: 9/16; max-height: 320px; background: #000;
  display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden;
}
.videoclip-beat-media img, .videoclip-beat-media video { width: 100%; height: 100%; object-fit: cover; }
.videoclip-beat-body { padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.videoclip-beat-num { font-size: 10.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.videoclip-beat-desc { font-size: 12px; color: var(--text); line-height: 1.35; }

/* ── Utilidades: Lista de Herramientas (PWA Fiel) ─────────────── */
.util-sub-list {
  display: flex; flex-direction: column; gap: 10px; max-width: 820px;
}
.util-sub-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  cursor: pointer; transition: all .14s ease; text-decoration: none; color: inherit;
}
.util-sub-row:hover {
  border-color: var(--hint); background: var(--surface2); transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,.25); text-decoration: none;
}
.util-sub-ic {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0; box-shadow: 0 2px 10px rgba(0,0,0,.3);
}
.util-sub-txt { flex: 1; min-width: 0; }
.util-sub-name { font-size: 14.5px; font-weight: 800; color: var(--text); }
.util-sub-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.util-sub-chev { font-size: 18px; color: var(--muted); font-weight: 700; }

/* ── Biblioteca: Galería de Medios Unificada ─────────────────── */
.bib-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.bib-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.bib-card {
  position: relative; aspect-ratio: 1; border-radius: var(--r-md);
  overflow: hidden; background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: transform .15s ease, box-shadow .15s ease;
}
.bib-card:hover {
  transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.45);
  border-color: var(--hint);
}
.bib-card.video { aspect-ratio: 9/16; }
.bib-card img, .bib-card video { width: 100%; height: 100%; object-fit: cover; }
.bib-card-overlay {
  position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,.85));
  display: flex; flex-direction: column; justify-content: flex-end; padding: 10px;
  opacity: 0; transition: opacity .15s ease;
}
.bib-card:hover .bib-card-overlay { opacity: 1; }
.bib-card-label { font-size: 11px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bib-card-sub { font-size: 10px; color: rgba(255,255,255,.7); }
.bib-type-badge {
  position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px); border-radius: 6px; padding: 2px 6px; font-size: 10px; font-weight: 800; color: #fff;
}

/* ── GenAI Chat Desktop ──────────────────────────────────────── */
.chat-container {
  display: flex; flex-direction: column; height: calc(100vh - 180px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  overflow: hidden;
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px;
}
.chat-msg {
  max-width: 78%; padding: 12px 16px; border-radius: 16px; font-size: 13.5px; line-height: 1.45;
  white-space: pre-wrap; word-break: break-word;
}
.chat-msg.user {
  align-self: flex-end; background: var(--accent); color: #fff;
  border-bottom-right-radius: 4px; box-shadow: 0 2px 10px rgba(10,132,255,.25);
}
.chat-msg.assistant {
  align-self: flex-start; background: var(--surface2); color: var(--text);
  border-bottom-left-radius: 4px; border: 1px solid var(--border);
}
.chat-bar-wrap {
  padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: center;
}
.chat-input {
  flex: 1; padding: 11px 16px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); font-size: 13px;
}
.chat-input:focus { border-color: var(--accent); outline: none; background: var(--surface); }

/* ── Publicados: Tarjetas de Clips & Acciones TikTok (PWA Fiel) ─ */
.pub-cards-list {
  display: flex; flex-direction: column; gap: 14px; max-width: 900px;
}
.pub-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  overflow: hidden; transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.pub-card:hover {
  border-color: var(--hint); transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.pub-card-body {
  padding: 16px; display: flex; gap: 16px; align-items: center;
}
.pub-thumb {
  width: 140px; height: 80px; border-radius: 10px; background: #000;
  overflow: hidden; flex-shrink: 0; position: relative; display: flex; align-items: center; justify-content: center;
}
.pub-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pub-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pub-title { font-size: 15px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pub-chips-row { display: flex; gap: 6px; align-items: center; }
.pub-date { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.pub-card-sep { height: 1px; background: var(--border); }
.pub-card-actions {
  padding: 10px 16px; background: rgba(128,128,128,.04);
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
}

/* Modales de Publicados */
.pub-view-modal-video {
  width: 100%; max-height: 65vh; border-radius: 12px; background: #000; display: block;
}
.pub-upload-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.pub-upload-field label { font-size: 12px; font-weight: 700; color: var(--muted); }
.pub-upload-field input, .pub-upload-field select, .pub-upload-field textarea {
  padding: 9px 12px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); font-size: 13px; font-family: inherit;
}
.pub-upload-field textarea { resize: vertical; min-height: 70px; }
.pub-upload-field input:focus, .pub-upload-field select:focus, .pub-upload-field textarea:focus {
  border-color: var(--accent); outline: none; background: var(--surface);
}

/* ── Filtros de Redes Sociales en Publicados ───────────────── */
.social-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.social-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted2);
  cursor: pointer;
  transition: all .16s ease;
  user-select: none;
}
.social-filter-btn:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--hint);
  transform: translateY(-1px);
}
.social-filter-btn svg {
  flex-shrink: 0;
  transition: transform .16s ease;
}
.social-filter-btn:hover svg {
  transform: scale(1.12);
}

/* Activos específicos por plataforma */
.social-filter-btn.active[data-p="all"] {
  background: var(--grad-primary);
  border-color: transparent;
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(10,132,255,.32);
}
.social-filter-btn.active[data-p="tiktok"] {
  background: linear-gradient(135deg, #010101, #121212);
  border-color: #00f2fe;
  color: #fff !important;
  box-shadow: 0 4px 16px rgba(0,242,254,.35), 0 0 10px rgba(254,44,85,.3);
}
.social-filter-btn.active[data-p="instagram"] {
  background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
  border-color: transparent;
  color: #fff !important;
  box-shadow: 0 4px 16px rgba(225,48,108,.4);
}
.social-filter-btn.active[data-p="youtube"] {
  background: linear-gradient(135deg, #cc0000, #ff0000);
  border-color: transparent;
  color: #fff !important;
  box-shadow: 0 4px 16px rgba(255,0,0,.38);
}
.social-filter-btn.active[data-p="facebook"] {
  background: linear-gradient(135deg, #1877f2, #0d65d9);
  border-color: transparent;
  color: #fff !important;
  box-shadow: 0 4px 16px rgba(24,119,242,.35);
}

/* ── Chips Multiselección de Redes Sociales en Detalle ─────── */
.social-chips-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.social-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: default;
  user-select: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.social-chip[data-plat="tiktok"] {
  background: rgba(0,242,254,.10);
  border-color: rgba(0,242,254,.45);
  color: #00f2fe;
}
.social-chip[data-plat="instagram"] {
  background: rgba(225,48,108,.12);
  border-color: rgba(225,48,108,.45);
  color: #ff5b94;
}
.social-chip[data-plat="shorts"], .social-chip[data-plat="youtube"] {
  background: rgba(255,68,68,.12);
  border-color: rgba(255,68,68,.45);
  color: #ff5252;
}
.social-chip[data-plat="vimeo"] {
  background: rgba(26,183,234,.12);
  border-color: rgba(26,183,234,.45);
  color: #1ab7ea;
}

