/* ─────────────────────────────────────────────────────────────
   Serclai — Design System
   Inspirado en Claude (Anthropic) + identidad propia
   ───────────────────────────────────────────────────────────── */

:root {
  /* Color */
  --bg: #F5F4EE;
  --surface: #FFFFFF;
  --surface-2: #FAF9F4;
  --ink: #1F1E1D;
  --ink-soft: #5C5B57;
  --ink-mute: #8E8C85;
  --line: #E7E4DB;
  --line-strong: #D8D4C8;
  --coral: #D97757;
  --coral-soft: #F0B49A;
  --coral-bg: #FBEDE3;
  --success: #2D5F3F;
  --success-soft: #7FA88E;
  --shadow-sm: 0 1px 2px rgba(31, 30, 29, 0.04);
  --shadow-md: 0 4px 12px rgba(31, 30, 29, 0.06);
  --shadow-lg: 0 20px 40px rgba(31, 30, 29, 0.08);

  /* Typography */
  --serif: "Source Serif 4", "Tiempos Headline", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Transitions */
  --t-fast: 150ms ease;
  --t-base: 250ms ease;
  --t-slow: 400ms ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

button { font: inherit; cursor: pointer; border: none; background: none; }

input, textarea, select { font: inherit; }

/* ── Layout ─────────────────────────────────────────────────── */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}

.container-sm {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Typography ─────────────────────────────────────────────── */

.serif { font-family: var(--serif); font-weight: 400; }
.italic { font-style: italic; }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

h1 { font-size: clamp(44px, 7vw, 84px); letter-spacing: -0.03em; line-height: 1.02; }
h2 { font-size: clamp(32px, 4.5vw, 52px); }
h3 { font-size: clamp(24px, 2.6vw, 32px); }
h4 { font-size: 20px; }

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
  font-weight: 500;
  font-family: var(--sans);
}

.muted { color: var(--ink-soft); }
.subtle { color: var(--ink-mute); }

/* ── Logo ───────────────────────────────────────────────────── */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: -0.01em;
  font-weight: 400;
}
.logo-mark { color: var(--coral); display: inline-flex; }

/* ── Buttons ────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: all var(--t-base);
  white-space: nowrap;
  border: 1px solid transparent;
  background: var(--ink);
  color: white;
}
.btn:hover { background: #2D2C2A; transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-coral { background: var(--coral); }
.btn-coral:hover { background: #C7674E; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-ghost:hover { background: var(--surface); border-color: var(--ink); transform: translateY(-1px); }

.btn-link {
  background: transparent;
  color: var(--ink);
  padding: 8px 0;
}
.btn-link:hover { color: var(--coral); transform: none; box-shadow: none; }

.btn-lg { padding: 15px 28px; font-size: 15px; }
.btn-block { width: 100%; }

/* ── Nav ────────────────────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 244, 238, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-base);
}
.nav.scrolled { border-bottom-color: var(--line); }

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-links > a { color: var(--ink-soft); font-size: 14px; font-weight: 500; transition: color var(--t-fast); }
.nav-links > a:hover { color: var(--ink); }

/* Enlaces inyectados arriba (Home/IA/Mi espacio/Perfil) cuando hay sesión */
.nav-links > a.nav-top-link {
  position: relative;
  padding: 6px 0;
  text-decoration: none;
}
.nav-links > a.nav-top-link.active {
  color: var(--coral);
  font-weight: 600;
}
.nav-links > a.nav-top-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--coral);
  border-radius: 2px;
}

/* Language toggle */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 2px;
  background: var(--surface);
}
.lang-toggle button {
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  transition: all var(--t-fast);
}
.lang-toggle button.active {
  background: var(--ink);
  color: white;
}

/* ── Cards ──────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 32px;
  transition: all var(--t-base);
}
.card:hover { border-color: var(--line-strong); }

/* ── Pills / chips ──────────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 500;
}
.pill .dot {
  width: 6px;
  height: 6px;
  background: var(--coral);
  border-radius: 50%;
  display: inline-block;
}
.pill .dot.success { background: var(--success); }

/* ── Form ───────────────────────────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}
.field input,
.field textarea {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.12);
}

/* ── Auth pages ─────────────────────────────────────────────── */

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--ink-mute);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.btn-social {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  font-weight: 500;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--t-fast);
}
.btn-social:hover { background: var(--surface-2); border-color: var(--ink); transform: translateY(-1px); }

/* ── Dashboard / App layout ─────────────────────────────────── */

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  /* Min height descontando el alto de la nav top (≈ 64px) */
  min-height: calc(100vh - 64px);
}
.app-sidebar {
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  /* Sticky justo bajo la nav top (que mide 64px) */
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
}
.sidebar-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  padding: 0 12px 4px;
}

.app-greeting { margin-bottom: 24px; }
.app-greeting h1 { font-size: 36px; margin-bottom: 8px; }

/* Hub de espacios: vista por defecto del tab "Mi espacio" */
/* En /app, por defecto se ve el HUB (lista de espacios); el dashboard
   solo aparece si el body tiene la clase .view-dashboard (la añade el
   JS cuando el hash es uno del sidebar: #conexiones, #cursos, …). */
.hub-view { display: block; padding: 32px 24px 80px; max-width: 760px; margin: 0 auto; }
.app-shell { display: none; }
body.view-dashboard .hub-view { display: none; }
body.view-dashboard .app-shell { display: grid; }
.hub-grid { display: grid; gap: 12px; }
.hub-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  text-decoration: none;
  color: inherit;
  transition: all .15s;
}
.hub-card:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.hub-card-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--coral-bg);
  overflow: hidden;
  flex-shrink: 0;
}
.hub-card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.hub-card-body { flex: 1; min-width: 0; }
.hub-card-title { font-weight: 600; font-size: 16px; color: var(--ink); margin-bottom: 2px; }
.hub-card-sub { font-size: 13px; color: var(--ink-mute); }
.hub-card-chevron { color: var(--ink-mute); flex-shrink: 0; }
.hub-card-loading { padding: 32px; text-align: center; color: var(--ink-mute); }
.hub-empty { padding: 60px 24px; text-align: center; color: var(--ink-mute); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); }

/* Botón "Mis espacios" del sidebar (volver al hub) */
.sidebar-back {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-mute);
  padding: 4px 12px;
  margin-bottom: 4px;
  border-radius: var(--r-sm);
  transition: all .15s;
}
.sidebar-back:hover { color: var(--ink); background: var(--surface); }

/* ── Avatar chip del nav top (link al 4º tab "Perfil") ─────────── */
.nav-chip-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  transition: all .15s;
}
.nav-chip-link:hover { background: var(--surface-2); border-color: var(--line-strong); }
.nav-chip-link.active {
  border-color: var(--coral);
  box-shadow: 0 0 0 2px rgba(217, 119, 87, 0.18);
}
.nav-chip-avatar,
.nav-chip-fallback {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.nav-chip-fallback {
  background: var(--coral);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 600; font-size: 12px;
}
.nav-chip-link span {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── (legacy) estilos antiguos del perfil IG en /app#mi-perfil ── */
.ig-profile {
  display: flex;
  gap: 64px;
  align-items: flex-start;
  padding: 16px 0 32px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}
.ig-avatar-wrap {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--coral), #E8A87C);
  padding: 4px;
  flex-shrink: 0;
  position: relative;
}
.ig-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
  border: 3px solid var(--bg);
  display: block;
}
.ig-avatar-edit {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  border: 3px solid var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  transition: transform var(--t-fast), background var(--t-fast);
  padding: 0;
}
.ig-avatar-edit:hover {
  background: #c46647;
  transform: scale(1.06);
}
.ig-avatar-edit svg { display: block; }
.ig-meta { flex: 1; min-width: 0; }
.ig-nameline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.ig-handle {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}
.ig-verified {
  color: var(--coral);
  display: inline-flex;
  align-items: center;
}
.ig-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.ig-buttons .btn { font-size: 13px; padding: 7px 14px; }
.ig-stats {
  display: flex;
  gap: 32px;
  margin-bottom: 14px;
  font-size: 14px;
  color: var(--ink-soft);
}
.ig-stats strong { color: var(--ink); font-weight: 600; }
.ig-bio { font-size: 14px; line-height: 1.5; color: var(--ink); }
.ig-displayname { font-weight: 500; font-size: 14px; color: var(--ink-mute); margin-bottom: 4px; }
.ig-spec { color: var(--ink-mute); font-size: 13px; margin-bottom: 8px; }
.ig-bio-text { color: var(--ink-soft); margin: 0; white-space: pre-wrap; }

.ig-tabs {
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--line);
  margin: 0 0 24px;
}
.ig-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  padding: 14px 24px;
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--ink-mute);
  cursor: pointer;
  border-top: 2px solid transparent;
  margin-top: -1px;
}
.ig-tab.active { color: var(--ink); border-top-color: var(--ink); }

/* Pack G+: 1 publicación por pantalla (snap-style). Thumb 4:5 vertical
   estilo Instagram para que ocupe la mayor parte del viewport y no
   se vean 2 cards a la vez. */
.ig-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
  max-width: 640px;
  margin: 0 auto;
}
.ig-cell {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--t-base);
}
.ig-cell:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.ig-cell-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-size: cover;
  background-position: center;
  background-color: var(--coral-bg);
  position: relative;
}
.ig-cell-no-thumb {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 56px;
  color: var(--ink-mute);
  background: var(--coral-bg);
}
.ig-cell-tipo {
  position: absolute;
  top: 12px;
  right: 14px;
  color: #fff;
  font-size: 20px;
  text-shadow: 0 1px 6px rgba(0,0,0,.5);
}
.ig-cell-priv {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0,0,0,.65);
  color: #fff;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.ig-cell-overlay {
  padding: 16px 20px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.ig-cell-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}
.ig-cell-stats {
  display: flex;
  flex-direction: row;
  gap: 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-mute);
  margin-top: 6px;
}
.ig-cell-stats span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.ig-cell-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.ig-cell-actions select {
  font-size: 10px;
  padding: 3px 16px 3px 6px;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,.95);
  color: var(--ink);
  border: 0;
  flex: 1;
  min-width: 0;
}
.ig-cell-btn {
  font-size: 11px;
  padding: 4px 8px;
  background: rgba(255,255,255,.95);
  color: var(--ink);
  border: 0;
  border-radius: var(--r-pill);
  cursor: pointer;
  font-weight: 500;
}
.ig-cell-btn.danger { color: #B5462E; }

@media (max-width: 720px) {
  .ig-profile { gap: 24px; padding: 12px 0 24px; }
  .ig-avatar-wrap { width: 90px; height: 90px; }
  .ig-handle { font-size: 18px; }
  .ig-stats { gap: 18px; font-size: 13px; }
  .ig-grid { gap: 2px; }
}
.sidebar-section { display: flex; flex-direction: column; gap: 4px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  font-size: 14px;
  transition: all var(--t-fast);
}
.sidebar-link:hover { background: var(--surface); color: var(--ink); }
.sidebar-link.active { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: var(--shadow-sm); }
.sidebar-icon { width: 18px; height: 18px; opacity: 0.7; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-mute);
}

.app-main {
  padding: 32px 40px;
  max-width: 1100px;
}
.app-main h1 { font-size: 36px; margin-bottom: 8px; }

.section-spacer { height: 40px; }

/* ── Connection cards (dashboard) ───────────────────────────── */

.conn-list { display: grid; grid-template-columns: 1fr; gap: 12px; }
.conn-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: all var(--t-base);
}
.conn-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.conn-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  background: var(--coral-bg);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}
.conn-body { flex: 1; }
.conn-title { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.conn-meta { font-size: 13px; color: var(--ink-mute); }
.conn-status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--bg);
  color: var(--ink-mute);
}
.conn-status.connected { background: rgba(45, 95, 63, 0.1); color: var(--success); }

/* ── Chat demo (animated) ───────────────────────────────────── */

.chat-frame {
  background: var(--ink);
  border-radius: var(--r-xl);
  padding: 28px;
  color: white;
  box-shadow: var(--shadow-lg);
  max-width: 520px;
  margin: 0 auto;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.chat-head .dot {
  width: 8px;
  height: 8px;
  background: var(--coral);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
.chat-msgs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 280px;
}
.chat-msg {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 14px;
  line-height: 1.55;
  opacity: 0;
  transform: translateY(8px);
  animation: msgIn 400ms ease forwards;
}
.chat-msg.user {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.chat-msg.ia {
  align-self: flex-start;
  background: var(--coral);
  color: white;
}
.chat-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--r-md);
  opacity: 0;
  animation: msgIn 200ms ease forwards;
}
.chat-typing span {
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  animation: typing 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes msgIn {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.9); }
}

/* ── Footer ─────────────────────────────────────────────────── */

footer.site-footer {
  border-top: 1px solid var(--line);
  padding: 56px 0 40px;
  background: var(--surface);
  margin-top: 80px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 40px;
}
.footer-brand p {
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 14px;
  max-width: 320px;
  line-height: 1.6;
}
.footer-col h5 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
  margin-bottom: 16px;
  font-weight: 600;
}
.footer-col a {
  display: block;
  color: var(--ink-soft);
  font-size: 14px;
  padding: 4px 0;
  transition: color var(--t-fast);
}
.footer-col a:hover { color: var(--ink); }
.footer-base {
  border-top: 1px solid var(--line);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--ink-mute);
}

/* ── Feed (publicaciones) ───────────────────────────────────── */

.feed-hero {
  padding: 56px 0 32px;
  text-align: center;
}
.feed-hero h1 {
  font-size: clamp(36px, 5.4vw, 60px);
  margin-bottom: 14px;
}
.feed-hero p.lead {
  color: var(--ink-soft);
  font-size: 18px;
  max-width: 560px;
  margin: 0 auto 32px;
}

/* Banda sticky que mantiene el buscador visible al hacer scroll. */
.feed-search-sticky {
  position: sticky;
  top: 64px; /* justo debajo de la nav top (≈64px) */
  z-index: 50;
  padding: 12px 0;
  background: rgba(245, 244, 238, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-base);
}
/* Cuando el feed está por debajo (al scrollear), se ve un borde sutil */
.feed-search-sticky.scrolled { border-bottom-color: var(--line); }

.feed-search {
  position: relative;
  max-width: 580px;
  margin: 0 auto;
}

/* Filtros rápidos por tipo (chips) bajo el buscador */
.feed-filters {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 0 16px;
}
.feed-filter {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-base);
  white-space: nowrap;
}
.feed-filter:hover {
  border-color: var(--coral);
  color: var(--ink);
}
.feed-filter.on {
  background: var(--coral);
  border-color: var(--coral);
  color: white;
}
.feed-filter.on:hover { color: white; }

/* Estado deshabilitado de los CTAs de publicación. Aplica a feed,
   modal y vista de líder. Mantenemos el texto pero se ve "apagado"
   y no captura clicks. */
.btn.is-disabled,
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.5);
}

/* Pack F flow fix: estado "info enviada" del botón Dame más info.
   El texto se mantiene "Dame más info" pero se ve grisáceo/opaco
   indicando que ya se pulsó. El click sigue funcionando (abre el
   chat para LEER la respuesta del líder, sin escribir). */
.btn.info-sent {
  opacity: 0.55;
  background: var(--surface-2, #ECEAE3);
  border-color: var(--line-strong);
  color: var(--ink-mute);
  cursor: pointer;
}
.btn.info-sent:hover {
  opacity: 0.75;
  background: var(--surface-2, #ECEAE3);
}

/* Pack G: botones de visibilidad en modal Nueva publicación
   (Pública / VIP). Cards seleccionables con estado .np-vis-on. */
.np-vis-btn {
  appearance: none;
  text-align: left;
  background: var(--surface, #fff);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all var(--t-base, 0.18s ease);
}
.np-vis-btn:hover {
  border-color: var(--line-strong);
  background: var(--bg, #F5F4EE);
}
.np-vis-btn.np-vis-on {
  border-color: var(--coral);
  background: rgba(217, 119, 87, 0.06);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.10);
}

/* Ícono de origen de publicación importada (IG, Spotify, YouTube,
   Substack). Pack C Fase 8. Aparece en la esquina superior-derecha
   de la thumb si origen != 'serclai'. */
.pub-origin-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.75);
  color: white;
  display: grid;
  place-items: center;
  font-size: 13px;
  line-height: 1;
  z-index: 2;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}
.pub-origin-icon[data-origen="instagram"] {
  background: linear-gradient(135deg, #f09433, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888);
}
.pub-origin-icon[data-origen="spotify"]   { background: #1DB954; }
.pub-origin-icon[data-origen="youtube"]   { background: #FF0000; }
.pub-origin-icon[data-origen="substack"]  { background: #FF6719; }
.pub-origin-icon svg { display: block; }

/* Pack F: card de SOLO TEXTO (articulo sin thumbnail). Acabado
   tipográfico — el título se hace protagonista en lugar del thumb. */
.feed-card-text .feed-thumb-text {
  aspect-ratio: 16 / 5;
  background: linear-gradient(135deg, rgba(217, 119, 87, 0.08), rgba(217, 119, 87, 0.18));
  display: grid;
  place-items: center;
  position: relative;
}
.feed-card-text .feed-thumb-text::before {
  content: "“";
  font-family: var(--serif, Georgia, serif);
  font-size: 96px;
  color: rgba(217, 119, 87, 0.35);
  line-height: 1;
  user-select: none;
}
.feed-card-text .feed-title-text {
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 10px 0 8px;
  color: var(--ink);
}
.feed-card-text .feed-resumen-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-soft);
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

/* Sentinel de infinite scroll */
#feed-sentinel {
  font-style: italic;
  letter-spacing: 0.02em;
}
@media (max-width: 600px) {
  .feed-filters {
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding: 0 16px 4px;
  }
  .feed-filter { scroll-snap-align: start; }
}
.feed-search input {
  width: 100%;
  padding: 16px 20px 16px 50px;
  font-size: 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  transition: all var(--t-base);
  box-shadow: var(--shadow-sm);
}
.feed-search input:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(217, 119, 87, 0.12), var(--shadow-sm);
}
.feed-search svg {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-mute);
  pointer-events: none;
}

.feed-filters {
  position: sticky;
  top: 68px;
  z-index: 50;
  background: rgba(245, 244, 238, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}
.feed-filters-row {
  display: flex;
  align-items: center;
  gap: 24px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 32px;
}
.feed-filters-row::-webkit-scrollbar { display: none; }

.chips {
  display: flex;
  gap: 8px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--t-fast);
  white-space: nowrap;
  cursor: pointer;
}
.chip:hover { border-color: var(--ink-soft); color: var(--ink); }
.chip.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
.chip.active:hover { background: #2D2C2A; }

.feed-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.feed-controls select {
  padding: 7px 30px 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%238E8C85' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* Pastillas de formato (Vídeo / Foto / Podcast / Texto) */
.tipo-pills {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 18px 32px 4px;
  background: rgba(245, 244, 238, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}
.tipo-pills::-webkit-scrollbar { display: none; }
.tipo-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--t-base);
  font-family: var(--sans);
}
.tipo-pill:hover {
  border-color: var(--ink-soft);
  color: var(--ink);
  transform: translateY(-1px);
}
.tipo-pill.active {
  background: var(--coral);
  border-color: var(--coral);
  color: white;
  box-shadow: 0 4px 14px rgba(217, 119, 87, 0.28);
}
.tipo-pill.active:hover {
  background: #C7674E;
  transform: translateY(-1px);
}
.tipo-pill svg {
  flex-shrink: 0;
}

/* Grid */

.feed-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 32px 0 80px;
  max-width: 640px;
  margin: 0 auto;
}

.feed-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--t-base);
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
}
.feed-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.feed-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, var(--coral-bg), var(--surface-2));
  overflow: hidden;
}
.feed-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--t-slow);
}
.feed-card:hover .feed-thumb img { transform: scale(1.04); }

.feed-thumb-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(31,30,29,0) 30%, rgba(31,30,29,0.45) 100%);
  transition: background var(--t-base);
}
.feed-card:hover .feed-thumb-play {
  background: linear-gradient(180deg, rgba(31,30,29,0.1) 0%, rgba(31,30,29,0.55) 100%);
}
.feed-thumb-play-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 20px rgba(31,30,29,0.3);
  transition: transform var(--t-base);
  pointer-events: none;
}
.feed-card:hover .feed-thumb-play-btn {
  transform: scale(1.08);
  background: white;
}
.feed-thumb-play-btn svg {
  color: var(--ink);
  margin-left: 3px;
}

.feed-thumb-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.feed-thumb-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: rgba(31, 30, 29, 0.82);
  color: white;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}
.feed-thumb-tag.alumnos {
  background: var(--coral);
  color: white;
}
.feed-thumb-tag.ejercicio {
  background: rgba(217, 119, 87, 0.18);
  color: #B5462E;
  border: 1px solid rgba(217, 119, 87, 0.45);
}

/* Pack I: badge "Pendiente / En curso / Hecho" en cards de ejercicio. */
.feed-thumb-ej-state {
  position: absolute;
  bottom: 12px;
  left: 12px;
  padding: 4px 9px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  backdrop-filter: blur(8px);
  z-index: 2;
}
.feed-thumb-ej-state.pendiente {
  background: rgba(31, 30, 29, 0.72);
  color: #fff;
}
.feed-thumb-ej-state.en-curso {
  background: rgba(217, 119, 87, 0.92);
  color: #fff;
}
.feed-thumb-ej-state.hecho {
  background: rgba(48, 140, 90, 0.92);
  color: #fff;
}
.feed-card.ejercicio {
  border: 1px solid rgba(217, 119, 87, 0.22);
}

.feed-thumb-duration {
  position: absolute;
  bottom: 12px;
  right: 12px;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: rgba(31, 30, 29, 0.78);
  color: white;
  font-size: 11px;
  font-weight: 500;
  backdrop-filter: blur(8px);
}

.feed-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.feed-lider {
  display: flex;
  align-items: center;
  gap: 10px;
}
.feed-lider-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--coral-bg);
  flex-shrink: 0;
  object-fit: cover;
}
.feed-lider-info {
  font-size: 12px;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}
.feed-lider-name {
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feed-lider-spec {
  color: var(--ink-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-title {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-resumen {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 4px;
}

/* CTAs Dame más info / Contactar dentro de cada card */
.feed-cta-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.feed-cta-btn {
  flex: 1;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--r-pill);
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
/* ── Mensajes (dashboard líder y perfil alumno) ─────────────── */
.msg-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.msg-tab {
  background: transparent;
  border: 0;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--ink-mute);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.msg-tab:hover { color: var(--ink); }
.msg-tab.active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--coral);
}
.msg-count {
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
}
.msg-tab.active .msg-count { background: var(--coral); color: #fff; }

.msg-filter {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.msg-filter-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 5px 12px;
  font-size: 12px;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: inherit;
}
.msg-filter-btn:hover { background: var(--surface-2); }
.msg-filter-btn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.msg-pill {
  font-size: 11px;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.msg-pill.info { background: var(--coral-bg); color: #8B4423; }
.msg-pill.contacto { background: #E8F4EC; color: #2D5F3F; }

/* Estado "Solicitud enviada" del botón Dame más info (legacy) */
.btn.sent,
.feed-cta-btn.sent {
  background: var(--surface-2) !important;
  color: var(--ink-mute) !important;
  border-color: var(--line) !important;
  cursor: not-allowed !important;
  pointer-events: none;
}
.btn.sent::before,
.feed-cta-btn.sent::before {
  content: "✓ ";
  font-weight: 600;
}
/* Estado "Leer conversación": activo, en otro tono para distinguirlo */
.btn.convo,
.feed-cta-btn.convo {
  background: #E8F4EC !important;
  color: #2D5F3F !important;
  border-color: #7FA88E !important;
  cursor: pointer !important;
}
.btn.convo:hover,
.feed-cta-btn.convo:hover {
  background: #D5E9DC !important;
}
.btn.convo::before,
.feed-cta-btn.convo::before {
  content: "💬 ";
}
.btn.btn-sm { font-size: 13px; padding: 8px 14px; }
.feed-tag {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--bg);
  color: var(--ink-soft);
  font-weight: 500;
}

.feed-empty {
  grid-column: 1 / -1;
  padding: 80px 24px;
  text-align: center;
  color: var(--ink-mute);
}
.feed-empty h3 {
  font-size: 22px;
  margin-bottom: 8px;
  color: var(--ink-soft);
}

.feed-skeleton {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.feed-skeleton .sk-thumb {
  aspect-ratio: 4 / 3;
  background: linear-gradient(90deg, var(--surface-2), var(--bg), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.feed-skeleton .sk-body { padding: 18px 20px; }
.feed-skeleton .sk-line {
  height: 12px;
  background: linear-gradient(90deg, var(--surface-2), var(--bg), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
  margin-bottom: 8px;
}
.feed-skeleton .sk-line.short { width: 50%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Modal de detalle (cuando URL es null = seed demo) */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(31, 30, 29, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
  animation: fadeIn 200ms ease;
}
.modal-backdrop.open { display: flex; }
.modal-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  max-width: 580px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 280ms ease;
}
.modal-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  object-fit: cover;
  display: block;
}
.modal-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}
.modal-media:empty { display: none; }
.modal-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.modal-body { padding: 32px; }
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 1;
  border: 1px solid var(--line);
  transition: all var(--t-fast);
}
.modal-close:hover { background: white; transform: scale(1.05); }

.modal-demo-banner {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--coral-bg);
  border-radius: var(--r-md);
  font-size: 13px;
  color: #8B4423;
  line-height: 1.5;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* Tabs (portal cliente) */
.feed-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.feed-tab {
  padding: 12px 4px;
  margin-right: 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-mute);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--t-fast);
  cursor: pointer;
}
.feed-tab:hover { color: var(--ink-soft); }
.feed-tab.active {
  color: var(--ink);
  border-bottom-color: var(--coral);
}

/* Header del portal cliente */
.portal-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: saturate(180%) blur(14px);
  background: rgba(255, 255, 255, 0.92);
}
.portal-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.portal-lider {
  display: flex;
  align-items: center;
  gap: 12px;
}
.portal-lider img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}
.portal-lider-info { line-height: 1.25; }
.portal-lider-name { font-weight: 600; font-size: 14px; }
.portal-lider-spec { font-size: 12px; color: var(--ink-mute); }

.lider-switcher {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 16px 0;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.lider-switcher::-webkit-scrollbar { display: none; }

.lider-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--t-fast);
  flex-shrink: 0;
  font-family: var(--sans);
}
.lider-tab:hover { border-color: var(--ink-soft); }
.lider-tab.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}
.lider-tab.todos { padding-left: 14px; }
.lider-tab img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.lider-tab-name {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Líder publish form (dashboard) */
.publish-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
  margin-bottom: 24px;
}
.publish-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.tema-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tema-toggle {
  padding: 6px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all var(--t-fast);
}
.tema-toggle:hover { border-color: var(--ink-soft); }
.tema-toggle.on {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}

.visibility-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 3px;
  background: var(--bg);
}
.visibility-toggle button {
  padding: 7px 14px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-mute);
  transition: all var(--t-fast);
}
.visibility-toggle button.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* Lista de publicaciones del del (dashboard) */
.pub-row {
  display: flex;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 8px;
  align-items: center;
  background: var(--surface);
}
.pub-row-thumb {
  width: 80px;
  height: 60px;
  border-radius: var(--r-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2);
}
.pub-row-info { flex: 1; min-width: 0; }
.pub-row-title {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pub-row-meta {
  font-size: 12px;
  color: var(--ink-mute);
  display: flex;
  gap: 8px;
}
.pub-row-vis {
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
}
.pub-row-vis.publico { color: var(--success); }
.pub-row-vis.alumnos { color: var(--coral); }

/* ── Editor de curso (dashboard lider) ─────────────────────── */

.cursos-list {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}
.cursos-list-row {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: all var(--t-base);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  width: 100%;
}
.cursos-list-row:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.cursos-list-portada {
  width: 80px; height: 50px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--coral-bg);
  flex-shrink: 0;
}
.cursos-list-info { flex: 1; min-width: 0; }
.cursos-list-titulo {
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}
.cursos-list-meta { font-size: 12px; color: var(--ink-mute); }

/* Editor de un curso individual */
.curso-editor-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 28px;
}
.curso-editor-portada {
  width: 180px;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-md);
  object-fit: cover;
  background: var(--coral-bg);
  flex-shrink: 0;
}
.curso-editor-info { flex: 1; min-width: 0; }

.modulo-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: 16px;
  overflow: hidden;
}
.modulo-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  transition: background var(--t-fast);
  user-select: none;
}
.modulo-head:hover { background: var(--surface-2); }
.modulo-head-orden {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--coral);
  letter-spacing: -0.02em;
  flex-shrink: 0;
  width: 30px;
  text-align: center;
}
.modulo-head-info { flex: 1; min-width: 0; }
.modulo-head-titulo {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}
.modulo-head-desc {
  font-size: 12px;
  color: var(--ink-mute);
}
.modulo-head-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.modulo-chevron {
  color: var(--ink-mute);
  transition: transform var(--t-fast);
}
.modulo-card.open .modulo-chevron { transform: rotate(180deg); }

.modulo-body {
  display: none;
  padding: 4px 20px 20px;
  border-top: 1px solid var(--line);
}
.modulo-card.open .modulo-body { display: block; }

.modulo-pubs {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}
.modulo-pub {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13px;
}
.modulo-pub-tag {
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.modulo-pub-tag.ejercicio {
  background: var(--coral-bg);
  color: #8B4423;
}
.modulo-pub-titulo {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
  font-weight: 500;
}
/* Pack I: cuando el título es clicable (botón de editar). */
.modulo-pub-titulo-edit {
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  padding: 4px 6px;
  margin: 0 -6px;
  border-radius: 6px;
  font-size: inherit;
  font-family: inherit;
  transition: background .12s ease, color .12s ease;
}
.modulo-pub-titulo-edit:hover {
  background: var(--coral-bg, rgba(217, 119, 87, 0.08));
  color: var(--coral);
}

.btn-mini {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all var(--t-fast);
}
.btn-mini:hover { border-color: var(--ink-soft); color: var(--ink); }
.btn-mini.danger { color: #B5462E; }
.btn-mini.danger:hover { border-color: #B5462E; }
.btn-mini.coral { background: var(--coral); color: white; border-color: var(--coral); }
.btn-mini.coral:hover { background: #C7674E; border-color: #C7674E; }

.empty-mini {
  font-size: 12px;
  color: var(--ink-mute);
  padding: 16px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  margin-bottom: 12px;
}

/* Form inline para añadir lección dentro de un módulo */
.add-leccion-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  font-family: var(--sans);
}
.add-leccion-toggle:hover {
  border-color: var(--coral);
  color: var(--coral);
  background: var(--coral-bg);
}
.add-leccion-toggle .plus { font-size: 16px; line-height: 1; }

.add-leccion-form {
  display: none;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 16px 18px;
  margin-top: 8px;
}
.add-leccion-form.open { display: block; }

.add-leccion-tipos {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.add-leccion-tipo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  font-family: var(--sans);
}
.add-leccion-tipo:hover { border-color: var(--ink-soft); color: var(--ink); }
.add-leccion-tipo.on {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}
.add-leccion-tipo svg { flex-shrink: 0; }

.add-leccion-form .field {
  margin-bottom: 10px;
}
.add-leccion-form .field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.add-leccion-form input,
.add-leccion-form textarea {
  font-size: 13px;
  padding: 8px 12px;
}

.add-leccion-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.add-leccion-seccion {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 2px;
  background: var(--bg);
  font-size: 11px;
}
.add-leccion-seccion button {
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-weight: 600;
  color: var(--ink-mute);
  font-size: 11px;
  letter-spacing: 0.04em;
  transition: all var(--t-fast);
}
.add-leccion-seccion button.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* Sección dentro de un módulo (editor lider) */
.seccion-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin: 8px 0;
  overflow: hidden;
}
.seccion-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
}
.seccion-head:hover { background: var(--surface-2); }
.seccion-head-orden {
  font-size: 13px;
  font-weight: 600;
  color: var(--coral);
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}
.seccion-head-info { flex: 1; min-width: 0; }
.seccion-head-titulo {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}
.seccion-head-desc {
  font-size: 11px;
  color: var(--ink-mute);
}
.seccion-card.open .modulo-chevron { transform: rotate(180deg); }
.seccion-body {
  display: none;
  padding: 4px 14px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.seccion-card.open .seccion-body { display: block; }

/* Pack I: agrupador Contenido/Ejercicios dentro de una sección. */
.seccion-grupo {
  margin-top: 10px;
}
.seccion-grupo:first-child {
  margin-top: 6px;
}
.seccion-grupo-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 8px 4px 6px;
}
.seccion-grupo-head .muted {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.ej-respuestas-btn {
  font-size: 11px !important;
  padding: 4px 9px !important;
  border-radius: 14px !important;
  border: 1px solid var(--line) !important;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s ease;
}
.ej-respuestas-btn:hover {
  background: var(--bg) !important;
}

.btn-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 0;
  color: var(--ink-mute);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }
.btn-icon:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Acordeón de módulos en portal alumno ────────────────────── */
.portal-modulo {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: 14px;
  overflow: hidden;
}
.portal-modulo-head {
  padding: 22px 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: background var(--t-fast);
  user-select: none;
}
.portal-modulo-head:hover { background: var(--surface-2); }
.portal-modulo-head-orden {
  font-family: var(--serif);
  font-size: 32px;
  color: var(--coral);
  letter-spacing: -0.02em;
  flex-shrink: 0;
  width: 48px;
  text-align: center;
  line-height: 1;
}
.portal-modulo-head-info { flex: 1; }
.portal-modulo-head-titulo {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.portal-modulo-head-meta {
  font-size: 13px;
  color: var(--ink-mute);
}
.portal-modulo-chevron {
  color: var(--ink-mute);
  transition: transform var(--t-base);
  flex-shrink: 0;
}
.portal-modulo.open .portal-modulo-chevron { transform: rotate(180deg); }
.portal-modulo-body {
  display: none;
  padding: 8px 26px 28px;
  border-top: 1px solid var(--line);
}
.portal-modulo.open .portal-modulo-body { display: block; }

/* Secciones dentro de un módulo (portal alumno) */
.portal-seccion {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  margin-bottom: 12px;
  overflow: hidden;
}
.portal-seccion-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}
.portal-seccion-head:hover { background: var(--surface-2); }
.portal-seccion-head-info { flex: 1; }
.portal-seccion-head-titulo {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.portal-seccion-head-meta {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 2px;
}
.portal-seccion-chevron {
  color: var(--ink-mute);
  transition: transform .2s;
  flex-shrink: 0;
}
.portal-seccion.open .portal-seccion-chevron { transform: rotate(180deg); }
.portal-seccion-body {
  display: none;
  padding: 4px 16px 16px;
  border-top: 1px solid var(--line);
}
.portal-seccion.open .portal-seccion-body { display: block; }

/* ── Cursos (portal alumno) ─────────────────────────────────── */

.cursos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 8px 0 40px;
}

.curso-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--t-base);
  text-align: left;
  width: 100%;
  font-family: inherit;
  display: flex;
  flex-direction: column;
}
.curso-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.curso-card-portada {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 8;
  background: linear-gradient(135deg, var(--coral-bg) 0%, var(--surface-2) 100%);
  overflow: hidden;
}
.curso-card-portada img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--t-slow);
}
.curso-card:hover .curso-card-portada img { transform: scale(1.04); }
.curso-card-portada::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(31,30,29,0.55) 100%);
  pointer-events: none;
}
.curso-card-lider-overlay {
  position: absolute;
  bottom: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1;
}
.curso-card-lider-overlay img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  flex-shrink: 0;
}
.curso-card-lider-name {
  font-size: 12px;
  font-weight: 600;
  color: white;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.curso-card-body {
  padding: 20px 22px 22px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.curso-card-titulo {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.curso-card-desc {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.curso-card-meta {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 6px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.curso-card-meta strong { color: var(--ink-soft); font-weight: 600; }

.curso-progress-bar {
  margin-top: 10px;
  height: 4px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
}
.curso-progress-bar-fill {
  height: 100%;
  background: var(--coral);
  transition: width var(--t-base);
  border-radius: 2px;
}
.curso-progress-text {
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 6px;
  font-weight: 500;
}

.feed-card.completado .feed-thumb-tag.alumnos,
.feed-card.completado::after {
  content: "✓";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.feed-card.completado { position: relative; }
.feed-card.completado .feed-thumb { opacity: 0.85; }

/* Breadcrumb / cabecera de curso */
.curso-header {
  margin: 24px 0 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.curso-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-mute);
  font-weight: 500;
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 0;
  width: fit-content;
  transition: color var(--t-fast);
}
.curso-back:hover { color: var(--ink); }
.curso-titulo {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.curso-desc {
  font-size: 16px;
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 640px;
}
.curso-section-title {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: -0.02em;
  margin: 32px 0 12px;
}

/* Lista vertical de publicaciones dentro de un curso */
.curso-pubs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 40px;
}
.curso-pub {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: all var(--t-base);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  width: 100%;
}
.curso-pub:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.curso-pub-thumb {
  position: relative;
  width: 160px;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-2);
}
.curso-pub-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.curso-pub-thumb-tag {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: rgba(31, 30, 29, 0.82);
  color: white;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.curso-pub-body { min-width: 0; }
.curso-pub-titulo {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--ink);
  line-height: 1.3;
}
.curso-pub-resumen {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.curso-pub-meta {
  font-size: 12px;
  color: var(--ink-mute);
  display: flex;
  gap: 12px;
  align-items: center;
}

@media (max-width: 720px) {
  .cursos-grid { grid-template-columns: 1fr; }
  .curso-pub { grid-template-columns: 1fr; }
  .curso-pub-thumb { width: 100%; aspect-ratio: 16 / 9; }
}

/* ── Password toggle (mostrar/ocultar contraseña) ────────────── */

.password-wrap {
  position: relative;
}
.password-wrap input {
  padding-right: 44px !important;
}
.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--ink-mute);
  border-radius: var(--r-sm);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color var(--t-fast);
  padding: 0;
}
.password-toggle:hover {
  color: var(--ink);
  background: var(--surface-2);
}
.password-toggle .icon-hide { display: none; }
.password-toggle.show .icon-show { display: none; }
.password-toggle.show .icon-hide { display: block; }

/* ── Configuración: dropdown engranaje ──────────────────────── */

.gear-wrap { position: relative; }
.gear-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--t-fast);
}
.gear-btn:hover { color: var(--ink); border-color: var(--ink-soft); }
.gear-menu {
  display: none;
  position: absolute;
  top: 44px;
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  z-index: 80;
  padding: 6px;
}
.gear-menu.open { display: block; }
.gear-menu a, .gear-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink-soft);
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t-fast);
  font-family: var(--sans);
}
.gear-menu a:hover, .gear-menu button:hover { background: var(--surface-2); color: var(--ink); }
.gear-menu hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 0;
}

/* Hashtag en captions */
.caption-hash {
  color: var(--coral);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.caption-hash:hover { text-decoration: underline; }

/* Sugerencias buscador */
.feed-search-suggestions {
  position: absolute;
  top: 100%;
  left: 12px;
  right: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  margin-top: 6px;
  display: none;
  z-index: 60;
  max-height: 280px;
  overflow-y: auto;
}
.feed-search-suggestions.open { display: block; }
.feed-search-suggestion {
  display: block;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.feed-search-suggestion:hover, .feed-search-suggestion.active {
  background: var(--surface-2);
  color: var(--ink);
}
.feed-search-suggestion small { color: var(--ink-mute); margin-left: 6px; }

/* ── Bottom nav (4 botones: Home / IA / Mi espacio / Perfil) ── */

.serclai-bnav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 150;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  font-family: var(--sans);
}
.serclai-bnav-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 720px;
  margin: 0 auto;
}
.bnav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 6px;
  color: var(--ink-mute);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: color var(--t-fast);
}
.bnav-btn svg { color: inherit; }
.bnav-btn:hover { color: var(--ink-soft); }
.bnav-btn.active {
  color: var(--coral);
}
/* Avatar mini en el tab Perfil (espejo del nav-chip de desktop) */
.bnav-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--ink-mute);
  display: block;
}
.bnav-btn.active .bnav-avatar {
  border-color: var(--coral);
}
.bnav-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft, #f3ede7);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
body.has-bnav { padding-bottom: 70px; }
@media (max-width: 720px) {
  .serclai-bnav { display: block; }
}

/* ── App badges (App Store + Google Play) ───────────────────── */

.app-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.app-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 14px;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  border: 1px solid var(--ink);
  transition: all var(--t-base);
  text-decoration: none;
  min-width: 152px;
}
.app-badge:hover {
  background: #2D2C2A;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.app-badge-icon {
  width: 24px;
  height: 28px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.app-badge-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  text-align: left;
}
.app-badge-small {
  font-size: 10px;
  letter-spacing: 0.04em;
  font-weight: 500;
  opacity: 0.8;
  margin-bottom: 2px;
}
.app-badge-big {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-family: var(--sans);
}

.app-badge-light {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}
.app-badge-light:hover {
  background: var(--surface-2);
  border-color: var(--ink);
}

/* ── Smart banner (sticky en mobile, cerrable) ─────────────── */

.app-banner {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--ink);
  color: white;
  padding: 10px 16px;
  font-family: var(--sans);
  animation: slideDown 280ms ease;
}
.app-banner-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
}
.app-banner-mark {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--coral);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.app-banner-text {
  flex: 1;
  line-height: 1.2;
  min-width: 0;
}
.app-banner-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 1px;
}
.app-banner-sub {
  font-size: 12px;
  opacity: 0.7;
}
.app-banner-cta {
  background: var(--coral);
  color: white;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--t-fast);
  text-decoration: none;
  flex-shrink: 0;
}
.app-banner-cta:hover { background: #C7674E; }
.app-banner-close {
  background: transparent;
  border: 0;
  color: rgba(255,255,255,0.65);
  font-size: 24px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  transition: color var(--t-fast);
  flex-shrink: 0;
}
.app-banner-close:hover { color: white; }

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── Bloque destacado app (portal cliente) ──────────────────── */

.app-cta-block {
  margin: 24px 0 32px;
  padding: 28px 32px;
  background: linear-gradient(135deg, var(--ink) 0%, #2D2C2A 100%);
  color: white;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  gap: 28px;
  position: relative;
  overflow: hidden;
}
.app-cta-block::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(217,119,87,0.25), transparent 70%);
  pointer-events: none;
}
.app-cta-info { flex: 1; min-width: 0; position: relative; }
.app-cta-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--coral-soft);
  font-weight: 600;
  margin-bottom: 8px;
  font-family: var(--sans);
}
.app-cta-title {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.app-cta-sub {
  font-size: 14px;
  opacity: 0.78;
  margin-bottom: 18px;
  max-width: 420px;
}

@media (max-width: 720px) {
  .app-cta-block { flex-direction: column; align-items: stretch; padding: 24px; }
  .app-cta-title { font-size: 22px; }
}

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 900px) {
  .container { padding: 0 24px; }
  .nav-links > a:not(.btn) { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 16px; }
  .sidebar-footer { display: none; }
  .app-main { padding: 24px; }
  .feed-grid { gap: 16px; }
  .feed-filters-row { padding: 0 24px; }
  .publish-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .footer-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 32px 24px; }
  .feed-grid { grid-template-columns: 1fr; }
  .feed-hero { padding: 32px 0 20px; }
  .feed-controls { display: none; }
}
