/* ============================================================
   DASHBOARD · Sidebar + topbar + KPIs + widgets
   ============================================================ */

/* Altura del bottom-nav móvil (usada para reservar espacio en el
   contenido y evitar que el menú tape los datos finales). */
:root {
  --mobile-bottom-nav-height: 66px;
}

/* ============================================================
   SHELL — Sidebar sticky FIJO en desktop, drawer en mobile.
   El sidebar ocupa SIEMPRE el lateral izquierdo completo de la
   pantalla en desktop. El contenido se desplaza con margin-left.
   ============================================================ */
.dash-shell {
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}
.dash-main {
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-w);
  transition: margin-left 280ms cubic-bezier(0.16, 1, 0.3, 1);
}
.dash-content {
  padding: 1.75rem 2rem;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  flex: 1;
}

.has-sidebar { background: var(--bg-base); }

/* ============================================================
   SIDEBAR — FIJO al lateral izquierdo completo en desktop
   ============================================================ */
.sidebar {
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-surface));
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  z-index: 50;
  scrollbar-width: thin;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--color-primary), var(--color-secondary));
  border-radius: 3px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.5rem 1.1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
.sidebar-brand:hover { color: var(--text-primary); }
.sidebar-brand-name {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.sidebar-brand-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 2px;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-group-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem 0.3rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--tx-fast);
  position: relative;
  border: 1px solid transparent;
}
.sidebar-link .icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color var(--tx-fast);
}
.sidebar-link span {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}
.sidebar-link:hover .icon { color: var(--color-secondary); }
.sidebar-link.active {
  background: linear-gradient(135deg, rgba(255, 0, 80, 0.15), rgba(0, 242, 234, 0.08));
  border-color: rgba(255, 0, 80, 0.25);
  color: var(--text-primary);
  font-weight: 600;
}
.sidebar-link.active .icon { color: var(--color-primary); }
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--gradient-tiktok);
  border-radius: 0 3px 3px 0;
  box-shadow: var(--glow-primary);
}

/* Badge bien colocado dentro del enlace */
.sidebar-badge {
  flex-shrink: 0;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--gradient-pink);
  color: white;
  font-size: 0.66rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(255, 0, 80, 0.4);
}

/* Footer del sidebar */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  margin-top: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--tx-fast);
}
.sidebar-user:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-soft);
  color: var(--text-primary);
}
.sidebar-user.is-active {
  background: rgba(255, 0, 80, 0.08);
  border-color: rgba(255, 0, 80, 0.3);
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.sidebar-user-role {
  font-size: 0.66rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
  font-weight: 600;
}

.sidebar-logout-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--tx-fast);
}
.sidebar-logout-row:hover {
  background: rgba(239, 68, 68, 0.08);
  color: var(--color-danger);
}
.sidebar-logout-row .icon { width: 14px; height: 14px; }

/* CTA primario en sidebar (opcional) */
.sidebar-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  background: var(--gradient-tiktok);
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: var(--glow-primary);
  transition: all var(--tx-fast);
}
.sidebar-cta:hover {
  transform: translateY(-1px);
  color: white;
  box-shadow: var(--glow-primary), var(--shadow-md);
}
.sidebar-cta .icon { width: 14px; height: 14px; }

/* Búsqueda rápida */
.sidebar-quicksearch {
  position: relative;
  margin-bottom: 1rem;
}
.sidebar-quicksearch input[type="search"] {
  width: 100%;
  padding: 0.55rem 0.75rem 0.55rem 2.3rem;
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.04);
}
.sidebar-quicksearch input[type="search"]::-webkit-search-cancel-button { display: none; }
.sidebar-quicksearch-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 14px;
  height: 14px;
  display: inline-flex;
}
.sidebar-quicksearch-icon svg { width: 100%; height: 100%; }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 2rem;
  height: 68px;
  background: rgba(14, 14, 22, 0.6);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.topbar-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}
.topbar-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}
.topbar-burger {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.03);
  align-items: center;
  justify-content: center;
}
.topbar-burger svg { width: 20px; height: 20px; color: var(--text-primary); }

/* Notificaciones dropdown */
.notif-wrap { position: relative; }
.notif-btn {
  position: relative;
}
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--gradient-pink);
  color: white;
  font-size: 0.62rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-base);
  line-height: 1;
  box-shadow: 0 2px 8px rgba(255, 0, 80, 0.5);
}
.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-width: 92vw;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity var(--tx-fast), transform var(--tx-fast), visibility 0s linear var(--tx-fast);
}
.notif-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity var(--tx-fast), transform var(--tx-fast);
}
.notif-head {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notif-head strong { font-size: 0.95rem; }
.notif-head .muted { font-size: 0.75rem; }
.notif-list {
  max-height: 380px;
  overflow-y: auto;
}
.notif-item {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  transition: background var(--tx-fast);
  text-decoration: none;
  color: var(--text-primary);
}
.notif-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--text-primary); }
.notif-item:last-child { border-bottom: none; }
.notif-item.is-unread { background: rgba(255, 0, 80, 0.05); }
.notif-item.is-unread::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
  margin-top: 8px;
  flex-shrink: 0;
  box-shadow: var(--glow-primary);
}
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
  line-height: 1.35;
}
.notif-item-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.notif-item-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.notif-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-grid-sm { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.kpi {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  position: relative;
  overflow: hidden;
  transition: all var(--tx-base);
}
.kpi:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.kpi-value {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-primary);
}
.kpi-trend {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.kpi-trend.up { color: var(--color-success); }
.kpi-trend.down { color: var(--color-danger); }

.kpi-pink::before, .kpi-cyan::before, .kpi-purple::before, .kpi-gold::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.kpi-pink::before   { background: var(--gradient-pink); }
.kpi-cyan::before   { background: var(--gradient-cyan); }
.kpi-purple::before { background: var(--gradient-purple); }
.kpi-gold::before   { background: var(--gradient-gold); }

/* ============================================================
   2-COL / 3-COL
   ============================================================ */
.two-col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}
.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* ============================================================
   RANKING TOP — Oro / Plata / Bronce CORRECTOS
   ============================================================ */
.rank-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  transition: background var(--tx-fast);
  border: 1px solid transparent;
}
.rank-item:hover { background: rgba(255, 255, 255, 0.04); }

.rank-item-pos {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  flex-shrink: 0;
  border: 1px solid var(--border-soft);
}

/* Sólo aplica oro/plata/bronce dentro de .rank-list (Top 10 acumulado) */
.rank-list > .rank-item:nth-of-type(1) .rank-item-pos {
  background: linear-gradient(135deg, #FFD700 0%, #B8860B 100%);
  color: #1a1a1a;
  border-color: #FFD700;
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.4);
}
.rank-list > .rank-item:nth-of-type(2) .rank-item-pos {
  background: linear-gradient(135deg, #E5E5E5 0%, #9C9C9C 100%);
  color: #1a1a1a;
  border-color: #C0C0C0;
  box-shadow: 0 0 14px rgba(192, 192, 192, 0.35);
}
.rank-list > .rank-item:nth-of-type(3) .rank-item-pos {
  background: linear-gradient(135deg, #CD7F32 0%, #8B5A2B 100%);
  color: white;
  border-color: #CD7F32;
  box-shadow: 0 0 12px rgba(205, 127, 50, 0.35);
}

.rank-item-name {
  flex: 1;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-item-value {
  font-weight: 700;
  color: var(--color-secondary);
  font-size: 0.92rem;
}

/* ============================================================
   EVENT ROW (próximos eventos)
   ============================================================ */
.event-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--color-primary);
  margin-bottom: 0.5rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--tx-fast);
}
.event-row:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(3px);
  color: var(--text-primary);
}
.event-row-date {
  text-align: center;
  flex-shrink: 0;
  min-width: 42px;
}
.event-row-day {
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--color-primary);
}
.event-row-month {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
  font-weight: 700;
}
.event-row-info { flex: 1; min-width: 0; }
.event-row-title { font-weight: 600; font-size: 0.88rem; line-height: 1.3; }
.event-row-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   POST CARD (comunidad)
   ============================================================ */
.post-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 0.85rem;
  transition: all var(--tx-base);
  position: relative;
  overflow: hidden;
}
.post-card:hover { border-color: var(--border-strong); }
.post-card.is-pinned {
  border-color: rgba(251, 191, 36, 0.4);
}
.post-card.is-pinned::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-gold);
}
.post-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.post-meta { flex: 1; min-width: 0; }
.post-author {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  line-height: 1.3;
}
.post-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.post-type-pill {
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.post-type-pill.type-update    { background: rgba(0, 242, 234, 0.12); color: var(--color-secondary); }
.post-type-pill.type-challenge { background: rgba(168, 85, 247, 0.12); color: var(--color-accent); }
.post-type-pill.type-question  { background: rgba(245, 158, 11, 0.12); color: var(--color-warning); }
.post-type-pill.type-win       { background: rgba(16, 185, 129, 0.12); color: var(--color-success); }

.post-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}
.post-content {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
  white-space: pre-wrap;
}
.post-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.post-footer-stat { display: inline-flex; align-items: center; gap: 0.3rem; }
.post-footer-stat .icon { width: 13px; height: 13px; }

/* ============================================================
   AVATAR UPLOADER
   ============================================================ */
.avatar-uploader {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.avatar-uploader-preview .avatar {
  width: 96px;
  height: 96px;
  font-size: 1.8rem;
}
.avatar-uploader-body { flex: 1; min-width: 240px; }
.avatar-uploader-body p { margin: 0 0 0.7rem; color: var(--text-secondary); }
.avatar-uploader-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* ============================================================
   MEDIA MANAGER (admin/media.php)
   ============================================================ */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.2rem;
  margin-top: 1rem;
}
.media-slot {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: all var(--tx-base);
}
.media-slot:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.media-slot-head h4 {
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}
.media-slot-head h4 .icon { color: var(--color-secondary); }
.media-slot-head p { font-size: 0.82rem; color: var(--text-secondary); margin: 0; }
.media-slot-head code {
  display: inline-block;
  margin-top: 0.3rem;
  font-size: 0.66rem;
  padding: 0.15rem 0.45rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  color: var(--text-muted);
}
.media-preview {
  aspect-ratio: 16/9;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
}
.media-preview img, .media-preview video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.media-preview-empty {
  text-align: center;
  color: var(--text-faded);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.media-preview-empty .icon { width: 32px; height: 32px; opacity: 0.5; }
.media-preview-empty p { margin: 0; font-size: 0.78rem; }
.media-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.media-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.media-pick { cursor: pointer; position: relative; overflow: hidden; }
.media-pick input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ============================================================
   LIST TOOLBAR / SEARCH / PAGINATION
   ============================================================ */
.list-toolbar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.list-toolbar > .list-search-input { flex: 1; min-width: 220px; }
.list-search-input { position: relative; display: flex; align-items: center; }
.list-search-input input[type="search"],
.list-search-input input[type="text"] {
  width: 100%;
  padding-left: 2.6rem;     /* hueco para la lupa */
  padding-right: 2.4rem;    /* hueco para clear button */
  line-height: 1.4;
}
.list-search-input input[type="search"]::-webkit-search-cancel-button { display: none; }
.list-search-icon {
  position: absolute;
  left: 0.9rem;
  top: 0;
  bottom: 0;
  margin: auto 0;           /* centrado vertical robusto */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
  z-index: 1;
}
.list-search-icon svg {
  width: 16px;
  height: 16px;
  display: block;           /* elimina el espacio inline bajo el SVG */
}
.list-search-clear {
  position: absolute;
  right: 0.6rem;
  top: 0;
  bottom: 0;
  margin: auto 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0;
  border: none;
  cursor: pointer;
}
.list-search-clear::before { content: '×'; font-size: 1.1rem; line-height: 1; }
.list-search-clear:hover { background: var(--color-danger); color: white; }

.list-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.list-pagination-info { font-size: 0.78rem; color: var(--text-muted); }
.list-pagination-pages { display: flex; gap: 4px; align-items: center; }
.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 500;
  transition: all var(--tx-fast);
}
.page-btn:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--border-strong); color: var(--text-primary); }
.page-btn.is-current {
  background: var(--gradient-tiktok);
  color: white;
  border-color: transparent;
  font-weight: 700;
}
.page-btn.is-disabled { opacity: 0.4; pointer-events: none; }
.page-ellipsis { color: var(--text-muted); padding: 0 0.25rem; font-size: 0.78rem; }

/* ============================================================
   CHART BARS
   ============================================================ */
.chart-bars {
  display: flex;
  gap: 0.65rem;
  align-items: stretch;  /* todas las cols misma altura */
  height: 260px;
  padding: 0.5rem 0 0;
}
.chart-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 36px;
  gap: 6px;
}
.chart-bar-value {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  /* Si no cabe (ej. 12.450,00€), reducimos */
  font-variant-numeric: tabular-nums;
}
/* El bar ocupa TODO el espacio sobrante en altura */
.chart-bar {
  flex: 1 1 0;
  min-height: 6px;
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.chart-bar-fill {
  width: 100%;
  background: var(--gradient-tiktok);
  background-size: 200% 200%;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: height var(--tx-slow);
  box-shadow: 0 -4px 16px rgba(255, 0, 80, 0.3) inset;
  min-height: 4px;
}
.chart-bar-col:hover .chart-bar-fill {
  background-position: 100% 50%;
}
.chart-bar-label {
  font-size: 0.66rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .chart-bars { height: 220px; gap: 0.3rem; }
  .chart-bar-value { font-size: 0.6rem; }
  .chart-bar-label { font-size: 0.58rem; letter-spacing: 0.04em; }
}

/* ============================================================
   RESPONSIVE — drawer móvil
   ============================================================ */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr; }

  /* En mobile: el contenido ocupa toda la pantalla. El sidebar es drawer */
  .dash-main {
    margin-left: 0;
  }
  .sidebar {
    /* Mantenemos position:fixed pero ahora se mueve fuera de pantalla */
    inset: 0 auto 0 0;
    width: min(300px, 85vw);
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    border-right: 1px solid var(--border-strong);
    will-change: transform;
  }
  .sidebar.is-open {
    transform: translateX(0);
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 280ms ease;
  }
  .sidebar-backdrop.is-active { opacity: 1; pointer-events: auto; }
  .topbar-burger { display: inline-flex; }
}

@media (max-width: 768px) {
  .topbar { padding: 0 1rem; }
  .topbar-title { font-size: 1rem; }

  .dash-content { padding: 1rem; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .kpi { padding: 1rem; }
  .kpi-value { font-size: 1.35rem; }

  .data-table { font-size: 0.78rem; }
  .data-table thead th, .data-table tbody td { padding: 0.6rem 0.5rem; }
  .table-wrap { margin: 0 -1rem; padding: 0 1rem; }

  .form-row { flex-direction: column; gap: 0.75rem; }
  .list-toolbar { flex-direction: column; align-items: stretch; }
  .list-pagination { flex-direction: column; align-items: center; }

  .notif-panel { width: 92vw; right: -8px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   MEDALLAS / LOGROS
   ============================================================ */

/* Banner destacado en el dashboard del alumno */
.medals-banner {
  background:
    linear-gradient(135deg, rgba(251, 191, 36, 0.06), rgba(255, 0, 80, 0.04)),
    var(--bg-card);
  border-color: rgba(251, 191, 36, 0.25);
}

.medals-progress { margin-top: 0.5rem; }

/* Hero de la página /achievements */
.medals-hero {
  background:
    radial-gradient(ellipse at top right, rgba(251, 191, 36, 0.10), transparent 60%),
    radial-gradient(ellipse at bottom left, rgba(255, 0, 80, 0.06), transparent 60%),
    var(--bg-card);
  border-color: rgba(251, 191, 36, 0.3);
}
.medals-hero-stats {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  flex-wrap: wrap;
}
.medals-hero-count {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-shrink: 0;
}
.medals-hero-num {
  font-size: clamp(3rem, 5vw, 4.5rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  background: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.medals-hero-total {
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 500;
}
.medals-hero-bar {
  flex: 1;
  min-width: 280px;
}

/* La medalla en sí (círculo con tier color) */
.medal {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.1);
}
.medal .icon {
  width: 24px;
  height: 24px;
}

/* Tier — bronce, plata, oro, platino, legendaria */
.medal-bronze {
  background: linear-gradient(135deg, #CD7F32, #8B5A2B);
  color: #fff;
  box-shadow: 0 0 16px rgba(205, 127, 50, 0.35);
}
.medal-silver {
  background: linear-gradient(135deg, #E5E5E5, #9C9C9C);
  color: #1a1a1a;
  box-shadow: 0 0 16px rgba(192, 192, 192, 0.4);
}
.medal-gold {
  background: linear-gradient(135deg, #FFD700, #B8860B);
  color: #1a1a1a;
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.5);
}
.medal-platinum {
  background: linear-gradient(135deg, #E5E4E2, #B0C4DE, #708090);
  color: #1a1a1a;
  box-shadow: 0 0 20px rgba(180, 200, 220, 0.55);
}
.medal-legendary {
  background:
    radial-gradient(circle at 30% 25%, #FF2D75, #FF0050 35%, #A855F7 65%, #00F2EA 100%);
  color: #fff;
  box-shadow: var(--glow-primary), var(--glow-purple);
  animation: medal-pulse 3s ease-in-out infinite;
  border-color: rgba(255, 255, 255, 0.2);
}
@keyframes medal-pulse {
  0%, 100% { transform: scale(1); box-shadow: var(--glow-primary), var(--glow-purple); }
  50%      { transform: scale(1.05); box-shadow: 0 0 28px rgba(255, 0, 80, 0.6), 0 0 28px rgba(168, 85, 247, 0.4); }
}

/* Grid de medallas */
.medals-grid {
  display: grid;
  /* === FIX: auto-fit (no auto-fill) para que colapse en mobile === */
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 0.85rem;
}
.medals-grid-full {
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
}

/* === Mobile: 1 sola columna asegurada === */
@media (max-width: 600px) {
  .medals-grid,
  .medals-grid-full {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  .medal-card {
    padding: 0.85rem;
    gap: 0.75rem;
  }
  .medal-card .medal {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }
  .medal-card .medal .icon {
    width: 20px;
    height: 20px;
  }
  /* Para que el texto se ajuste sin cortarse */
  .medal-card .medal-info {
    min-width: 0;
    flex: 1;
  }
  .medal-card .medal-name {
    font-size: 0.9rem;
    word-break: break-word;
  }
  .medal-card .medal-desc {
    font-size: 0.78rem;
    word-break: break-word;
  }
}

/* Card individual de medalla */
.medal-card {
  display: flex;
  align-items: flex-start;
  gap: 0.95rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--tx-fast);
  position: relative;
}
.medal-card.earned {
  border-color: rgba(251, 191, 36, 0.4);
  background:
    linear-gradient(135deg, rgba(251, 191, 36, 0.06), transparent),
    rgba(255, 255, 255, 0.03);
}
.medal-card.locked {
  opacity: 0.55;
  filter: grayscale(60%);
}
.medal-card.locked .medal {
  background: rgba(255, 255, 255, 0.06) !important;
  color: var(--text-muted);
  box-shadow: none;
  animation: none;
}
.medal-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}
.medal-card.earned:hover {
  border-color: rgba(251, 191, 36, 0.6);
  box-shadow: 0 4px 18px rgba(251, 191, 36, 0.15);
}

.medal-info {
  flex: 1;
  min-width: 0;
}
.medal-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
  line-height: 1.3;
}
.medal-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
}
.medal-earned-date {
  font-size: 0.72rem;
  color: var(--color-secondary);
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.medal-earned-date .icon { width: 12px; height: 12px; }

/* Pill con el nombre del tier */
.medal-tier-pill {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid;
}
.medal-tier-bronze    { background: rgba(205, 127, 50, 0.15);  color: #D29257; border-color: rgba(205, 127, 50, 0.35); }
.medal-tier-silver    { background: rgba(192, 192, 192, 0.15); color: #D8D8D8; border-color: rgba(192, 192, 192, 0.35); }
.medal-tier-gold      { background: rgba(255, 215, 0, 0.15);   color: #FFD700; border-color: rgba(255, 215, 0, 0.35); }
.medal-tier-platinum  { background: rgba(180, 200, 220, 0.15); color: #C9D5E4; border-color: rgba(180, 200, 220, 0.35); }
.medal-tier-legendary {
  background: linear-gradient(135deg, rgba(255, 0, 80, 0.18), rgba(168, 85, 247, 0.18));
  color: #fff;
  border-color: rgba(255, 0, 80, 0.4);
}

/* ============================================================
   MY-RANK (cuadro de posición del alumno)
   ============================================================ */
.my-rank {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(0, 242, 234, 0.08), rgba(255, 0, 80, 0.05));
  border: 1px solid rgba(0, 242, 234, 0.25);
  border-radius: var(--radius-md);
}
.my-rank-pos {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  background: var(--gradient-cyan);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
  flex-shrink: 0;
}
.my-rank-info { flex: 1; min-width: 0; }
.my-rank-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.my-rank-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

/* ============================================================
   NOTIF-ROW (avisos inline en widget)
   ============================================================ */
.notif-list-inline {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.notif-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  transition: background var(--tx-fast);
}
.notif-row:hover { background: rgba(255, 255, 255, 0.04); }
.notif-row.is-unread {
  background: rgba(255, 0, 80, 0.05);
  border-color: rgba(255, 0, 80, 0.18);
}
.notif-row-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 0, 80, 0.12);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notif-row-icon .icon { width: 14px; height: 14px; }
.notif-row-body { flex: 1; min-width: 0; }
.notif-row-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}
.notif-row-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   PLAY-MINI (icono ▶ en tabla de lecciones)
   ============================================================ */
.play-mini {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gradient-cyan);
  color: var(--bg-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(0, 242, 234, 0.3);
}
.play-mini .icon { width: 14px; height: 14px; }

/* ============================================================
   DIVIDER (separador entre bloques en widgets)
   ============================================================ */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 1rem 0;
}

/* ============================================================
   EMPTY-SM (variante compacta para widgets pequeños)
   ============================================================ */
.empty-sm {
  padding: 1rem 0.5rem;
  text-align: center;
}
.empty-sm .icon { width: 28px; height: 28px; margin-bottom: 0.3rem; opacity: 0.4; }
.empty-sm p { margin: 0; font-size: 0.85rem; }

/* ============================================================
   STUDENT CALENDAR — Grid layout
   ============================================================ */
.student-cal-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 980px) {
  .student-cal-grid { grid-template-columns: 1fr; }
}

.cal-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.btn-icon-sm {
  width: 30px; height: 30px;
}
.btn-icon-sm .icon { width: 14px; height: 14px; }

.event-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* ============================================================
   STUDENT RANKING — Podium + banner + me-row
   ============================================================ */
.rank-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 1.75rem 0 1rem;
  letter-spacing: -0.015em;
}

/* Mi banner */
.my-rank-banner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  background:
    linear-gradient(135deg, rgba(255, 0, 80, 0.10), rgba(0, 242, 234, 0.06)),
    var(--bg-card);
  border: 1px solid rgba(255, 0, 80, 0.25);
  flex-wrap: wrap;
}
.my-rank-banner-pos {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  background: var(--gradient-tiktok);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  flex-shrink: 0;
}
.my-rank-banner-info {
  flex: 1;
  min-width: 180px;
}
.my-rank-banner-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.my-rank-banner-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.my-rank-banner-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}
.my-rank-banner-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.my-rank-banner-stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-secondary);
  margin-top: 2px;
}

/* Podio (top 3 cards) */
.ranking-podium {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  max-width: 920px;
  align-items: stretch;
}
.ranking-podium .rank-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.25rem 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  position: relative;
  overflow: hidden;
  transition: transform var(--tx-base), box-shadow var(--tx-base);
}
.ranking-podium .rank-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.ranking-podium .rank-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}
.ranking-podium .rank-card.rank-pos-1 {
  border-color: rgba(255, 215, 0, 0.4);
  box-shadow: 0 0 28px rgba(255, 215, 0, 0.1);
}
.ranking-podium .rank-card.rank-pos-1::before { background: linear-gradient(90deg, #FFD700, #FFA500); }
.ranking-podium .rank-card.rank-pos-1 .rank-pos {
  color: #FFD700;
  text-shadow: 0 0 16px rgba(255, 215, 0, 0.5);
}

.ranking-podium .rank-card.rank-pos-2 { border-color: rgba(192, 192, 192, 0.35); }
.ranking-podium .rank-card.rank-pos-2::before { background: linear-gradient(90deg, #E5E5E5, #9C9C9C); }
.ranking-podium .rank-card.rank-pos-2 .rank-pos {
  color: #C0C0C0;
  text-shadow: 0 0 12px rgba(192, 192, 192, 0.4);
}

.ranking-podium .rank-card.rank-pos-3 { border-color: rgba(205, 127, 50, 0.35); }
.ranking-podium .rank-card.rank-pos-3::before { background: linear-gradient(90deg, #CD7F32, #8B5A2B); }
.ranking-podium .rank-card.rank-pos-3 .rank-pos {
  color: #CD7F32;
  text-shadow: 0 0 12px rgba(205, 127, 50, 0.4);
}

.ranking-podium .rank-pos {
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  font-family: var(--font-display);
}
.ranking-podium .rank-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.3;
  letter-spacing: -0.015em;
}
.ranking-podium .rank-revenue {
  font-weight: 800;
  font-size: 1.2rem;
  background: var(--gradient-cyan);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
}
.ranking-podium .rank-badge {
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-soft);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Fila resaltada (es el alumno actual) */
.data-table tbody tr.is-me {
  background: rgba(255, 0, 80, 0.08);
}
.data-table tbody tr.is-me:hover { background: rgba(255, 0, 80, 0.12); }
.data-table tbody tr.is-me td:first-child { box-shadow: inset 3px 0 0 var(--color-primary); }

/* ============================================================
   STUDENT RESOURCES — Grid de cards descargables
   ============================================================ */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.resource-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all var(--tx-fast);
  position: relative;
}
.resource-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.resource-card.is-locked {
  opacity: 0.7;
  border-style: dashed;
}
.resource-card.is-locked:hover { transform: none; }

.resource-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(0, 242, 234, 0.10);
  color: var(--color-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.resource-card.is-locked .resource-icon {
  background: rgba(251, 191, 36, 0.10);
  color: var(--color-gold);
}
.resource-icon .icon { width: 22px; height: 22px; }

.resource-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.resource-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.3;
}
.resource-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.resource-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.3rem;
}
.resource-card .btn {
  align-self: flex-start;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  /* === FIX MOBILE: estructura clara en 3 zonas verticales === */
  .resource-card {
    flex-direction: column;
    gap: 0.85rem;
    padding: 1rem;
  }
  /* Zona 1: icono pequeño a la izquierda, título a la derecha */
  .resource-card .resource-icon {
    width: 40px;
    height: 40px;
    align-self: flex-start;
    position: absolute;
    top: 1rem;
    left: 1rem;
  }
  .resource-card .resource-icon .icon { width: 18px; height: 18px; }
  /* Zona 2: cuerpo a la derecha del icono */
  .resource-card .resource-body {
    padding-left: 52px;     /* sitio para el icono absolute */
    min-height: 40px;       /* alinear con el icono */
  }
  .resource-card .resource-title {
    font-size: 1rem;
    word-break: break-word;
    hyphens: auto;
  }
  .resource-card .resource-desc {
    font-size: 0.85rem;
    padding-left: 0;
  }
  /* Cuando NO hay descripción, ajustamos el body para no quedar vacío */
  .resource-meta {
    margin-top: 0.5rem;
    gap: 0.4rem;
  }
  .resource-meta .badge {
    font-size: 0.65rem;
    padding: 0.18rem 0.5rem;
  }
  /* Zona 3: botón ancho completo, fácil de tocar (mín 44px) */
  .resource-card .btn {
    align-self: stretch;
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
    min-height: 44px;
    font-weight: 700;
  }
  /* Quitar el "translateY(-2px)" en hover mobile que se siente raro */
  .resource-card:hover {
    transform: none;
  }
}

/* === Reset para evitar overflow horizontal === */
.resources-grid {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* ============================================================
   MINI CALENDARIO (student/calendar.php)
   ============================================================ */
.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.mini-cal-dow {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.3rem 0 0.5rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mini-cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--tx-fast);
  position: relative;
  font-weight: 500;
  min-height: 36px;
}
.mini-cal-day:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}
.mini-cal-day.is-other {
  color: transparent;
  pointer-events: none;
}
.mini-cal-day.is-today {
  background: var(--gradient-tiktok);
  background-size: 200% 200%;
  color: white;
  font-weight: 800;
  box-shadow: var(--glow-primary);
}
.mini-cal-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-secondary);
  box-shadow: 0 0 6px var(--color-secondary);
}
.mini-cal-day.is-today.has-event::after { background: white; box-shadow: 0 0 6px white; }

.cal-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.cal-legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ============================================================
   STUDENT COURSES — módulos + lecciones
   ============================================================ */
.packages-info-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, rgba(255, 0, 80, 0.08), rgba(0, 242, 234, 0.04)),
              var(--bg-card);
  border: 1px solid rgba(255, 0, 80, 0.2);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

/* Sección de cada módulo */
.module-section {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  transition: border-color var(--tx-fast);
  position: relative;
  overflow: hidden;
}
.module-section:hover { border-color: var(--border-strong); }
.module-section.is-locked {
  opacity: 0.85;
  border-style: dashed;
}

/* Cabecera con thumbnail + título + progreso */
.module-card-head {
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  margin-bottom: 1rem;
}

.module-thumb {
  position: relative;
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--gradient-tiktok);
  background-size: 200% 200%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: var(--glow-primary);
}
.module-thumb-initial {
  font-size: 2rem;
  font-weight: 900;
  color: white;
  letter-spacing: -0.04em;
  font-family: var(--font-display, var(--font-sans));    /* fallback si no carga */
  z-index: 1;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  -webkit-font-smoothing: antialiased;
}
.module-thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity var(--tx-fast);
  z-index: 2;
  pointer-events: none;    /* No interferir con clicks */
}
.module-thumb-play .icon { width: 24px; height: 24px; color: white; }
.module-section:hover .module-thumb-play { opacity: 1; }

/* === FIX MOBILE: módulo más compacto, sin desbordamientos === */
@media (max-width: 600px) {
  .module-section {
    padding: 1rem;
  }
  .module-card-head {
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }
  .module-thumb {
    width: 56px;
    height: 56px;
    border-radius: 14px;     /* Esquinas más redondeadas para verse balanceado */
  }
  .module-thumb-initial {
    font-size: 1.75rem;       /* Mayor para ocupar bien el cuadrado */
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    /* Centrado matemático perfecto sin descender raro */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-1px);    /* Ajuste óptico (descender de la M visualmente alto) */
  }
  .module-info-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .module-info h3 {
    font-size: 1rem;
    line-height: 1.25;
    word-break: break-word;
  }
  .module-info p.muted {
    font-size: 0.78rem;
    margin-top: 0.25rem;
  }
  /* En mobile no hay hover. Mostrar play en estado base atenuado */
  .module-thumb-play { opacity: 0; }
}

.module-info {
  flex: 1;
  min-width: 0;
}
.module-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}
.module-info-row h3 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--text-primary);
  line-height: 1.25;
}
.module-info p { font-size: 0.88rem; line-height: 1.5; margin: 0; }

/* Lista de lecciones dentro del módulo */
.lessons-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
}

.lesson-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: all var(--tx-fast);
}
.lesson-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-soft);
  transform: translateX(2px);
}

/* Botón circular de play / check */
.play-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0, 242, 234, 0.12);
  color: var(--color-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(0, 242, 234, 0.25);
  transition: all var(--tx-fast);
}
.play-btn .icon { width: 16px; height: 16px; }
.lesson-item:hover .play-btn {
  background: var(--color-secondary);
  color: var(--bg-base);
  box-shadow: 0 0 14px rgba(0, 242, 234, 0.45);
}
.play-btn.completed {
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-success);
  border-color: rgba(16, 185, 129, 0.3);
}
.lesson-item:hover .play-btn.completed {
  background: var(--color-success);
  color: white;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.45);
}
.play-btn.locked {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border-color: var(--border-subtle);
}

.lesson-info {
  flex: 1;
  min-width: 0;
}
.lesson-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 2px;
}
.lesson-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.lesson-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-shrink: 0;
}
.lesson-actions form { margin: 0; }

/* Overlay bloqueado para módulos no accesibles */
.locked-overlay {
  text-align: center;
  padding: 2rem 1rem;
  background: linear-gradient(180deg, transparent, rgba(251, 191, 36, 0.04));
  border-top: 1px solid var(--border-subtle);
  margin: 1rem -1.5rem -1.5rem;
}
.locked-overlay .icon {
  width: 36px;
  height: 36px;
  color: var(--color-gold);
  opacity: 0.7;
  margin: 0 auto 0.6rem;
}
.locked-overlay h4 {
  font-size: 1rem;
  margin-bottom: 0.3rem;
  color: var(--text-primary);
}
.locked-overlay p {
  font-size: 0.85rem;
  margin: 0 0 1rem;
}

@media (max-width: 600px) {
  .module-card-head { flex-direction: column; }
  .module-thumb { width: 64px; height: 64px; }
  .module-thumb-initial { font-size: 1.6rem; }
  .lesson-item { flex-wrap: wrap; }
  .lesson-actions { width: 100%; justify-content: flex-end; margin-top: 0.4rem; }
}

/* ============================================================
   ONLINE WIDGET — Usuarios conectados (admin dashboard)
   ============================================================ */
.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  flex-shrink: 0;
  vertical-align: middle;
}
.online-dot-pulse {
  position: relative;
  animation: online-pulse 2s ease-in-out infinite;
  margin-right: 0.3rem;
}
@keyframes online-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  50%      { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}
.online-dot-corner {
  position: absolute;
  bottom: 0;
  right: 0;
  border: 2px solid var(--bg-elevated);
  width: 10px;
  height: 10px;
}

.online-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 320px;
  overflow-y: auto;
}
.online-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.55rem 0.7rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: background var(--tx-fast);
}
.online-item:hover { background: rgba(255, 255, 255, 0.05); }

.online-avatar {
  position: relative;
  flex-shrink: 0;
}

.online-info { flex: 1; min-width: 0; }
.online-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.online-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.online-path {
  font-family: var(--font-sans);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.72rem;
  color: var(--color-secondary);
  border: 1px solid var(--border-subtle);
}

/* ============================================================
   MODERATION — Strikes y revisión
   ============================================================ */

/* Banner del strike inmediato tras detectarse mensaje malo */
.strike-banner {
  display: flex;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background:
    linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(245, 158, 11, 0.06)),
    var(--bg-elevated);
  border: 2px solid var(--color-danger);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  box-shadow: 0 0 32px rgba(239, 68, 68, 0.2);
  animation: strike-shake 0.5s ease-out;
}
@keyframes strike-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.strike-banner-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.18);
  color: var(--color-danger);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  animation: strike-pulse-icon 1.4s ease-in-out infinite;
}
.strike-banner-icon .icon { width: 28px; height: 28px; }
@keyframes strike-pulse-icon {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 14px rgba(239, 68, 68, 0); }
}
.strike-banner-body { flex: 1; min-width: 0; }
.strike-banner-body strong {
  display: block;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}
.strike-banner-body p {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
}
.strike-banner-body code {
  background: rgba(239, 68, 68, 0.15);
  color: #FFB4B4;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.82em;
}
.strike-banner-body .strike-warn {
  margin-top: 0.6rem;
  padding: 0.55rem 0.85rem;
  background: rgba(245, 158, 11, 0.10);
  border-left: 3px solid var(--color-warning);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-primary);
}

/* Contador de dots (3 puntos) */
.strike-counter {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.5rem 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.strike-dots {
  display: inline-flex;
  gap: 4px;
}
.strike-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.15);
}
.strike-dot.is-on {
  background: var(--color-danger);
  border-color: var(--color-danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

/* Mini aviso permanente bajo el composer */
.strike-warning-mini {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}
.strike-warning-mini .icon {
  color: var(--color-warning);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.strike-warning-mini strong { color: var(--text-primary); }

/* Vista admin de strikes — card por usuario */
.strike-user-card { margin-bottom: 1rem; }
.strike-user-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1rem;
}
.strike-user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 220px;
}
.strike-user-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.strike-user-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.strike-counter-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.6rem 1.2rem;
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
}
.strike-counter-num {
  font-size: 2rem;
  font-weight: 900;
  color: var(--color-danger);
  line-height: 1;
}
.strike-counter-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.strike-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.strike-row {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.7rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--color-warning);
  border-radius: var(--radius-md);
}
.strike-row-when {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.strike-row-when .icon { width: 12px; height: 12px; }
.strike-row-reason { font-size: 0.88rem; color: var(--text-primary); }
.strike-row-reason strong { display: block; margin-bottom: 2px; }
.strike-row-match {
  display: inline-block;
  margin-top: 0.3rem;
  padding: 0.1rem 0.45rem;
  background: rgba(239, 68, 68, 0.12);
  color: #FFB4B4;
  border-radius: 4px;
  font-size: 0.78em;
}

.strike-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* Botón success para "Desestimar" */
.btn-success {
  background: var(--color-success);
  color: white;
  border-color: var(--color-success);
}
.btn-success:hover {
  background: #0FA972;
  border-color: #0FA972;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

/* Banner en admin/index del bloque "Alumnos bajo revisión" */
.moderation-banner {
  border-color: rgba(239, 68, 68, 0.3);
  background:
    linear-gradient(135deg, rgba(239, 68, 68, 0.06), transparent),
    var(--bg-card);
}
.moderation-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.moderation-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.moderation-row-info { flex: 1; min-width: 0; }

/* ============================================================
   COMMUNITY — Botón LIKE (corazón con animación)
   ============================================================ */
.community-feed {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1.25rem;
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--tx-fast);
}
.like-btn .icon { width: 16px; height: 16px; transition: transform var(--tx-fast); }
.like-btn:hover {
  background: rgba(255, 0, 80, 0.08);
  border-color: rgba(255, 0, 80, 0.25);
  color: var(--color-primary);
}
.like-btn.is-liked {
  background: rgba(255, 0, 80, 0.15);
  border-color: rgba(255, 0, 80, 0.4);
  color: var(--color-primary);
}
.like-btn.is-liked .icon {
  color: var(--color-primary);
  filter: drop-shadow(0 0 6px rgba(255, 0, 80, 0.5));
}
.like-btn.like-pulse .icon {
  animation: like-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes like-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}
.like-count {
  font-variant-numeric: tabular-nums;
  min-width: 1ch;
}

/* ============================================================
   RESOURCES — Aviso legal + Modal de descarga
   ============================================================ */
.resources-warning {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  background:
    linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(255, 0, 80, 0.04)),
    var(--bg-card);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}
.resources-warning-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.15);
  color: var(--color-gold);
  display: flex;
  align-items: center;
  justify-content: center;
}
.resources-warning-icon .icon { width: 22px; height: 22px; }
.resources-warning-body { flex: 1; min-width: 0; }
.resources-warning-body strong {
  display: block;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}
.resources-warning-body p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Modal de descarga */
.download-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;   /* === FIX: no interceptar clicks cuando está oculto === */
  transition: opacity var(--tx-base);
}
/* CRÍTICO: el atributo hidden debe ocultar 100% el modal (display:flex lo machacaba) */
.download-modal[hidden] {
  display: none !important;
}
.download-modal.is-open {
  opacity: 1;
  pointer-events: auto;   /* === FIX: solo capta clicks cuando está abierto === */
}
.download-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
}
.download-modal-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95);
  transition: transform var(--tx-base);
}
.download-modal.is-open .download-modal-content { transform: scale(1); }

.download-modal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.15);
  color: var(--color-gold);
  display: flex;
  align-items: center;
  justify-content: center;
}
.download-modal-icon .icon { width: 32px; height: 32px; }

.download-modal h3 {
  text-align: center;
  font-size: 1.25rem;
  margin: 0 0 0.5rem;
}
.download-modal-resource {
  text-align: center;
  margin: 0 0 1.2rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
}
.download-modal-warn {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-secondary);
}
.download-modal-warn p { margin: 0 0 0.55rem; }
.download-modal-warn ul, .download-modal-warn ol {
  margin: 0.5rem 0 0.55rem 1.2rem;
  padding: 0;
}
.download-modal-warn ul li, .download-modal-warn ol li { margin-bottom: 0.3rem; }
.download-modal-warn strong { color: var(--text-primary); }
.download-modal-id {
  margin-top: 0.85rem !important;
  padding: 0.6rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
}
.download-modal-id code {
  background: rgba(0, 242, 234, 0.1);
  color: var(--color-secondary);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.download-modal-check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 1.2rem 0;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-primary);
}
.download-modal-check input {
  margin-top: 2px;
  flex-shrink: 0;
}

.download-modal-actions {
  display: flex;
  gap: 0.55rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.btn-disabled, .btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

@media (max-width: 600px) {
  .strike-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .strike-actions { justify-content: stretch; }
  .strike-actions .btn { flex: 1; min-width: 0; justify-content: center; }
  .download-modal { padding: 0.5rem; }
  .download-modal-content { padding: 1.5rem 1.2rem; }
}

/* ============================================================
   RESPONSIVE TABLES — Card-on-mobile pattern (Sprint UX/UI v2)
   Transforma tablas en cards apiladas en <768px usando data-label.
   ============================================================ */

/* Wrap horizontal scroll por defecto en tablet */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  scrollbar-width: thin;
}
.table-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-thumb {
  background: var(--gradient-tiktok);
  border-radius: 3px;
}

/* En mobile, transformar tabla en cards apiladas */
@media (max-width: 720px) {
  .data-table.responsive,
  .data-table {
    border: none;
    background: transparent;
  }
  .data-table.responsive thead,
  .data-table thead {
    display: none;   /* ocultamos el head */
  }
  .data-table.responsive tbody,
  .data-table tbody { display: block; }
  .data-table.responsive tr,
  .data-table tr {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin-bottom: 0.7rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  .data-table.responsive td,
  .data-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
    border: none;
    border-bottom: 1px solid var(--border-subtle);
    text-align: right;
    font-size: 0.9rem;
    min-width: 0;                    /* permite encoger */
  }
  /* El valor (después del label) puede partir palabras largas como emails */
  .data-table td[data-label] {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .data-table.responsive td:last-child,
  .data-table tbody td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
  /* Etiqueta a la izquierda (sólo si tiene data-label) */
  .data-table td[data-label]::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    text-align: left;
    flex: 0 0 auto;
    min-width: 90px;
  }
  /* Cell con avatar/nombre — apila la imagen */
  .data-table td.cell-name {
    justify-content: flex-start;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.65rem;
    margin-bottom: 0.4rem;
    font-weight: 600;
  }
  /* Si una celda con data-label CONTIENE un .cell-name (contenido rico:
     icono + título + descripción), apilar en vertical para que el título
     no se solape con la etiqueta ni se corte por la derecha.
     .cell-rich es el fallback explícito para navegadores sin :has(). */
  .data-table td[data-label]:has(.cell-name),
  .data-table td.cell-rich {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 0.35rem;
  }
  .data-table td[data-label]:has(.cell-name)::before,
  .data-table td.cell-rich::before {
    min-width: 0;
  }
  .data-table td[data-label] .cell-name {
    width: 100%;
    text-align: left;
  }
  .data-table td[data-label] .cell-name strong {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .data-table td.cell-name::before { display: none; }
  /* Acciones a la derecha, sin label */
  .data-table td.cell-actions {
    justify-content: flex-end;
  }
  .data-table td.cell-actions::before { display: none; }
}

/* ============================================================
   CARDS — Sistema unificado SaaS
   ============================================================ */
.widget-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color var(--tx-base);
}
@media (min-width: 769px) {
  .widget-card { padding: 1.5rem; }
}
.widget-card:hover {
  border-color: var(--border-soft);
}
.widget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.widget-head h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
}
.widget-head h3 .icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ============================================================
   TWO-COL GRID — Auto-stack responsive
   ============================================================ */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (min-width: 1024px) {
  .two-col { gap: 1.25rem; }
}
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ============================================================
   KPI GRID — Auto-fit responsive
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }
  .kpi {
    padding: 0.85rem 0.75rem;
  }
  .kpi-value { font-size: 1.4rem; }
  .kpi-label { font-size: 0.7rem; }
  .kpi-trend { font-size: 0.65rem; }
}
@media (max-width: 340px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   DASHBOARD CONTENT — Padding responsive
   ============================================================ */
.dash-content {
  padding: 1rem;
}
@media (min-width: 640px) { .dash-content { padding: 1.25rem 1.5rem; } }
@media (min-width: 1024px) { .dash-content { padding: 1.5rem 2rem; } }
@media (min-width: 1440px) { .dash-content { padding: 2rem 2.5rem; } }

/* ============================================================
   FORMS — Mobile-first, anchos correctos
   ============================================================ */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.form-group small.muted {
  font-size: 0.75rem;
  line-height: 1.4;
}

/* ============================================================
   SIDEBAR mobile — más cómodo y accesible
   ============================================================ */
@media (max-width: 1024px) {
  .sidebar-link {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
  }
  .sidebar-link .icon {
    width: 20px;
    height: 20px;
  }
}

/* ============================================================
   TOPBAR — más limpio en móvil
   ============================================================ */
@media (max-width: 640px) {
  .topbar {
    padding: 0.6rem 0.85rem;
    gap: 0.6rem;
  }
  .topbar-title {
    font-size: 1.05rem;
    line-height: 1.2;
  }
  .topbar-subtitle {
    font-size: 0.72rem;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* ============================================================
   CALENDARIO — Touch-friendly en mobile
   ============================================================ */
@media (max-width: 768px) {
  .cal-toolbar {
    flex-wrap: wrap;
    gap: 0.5rem !important;
  }
  .cal-toolbar > * { flex: 0 0 auto; }
  .cal-toolbar-views {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    display: flex;
    gap: 0.4rem;
  }
  .cal-toolbar-views::-webkit-scrollbar { display: none; }
  .cal-view-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  /* Grid del calendario semanal en móvil → vista lista */
  .cal-week-grid {
    grid-template-columns: 1fr !important;
  }
  .cal-day-col {
    border-right: none !important;
    border-bottom: 1px solid var(--border-subtle);
  }
  /* Eventos: ocupar ancho completo */
  .cal-event {
    position: relative !important;
    width: 100% !important;
    left: 0 !important;
    top: auto !important;
    height: auto !important;
    min-height: auto !important;
    margin-bottom: 0.4rem;
  }
}

/* ============================================================
   BUTTONS — Mobile-friendly group
   ============================================================ */
@media (max-width: 540px) {
  .btn-group,
  .form-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  .btn-group .btn,
  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================================
   MODALS — Mobile fullscreen-ish
   ============================================================ */
@media (max-width: 600px) {
  .download-modal,
  .modal-backdrop {
    padding: 0.5rem !important;
  }
  .download-modal-content,
  .modal {
    max-height: calc(100dvh - 1rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
  }
}

/* ============================================================
   ALERTS — Más legibles en móvil
   ============================================================ */
@media (max-width: 600px) {
  .alert {
    padding: 0.85rem 1rem;
    font-size: 0.88rem;
    border-radius: var(--radius-md);
  }
}

/* ============================================================
   BADGES — Tamaño consistente
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
  line-height: 1.4;
}

/* ============================================================
   COMMUNITY — feed cómodo en móvil
   ============================================================ */
@media (max-width: 600px) {
  .post-card {
    padding: 1rem;
    border-radius: var(--radius-md);
  }
  .post-head {
    flex-wrap: wrap;
  }
  .post-head .cell-actions {
    margin-left: auto;
  }
  .post-content {
    font-size: 0.92rem;
    line-height: 1.6;
  }
}

/* ============================================================
   RESOURCES GRID — touch-friendly cards
   ============================================================ */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}
@media (max-width: 480px) {
  .resources-grid { grid-template-columns: 1fr; gap: 0.6rem; }
  .resource-card { padding: 0.85rem; }
}

/* ============================================================
   COURSES — module thumb / lesson item
   ============================================================ */
@media (max-width: 768px) {
  .module-section {
    padding: 0.85rem;
    border-radius: var(--radius-md);
  }
  .module-thumb {
    height: 140px;
  }
  .lesson-item {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .lesson-item .lesson-info {
    flex: 1 1 100%;
    order: 2;
  }
}

/* ============================================================
   ACHIEVEMENTS — Cards grid premium
   ============================================================ */
@media (max-width: 600px) {
  .medals-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }
  .medal-card {
    padding: 0.85rem 0.5rem;
  }
  .medal-icon {
    width: 56px;
    height: 56px;
  }
}
@media (max-width: 340px) {
  .medals-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   PREMIUM POLISH FINAL — Sprint visual SaaS
   Mejoras quirúrgicas: tablet 1024px, mobile 430-320px
   ============================================================ */

/* --- Botón burger del topbar: más visible + táctil --- */
.topbar-burger {
  width: 42px;
  height: 42px;
  transition: background var(--tx-fast), border-color var(--tx-fast), transform var(--tx-fast);
}
.topbar-burger:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-strong);
}
.topbar-burger:active { transform: scale(0.94); }

/* --- Sidebar: tamaños táctiles confortables --- */
@media (max-width: 1024px) {
  .sidebar {
    padding: 1rem 0.85rem;
  }
  .sidebar-brand {
    padding: 0.5rem 0.5rem;
    margin-bottom: 0.5rem;
  }
  .sidebar-link {
    padding: 0.85rem 0.95rem;
    min-height: 46px;
    font-size: 0.95rem;
    margin-bottom: 2px;
  }
  .sidebar-link .icon {
    width: 20px;
    height: 20px;
  }
  .sidebar-group-title {
    padding: 0.5rem 1rem;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
  }
  .sidebar-user {
    padding: 0.85rem 0.85rem;
    border-radius: var(--radius-md);
  }
  .sidebar-logout-row {
    padding: 0.85rem 0.95rem;
    min-height: 44px;
  }
}

/* --- Topbar premium en mobile --- */
@media (max-width: 768px) {
  .topbar {
    height: 60px;
    padding: 0 0.85rem;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(7, 7, 12, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-subtle);
  }
  .topbar-left {
    flex: 1;
    min-width: 0;
  }
  .topbar-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-subtitle {
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .topbar-actions {
    gap: 0.35rem;
  }
}

/* --- Notif panel mobile fullscreen-like --- */
@media (max-width: 600px) {
  .notif-panel {
    position: fixed;
    top: 60px;
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    max-width: none;
    max-height: calc(100dvh - 80px);
  }
}

/* --- KPI cards mobile: tamaños mejores --- */
@media (max-width: 768px) {
  .kpi {
    padding: 1rem 0.85rem;
    border-radius: var(--radius-md);
  }
  .kpi-label {
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .kpi-value {
    font-size: 1.6rem;
    letter-spacing: -0.02em;
    line-height: 1.1;
  }
  .kpi-trend {
    font-size: 0.7rem;
    line-height: 1.3;
  }
}
@media (max-width: 380px) {
  .kpi-value { font-size: 1.35rem; }
}

/* --- Online widget mobile --- */
@media (max-width: 600px) {
  .online-list {
    max-height: 260px;
  }
  .online-item {
    padding: 0.6rem 0.5rem;
    gap: 0.6rem;
  }
  .online-name {
    font-size: 0.85rem;
  }
  .online-meta {
    font-size: 0.7rem;
  }
  .online-path {
    font-size: 0.68rem;
    padding: 0.05rem 0.35rem;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
  }
}

/* --- Chart bars 12 meses: legibilidad mobile --- */
@media (max-width: 600px) {
  .chart-bars {
    height: 200px;
    gap: 0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.5rem;
  }
  .chart-bars::-webkit-scrollbar { display: none; }
  .chart-bar-col {
    min-width: 42px;
    flex: 0 0 auto;
  }
  .chart-bar-value {
    font-size: 0.62rem;
  }
  .chart-bar-label {
    font-size: 0.6rem;
    letter-spacing: 0.02em;
  }
}

/* --- List toolbar (search + filtros) mobile --- */
@media (max-width: 768px) {
  .list-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }
  .list-toolbar > * {
    width: 100%;
  }
  .list-search-input {
    min-width: 0 !important;
    width: 100%;
  }
  .select-inline {
    width: 100%;
    min-height: 44px;
  }
}

/* --- Calendar admin: tools y vistas mobile --- */
@media (max-width: 768px) {
  .cal-toolbar {
    flex-wrap: wrap;
    gap: 0.6rem !important;
  }
  .cal-toolbar-nav {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 0.4rem;
  }
  .cal-toolbar-views {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    gap: 0.4rem;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
  }
  .cal-toolbar-views::-webkit-scrollbar { display: none; }
  .cal-view-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
    min-height: 40px;
  }
  /* Vista mes: cells más compactas */
  .cal-month-grid {
    gap: 1px !important;
  }
  .cal-month-cell {
    min-height: 64px !important;
    padding: 0.35rem !important;
    font-size: 0.75rem !important;
  }
  .cal-month-cell .day-num {
    font-size: 0.85rem !important;
  }
  .cal-month-cell .cal-event {
    font-size: 0.62rem !important;
    padding: 0.1rem 0.3rem !important;
  }
}

/* --- Forms admin: mejor experiencia táctil --- */
@media (max-width: 768px) {
  .form-group input,
  .form-group select,
  .form-group textarea {
    width: 100%;
    padding: 0.85rem 0.9rem;
    font-size: 16px;
    border-radius: var(--radius-md);
  }
  .form-group textarea {
    min-height: 100px;
  }
  /* Buttons en formularios */
  .form-actions,
  form .btn-group {
    display: flex;
    flex-direction: column-reverse;  /* primario abajo (más cerca del pulgar) */
    gap: 0.6rem;
  }
  form .btn-group .btn,
  .form-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 0.9rem;
    min-height: 48px;
  }
}

/* --- Tablas: mejorar tamaños responsivos en transición desktop→tablet --- */
@media (max-width: 1024px) and (min-width: 721px) {
  .data-table {
    font-size: 0.82rem;
  }
  .data-table thead th,
  .data-table tbody td {
    padding: 0.65rem 0.55rem;
  }
  .table-wrap {
    border-radius: var(--radius-md);
  }
}

/* --- Tablas mobile: cards con mejor espaciado --- */
@media (max-width: 720px) {
  .data-table tr {
    padding: 1rem 1.1rem !important;
    margin-bottom: 0.75rem !important;
  }
  .data-table tbody td {
    font-size: 0.92rem;
    padding: 0.55rem 0 !important;
    min-height: 36px;
  }
  .data-table td[data-label]::before {
    font-size: 0.7rem !important;
    color: var(--text-muted);
    flex: 0 0 auto;
    min-width: 88px;
  }
  /* Avatar + nombre arriba destacado */
  .data-table td.cell-name {
    font-size: 1rem !important;
    font-weight: 700 !important;
    padding-bottom: 0.75rem !important;
    margin-bottom: 0.5rem !important;
    gap: 0.6rem;
  }
  .data-table td.cell-actions {
    padding-top: 0.75rem !important;
    margin-top: 0.5rem !important;
    border-top: 1px solid var(--border-subtle);
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-start !important;
  }
  .data-table td.cell-actions .btn,
  .data-table td.cell-actions .btn-icon {
    flex: 1 1 auto;
  }
}

/* --- Pagination mobile --- */
@media (max-width: 600px) {
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3rem;
  }
  .pagination a, .pagination span {
    min-width: 38px;
    min-height: 38px;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
  }
}

/* --- Resources cards mobile: layout más compacto --- */
@media (max-width: 600px) {
  .resource-card {
    flex-wrap: wrap;
    padding: 1rem !important;
    gap: 0.8rem;
  }
  .resource-card .resource-icon {
    width: 40px;
    height: 40px;
  }
  .resource-card .resource-body {
    flex: 1 1 calc(100% - 60px);
    min-width: 0;
  }
  .resource-card .btn {
    width: 100%;
    margin-top: 0.4rem;
  }
}

/* --- Strikes cards admin mobile --- */
@media (max-width: 640px) {
  .strike-user-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
  }
  .strike-user-stats {
    width: 100%;
    justify-content: flex-end;
  }
  .strike-counter-big {
    padding: 0.5rem 1rem;
  }
  .strike-counter-num {
    font-size: 1.6rem;
  }
}

/* --- Modal mejores anchos mobile --- */
@media (max-width: 600px) {
  .download-modal-content {
    padding: 1.5rem 1.25rem;
    border-radius: var(--radius-lg);
    max-height: calc(100dvh - 1rem);
  }
  .download-modal-warn {
    font-size: 0.82rem;
    padding: 0.85rem 1rem;
  }
  .download-modal-actions {
    flex-direction: column-reverse;
    gap: 0.5rem;
  }
  .download-modal-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 0.9rem;
  }
}

/* --- Avatar premium consistency --- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
  background: var(--gradient-tiktok);
  color: white;
  letter-spacing: -0.02em;
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.72rem; }
.avatar-md { width: 40px; height: 40px; font-size: 0.85rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1rem; }
.avatar-img {
  background-size: cover !important;
  background-position: center !important;
  color: transparent;
}

/* --- Botones premium: estados consistentes --- */
.btn {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active { transform: translateY(1px); }

/* --- Smooth scroll para anchors --- */
@supports (scroll-padding-top: 1px) {
  html { scroll-padding-top: 80px; }
  @media (max-width: 768px) {
    html { scroll-padding-top: 70px; }
  }
}

/* --- Reveal animation respetando reduce-motion --- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms ease-out, transform 600ms ease-out;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* --- Empty state premium --- */
.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}
.empty .icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  opacity: 0.4;
}
.empty h3 {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.empty p {
  font-size: 0.9rem;
  line-height: 1.5;
}
@media (max-width: 600px) {
  .empty { padding: 2rem 0.5rem; }
  .empty .icon { width: 40px; height: 40px; }
}


/* ============================================================
   PANEL SISTEMA — Monitoring estilo SaaS
   ============================================================ */

.system-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.5rem;
}
@media (max-width: 600px) {
  .system-status-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }
}
@media (max-width: 340px) {
  .system-status-grid { grid-template-columns: 1fr; }
}

.system-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--color-success);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  backdrop-filter: blur(20px);
  transition: border-color var(--tx-base), transform var(--tx-fast);
}
.system-card:hover { transform: translateY(-2px); }
.system-card.is-warn  { border-left-color: var(--color-warning); }
.system-card.is-error { border-left-color: var(--color-danger); }

.system-card-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.system-card-head .icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}
.system-card-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex: 1;
}
.system-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}
.system-card.is-warn .system-status-dot {
  background: var(--color-warning);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}
.system-card.is-error .system-status-dot {
  background: var(--color-danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}
.system-status-dot-pulse {
  animation: system-pulse 2s ease-in-out infinite;
}
@keyframes system-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  50%      { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}
.system-card-value {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}
.system-card-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Audit list */
.audit-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.audit-row {
  display: flex;
  gap: 0.85rem;
  padding: 0.7rem 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--border-soft);
  border-radius: var(--radius-md);
  align-items: flex-start;
}
.audit-row.sev-warn     { border-left-color: var(--color-warning); }
.audit-row.sev-security { border-left-color: var(--color-secondary); }
.audit-row.sev-critical {
  border-left-color: var(--color-danger);
  background: rgba(239, 68, 68, 0.04);
}
.audit-row-sev {
  flex: 0 0 auto;
  padding-top: 0.15rem;
}
.audit-row-body {
  flex: 1;
  min-width: 0;
}
.audit-row-title {
  font-size: 0.88rem;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 0.15rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.audit-row-title code {
  background: rgba(0, 242, 234, 0.08);
  color: var(--color-secondary);
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  font-size: 0.78em;
  font-weight: 600;
}
.audit-row-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 0.2rem;
}
.audit-row-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.audit-row-meta code {
  font-family: var(--font-sans);
  background: rgba(255, 255, 255, 0.04);
  padding: 0 0.35rem;
  border-radius: 4px;
}
@media (max-width: 600px) {
  .audit-row {
    flex-direction: column;
    gap: 0.4rem;
  }
}

/* Error log pre */
.error-log {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 0.78rem;
  color: #FF9E9E;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
  line-height: 1.6;
}

/* Storage grid */
.storage-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.storage-row-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}
.storage-row-head strong {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Env grid */
.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
}
.env-row {
  display: flex;
  flex-direction: column;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}
.env-row .muted {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.env-row strong {
  font-size: 0.88rem;
  margin-top: 0.2rem;
  word-break: break-all;
}

/* Avatar success */
.avatar-success {
  background: var(--color-success) !important;
  color: white;
}
.avatar-success .icon { width: 14px; height: 14px; }

/* Text danger */
.text-danger { color: var(--color-danger); }


/* ============================================================
   🎯 COMMAND CENTER — Centro de mando alumno (Sprint Producto)
   ============================================================ */
.command-center {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 1024px) {
  .command-center { grid-template-columns: 1fr; }
}

/* Main: greeting + next action */
.cc-main {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.cc-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}
.cc-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0.25rem 0 0.4rem;
  line-height: 1.1;
}
.cc-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
  max-width: 60ch;
}

/* Next Action card — el corazón del dashboard */
.cc-next-action {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.1rem;
  padding: 1.25rem 1.4rem;
  background:
    linear-gradient(135deg, rgba(255, 0, 80, 0.10) 0%, rgba(168, 85, 247, 0.06) 50%, rgba(0, 242, 234, 0.10) 100%),
    var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text-primary);
  position: relative;
  overflow: hidden;
  transition: transform var(--tx-base), border-color var(--tx-base), box-shadow var(--tx-base);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.cc-next-action::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.06) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 600ms ease;
}
.cc-next-action:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 0, 80, 0.4);
  box-shadow: 0 12px 36px rgba(255, 0, 80, 0.15);
}
.cc-next-action:hover::before { transform: translateX(100%); }

.cc-next-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--gradient-tiktok);
  background-size: 200% 200%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  box-shadow: 0 8px 24px rgba(255, 0, 80, 0.3);
  animation: cc-icon-shine 4s ease-in-out infinite;
}
.cc-next-icon .icon { width: 26px; height: 26px; }
@keyframes cc-icon-shine {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

.cc-next-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.cc-next-eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
}
.cc-next-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.cc-next-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.cc-next-progress {
  margin-top: 0.55rem;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.cc-next-progress-bar {
  height: 100%;
  background: var(--gradient-tiktok);
  border-radius: var(--radius-pill);
  transition: width 700ms ease;
}

.cc-next-cta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.1rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--tx-fast), border-color var(--tx-fast);
}
.cc-next-cta .icon { width: 14px; height: 14px; }
.cc-next-action:hover .cc-next-cta {
  background: var(--gradient-tiktok);
  border-color: transparent;
  color: white;
}

/* SIDE: streak + weekly goals */
.cc-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  /* Bajamos el reto + objetivos para alinearlos con la "siguiente acción" de
     la columna izquierda (que va tras el saludo) y evitar el hueco que
     quedaba arriba en el layout de ordenador. */
  margin-top: 7.5rem;
}
@media (max-width: 900px) {
  /* En móvil/tablet las columnas se apilan; ahí no debe haber ese margen. */
  .cc-side { margin-top: 0; }
}

/* Streak premium estilo Duolingo */
.cc-streak {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}
.cc-streak-active {
  background:
    linear-gradient(135deg, rgba(251, 191, 36, 0.12) 0%, rgba(255, 0, 80, 0.06) 100%),
    var(--bg-card);
  border-color: rgba(251, 191, 36, 0.35);
}
.cc-streak-fire {
  font-size: 2.4rem;
  line-height: 1;
  filter: grayscale(1) opacity(0.4);
  transition: filter 400ms ease;
}
.cc-streak-active .cc-streak-fire {
  filter: none;
  animation: cc-fire-glow 1.8s ease-in-out infinite;
}
@keyframes cc-fire-glow {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 8px rgba(251, 146, 60, 0.5)); }
  50%      { transform: scale(1.05); filter: drop-shadow(0 0 16px rgba(251, 146, 60, 0.8)); }
}
.cc-streak-info { flex: 1; }
.cc-streak-num {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}
.cc-streak-active .cc-streak-num {
  background: linear-gradient(135deg, #FBBF24 0%, #FF6B00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.cc-streak-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Objetivos semanales */
.cc-weekly {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  backdrop-filter: blur(20px);
}
.cc-weekly-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}
.cc-weekly-head strong {
  font-size: 0.95rem;
  font-weight: 700;
}
.cc-weekly-count {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  background: rgba(0, 242, 234, 0.12);
  color: var(--color-secondary);
  border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
}
.cc-weekly-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.cc-weekly-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0;
  transition: opacity var(--tx-fast);
}
.cc-weekly-item.is-done {
  opacity: 0.6;
}
.cc-weekly-item.is-done .cc-weekly-label {
  text-decoration: line-through;
}
.cc-weekly-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: background var(--tx-fast), border-color var(--tx-fast), color var(--tx-fast);
}
.cc-weekly-check .icon { width: 14px; height: 14px; }
.cc-weekly-item.is-done .cc-weekly-check {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}
.cc-weekly-text { flex: 1; min-width: 0; }
.cc-weekly-label {
  font-size: 0.88rem;
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.3;
}
.cc-weekly-progress {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* Mobile */
@media (max-width: 600px) {
  .cc-next-action {
    grid-template-columns: auto 1fr;
    gap: 0.85rem;
    padding: 1rem;
  }
  .cc-next-icon {
    width: 48px;
    height: 48px;
  }
  .cc-next-icon .icon { width: 22px; height: 22px; }
  .cc-next-title { font-size: 1rem; }
  .cc-next-subtitle { font-size: 0.8rem; }
  .cc-next-cta {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
    margin-top: 0.3rem;
  }
  .cc-streak-num { font-size: 1.7rem; }
  .cc-streak-fire { font-size: 2rem; }
}

/* ============================================================
   ONBOARDING modal — Primera vez
   ============================================================ */
.onboard-modal {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 280ms ease, visibility 280ms ease;
}
.onboard-modal.is-open {
  opacity: 1;
  visibility: visible;
}
.onboard-content {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: 2rem;
  text-align: center;
  transform: scale(0.95);
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
}
.onboard-modal.is-open .onboard-content { transform: scale(1); }
.onboard-emoji {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
}
.onboard-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0.5rem 0;
}
.onboard-text {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}
.onboard-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
  margin: 1.5rem 0;
}
.onboard-step {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.onboard-step-num {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--gradient-tiktok);
  color: white;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.onboard-step-text { flex: 1; font-size: 0.88rem; line-height: 1.5; }
.onboard-step-text strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}
.onboard-step-text span { color: var(--text-secondary); }
@media (max-width: 500px) {
  .onboard-content { padding: 1.5rem 1.25rem; border-radius: var(--radius-lg); }
  .onboard-emoji { font-size: 2.8rem; }
  .onboard-title { font-size: 1.25rem; }
}


/* ============================================================
   🏢 BUSINESS CONSOLE — Centro de control admin (Sprint Producto)
   ============================================================ */
.biz-console {
  margin-bottom: 1.5rem;
}
.biz-console-head {
  margin-bottom: 1rem;
}
.biz-eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.25rem;
}
.biz-title {
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}
.biz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}
@media (max-width: 600px) {
  .biz-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }
}
@media (max-width: 340px) {
  .biz-grid { grid-template-columns: 1fr; }
}

.biz-card {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.02), transparent),
    var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  position: relative;
  transition: transform var(--tx-base), border-color var(--tx-base);
  backdrop-filter: blur(20px);
  overflow: hidden;
}
.biz-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-soft);
}
.biz-card::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  opacity: 0.1;
  filter: blur(30px);
}
.biz-card:nth-child(1)::after { background: var(--color-primary); }
.biz-card:nth-child(2)::after { background: var(--color-secondary); }
.biz-card:nth-child(3)::after { background: var(--color-accent); }
.biz-card:nth-child(4)::after { background: var(--color-gold); }

.biz-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 1;
}
.biz-card-icon .icon { width: 18px; height: 18px; }
.biz-icon-flame  { background: linear-gradient(135deg, #FF0050, #FF6B00); }
.biz-icon-cyan   { background: linear-gradient(135deg, #00F2EA, #00C8C0); }
.biz-icon-purple { background: linear-gradient(135deg, #A855F7, #7C3AED); }
.biz-icon-gold   { background: linear-gradient(135deg, #FBBF24, #F59E0B); }

.biz-card-num {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 0.3rem;
  font-variant-numeric: tabular-nums;
}
.biz-card-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.15rem;
}
.biz-card-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

@media (max-width: 600px) {
  .biz-card { padding: 0.85rem; }
  .biz-card-num { font-size: 1.6rem; }
}


/* ============================================================
   COMMUNITY PREMIUM — Sidebar + estadísticas + win semana
   ============================================================ */
.community-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  margin-top: 1.25rem;
  align-items: start;
}
@media (max-width: 1024px) {
  .community-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.community-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 72px;
}
@media (max-width: 1024px) {
  .community-side {
    position: static;
    flex-direction: column;
  }
}

/* Stats horizontal */
.comm-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
}
.comm-stat { text-align: center; }
.comm-stat-num {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  background: var(--gradient-tiktok);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.comm-stat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.3rem;
}

/* Card lateral genérica */
.comm-side-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  backdrop-filter: blur(20px);
}
.comm-side-head {
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.comm-side-eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.comm-side-eyebrow .icon { width: 14px; height: 14px; }

/* Win semanal */
.comm-win-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.comm-win-author {
  font-weight: 700;
  font-size: 0.92rem;
}
.comm-win-meta {
  font-size: 0.75rem;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.comm-win-meta .icon { width: 12px; height: 12px; }
.comm-win-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
  padding: 0.85rem 1rem;
  background: rgba(255, 0, 80, 0.05);
  border-left: 3px solid var(--color-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Top members */
.comm-top-members {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.comm-top-member {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background var(--tx-fast);
}
.comm-top-member:hover { background: rgba(255, 255, 255, 0.03); }
.comm-top-rank {
  font-size: 1.05rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.comm-top-info { flex: 1; min-width: 0; }
.comm-top-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.comm-top-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Reglas */
.comm-rules-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.comm-rules-list li {
  padding-left: 1.2rem;
  position: relative;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.comm-rules-list li::before {
  content: '·';
  position: absolute;
  left: 0.5rem;
  color: var(--color-secondary);
  font-weight: 900;
  font-size: 1.4rem;
  line-height: 0.6;
}

/* ============================================================
   CONTINUE HERO — Courses "Empieza aquí"
   ============================================================ */
.continue-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: center;
  padding: 1.75rem;
  background:
    radial-gradient(circle at top right, rgba(0, 242, 234, 0.10), transparent 60%),
    radial-gradient(circle at bottom left, rgba(255, 0, 80, 0.10), transparent 60%),
    var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  margin-bottom: 1.5rem;
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}
.continue-hero-body { min-width: 0; }
.continue-hero-eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--color-secondary);
  text-transform: uppercase;
}
.continue-hero-title {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0.3rem 0 0.55rem;
  line-height: 1.15;
}
.continue-hero-sub {
  color: var(--text-secondary);
  margin-bottom: 1.1rem;
  font-size: 0.92rem;
  line-height: 1.5;
}

.continue-hero-progress {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.continue-hero-progress-circle {
  --pct: 0;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background:
    conic-gradient(
      var(--color-primary) 0%,
      var(--color-secondary) calc(var(--pct) * 1%),
      rgba(255, 255, 255, 0.08) calc(var(--pct) * 1%)
    );
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.continue-hero-progress-circle::before {
  content: '';
  position: absolute;
  inset: 7px;
  background: var(--bg-card);
  border-radius: 50%;
}
.continue-hero-progress-circle span {
  position: relative;
  z-index: 1;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}
.continue-hero-progress-text {
  display: flex;
  flex-direction: column;
}
.continue-hero-progress-text strong {
  font-size: 1.05rem;
  font-weight: 700;
}
.continue-hero-progress-text span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .continue-hero {
    grid-template-columns: 1fr;
    padding: 1.25rem;
    gap: 1.25rem;
  }
  .continue-hero-progress {
    justify-content: center;
  }
}


/* ============================================================
   RECOMENDADOS PARA TI — Recursos personalizados (Sprint Líder)
   ============================================================ */
.reco-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}
.reco-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: transform var(--tx-fast), border-color var(--tx-fast);
  position: relative;
  overflow: hidden;
}
.reco-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}
.reco-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}
.reco-card-ext {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  background: rgba(0, 242, 234, 0.1);
  color: var(--color-secondary);
  border-radius: 4px;
  letter-spacing: 0.06em;
}
.reco-card-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.reco-tag-new      { background: rgba(255, 0, 80, 0.12); color: #FF5588; }
.reco-tag-gem      { background: rgba(168, 85, 247, 0.12); color: #C892FF; }
.reco-tag-popular  { background: rgba(251, 191, 36, 0.12); color: #FCD34D; }

.reco-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}
.reco-card-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
  flex: 1;
}
.reco-card-cta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-secondary);
  margin-top: 0.2rem;
}
.reco-card-cta .icon { width: 14px; height: 14px; }
@media (max-width: 480px) {
  .reco-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   ÚLTIMAS MEDALLAS CONSEGUIDAS — Refuerzo dopamina
   ============================================================ */
.achievements-recent {
  background:
    linear-gradient(135deg, rgba(251, 191, 36, 0.06), transparent),
    var(--bg-card);
  border-color: rgba(251, 191, 36, 0.2);
}
.recent-medals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
}
.recent-medal {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.recent-medal-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.recent-medal-icon .icon { width: 22px; height: 22px; }
.recent-medal-info { flex: 1; min-width: 0; }
.recent-medal-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}
.recent-medal-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 0.2rem;
}
.recent-medal-when {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ============================================================
   RETENTION — At-risk students + engagement (Admin)
   ============================================================ */
.at-risk-card {
  border-left: 3px solid var(--color-warning);
}
.at-risk-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.at-risk-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.75rem;
  background: rgba(245, 158, 11, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.at-risk-info { flex: 1; min-width: 0; }
.at-risk-name {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.at-risk-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .at-risk-meta { font-size: 0.68rem; }
}

/* Engagement stats */
.engagement-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.engagement-stat { text-align: center; }
.engagement-stat-num {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  background: var(--gradient-tiktok);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.engagement-stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.35rem;
  line-height: 1.2;
}

.engagement-modules {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.engagement-modules-title {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
  display: block;
}
.engagement-module-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 0.3rem;
}
.engagement-module-head span {
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.engagement-module-head strong {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}


/* ============================================================
   COACH TIP — Voz humana del entrenador (Sprint Entrenador Digital)
   ============================================================ */
.cc-next-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--border-subtle);
  flex-wrap: wrap;
  font-size: 0.78rem;
}
.cc-next-eta {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.6rem;
  background: rgba(0, 242, 234, 0.1);
  color: var(--color-secondary);
  border-radius: var(--radius-pill);
  font-weight: 700;
  flex-shrink: 0;
}
.cc-next-eta .icon { width: 12px; height: 12px; }
.cc-next-impact {
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.4;
}

.cc-coach-tip {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--color-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-top: 0.5rem;
}
.cc-coach-tip.cc-tone-praise   { border-left-color: var(--color-success); }
.cc-coach-tip.cc-tone-push     { border-left-color: var(--color-warning); }
.cc-coach-tip.cc-tone-recover  { border-left-color: var(--color-danger);
                                  background: rgba(239, 68, 68, 0.04); }
.cc-coach-tip.cc-tone-guide    { border-left-color: var(--color-secondary); }
.cc-coach-emoji {
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.05em;
}
.cc-coach-msg {
  color: var(--text-primary);
  font-weight: 500;
}

/* ============================================================
   ROADMAP — Hoja de ruta visual (Sprint Entrenador Digital)
   ============================================================ */
.roadmap-card {
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.4rem;
  background:
    linear-gradient(135deg, rgba(0, 242, 234, 0.04), rgba(168, 85, 247, 0.04)),
    var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
}
.roadmap-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.roadmap-eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--color-secondary);
  text-transform: uppercase;
}
.roadmap-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0.3rem 0 0;
}
.roadmap-counter {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.3rem 0.85rem;
  background: rgba(0, 242, 234, 0.1);
  color: var(--color-secondary);
  border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
}

.roadmap-track {
  display: flex;
  align-items: flex-start;
  gap: 0;
  position: relative;
}
.roadmap-step {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.55rem;
  position: relative;
}
/* Riel: contiene el icono y las líneas conectoras a izquierda/derecha */
.roadmap-step-rail {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 42px;
}
.roadmap-line {
  position: absolute;
  top: 50%;
  height: 2px;
  background: var(--border-soft);
  transform: translateY(-50%);
  z-index: 1;
}
.roadmap-line-left  { left: 0; right: 50%; margin-right: 22px; }
.roadmap-line-right { right: 0; left: 50%; margin-left: 22px; }
/* Línea verde (con leve degradado) cuando el tramo está completado */
.roadmap-done .roadmap-line-right,
.roadmap-done .roadmap-line-left {
  background: linear-gradient(90deg, #10B981, #34D399);
}
.roadmap-current .roadmap-line-left {
  background: linear-gradient(90deg, #10B981, #34D399);
}
@media (max-width: 768px) {
  .roadmap-track {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* Móvil: la timeline horizontal se apila en vertical (línea a la izquierda) */
@media (max-width: 768px) {
  .roadmap-track { flex-direction: column; gap: 0; }
  .roadmap-step {
    flex-direction: row;
    text-align: left;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.4rem 0;
    width: 100%;
  }
  .roadmap-step-rail {
    width: 42px;
    height: auto;
    min-height: 42px;
    flex-direction: column;
    flex-shrink: 0;
  }
  .roadmap-step-text { padding-top: 0.5rem; }
  /* En vertical, las líneas conectan de arriba a abajo */
  .roadmap-line { top: 0; bottom: 0; left: 50%; right: auto; height: auto; width: 2px; transform: translateX(-50%); margin: 0; }
  .roadmap-line-left  { top: 0; height: 21px; bottom: auto; }
  .roadmap-line-right { top: 21px; bottom: -0.4rem; height: auto; }
}

.roadmap-step-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid var(--border-soft);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--tx-base), box-shadow var(--tx-base), background var(--tx-base), border-color var(--tx-base);
  position: relative;
  z-index: 2;
}
.roadmap-step-icon .icon { width: 19px; height: 19px; }
/* Completado: verde limpio con brillo superior sutil (volumen) */
.roadmap-done .roadmap-step-icon {
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.3), transparent 55%),
    linear-gradient(180deg, #34D399 0%, #10B981 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35), 0 0 0 4px rgba(16, 185, 129, 0.12);
}
/* Actual: gradiente rosa vertical LIMPIO (sin cyan que manche el círculo)
   + brillo superior, igual que los números de "EL CAMINO". */
.roadmap-current .roadmap-step-icon {
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.35), transparent 55%),
    linear-gradient(180deg, #FF2D75 0%, #FF0050 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 22px rgba(255, 0, 80, 0.35);
  animation: roadmap-pulse 2s ease-in-out infinite;
}
.roadmap-step:hover .roadmap-step-icon { transform: scale(1.08); }
@keyframes roadmap-pulse {
  0%, 100% { box-shadow: 0 8px 22px rgba(255, 0, 80, 0.35), 0 0 0 0 rgba(255, 0, 80, 0.4); }
  50%      { box-shadow: 0 8px 22px rgba(255, 0, 80, 0.35), 0 0 0 8px rgba(255, 0, 80, 0); }
}
.roadmap-locked .roadmap-step-icon {
  opacity: 0.4;
}

.roadmap-step-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
}
.roadmap-step-text strong {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}
.roadmap-locked .roadmap-step-text strong { color: var(--text-muted); }
.roadmap-step-text span {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}



/* ============================================================
   🎯 MISSION — La pantalla diferencial del producto
   Sistema TikTok Shop OS: fases + checkpoints
   ============================================================ */

/* HERO: progreso global */
.mission-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
  padding: 2rem;
  background:
    radial-gradient(circle at top right, rgba(255, 0, 80, 0.10), transparent 60%),
    radial-gradient(circle at bottom left, rgba(0, 242, 234, 0.08), transparent 60%),
    var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  margin-bottom: 2rem;
  backdrop-filter: blur(20px);
}
@media (max-width: 900px) {
  .mission-hero {
    grid-template-columns: 1fr;
    padding: 1.5rem 1.25rem;
    gap: 1.5rem;
  }
}
.mission-hero-eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  font-weight: 800;
  color: var(--color-primary);
  text-transform: uppercase;
}
.mission-hero-title {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0.4rem 0 0.75rem;
}
.mission-hero-sub {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
  max-width: 60ch;
}
.mission-hero-progress {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
@media (max-width: 480px) {
  .mission-hero-progress {
    flex-direction: column;
    gap: 1rem;
  }
}
.mission-hero-circle {
  --pct: 0;
  width: 130px;
  height: 130px;
  flex-shrink: 0;
  border-radius: 50%;
  background:
    conic-gradient(
      var(--color-primary) 0%,
      var(--color-secondary) calc(var(--pct) * 1%),
      rgba(255, 255, 255, 0.06) calc(var(--pct) * 1%)
    );
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.mission-hero-circle::before {
  content: '';
  position: absolute;
  inset: 10px;
  background: var(--bg-card);
  border-radius: 50%;
}
.mission-hero-circle span {
  position: relative;
  z-index: 1;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--gradient-tiktok);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.mission-hero-stats {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.mission-hero-stat strong {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.mission-hero-stat span {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.15rem;
}

/* PHASE CARDS */
.phase-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--phase-color, var(--color-primary));
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  backdrop-filter: blur(20px);
  transition: border-color var(--tx-base);
}
.phase-card.phase-complete {
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.04), transparent),
    var(--bg-card);
  border-left-color: var(--color-success);
}
.phase-card.phase-pending {
  opacity: 0.85;
}

.phase-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.25rem;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}
@media (max-width: 768px) {
  .phase-head {
    grid-template-columns: auto 1fr;
    gap: 0.85rem;
  }
  .phase-progress-wrap {
    grid-column: 1 / -1;
    margin-top: 0.5rem;
  }
}

.phase-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--phase-color, var(--color-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--phase-color, var(--color-primary)) 30%, transparent);
}
.phase-icon .icon { width: 26px; height: 26px; }
.phase-complete .phase-icon {
  background: var(--color-success);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.phase-info { min-width: 0; }
.phase-eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
}
.phase-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0.25rem 0 0.3rem;
  line-height: 1.2;
}
.phase-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0;
}

.phase-progress-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  min-width: 140px;
}
@media (max-width: 768px) {
  .phase-progress-wrap { align-items: stretch; }
}
.phase-progress-num {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--phase-color, var(--color-primary));
  font-variant-numeric: tabular-nums;
}
.phase-complete .phase-progress-num { color: var(--color-success); }
.phase-progress-bar {
  width: 140px;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
@media (max-width: 768px) {
  .phase-progress-bar { width: 100%; }
}
.phase-progress-fill {
  height: 100%;
  background: var(--phase-color, var(--color-primary));
  border-radius: var(--radius-pill);
  transition: width 700ms ease;
}
.phase-complete .phase-progress-fill {
  background: var(--color-success);
}
.phase-progress-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

/* CHECKPOINTS */
.checkpoint-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.checkpoint {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  align-items: center;
  transition: background var(--tx-fast), border-color var(--tx-fast);
}
@media (max-width: 600px) {
  .checkpoint {
    grid-template-columns: auto 1fr;
    gap: 0.7rem;
  }
  .checkpoint-actions {
    grid-column: 1 / -1;
    margin-top: 0.4rem;
    margin-left: 38px;
  }
}
.checkpoint:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-soft);
}
.checkpoint.is-done {
  background: rgba(16, 185, 129, 0.04);
  border-color: rgba(16, 185, 129, 0.2);
}
.checkpoint.is-done .checkpoint-title {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.checkpoint-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}
.checkpoint-check .icon { width: 14px; height: 14px; }
.is-done .checkpoint-check {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}
.checkpoint-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.checkpoint-body { min-width: 0; }
.checkpoint-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.checkpoint-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
}
.checkpoint-when {
  font-size: 0.7rem;
  color: var(--color-success);
  margin-top: 0.25rem;
  font-weight: 600;
}

.checkpoint-actions {
  flex-shrink: 0;
}

.badge-cyan {
  background: rgba(0, 242, 234, 0.12);
  color: var(--color-secondary);
  border-color: rgba(0, 242, 234, 0.25);
}


/* ============================================================
   📈 MIS RESULTADOS — La transformación visible
   ============================================================ */
.results-hero {
  padding: 2rem;
  background:
    radial-gradient(circle at top right, rgba(16, 185, 129, 0.10), transparent 60%),
    radial-gradient(circle at bottom left, rgba(0, 242, 234, 0.06), transparent 60%),
    var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  margin-bottom: 1.5rem;
  backdrop-filter: blur(20px);
}
@media (max-width: 768px) {
  .results-hero { padding: 1.25rem; }
}
.results-hero-eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  font-weight: 800;
  color: var(--color-success);
  text-transform: uppercase;
}
.results-hero-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0.4rem 0 0.8rem;
  line-height: 1.15;
}
.num-highlight {
  background: linear-gradient(135deg, #10B981 0%, #00F2EA 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.results-hero-sub {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 1.5rem;
  max-width: 60ch;
}

.results-impact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
}
@media (max-width: 768px) {
  .results-impact-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
}
.results-impact {
  padding: 1.1rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-align: center;
}
.results-impact-num {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  background: var(--gradient-tiktok);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}
.results-impact-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.4rem;
}

/* Evolution chart */
.evolution-chart {
  display: flex;
  align-items: flex-end;
  height: 240px;
  gap: 0.4rem;
  padding: 0.5rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.evolution-chart::-webkit-scrollbar { display: none; }
.evolution-col {
  flex: 1 1 0;
  min-width: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.evolution-bar-wrap {
  width: 100%;
  height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
}
.evolution-bar-value {
  position: absolute;
  top: -1.2rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.62rem;
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.evolution-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  transition: height 700ms cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 4px;
}
.evolution-bar.has-data {
  background: var(--gradient-tiktok);
  box-shadow: 0 -2px 12px rgba(255, 0, 80, 0.25);
}
.evolution-bar.no-data {
  background: rgba(255, 255, 255, 0.04);
}
.evolution-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* TIMELINE de logros */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 17px;
  top: 16px;
  bottom: 16px;
  width: 1px;
  background: var(--border-subtle);
}
.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.5rem 0;
  position: relative;
}
.timeline-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 2px solid var(--border-soft);
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}
.timeline-icon .icon { width: 16px; height: 16px; }
.timeline-medal .timeline-icon      { background: rgba(251, 191, 36, 0.15); border-color: rgba(251, 191, 36, 0.4); color: #FBBF24; }
.timeline-checkpoint .timeline-icon { background: rgba(0, 242, 234, 0.12); border-color: rgba(0, 242, 234, 0.4); color: var(--color-secondary); }
.timeline-income .timeline-icon     { background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.4); color: var(--color-success); }

.timeline-body { flex: 1; min-width: 0; padding-top: 0.4rem; }
.timeline-title {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}
.timeline-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ============================================================
   🎯 RETO SEMANAL — En Command Center
   ============================================================ */
.cc-challenge {
  padding: 1rem 1.15rem;
  background:
    linear-gradient(135deg, rgba(168, 85, 247, 0.10), rgba(255, 0, 80, 0.06)),
    var(--bg-card);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: var(--radius-lg);
  position: relative;
}
.cc-challenge.is-done {
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.10), transparent),
    var(--bg-card);
  border-color: rgba(16, 185, 129, 0.35);
}
.cc-challenge-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
  flex-wrap: wrap;
}
.cc-challenge-emoji {
  font-size: 1.3rem;
  line-height: 1;
}
.cc-challenge-eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  font-weight: 800;
  color: var(--color-accent);
  text-transform: uppercase;
  flex: 1;
}
.cc-challenge.is-done .cc-challenge-eyebrow { color: var(--color-success); }
.cc-challenge-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.18rem 0.55rem;
  background: var(--color-success);
  color: white;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  letter-spacing: 0.04em;
}
.cc-challenge-badge .icon { width: 12px; height: 12px; }
.cc-challenge-title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.7rem;
}
.cc-challenge-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.cc-challenge-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.cc-challenge-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-primary));
  border-radius: var(--radius-pill);
  transition: width 700ms cubic-bezier(0.16, 1, 0.3, 1);
}
.cc-challenge.is-done .cc-challenge-fill {
  background: var(--color-success);
}
.cc-challenge-progress {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ============================================================
   🏆 CASOS DE ÉXITO — Banner en comunidad
   ============================================================ */
.success-banner {
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  background:
    radial-gradient(circle at top right, rgba(251, 191, 36, 0.10), transparent 60%),
    var(--bg-card);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
}
.success-banner-head {
  margin-bottom: 1rem;
}
.success-banner-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  font-weight: 800;
  color: #FBBF24;
  text-transform: uppercase;
  display: block;
}
.success-banner-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  display: block;
}

.success-cases {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}
.success-case {
  padding: 0.95rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  border-left: 3px solid #FBBF24;
}
.success-case-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}
.success-case-author {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
}
.success-case-when {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.1rem;
}
.success-case-when .icon { width: 11px; height: 11px; color: var(--color-primary); }
.success-case-text {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}


/* ============================================================
   🎯 ONBOARDING DIAGNÓSTICO — Flujo de bienvenida real
   ============================================================ */
.onboard-body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 0, 80, 0.10), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(0, 242, 234, 0.08), transparent 50%),
    var(--bg-base);
}
.onboard-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 2rem 1.25rem;
}
.onboard-wizard {
  width: 100%;
  max-width: 720px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
@media (max-width: 600px) {
  .onboard-wizard {
    padding: 1.75rem 1.25rem;
    border-radius: var(--radius-lg);
  }
}

.onboard-wiz-head {
  margin-bottom: 2rem;
  text-align: center;
}
.onboard-wiz-eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  font-weight: 800;
  color: var(--color-primary);
  text-transform: uppercase;
}
.onboard-wiz-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0.6rem 0 0.8rem;
  line-height: 1.2;
}
.onboard-wiz-sub {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 auto;
  max-width: 56ch;
}

.onboard-step {
  margin-bottom: 2rem;
}
.onboard-step:last-of-type { margin-bottom: 1.5rem; }
.onboard-step-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.onboard-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-tiktok);
  color: white;
  font-weight: 800;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(255, 0, 80, 0.3);
}
.onboard-step-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}

.onboard-options {
  display: grid;
  gap: 0.6rem;
}
.onboard-options-row {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 600px) {
  .onboard-options-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.onboard-option {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--tx-fast);
  position: relative;
}
.onboard-option:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-soft);
}
.onboard-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.onboard-option:has(input:checked) {
  background: linear-gradient(135deg, rgba(255, 0, 80, 0.10), rgba(0, 242, 234, 0.06));
  border-color: var(--color-primary);
  box-shadow: 0 4px 20px rgba(255, 0, 80, 0.15);
}
.onboard-option-body {
  flex: 1;
  min-width: 0;
}
.onboard-option-body strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
  line-height: 1.3;
}
.onboard-option-body span {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.onboard-actions {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}
.onboard-actions .btn {
  width: 100%;
  max-width: 320px;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  justify-content: center;
}

/* ============================================================
   ADMIN MISSIONS — Distribución por fases + revisión hitos
   ============================================================ */
.phase-dist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
}
.phase-dist-item {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--phase-color, var(--color-primary));
  border-radius: var(--radius-md);
}
.phase-dist-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.55rem;
}
.phase-dist-name {
  font-size: 0.82rem;
  font-weight: 700;
}
.phase-dist-num {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--phase-color);
  font-variant-numeric: tabular-nums;
}
.phase-dist-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 0.35rem;
}
.phase-dist-fill {
  height: 100%;
  background: var(--phase-color);
  border-radius: var(--radius-pill);
  transition: width 700ms ease;
}
.phase-dist-pct {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.proof-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.proof-row {
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--color-secondary);
  border-radius: var(--radius-md);
}
.proof-row-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.proof-row-info { flex: 1; min-width: 0; }
.proof-row-name {
  font-size: 0.9rem;
  font-weight: 700;
}
.proof-row-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}
.proof-row-note {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-style: italic;
  padding: 0.5rem 0.85rem;
  background: rgba(0, 242, 234, 0.04);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}
.proof-row-actions {
  text-align: right;
}


/* ============================================================
   RECURSOS — Bloque "Para tu fase actual" (conexión con Misión)
   ============================================================ */
.resources-phase-banner {
  padding: 1.25rem 1.4rem;
  background:
    linear-gradient(135deg, rgba(255, 0, 80, 0.10), rgba(0, 242, 234, 0.06)),
    var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
  backdrop-filter: blur(20px);
}
.resources-phase-eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  font-weight: 800;
  color: var(--color-primary);
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}
.resources-phase-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0.25rem 0 0.5rem;
  line-height: 1.2;
}
.resources-phase-sub {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0;
  max-width: 60ch;
}

.resource-card.is-priority {
  border-color: rgba(255, 0, 80, 0.35);
  box-shadow: 0 4px 20px rgba(255, 0, 80, 0.08);
  position: relative;
}
.resource-card.is-priority::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 0, 80, 0.04), transparent 50%);
  border-radius: inherit;
  pointer-events: none;
}

.badge-priority {
  background: var(--gradient-tiktok) !important;
  color: white !important;
  border: none !important;
  font-weight: 700;
}


/* ============================================================
   POLISH LAYER · Dashboard — Refinamientos finales
   ============================================================ */

/* === Topbar refinada — altura premium y sombra sutil === */
.topbar {
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
}

/* === Sidebar brand más limpio === */
.sidebar-brand {
  letter-spacing: -0.02em;
}
.sidebar-brand-name {
  font-weight: 800;
  font-size: 1.05rem;
  background: var(--gradient-tiktok);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.sidebar-brand-sub {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
}

/* === Sidebar links — active con indicator izquierda === */
.sidebar-link.active {
  background:
    linear-gradient(90deg, rgba(255, 0, 80, 0.10), transparent),
    rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--gradient-tiktok);
  border-radius: 0 3px 3px 0;
}
.sidebar-link {
  position: relative;
}

/* === KPI cards: número con descender perfecto === */
.kpi-value {
  font-weight: 800;
  background: linear-gradient(180deg, var(--text-primary) 0%, var(--text-secondary) 200%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* KPIs con color de marca - colores específicos */
.kpi-pink .kpi-value   { background: linear-gradient(135deg, #FF0050, #FF7A9D); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.kpi-cyan .kpi-value   { background: linear-gradient(135deg, #00F2EA, #7DFFFA); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.kpi-purple .kpi-value { background: linear-gradient(135deg, #A855F7, #D5A8FF); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.kpi-gold .kpi-value   { background: linear-gradient(135deg, #FBBF24, #FFE5A5); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* === Command Center — refinamiento del contenedor === */
.cc-main {
  padding: 0;
}
.cc-greeting {
  margin-bottom: 0.5rem;
}
.cc-title { letter-spacing: -0.03em; }

/* === Tablas premium === */
.data-table thead th {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 0.85rem;
}
.data-table tbody tr {
  transition: background-color 160ms ease;
}
.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* === Cells with cell-actions: btn icons más limpios === */
.cell-actions .btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  transition: all 160ms ease;
}
.cell-actions .btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

/* === Modal premium === */
.modal,
.download-modal-content {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 24px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.04);
}

/* === Forms: labels más legibles === */
.form-group label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  text-transform: none;
}

/* === Checkpoints: refinar el border-left animado === */
.checkpoint.is-done {
  border-left: 3px solid var(--color-success);
}
.checkpoint:not(.is-done):hover {
  border-left: 3px solid var(--color-primary);
}

/* === Roadmap step-icon: pulso más sutil === */
.roadmap-current .roadmap-step-icon {
  animation: roadmap-pulse-soft 2.4s ease-in-out infinite;
}
@keyframes roadmap-pulse-soft {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 0, 80, 0.35),
                0 0 0 0 rgba(255, 0, 80, 0.25);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(255, 0, 80, 0),
                0 0 24px rgba(255, 0, 80, 0.25);
  }
}

/* === Mobile: mejorar la altura de topbar para mejor touch === */
@media (max-width: 768px) {
  .topbar { height: 60px; }
  .sidebar { padding-top: 0.85rem; }
}

/* === Empty states: padding más generoso === */
.empty {
  padding: 3rem 1.5rem;
}
.empty h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0.85rem 0 0.4rem;
}
.empty p {
  max-width: 32ch;
  margin: 0 auto;
  font-size: 0.88rem;
  line-height: 1.55;
}

/* === Notifications dropdown — mejor backdrop === */
.notif-panel {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 24px 64px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-soft);
}


/* ============================================================
   PODIO TOP 3 — Diseño premium con #1 destacado en el centro
   (Sprint fix bugs - mejora visual ranking)
   ============================================================ */
.podium-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: 0.85rem;
  align-items: end;
  margin: 1.25rem 0 2rem;
}
@media (max-width: 600px) {
  .podium-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
  .podium-pos-1 { order: 1; }
  .podium-pos-2 { order: 2; }
  .podium-pos-3 { order: 3; }
  .podium-grid .podium-pos { display: none; }
}

.podium-card {
  padding: 1.5rem 1rem 1.25rem;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
    var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  transition: transform 240ms var(--ease-out-expo), box-shadow 240ms ease;
}
.podium-card:hover { transform: translateY(-4px); }
.podium-pos-1:hover { transform: translateY(-16px); }
/* Barra superior de color metálico */
.podium-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
/* Halo de fondo sutil detrás del avatar */
.podium-card::after {
  content: '';
  position: absolute;
  top: -30px;
  left: 50%;
  width: 120px;
  height: 120px;
  transform: translateX(-50%);
  border-radius: 50%;
  opacity: 0.12;
  filter: blur(30px);
  pointer-events: none;
}

/* ═══ #1 — ORO, destacado y elevado ═══ */
.podium-pos-1 {
  transform: translateY(-14px);
  border-color: rgba(251, 191, 36, 0.45);
  background:
    radial-gradient(circle at 50% 0%, rgba(251, 191, 36, 0.14), transparent 65%),
    var(--bg-elevated);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 16px 44px rgba(251, 191, 36, 0.20);
}
.podium-pos-1::before { background: linear-gradient(90deg, #B8860B, #FBBF24, #FFE5A5, #FBBF24, #B8860B); }
.podium-pos-1::after { background: #FBBF24; }

/* ═══ #2 — PLATA ═══ */
.podium-pos-2 {
  border-color: rgba(203, 213, 225, 0.30);
  background:
    radial-gradient(circle at 50% 0%, rgba(203, 213, 225, 0.08), transparent 65%),
    var(--bg-elevated);
}
.podium-pos-2::before { background: linear-gradient(90deg, #94A3B8, #E2E8F0, #94A3B8); }
.podium-pos-2::after { background: #CBD5E1; }

/* ═══ #3 — BRONCE ═══ */
.podium-pos-3 {
  border-color: rgba(205, 127, 50, 0.30);
  background:
    radial-gradient(circle at 50% 0%, rgba(205, 127, 50, 0.08), transparent 65%),
    var(--bg-elevated);
}
.podium-pos-3::before { background: linear-gradient(90deg, #A0522D, #CD7F32, #E89B5A, #CD7F32, #A0522D); }
.podium-pos-3::after { background: #CD7F32; }

/* Medalla/emoji sobre un disco */
.podium-medal {
  font-size: 2.2rem;
  line-height: 1;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.35));
}
.podium-pos-1 .podium-medal { font-size: 2.8rem; }

.podium-pos {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 0.85rem;
}
.podium-pos-1 .podium-pos { font-size: 1.6rem; }

/* Avatar con anillo metálico según el puesto (los TRES, no solo el 1º) */
.podium-avatar {
  margin: 0 auto 0.75rem;
  position: relative;
  z-index: 1;
}
.podium-pos-1 .podium-avatar {
  box-shadow: 0 0 0 3px var(--bg-elevated), 0 0 0 5px #FBBF24, 0 8px 24px rgba(251, 191, 36, 0.35);
}
.podium-pos-2 .podium-avatar {
  box-shadow: 0 0 0 3px var(--bg-elevated), 0 0 0 4px #CBD5E1, 0 6px 18px rgba(203, 213, 225, 0.25);
}
.podium-pos-3 .podium-avatar {
  box-shadow: 0 0 0 3px var(--bg-elevated), 0 0 0 4px #CD7F32, 0 6px 18px rgba(205, 127, 50, 0.25);
}

.podium-name {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  line-height: 1.3;
  word-break: break-word;
  color: var(--text-primary);
}

/* Ingresos con color metálico del puesto */
.podium-revenue {
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  background: var(--gradient-tiktok);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  word-break: break-all;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}
/* Ingresos con color metálico según el puesto (refuerza la jerarquía) */
.podium-pos-1 .podium-revenue { background: linear-gradient(135deg, #FBBF24, #FFE5A5); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.podium-pos-2 .podium-revenue { background: linear-gradient(135deg, #94A3B8, #E2E8F0); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.podium-pos-3 .podium-revenue { background: linear-gradient(135deg, #CD7F32, #E89B5A); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
@media (max-width: 380px) {
  .podium-revenue { font-size: 0.95rem; }
}

.podium-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
}
.podium-pos-1 .podium-badge {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.3);
  color: #FBBF24;
}


/* ============================================================
   BOTTOM NAV MOBILE — Estilo TikTok / Instagram
   Sólo aparece en mobile/tablet pequeño (≤768px).
   ============================================================ */
.bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .bottom-nav {
    display: grid;
    grid-template-columns: 1fr 1fr auto 1fr 1fr;
    align-items: center;
    gap: 0.2rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    /* === Más compacto: menos padding vertical, pegado al borde === */
    padding: 0.3rem 0.5rem calc(0.3rem + env(safe-area-inset-bottom)) 0.5rem;
    background: rgba(14, 14, 22, 0.94);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border-top: 1px solid var(--border-soft);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
  }

  .bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    padding: 0.35rem 0.25rem;
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-sm);
    -webkit-tap-highlight-color: transparent;
    min-height: 42px;
    transition: color 180ms ease;
  }
  .bottom-nav-link .icon {
    width: 20px;
    height: 20px;
    transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .bottom-nav-link:hover,
  .bottom-nav-link:active {
    color: var(--text-primary);
  }
  .bottom-nav-link.is-active {
    color: var(--color-primary);
  }
  .bottom-nav-link.is-active .icon {
    transform: translateY(-2px);
    filter: drop-shadow(0 4px 8px rgba(255, 0, 80, 0.4));
  }
  /* Indicador activo: punto debajo */
  .bottom-nav-link.is-active::after {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color-primary);
    margin-top: 1px;
  }

  /* Botón central destacado — menos elevación para ganar altura útil */
  .bottom-nav-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    top: -10px;
    min-width: 60px;
  }
  .bottom-nav-center-inner {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--gradient-tiktok);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.15) inset,
      0 8px 24px rgba(255, 0, 80, 0.5),
      0 0 0 4px rgba(14, 14, 22, 0.94);     /* anillo del color del nav */
    transition: transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .bottom-nav-center-inner .icon { width: 22px; height: 22px; }
  .bottom-nav-center:active .bottom-nav-center-inner {
    transform: scale(0.92);
  }

  /* Hacer espacio para el bottom nav en el contenido (ahora más bajo) */
  .dash-content {
    /* Deja espacio para el bottom-nav fijo + el botón central que
       sobresale ~10px + un margen de respiro, para que el contenido
       final no quede tapado por el menú. */
    padding-bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 28px);
  }

  /* Ocultar el burger antiguo del topbar (lo sustituye el botón central) */
  .topbar-burger {
    display: none !important;
  }
}


/* ============================================================
   PWA / STANDALONE — Mejorar experiencia tipo app
   ============================================================ */

/* Detectar modo standalone para refinamientos extras */
@media all and (display-mode: standalone) {
  /* Topbar respeta safe-area top (notch) */
  .topbar {
    padding-top: env(safe-area-inset-top);
    height: calc(68px + env(safe-area-inset-top));
  }
  .sidebar {
    padding-top: calc(1.25rem + env(safe-area-inset-top));
  }
  /* Sin selección de texto accidental en UI */
  .sidebar, .topbar, .bottom-nav {
    -webkit-user-select: none;
    user-select: none;
  }
  /* Sin highlights en taps */
  a, button {
    -webkit-tap-highlight-color: transparent;
  }
  /* iOS pull-to-refresh - desactivar overscroll */
  html, body {
    overscroll-behavior-y: contain;
  }
}

/* Safe area lateral en mobile siempre (notch landscape) */
@media (max-width: 768px) {
  .topbar {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  .dash-content {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

/* Inputs nunca generan zoom en iOS (font-size mínimo 16px) */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  input[type="url"],
  input[type="search"],
  select, textarea {
    font-size: 16px !important;
  }
}


/* ============================================================
   FAB — Botón flotante crear publicación en comunidad
   ============================================================ */
.fab-new-post {
  position: fixed;
  right: 2rem;
  bottom: 2rem;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.95rem 1.4rem 0.95rem 1.1rem;
  background: var(--gradient-tiktok);
  color: white;
  border: none;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.15) inset,
    0 12px 32px rgba(255, 0, 80, 0.4),
    0 0 0 1px rgba(255, 0, 80, 0.2);
  -webkit-tap-highlight-color: transparent;
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 200ms ease;
}
.fab-new-post:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 16px 40px rgba(255, 0, 80, 0.5);
}
.fab-new-post:active {
  transform: scale(0.96);
}
.fab-new-post .icon {
  width: 20px;
  height: 20px;
}
.fab-new-post-label {
  white-space: nowrap;
}

/* Mobile: bottom margin (encima del bottom-nav) + safe area
   El bottom-nav mide ~64px + el botón central sobresale 14px hacia arriba.
   Usamos variable CSS reutilizable para mantener consistencia. */
:root {
  --mobile-bottom-nav-height: 66px;
}
@media (max-width: 768px) {
  .fab-new-post {
    right: 1rem;
    bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 20px);
    padding: 0.85rem 1.1rem 0.85rem 0.95rem;
  }
}

/* Mobile pequeño: sólo icono circular */
@media (max-width: 380px) {
  .fab-new-post {
    padding: 0;
    width: 56px;
    height: 56px;
    justify-content: center;
  }
  .fab-new-post-label {
    display: none;
  }
}

/* ============================================================
   MODAL — Formulario de nueva publicación
   ============================================================ */
.post-modal {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.post-modal[hidden] { display: none !important; }
.post-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}
.post-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.post-modal-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 24px 80px rgba(0, 0, 0, 0.6);
  transform: scale(0.96) translateY(8px);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.post-modal.is-open .post-modal-content {
  transform: scale(1) translateY(0);
}

.post-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
.post-modal-head h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.post-modal-close {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 160ms ease;
}
.post-modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}
.post-modal-close .icon { width: 16px; height: 16px; }

.post-modal-form .form-group { margin-bottom: 1rem; }
.post-modal-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 120px;
}
.post-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

@media (max-width: 480px) {
  .post-modal { padding: 0.85rem; }
  .post-modal-content { padding: 1.1rem; }
  .post-modal-actions { flex-direction: column-reverse; }
  .post-modal-actions .btn { width: 100%; }
}


/* ============================================================
   MEDALLAS — FORZAR 1 columna en mobile (sin solapamientos)
   Reutiliza el patrón visual de "Lo último que has conseguido"
   ============================================================ */
@media (max-width: 768px) {
  /* Grid: 1 columna SIEMPRE en mobile */
  .medals-grid,
  .medals-grid-full {
    grid-template-columns: 1fr !important;
    gap: 0.6rem !important;
  }
  /* Card de medalla: estilo recent-medal (compacto, horizontal) */
  .medal-card {
    display: flex;
    align-items: center;       /* Centrado vertical igual que recent-medal */
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    min-height: 0;             /* Permitir altura natural */
  }
  .medal-card.earned {
    border-color: rgba(251, 191, 36, 0.3);
  }
  .medal-card .medal {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .medal-card .medal .icon {
    width: 22px;
    height: 22px;
  }
  .medal-card .medal-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;          /* Si el texto es largo, no desborda */
  }
  .medal-card .medal-title {
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
    line-height: 1.25;
    word-break: break-word;
    overflow-wrap: break-word;
  }
  .medal-card .medal-desc {
    font-size: 0.78rem;
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: break-word;
    /* Limita a 2 líneas con elipsis para mantener consistencia visual */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .medal-card .medal-earned-date {
    font-size: 0.7rem;
    margin-top: 0.25rem;
  }
  /* Hover transform off en mobile */
  .medal-card:hover {
    transform: none;
  }
}


/* ============================================================
   PODIO COMPACTO — Versión reducida para sidebar del dashboard
   Reutiliza .podium-grid + .podium-card del ranking premium
   ============================================================ */
.podium-compact {
  margin: 0 0 1rem;
  gap: 0.5rem;
}
.podium-compact .podium-card {
  padding: 0.85rem 0.5rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    var(--bg-card);
}
.podium-compact .podium-medal {
  font-size: 1.6rem;
  margin-bottom: 0.2rem;
}
.podium-compact .podium-pos-1 {
  transform: translateY(-8px);
}
.podium-compact .podium-pos-1 .podium-medal {
  font-size: 1.85rem;
}
.podium-compact .podium-avatar {
  width: 40px;
  height: 40px;
  font-size: 0.78rem;
  margin: 0 auto 0.45rem;
}
.podium-compact .podium-pos-1 .podium-avatar {
  width: 46px;
  height: 46px;
  font-size: 0.85rem;
}
.podium-compact .podium-name {
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  line-height: 1.2;
}
.podium-compact .podium-revenue {
  font-size: 0.78rem;
  line-height: 1.2;
}
.podium-compact .podium-pos {
  display: none; /* el medal ya identifica la posición */
}

/* === Mi posición — card resaltada debajo del podio === */
.my-rank-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.85rem 1rem;
  background:
    linear-gradient(135deg, rgba(255, 0, 80, 0.10), rgba(0, 242, 234, 0.05)),
    var(--bg-card);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
}
.my-rank-card-label {
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  font-weight: 800;
  color: var(--color-primary);
  text-transform: uppercase;
}
.my-rank-card-body {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.my-rank-card-pos {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--gradient-tiktok);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.my-rank-card-value {
  font-size: 1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

/* En mobile, el podio en sidebar se ajusta a 3 columnas igualadas */
@media (max-width: 480px) {
  .podium-compact .podium-pos-1 { transform: none; }
  .podium-compact .podium-medal { font-size: 1.4rem; }
  .podium-compact .podium-pos-1 .podium-medal { font-size: 1.55rem; }
  .podium-compact .podium-avatar { width: 36px; height: 36px; }
  .podium-compact .podium-pos-1 .podium-avatar { width: 40px; height: 40px; }
  .podium-compact .podium-revenue { font-size: 0.72rem; }
}


/* ============================================================
   PLANS MODAL — Modal compartido cambio de plan
   ============================================================ */
.plans-modal {
  position: fixed;
  inset: 0;
  z-index: 9200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.plans-modal[hidden] { display: none !important; }
.plans-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}
.plans-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.plans-modal-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 980px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 32px 96px rgba(0, 0, 0, 0.7);
  transform: scale(0.96);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.plans-modal.is-open .plans-modal-content {
  transform: scale(1);
}
.plans-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.plans-modal-head h3 {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.plans-modal-close {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
}
.plans-modal-close .icon { width: 16px; height: 16px; }
.plans-modal-sub {
  color: var(--text-secondary);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 60ch;
}

.plans-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 1rem;
}
.plans-modal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.5rem 1.25rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: transform 200ms var(--ease-out-expo), border-color 200ms ease;
}
.plans-modal-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}
.plans-modal-card.is-featured {
  border-color: var(--color-primary);
  background:
    linear-gradient(135deg, rgba(255, 0, 80, 0.06), rgba(0, 242, 234, 0.04)),
    var(--bg-card);
  box-shadow: 0 12px 32px rgba(255, 0, 80, 0.15);
}
.plans-modal-card.is-current {
  opacity: 0.7;
  border-style: dashed;
}
.plans-modal-badge {
  position: absolute;
  top: -10px;
  right: 1.25rem;
  background: var(--gradient-tiktok);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 12px rgba(255, 0, 80, 0.4);
}
.plans-modal-card.is-current .plans-modal-badge {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  box-shadow: none;
}
.plans-modal-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.plans-modal-price {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--gradient-tiktok);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}
.plans-modal-cycle {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  -webkit-text-fill-color: var(--text-muted);
}
.plans-modal-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}
.plans-modal-features li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.plans-modal-features .icon {
  width: 14px;
  height: 14px;
  color: var(--color-success);
  flex-shrink: 0;
  margin-top: 0.15rem;
}
.plans-modal-card .btn {
  margin-top: auto;
  justify-content: center;
  width: 100%;
}

@media (max-width: 600px) {
  .plans-modal { padding: 0.85rem; }
  .plans-modal-content { padding: 1.25rem; max-height: 95vh; }
  .plans-modal-grid { grid-template-columns: 1fr; }
}

/* btn-link sutil utility */
.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-secondary);
  cursor: pointer;
  text-decoration: underline;
  font-size: inherit;
  font-family: inherit;
}
.btn-link:hover { color: var(--color-primary); }


/* ============================================================
   SEARCH BOX UNIFICADO — Lupa perfectamente alineada
   ============================================================ */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 380px;
}
.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 0;
  bottom: 0;
  margin: auto 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}
.search-box .search-icon svg { width: 16px; height: 16px; display: block; }
.search-box input[type="text"],
.search-box input[type="search"] {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.35rem !important;  /* hueco para la lupa */
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.search-box input[type="text"]:focus,
.search-box input[type="search"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255, 0, 80, 0.15);
}
.search-box input::placeholder {
  color: var(--text-muted);
  font-size: 0.88rem;
}
/* Clear button opcional */
.search-box .search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 160ms ease;
}
.search-box input:not(:placeholder-shown) ~ .search-clear { opacity: 1; }
.search-box .search-clear:hover { color: var(--text-primary); }
.search-box .search-clear .icon { width: 12px; height: 12px; }

@media (max-width: 600px) {
  .search-box { max-width: 100%; }
}

/* ============================================================
   ADMIN MODAL UNIFICADO — Sistema único para todas las acciones
   ============================================================ */
.admin-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  z-index: 9300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.admin-modal[hidden] { display: none !important; }
.admin-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}
.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
}
.admin-modal-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 32px 96px rgba(0, 0, 0, 0.7);
  transform: scale(0.96) translateY(8px);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.admin-modal.is-open .admin-modal-content {
  transform: scale(1) translateY(0);
}
.admin-modal-content.is-narrow { max-width: 460px; }
.admin-modal-content.is-wide   { max-width: 880px; }
.admin-modal-content.is-danger { border-top: 3px solid var(--color-danger); }

.admin-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
.admin-modal-head h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.015em;
}
.admin-modal-close {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 160ms ease;
}
.admin-modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}
.admin-modal-close .icon { width: 16px; height: 16px; }

.admin-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.admin-modal-body p {
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

.admin-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

@media (max-width: 600px) {
  .admin-modal { padding: 0.85rem; }
  .admin-modal-content { padding: 1.25rem; max-height: 95vh; }
  .admin-modal-actions { flex-direction: column-reverse; }
  .admin-modal-actions .btn { width: 100%; justify-content: center; }
}

/* ============================================================
   SHOW MORE button
   ============================================================ */
.show-more-wrap {
  text-align: center;
  margin-top: 1rem;
}
[data-show-more] {
  width: 100%;
  padding: 0.7rem 1rem;
  background: transparent;
  border: 1px dashed var(--border-soft);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 160ms ease;
}
[data-show-more]:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(255, 0, 80, 0.03);
}


/* ============================================================
   ROW ACTIONS — Botones editar/eliminar encuadrados y alineados
   ============================================================ */
.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  justify-content: center;   /* === centrado === */
}
/* Cada botón de acción: cuadrado perfecto, icono centrado */
.row-actions .btn-icon,
.cell-actions .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 160ms ease;
  flex-shrink: 0;
}
.row-actions .btn-icon .icon,
.cell-actions .btn-icon .icon {
  width: 15px;
  height: 15px;
  display: block;
}
.row-actions .btn-icon:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-strong);
  color: var(--text-primary);
  transform: translateY(-1px);
}
/* Botón eliminar: rojo al hover */
.row-actions .btn-icon-danger:hover,
.cell-actions .btn-icon-danger:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: var(--color-danger);
  color: var(--color-danger);
}
/* La celda de acciones centrada (header + contenido).
   Como .cell-actions es un contenedor flex, se centra con
   justify-content (text-align se ignora en flex). align-items
   centra verticalmente el contenido dentro de la altura de fila. */
/* El td de acciones usa comportamiento nativo de tabla (vertical-align)
   para centrarse verticalmente en filas altas. NO es flex: si lo fuera,
   perdería el vertical-align y el contenido se iría arriba. */
.cell-actions {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}
/* El .row-actions interno es quien hace el flex horizontal centrado */
.cell-actions .row-actions {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  vertical-align: middle;
}
/* El form inline dentro de acciones no debe alterar la alineación */
.cell-actions .row-actions form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}
/* El header de la columna de acciones también centrado */
.data-table th.text-right,
.data-table th.cell-actions { text-align: center !important; }

/* En mobile (cards), las acciones se ven en fila cómoda */
@media (max-width: 720px) {
  .row-actions {
    justify-content: flex-start;
  }
  .row-actions .btn-icon,
  .cell-actions .btn-icon {
    width: 40px;
    height: 40px;
  }
}


/* ============================================================
   REACCIONES EMOJI — Estilo Microsoft Teams
   ============================================================ */
/* Barra de reacciones agregadas (chips) bajo el contenido */
.post-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 0;
}
.post-reactions:empty { margin: 0; }

.reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  transition: all 160ms ease;
  -webkit-tap-highlight-color: transparent;
}
.reaction-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.reaction-chip.is-mine {
  background: rgba(255, 0, 80, 0.12);
  border-color: var(--color-primary);
}
.reaction-chip .reaction-emoji { font-size: 1rem; }
.reaction-chip .reaction-count {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-size: 0.8rem;
}
.reaction-chip.is-mine .reaction-count { color: var(--color-primary); }

/* Animación pop al cambiar */
@keyframes reaction-pop {
  0%   { transform: scale(0.8); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.reaction-chip.reaction-pop { animation: reaction-pop 350ms cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Botón "Reaccionar" en el footer */
.post-footer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.reaction-picker-wrap {
  position: relative;
  display: inline-block;
}
.react-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 160ms ease;
  -webkit-tap-highlight-color: transparent;
}
.react-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.react-btn .icon { width: 16px; height: 16px; }

/* Picker flotante de emojis (estilo Teams) */
.emoji-picker {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 300;                     /* por encima de cards, badges y galería */
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 16px 48px rgba(0, 0, 0, 0.6);
  padding: 0.6rem;
  width: min(300px, calc(100vw - 2rem));
  max-width: calc(100vw - 1.5rem);
  animation: emoji-picker-in 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
/* Si el botón está en la mitad derecha, anclar el picker a la derecha
   para que no se salga del panel (se activa con .align-right vía JS o
   como fallback en pantallas estrechas). */
.emoji-picker.align-right { left: auto; right: 0; }
/* En móvil: el picker se fija centrado abajo, nunca desborda */
@media (max-width: 560px) {
  .emoji-picker {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 1rem;
    transform: translateX(-50%);
    width: calc(100vw - 2rem);
    max-width: 360px;
  }
  @keyframes emoji-picker-in {
    from { opacity: 0; transform: translateX(-50%) translateY(6px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
  }
}
@keyframes emoji-picker-in {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* Fila rápida (reacciones más usadas) */
.emoji-picker-quick {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.1rem;
}
.emoji-picker-sep {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.5rem 0;
}
/* Zona scrollable con todas las categorías */
.emoji-picker-scroll {
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  padding-right: 2px;
}
.emoji-picker-scroll::-webkit-scrollbar { width: 6px; }
.emoji-picker-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}
/* Etiqueta de categoría (sticky para orientación al hacer scroll) */
.emoji-picker-cat {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.4rem 0.25rem 0.3rem;
  z-index: 1;
}
.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.1rem;
  margin-bottom: 0.4rem;
}
.emoji-opt {
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.35rem 0;
  min-height: 38px;                 /* fallback si aspect-ratio no está soportado */
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 120ms ease, background 120ms ease;
  -webkit-tap-highlight-color: transparent;
}
.emoji-opt:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.25);
}
.emoji-opt:active { transform: scale(1.05); }

/* Mobile: picker centrado, más ancho y emojis más grandes (táctil) */
@media (max-width: 600px) {
  .emoji-picker {
    width: min(320px, calc(100vw - 1.5rem));
    left: 50%;
    transform: translateX(-50%);
  }
  @keyframes emoji-picker-in {
    from { opacity: 0; transform: translateX(-50%) translateY(6px) scale(0.96); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  }
  .emoji-picker-quick { grid-template-columns: repeat(6, 1fr); }
  .emoji-picker-grid { grid-template-columns: repeat(6, 1fr); }
  .emoji-opt { font-size: 1.5rem; }
  .emoji-picker-scroll { max-height: 45vh; }
}


/* ============================================================
   RESPONSIVE TABLET (768px – 1024px) — Punto intermedio
   ============================================================ */
@media (min-width: 721px) and (max-width: 1024px) {
  /* Grids de 2-3 columnas colapsan a 2 en tablet */
  .two-col,
  .three-col,
  .stats-grid,
  .biz-cards,
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1rem;
  }
  /* Command center: la columna principal + sidebar se apilan */
  .cc-layout,
  .dash-two-col {
    grid-template-columns: 1fr !important;
  }
  /* El contenido respira menos en tablet */
  .dash-content {
    padding: 1.25rem;
  }
  /* Tablas: fuente y padding ajustados (aún tabla, no cards) */
  .data-table {
    font-size: 0.85rem;
  }
  .data-table thead th,
  .data-table tbody td {
    padding: 0.65rem 0.55rem;
  }
  /* Widget cards con menos padding */
  .widget-card {
    padding: 1.15rem;
  }
  /* Podio premium: ajustar tamaños */
  .podium-grid { gap: 0.85rem; }
  /* Modales: aprovechar más ancho en tablet */
  .admin-modal-content,
  .plans-modal-content,
  .post-modal-content { max-width: 90vw; }
  .admin-modal-content.is-wide { max-width: 92vw; }
}

/* ============================================================
   RESPONSIVE — Ajustes globales anti-overflow (todos los tamaños)
   ============================================================ */
@media (max-width: 1024px) {
  /* Nada debe generar scroll horizontal */
  html, body { overflow-x: hidden; max-width: 100%; }
  .dash-content, .widget-card, section { max-width: 100%; }
  /* Imágenes y media nunca desbordan */
  img, video, canvas, svg { max-width: 100%; height: auto; }
  /* Tablas anchas: scroll interno como último recurso */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ============================================================
   RESPONSIVE MÓVIL — Refinamientos (≤ 600px)
   ============================================================ */
@media (max-width: 600px) {
  /* Títulos de página más compactos */
  .page-title, .dash-title h1 { font-size: 1.35rem; }
  .topbar-title { font-size: 1rem; }
  /* Command center: cards a 1 columna */
  .stats-grid, .biz-cards, .kpi-grid,
  .two-col, .three-col {
    grid-template-columns: 1fr !important;
  }
  /* Botones de widget-head no se salen */
  .widget-head {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .widget-head h3 { font-size: 1rem; }
  /* Next action card apila su contenido */
  .next-action-card {
    flex-direction: column;
    text-align: center;
  }
  .next-action-icon { margin: 0 auto; }
  /* Chips y badges no desbordan */
  .badge { font-size: 0.65rem; }
  /* Forms: inputs full width, filas apiladas */
  .form-row { flex-direction: column; gap: 0; }
  .form-row .form-group { width: 100%; }
  /* Evita que los modales toquen bordes */
  .admin-modal, .plans-modal, .post-modal, .kpi-modal {
    padding: 0.75rem;
  }
}


/* ============================================================
   MISIÓN — Responsive tablet/móvil de fases y checkpoints
   ============================================================ */
@media (max-width: 768px) {
  .phase-card {
    padding: 1.15rem;
    margin-bottom: 1rem;
  }
  .phase-icon {
    width: 46px;
    height: 46px;
  }
  .phase-icon .icon { width: 22px; height: 22px; }
  .phase-title { font-size: 1.05rem; }
  .phase-subtitle { font-size: 0.8rem; }
  /* Checkpoint: apila acciones si hace falta */
  .checkpoint {
    padding: 0.7rem 0.85rem;
    gap: 0.65rem;
  }
  .checkpoint-title { font-size: 0.9rem; }
  .checkpoint-note { font-size: 0.78rem; }
  /* Badge "con prueba" no desborda */
  .checkpoint-proof-badge {
    font-size: 0.6rem;
    padding: 0.1rem 0.4rem;
  }
}

@media (max-width: 480px) {
  .phase-card { padding: 1rem; }
  .phase-head {
    gap: 0.65rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
  }
  .phase-icon { width: 40px; height: 40px; }
  .phase-icon .icon { width: 18px; height: 18px; }
  .phase-title { font-size: 0.98rem; line-height: 1.25; }
  /* El % de progreso del círculo más pequeño */
  .phase-progress-ring { width: 44px; height: 44px; }
  .checkpoint {
    flex-wrap: wrap;
  }
  .checkpoint-check { flex-shrink: 0; }
}


/* ============================================================
   CHECKPOINT — Nota + enlace de prueba (ejemplos visibles)
   ============================================================ */
.checkpoint-note {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin-top: 0.4rem;
  padding: 0.5rem 0.65rem;
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid var(--color-secondary);
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
  font-style: italic;
}
.checkpoint-note .icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  margin-top: 0.15rem;
  color: var(--color-secondary);
}
.checkpoint-when {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--color-success);
  font-weight: 600;
}
.checkpoint-when .icon { width: 12px; height: 12px; }
.checkpoint-proof-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--color-secondary);
  text-decoration: none;
  font-weight: 700;
}
.checkpoint-proof-link:hover { text-decoration: underline; }
.checkpoint-proof-link .icon { width: 12px; height: 12px; }


/* ============================================================
   PRESENCIA estilo Teams — Puntos de estado
   ============================================================ */
.presence-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-elevated);
  flex-shrink: 0;
  background: #6B7280;              /* offline por defecto */
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
}
.presence-dot.is-available { background: #22C55E; }
.presence-dot.is-away      { background: #FBBF24; }
.presence-dot.is-busy      { background: #EF4444; }
.presence-dot.is-offline   { background: #6B7280; }
/* Anillo pulsante sólo para disponible */
.presence-dot.is-available {
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 0 0 3px rgba(34, 197, 94, 0.25);
}

/* Punto sobre avatar (esquina inferior derecha) */
.avatar-presence {
  position: relative;
  display: inline-flex;
}
.avatar-presence .presence-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 12px;
  height: 12px;
}

/* Selector de estado en el topbar */
.presence-picker {
  position: relative;
}
.presence-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 160ms ease;
  -webkit-tap-highlight-color: transparent;
}
.presence-trigger:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text-primary);
}
.presence-trigger .presence-dot { width: 9px; height: 9px; border-width: 0; }
.presence-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 300;
  min-width: 190px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  padding: 0.35rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.presence-menu.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.presence-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  transition: background 140ms ease, color 140ms ease;
}
.presence-option:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.presence-option.is-active { color: var(--text-primary); font-weight: 700; }
.presence-option .presence-dot { width: 11px; height: 11px; border-width: 0; }

/* Mobile: el trigger sólo muestra el punto (ahorra espacio) */
@media (max-width: 600px) {
  .presence-trigger .presence-label { display: none; }
  .presence-trigger { padding: 0.4rem; }
}


/* ════════════════════════════════════════════════════════════
   PANEL ADMIN — Responsive táctil completo
   Tablet: 1024/820/768 · Móvil: 430/375/320
   ════════════════════════════════════════════════════════════ */

/* Anti-overflow universal en dashboard */
.dash-content { max-width: 100%; overflow-x: hidden; }
.dash-content img, .dash-content canvas, .dash-content svg { max-width: 100%; }

/* ---------- TABLET (≤ 1024px) ---------- */
@media (max-width: 1024px) {
  /* KPIs y business cards a 2 columnas */
  .biz-cards, .kpi-grid, .stats-grid,
  .system-cards, .three-col {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  /* Dashboards de 2 columnas apilan */
  .dash-two-col, .two-col, .cc-layout {
    grid-template-columns: 1fr !important;
  }
  /* Charts no se salen */
  .chart-wrap, .evolution-chart { overflow-x: auto; }
}

/* ---------- TABLET PEQUEÑA (≤ 820px) ---------- */
@media (max-width: 820px) {
  .dash-content { padding: 1.15rem; }
  /* Toolbar de filtros/búsqueda apila */
  .list-toolbar {
    flex-wrap: wrap;
    gap: 0.65rem;
  }
  .list-toolbar > * { flex: 1 1 auto; }
}

/* ---------- MÓVIL GRANDE (≤ 768px) ---------- */
@media (max-width: 768px) {
  /* Todo a 1 columna */
  .biz-cards, .kpi-grid, .stats-grid,
  .system-cards, .three-col, .two-col {
    grid-template-columns: 1fr !important;
    gap: 0.85rem;
  }
  /* Widget heads: título + acción apilan si hace falta */
  .widget-head {
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
  }
  .widget-head h3 { font-size: 1rem; }
  /* Búsqueda a ancho completo */
  .search-box, .list-search-input { max-width: 100% !important; width: 100%; }
  /* Modales admin: casi pantalla completa, táctiles */
  .admin-modal-content {
    max-width: 100% !important;
    max-height: 92vh;
  }
  .admin-modal-actions .btn { min-height: 46px; }
}

/* ---------- MÓVIL (≤ 430px) ---------- */
@media (max-width: 430px) {
  .dash-content { padding: 1rem 0.85rem; }
  .page-title, .dash-title h1 { font-size: 1.25rem; }
  /* Cards de tabla (data-table responsive) con menos padding */
  .data-table tr { padding: 0.75rem 0.85rem; }
  .data-table td { font-size: 0.85rem; }
  /* Botones de acción táctiles */
  .row-actions .btn-icon,
  .cell-actions .btn-icon { width: 42px; height: 42px; }
  /* Biz card / KPI: números legibles */
  .biz-card-value, .kpi-value { font-size: 1.5rem; }
}

/* ---------- MÓVIL PEQUEÑO (≤ 375px) ---------- */
@media (max-width: 375px) {
  .dash-content { padding: 0.85rem 0.7rem; }
  .widget-card { padding: 1rem; }
  .admin-modal { padding: 0.5rem; }
  .admin-modal-content { padding: 1.1rem; }
}

/* ---------- MÓVIL MÍNIMO (≤ 320px) ---------- */
@media (max-width: 320px) {
  .biz-card-value, .kpi-value { font-size: 1.35rem; }
  .btn { font-size: 0.85rem; padding: 0.6rem 0.9rem; }
  .row-actions { gap: 0.3rem; }
}


/* ============================================================
   GALERÍA DE IMÁGENES en publicaciones de comunidad
   ============================================================ */
.post-gallery {
  display: grid;
  gap: 3px;
  margin: 0.75rem 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  max-height: 420px;                /* contenida como Twitter/X, no domina el feed */
}
/* 1 imagen: grande pero con tope de altura */
.post-gallery.gallery-count-1 { grid-template-columns: 1fr; }
.post-gallery.gallery-count-1 .post-gallery-item { max-height: 420px; aspect-ratio: 16 / 10; }
/* 2 imágenes: lado a lado, misma altura */
.post-gallery.gallery-count-2 { grid-template-columns: 1fr 1fr; grid-auto-rows: 260px; }
/* 3 imágenes: una grande + dos apiladas */
.post-gallery.gallery-count-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 130px 130px; }
.post-gallery.gallery-count-3 .post-gallery-item:first-child { grid-row: span 2; }
/* 4+ imágenes: mosaico 2x2 uniforme */
.post-gallery.gallery-count-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 130px 130px; }

.post-gallery-item {
  display: block;
  overflow: hidden;
  background: var(--bg-card);
  position: relative;
  min-height: 120px;
  padding: 0;
  border: none;
  cursor: pointer;
  width: 100%;
}
.post-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 300ms ease;
}
.post-gallery-item:hover img { transform: scale(1.04); }
/* Badge "+N" sobre la 4ª imagen cuando hay más */
.post-gallery-more {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 800;
  backdrop-filter: blur(2px);
}

/* Móvil: galería más compacta */
@media (max-width: 600px) {
  .post-gallery { max-height: 340px; }
  .post-gallery.gallery-count-1 .post-gallery-item { max-height: 320px; }
  .post-gallery.gallery-count-2 { grid-auto-rows: 180px; }
  .post-gallery.gallery-count-3,
  .post-gallery.gallery-count-4 { grid-template-rows: 100px 100px; }
  .post-gallery-item { min-height: 90px; }
}

/* ════════════════════════════════════════════════════════════
   LIGHTBOX — Visor de imágenes a pantalla completa con carrusel
   ════════════════════════════════════════════════════════════ */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lightbox-fade 200ms ease;
}
@keyframes lightbox-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.img-lightbox[hidden] { display: none; }
.img-lightbox-stage {
  max-width: 92vw;
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-lightbox-img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: lightbox-zoom 250ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes lightbox-zoom {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}
.img-lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms ease;
  z-index: 2;
}
.img-lightbox-close:hover { background: rgba(255, 255, 255, 0.2); }
.img-lightbox-close .icon { width: 22px; height: 22px; }
.img-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms ease;
  z-index: 2;
}
.img-lightbox-nav:hover { background: rgba(255, 255, 255, 0.22); }
.img-lightbox-nav .icon { width: 26px; height: 26px; }
.img-lightbox-prev { left: 1.25rem; }
.img-lightbox-next { right: 1.25rem; }
.img-lightbox-counter {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
}
/* Móvil: flechas más pequeñas y pegadas a los bordes */
@media (max-width: 600px) {
  .img-lightbox-nav { width: 40px; height: 40px; }
  .img-lightbox-prev { left: 0.5rem; }
  .img-lightbox-next { right: 0.5rem; }
  .img-lightbox-close { top: 0.75rem; right: 0.75rem; }
}

/* ============================================================
   SUBIDA DE IMÁGENES — botón + preview antes de publicar
   ============================================================ */
.image-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 160ms ease;
}
.image-upload-btn:hover {
  background: rgba(255, 0, 80, 0.08);
  border-color: var(--color-primary);
  color: var(--text-primary);
}
.image-upload-btn .icon { width: 16px; height: 16px; }

.image-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}
.image-preview-item {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
}
.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.image-preview-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 140ms ease;
}
.image-preview-remove:hover { background: var(--color-danger); }

/* Móvil: previews un poco más grandes para el dedo */
@media (max-width: 600px) {
  .image-preview-item { width: 84px; height: 84px; }
  .image-preview-remove { width: 24px; height: 24px; }
}


/* ════════════════════════════════════════════════════════════
   MÓDULO MISIONES — Guía, conceptos y gestión
   ════════════════════════════════════════════════════════════ */
.mission-guide { border-left: 3px solid var(--color-secondary); }
.mission-guide-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem;
}
.mission-guide-head h3 { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.mission-concepts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.concept-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.1rem;
}
.concept-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(0, 242, 234, 0.1);
  color: var(--color-secondary);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.6rem;
}
.concept-icon .icon { width: 20px; height: 20px; }
.concept-card h4 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.concept-card p { margin: 0; font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; }
.concept-card em { color: var(--text-primary); font-style: italic; }

.mission-steps {
  background: rgba(255, 0, 80, 0.04);
  border: 1px solid rgba(255, 0, 80, 0.15);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.mission-steps strong { display: block; margin-bottom: 0.5rem; }
.mission-steps ol { margin: 0; padding-left: 1.25rem; }
.mission-steps li { font-size: 0.86rem; color: var(--text-secondary); margin-bottom: 0.3rem; }
/* Tarjeta de ayuda "Modelo híbrido" — limpia, icono integrado */
.mission-model-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  margin-top: 1rem;
  background: color-mix(in srgb, var(--color-secondary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-secondary) 25%, transparent);
  border-radius: var(--radius-md);
}
.mission-model-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-secondary) 18%, transparent);
  color: var(--color-secondary);
  flex-shrink: 0;
}
.mission-model-icon .icon { width: 17px; height: 17px; }
.mission-model-text { min-width: 0; flex: 1; }
.mission-model-text strong { display: block; color: var(--text-primary); font-size: 0.9rem; margin-bottom: 0.2rem; }
.mission-model-text p { margin: 0; color: var(--text-secondary); font-size: 0.82rem; line-height: 1.5; overflow-wrap: anywhere; }

/* Icono de misión en tabla */
.mission-icon-badge {
  width: 34px; height: 34px; border-radius: 9px;
  background: color-mix(in srgb, var(--mc) 15%, transparent);
  color: var(--mc);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.mission-icon-badge .icon { width: 17px; height: 17px; }

/* Badges de dificultad */
.diff-badge {
  font-size: 0.7rem; font-weight: 700; padding: 0.2rem 0.6rem;
  border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em;
}
.diff-easy   { background: rgba(34, 197, 94, 0.12); color: #22C55E; }
.diff-medium { background: rgba(251, 191, 36, 0.12); color: #FBBF24; }
.diff-hard   { background: rgba(239, 68, 68, 0.12); color: #EF4444; }
.badge-muted { background: rgba(255,255,255,0.06); color: var(--text-muted); }

/* Modal grande para hitos */
.admin-modal-lg { max-width: 640px; }
.checkpoints-list { margin-bottom: 1.25rem; max-height: 320px; overflow-y: auto; }
.checkpoint-row {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.7rem 0.85rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}
.cp-order {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem; flex-shrink: 0;
}
.cp-info { flex: 1; min-width: 0; }
.cp-info strong { font-size: 0.9rem; }
.cp-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.btn-icon-sm { width: 32px; height: 32px; }
.checkpoint-form {
  border-top: 1px solid var(--border-subtle);
  padding-top: 1rem;
}

/* Responsive de la gestión de misiones */
@media (max-width: 768px) {
  .mission-concepts { grid-template-columns: 1fr; gap: 0.75rem; }
  .mission-guide-head { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}


/* ════════════════════════════════════════════════════════════
   MISIÓN ALUMNO — Banner "¿Qué hago ahora?" + guía rápida
   ════════════════════════════════════════════════════════════ */
.next-step-banner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
  margin: 1.25rem 0;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--phase-color, #FF0050) 14%, transparent),
      color-mix(in srgb, var(--phase-color, #FF0050) 3%, transparent));
  border: 1px solid color-mix(in srgb, var(--phase-color, #FF0050) 35%, transparent);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}
.next-step-banner::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--phase-color, #FF0050);
}
.next-step-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--phase-color, #FF0050) 20%, transparent);
  color: var(--phase-color, #FF0050);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.next-step-icon .icon { width: 28px; height: 28px; }
.next-step-body { flex: 1; min-width: 0; }
.next-step-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--phase-color, #FF0050);
  text-transform: uppercase;
}
.next-step-title {
  margin: 0.25rem 0 0.4rem;
  font-size: 1.25rem;
  line-height: 1.2;
  color: var(--text-primary);
}
.next-step-desc {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.next-step-phase {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}
.next-step-phase .icon { width: 14px; height: 14px; }
.next-step-cta {
  flex-shrink: 0;
  white-space: nowrap;
}
.next-step-cta .icon { width: 16px; height: 16px; margin-left: 0.3rem; }
.next-step-welcome {
  --phase-color: #A855F7;
}

/* Hint explicativo para el alumno */
.student-mission-hint {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.9rem 1.15rem;
  margin-bottom: 1.5rem;
  background: rgba(0, 242, 234, 0.05);
  border: 1px solid rgba(0, 242, 234, 0.15);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.student-mission-hint .icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--color-secondary);
}
.student-mission-hint strong { color: var(--text-primary); }

/* Responsive del banner en móvil */
@media (max-width: 640px) {
  .next-step-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
  }
  .next-step-cta {
    width: 100%;
    justify-content: center;
  }
  .next-step-title { font-size: 1.1rem; }
}


/* ════════════════════════════════════════════════════════════
   LEADS — Pestañas de vista (pendientes / convertidos / todos)
   ════════════════════════════════════════════════════════════ */
.lead-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.lead-tabs::-webkit-scrollbar { display: none; }
.lead-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 160ms ease, border-color 160ms ease;
  margin-bottom: -1px;
}
.lead-tab:hover { color: var(--text-primary); }
.lead-tab.is-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
.lead-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  font-weight: 700;
}
.lead-tab.is-active .lead-tab-count {
  background: rgba(255, 0, 80, 0.18);
  color: var(--color-primary);
}


/* ════════════════════════════════════════════════════════════
   MISIONES — Espaciado uniforme entre bloques (respiración visual)
   Da separación consistente a todas las secciones del módulo,
   tanto en el panel admin como en la vista del alumno.
   ════════════════════════════════════════════════════════════ */
.mission-admin-content > section,
.mission-admin-content > .widget-card {
  margin-bottom: 1.75rem;
}
.mission-admin-content > section:last-child,
.mission-admin-content > .widget-card:last-child {
  margin-bottom: 0;
}
/* La guía necesita algo más de aire respecto a la gestión */
.mission-admin-content > .mission-guide {
  margin-bottom: 2rem;
}

/* Vista alumno: separación clara entre hero, banner, hint y fases */
.mission-student-content > section,
.mission-student-content > .next-step-banner,
.mission-student-content > .student-mission-hint,
.mission-student-content > .phase-card {
  margin-bottom: 1.5rem;
}
.mission-student-content > .mission-hero {
  margin-bottom: 1.75rem;
}
.mission-student-content > .phase-card:last-child {
  margin-bottom: 0;
}

/* En móvil, un poco menos de separación para aprovechar pantalla */
@media (max-width: 640px) {
  .mission-admin-content > section,
  .mission-admin-content > .widget-card,
  .mission-student-content > section,
  .mission-student-content > .phase-card {
    margin-bottom: 1.25rem;
  }
}


/* ════════════════════════════════════════════════════════════
   HITOS — Botón "Ver más" (paginación de 5 en 5)
   ════════════════════════════════════════════════════════════ */
.checkpoint-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding: 0.6rem 1.1rem;
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--color-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}
.checkpoint-more-btn:hover {
  background: rgba(0, 242, 234, 0.08);
  border-color: var(--color-secondary);
}
.checkpoint-more-btn .icon { width: 16px; height: 16px; transform: rotate(90deg); }

/* ════════════════════════════════════════════════════════════
   PRESENCIA — Indicador simple (solo Activo / Desconectado)
   Sin selector, sin opciones. Solo muestra el estado.
   ════════════════════════════════════════════════════════════ */
.presence-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--text-secondary);
  user-select: none;
}
.presence-indicator .presence-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.presence-indicator .presence-dot.is-available {
  background: #22C55E;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}
.presence-indicator .presence-dot.is-offline {
  background: #6B7280;
}

/* ════════════════════════════════════════════════════════════
   RESULTADOS MENSUALES — badges, proceso, revisión
   ════════════════════════════════════════════════════════════ */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--sc, #888);
  background: color-mix(in srgb, var(--sc, #888) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--sc, #888) 35%, transparent);
  white-space: nowrap;
}

/* Tarjeta del proceso (3 pasos) */
.result-info-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.result-info-step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 180px;
}
.result-info-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gradient-tiktok);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.result-info-arrow { color: var(--text-muted); flex-shrink: 0; }
.result-info-arrow .icon { width: 18px; height: 18px; }

/* Modal de revisión (admin) */
.admin-modal-lg .admin-modal-content,
.admin-modal-content.admin-modal-lg { max-width: 640px; }
.review-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.75rem;
  padding: 0.85rem;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
}
.review-notes { margin-bottom: 1rem; }
.review-ev-title { margin: 0.5rem 0; font-size: 0.9rem; }
.review-evidence {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.review-ev-img {
  display: block;
  width: 90px;
  height: 90px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.review-ev-img img { width: 100%; height: 100%; object-fit: cover; }
.review-ev-pdf {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
}
.review-ev-pdf:hover { border-color: var(--color-primary); }
.review-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.required-mark { color: var(--color-primary); }

@media (max-width: 600px) {
  .result-info-card { flex-direction: column; align-items: stretch; }
  .result-info-arrow { transform: rotate(90deg); align-self: center; }
  .review-actions .btn { flex: 1; }
}

/* ════════════════════════════════════════════════════════════
   PROGRESO SECUENCIAL DE LECCIONES — estados visuales
   ════════════════════════════════════════════════════════════ */
.badge-muted {
  background: color-mix(in srgb, var(--text-muted) 15%, transparent);
  color: var(--text-muted);
  border: 1px solid color-mix(in srgb, var(--text-muted) 30%, transparent);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.badge-muted .icon { width: 13px; height: 13px; }
/* Lección bloqueada: atenuada y sin interacción */
.lesson-item.lesson-locked {
  opacity: 0.55;
}
.lesson-item.lesson-locked .lesson-title { color: var(--text-muted); }
.play-btn.locked { background: color-mix(in srgb, var(--text-muted) 20%, transparent); }
.play-btn.locked .icon { color: var(--text-muted); }
/* Lección en progreso: acento sutil */
.lesson-item.lesson-in_progress .play-btn {
  background: color-mix(in srgb, var(--color-secondary) 20%, transparent);
  border: 1px solid var(--color-secondary);
}

/* ════════════════════════════════════════════════════════════
   SPRINT REDISEÑO — Componentes profesionales reutilizables
   (stat-cards, filter-panel, drawer, avatar) — usan tokens
   existentes, no cambian la identidad visual.
   ════════════════════════════════════════════════════════════ */

/* ---- STAT CARDS (KPIs uniformes, misma altura/ancho/padding) ---- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.15rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  min-height: 88px;
  box-sizing: border-box;
}
.stat-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--ic, #888) 15%, transparent);
  color: var(--ic, #888);
  flex-shrink: 0;
}
.stat-card-icon .icon { width: 22px; height: 22px; }
.stat-card-body { min-width: 0; }
.stat-card-value {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.stat-card-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ---- FILTER PANEL (tipo CRM, auto-aplicado) ---- */
.filter-panel {
  display: flex;
  align-items: flex-end;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding: 1rem 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
}
.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 150px;
  flex: 1;
}
.filter-field label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.filter-field select,
.filter-field input {
  height: 42px;
  padding: 0 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.88rem;
}
.filter-field select:focus,
.filter-field input:focus {
  outline: none;
  border-color: var(--color-secondary);
}
.filter-clear {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 42px;
  padding: 0 1rem;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;
}
.filter-clear:hover { border-color: var(--color-primary); color: var(--color-primary); }
.filter-clear .icon { width: 15px; height: 15px; }

/* ---- AVATAR INITIALS ---- */
.avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gradient-tiktok);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.avatar-initials.avatar-lg { width: 48px; height: 48px; font-size: 1.15rem; }

/* ---- TABLE CARD wrapper + footer ---- */
.table-card { padding: 0; overflow: hidden; }
.table-card .table-scroll { padding: 0.25rem 0.5rem; }
.table-foot {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
}
.btn-icon-primary {
  color: var(--color-secondary);
  border: 1px solid color-mix(in srgb, var(--color-secondary) 30%, transparent);
}
.btn-icon-primary:hover { background: color-mix(in srgb, var(--color-secondary) 12%, transparent); }

/* ---- DRAWER lateral profesional ---- */
.drawer[hidden] { display: none !important; }
.drawer {
  position: fixed;
  inset: 0;
  z-index: 9400;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 280ms ease;
}
.drawer.is-open .drawer-backdrop { opacity: 1; }
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 92vw);
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
}
.drawer.is-open .drawer-panel { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}
.drawer-head-user { display: flex; align-items: center; gap: 0.75rem; }
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}
.drawer-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.drawer-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0.85rem;
  background: var(--bg-card);
  border-radius: var(--radius-md);
}
.drawer-stat strong { font-size: 1.05rem; color: var(--text-primary); }
.drawer-section { margin-bottom: 1.5rem; }
.drawer-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 0.6rem;
}
.drawer-evidence {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.drawer-ev-img {
  display: block;
  width: 84px;
  height: 84px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.drawer-ev-img img { width: 100%; height: 100%; object-fit: cover; }
.drawer-ev-file {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.82rem;
  max-width: 100%;
}
.drawer-ev-pdf-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.4rem;
  background: var(--color-primary);
  color: #fff;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}
.drawer-ev-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-history { display: flex; flex-direction: column; gap: 0.4rem; }
.drawer-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}
.drawer-history-period { font-size: 0.85rem; color: var(--text-secondary); }
.status-badge-sm { font-size: 0.68rem; padding: 0.2rem 0.5rem; }
.drawer-foot {
  border-top: 1px solid var(--border-subtle);
  padding: 1rem 1.25rem;
}
.drawer-comment {
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.88rem;
  resize: vertical;
  box-sizing: border-box;
}
.drawer-actions { display: flex; gap: 0.5rem; }
.drawer-actions .btn { flex: 1; }

@media (max-width: 600px) {
  .drawer-panel { width: 100vw; }
  .drawer-stats { grid-template-columns: 1fr 1fr; }
  .filter-field { min-width: 130px; }
}

/* ---- EVOLUTION CHART (mini-gráfica de barras, sin librerías) ---- */
.evolution-card { padding-bottom: 1.5rem; }
.evolution-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  height: 160px;
  padding: 1rem 0.5rem 0;
}
.evolution-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 0.5rem;
}
.evolution-bar {
  width: 100%;
  max-width: 48px;
  min-height: 6px;
  background: var(--gradient-tiktok);
  border-radius: 6px 6px 0 0;
  transition: height 400ms cubic-bezier(0.16, 1, 0.3, 1);
}
.evolution-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.table-card-head {
  padding: 1.15rem 1.25rem 0.5rem;
}
.table-card-head .widget-title { margin: 0; }

/* ---- ACTIVITY TIMELINE (feed de eventos elegante) ---- */
.activity-timeline-card { margin-top: 1.5rem; }
.activity-timeline {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-subtle);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ac, #888) 15%, transparent);
  color: var(--ac, #888);
  flex-shrink: 0;
}
.activity-dot .icon { width: 17px; height: 17px; }
.activity-body { flex: 1; min-width: 0; }
.activity-title { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.activity-desc { margin-top: 0.1rem; }
.activity-time { flex-shrink: 0; white-space: nowrap; padding-top: 0.15rem; }

/* ════════════════════════════════════════════════════════════
   FILTER TOOLBAR — panel de búsqueda profesional (HubSpot/Stripe)
   Buscador de ancho limitado + controles de altura uniforme.
   ════════════════════════════════════════════════════════════ */
.list-toolbar.filter-toolbar {
  padding: 0.9rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  align-items: center;
  flex-wrap: nowrap;        /* desktop: todo en una sola línea */
}
/* El buscador ya NO se estira infinitamente: ancho cómodo y tope */
.list-toolbar.filter-toolbar > .filter-search {
  flex: 1 1 auto;
  max-width: 380px;
  min-width: 180px;
}
/* Todos los controles: misma altura (42px), padding y radio */
.list-toolbar.filter-toolbar .filter-search input[type="search"],
.list-toolbar.filter-toolbar .select-inline {
  height: 42px;
  border-radius: var(--radius-md);
  box-sizing: border-box;
}
.list-toolbar.filter-toolbar .select-inline {
  flex: 0 0 auto;           /* los selects no se estiran ni se encogen */
  width: 190px;             /* ancho fijo: no depende del texto de las opciones */
  min-width: 0;
  max-width: 190px;
  padding: 0 2.2rem 0 0.9rem;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  text-overflow: ellipsis;
}
.list-toolbar.filter-toolbar .filter-search input[type="search"] {
  background-color: var(--bg-elevated);
}

/* Tablet: permitir wrap solo si de verdad no cabe */
@media (max-width: 1024px) and (min-width: 721px) {
  .list-toolbar.filter-toolbar { flex-wrap: wrap; }
  .list-toolbar.filter-toolbar > .filter-search { flex: 1 1 100%; max-width: none; }
  .list-toolbar.filter-toolbar .select-inline { flex: 1 1 calc(50% - 0.5rem); }
}
/* Móvil: apilar controles a ancho completo, sin romper */
@media (max-width: 720px) {
  .list-toolbar.filter-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }
  .list-toolbar.filter-toolbar > .filter-search,
  .list-toolbar.filter-toolbar .select-inline {
    flex: 1 1 auto;
    max-width: none;
    width: 100%;
  }
}

/* ---- AUTOCOMPLETE (buscador de alumno con dropdown) ---- */
.filter-field-search { position: relative; }
.autocomplete-wrap { position: relative; }
.autocomplete-wrap input[type="text"] {
  width: 100%;
  height: 42px;
  padding: 0 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.88rem;
  box-sizing: border-box;
}
.autocomplete-wrap input[type="text"]:focus {
  outline: none;
  border-color: var(--color-secondary);
}
.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  z-index: 100;
  padding: 0.3rem;
}
.autocomplete-list[hidden] { display: none; }
.autocomplete-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
}
.autocomplete-item:hover,
.autocomplete-item:focus {
  background: color-mix(in srgb, var(--color-secondary) 12%, transparent);
}
.autocomplete-item .ac-name { font-size: 0.88rem; color: var(--text-primary); font-weight: 500; }
.autocomplete-item .ac-user { font-size: 0.75rem; color: var(--text-muted); }

/* ════════════════════════════════════════════════════════════
   PROGRESS CELL — barra + % centrados en columnas de tabla
   Resuelve el desalineado de barras con ancho fijo dentro de td.
   ════════════════════════════════════════════════════════════ */
.progress-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  width: 100%;
}
.progress-cell .progress {
  margin: 0 auto;   /* barra centrada aunque tenga ancho fijo */
}
.progress-cell-pct {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}
/* En móvil (tabla en cards), la barra se alinea a la derecha con su label */
@media (max-width: 720px) {
  .data-table td[data-label] .progress-cell {
    align-items: flex-end;
  }
}

/* ════════════════════════════════════════════════════════════
   SETTINGS — distribución en grid (aprovecha el ancho)
   ════════════════════════════════════════════════════════════ */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem 1.25rem;
}
.settings-grid .form-group { margin-bottom: 0; }
.settings-grid .form-group-full { grid-column: 1 / -1; }
@media (max-width: 720px) {
  .settings-grid { grid-template-columns: 1fr; }
}

/* ---- Encabezado compacto (title + hint en una línea) ---- */
.page-head-compact {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
}
.page-title-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  margin: 0;
}
.page-title-sm .icon { width: 22px; height: 22px; color: var(--color-secondary); }
.page-head-hint {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* ---- Encabezado flex: título compacto + acción a la derecha ---- */
.page-head-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-head-compact--stacked {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}
.page-head-compact--stacked .page-head-hint { font-size: var(--fs-sm); }
@media (max-width: 600px) {
  .page-head-flex { align-items: stretch; }
  .page-head-flex .btn { width: 100%; justify-content: center; }
}

/* ---- Revisión de pruebas de hito (admin) ---- */
.proof-review-card { border-color: color-mix(in srgb, var(--color-gold) 30%, transparent); }
.proof-review-list { display: flex; flex-direction: column; gap: 0.75rem; }
.proof-review-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.proof-review-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  display: block;
}
.proof-review-thumb img { width: 100%; height: 100%; object-fit: cover; }
.proof-review-thumb--empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); background: var(--bg-elevated);
}
.proof-review-body { flex: 1; min-width: 0; }
.proof-review-student { display: flex; align-items: baseline; gap: 0.5rem; }
.proof-review-cp { font-size: var(--fs-sm); color: var(--text-secondary); margin-top: 0.15rem; }
.proof-review-note { margin-top: 0.3rem; font-style: italic; }
.proof-review-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
@media (max-width: 600px) {
  .proof-review-item { flex-wrap: wrap; }
  .proof-review-actions { width: 100%; }
  .proof-review-actions form:first-child { flex: 1; }
  .proof-review-actions .btn-success { width: 100%; }
}

/* ---- Picker de emojis flotante (anexado al body, escapa del overflow) ---- */
.emoji-picker.emoji-picker-floating {
  position: fixed;
  bottom: auto;
  left: 0;                       /* el JS fija left/top exactos */
  top: 0;
  z-index: 9600;                 /* por encima de todo (posts, drawers) */
  margin: 0;
}
/* En el modo flotante, las reglas responsive de posición fixed previas
   no deben aplicarse (el JS ya calcula la posición óptima). */
@media (max-width: 560px) {
  .emoji-picker.emoji-picker-floating {
    position: fixed;
    transform: none;
    width: min(320px, calc(100vw - 1rem));
  }
}

/* ---- Lightbox de pruebas de hito (admin) ---- */
.proof-review-thumb { position: relative; cursor: pointer; border: none; padding: 0; background: transparent; }
.proof-review-thumb-zoom {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  opacity: 0;
  transition: opacity var(--tx-fast);
  border-radius: var(--radius-sm);
}
.proof-review-thumb:hover .proof-review-thumb-zoom { opacity: 1; }
.proof-review-thumb-zoom .icon { width: 20px; height: 20px; }

.proof-lightbox[hidden] { display: none !important; }
.proof-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9600;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 220ms ease;
  padding: 2rem;
}
.proof-lightbox.is-open { opacity: 1; }
.proof-lightbox-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.85); }
.proof-lightbox-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  transform: scale(0.95);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.proof-lightbox.is-open .proof-lightbox-inner { transform: scale(1); }
.proof-lightbox-inner img {
  max-width: 90vw;
  max-height: 88vh;
  border-radius: var(--radius-md);
  box-shadow: var(--elevation-4);
  display: block;
}
.proof-lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}
.proof-lightbox-close:hover { background: var(--color-primary); color: #fff; }

/* ════════════════════════════════════════════════════════════
   DASHBOARD ALUMNO — reestructura para equilibrar columnas
   Fila racha+tip + accesos rápidos rellenan la columna izquierda
   para que no quede hueco frente a la derecha (reto+objetivos).
   ════════════════════════════════════════════════════════════ */
.cc-main-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: stretch;
}
/* Si la fila solo contiene la racha (sin coach tip), que ocupe todo el ancho */
.cc-main-row:not(:has(.cc-coach-tip)) { grid-template-columns: 1fr; }
/* En la fila, la racha es compacta y el tip ocupa el resto */
.cc-main-row .cc-streak { margin: 0; height: 100%; }
.cc-main-row .cc-coach-tip { margin: 0; height: 100%; align-items: center; }

/* Accesos rápidos: 4 atajos que rellenan el fondo de la columna */
.cc-quick-access {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}
.cc-quick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.1rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  transition: transform var(--tx-fast), border-color var(--tx-fast), color var(--tx-fast);
}
.cc-quick-item:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--color-primary) 40%, var(--border-subtle));
  color: var(--text-primary);
}
.cc-quick-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  color: var(--color-primary);
}
.cc-quick-icon .icon { width: 20px; height: 20px; }
.cc-quick-label { font-size: var(--fs-sm); font-weight: var(--fw-medium); text-align: center; }

@media (max-width: 720px) {
  .cc-main-row { grid-template-columns: 1fr; }
  .cc-quick-access { grid-template-columns: repeat(2, 1fr); }
}

/* ════════════════════════════════════════════════════════════
   FIX FINAL — Espacio inferior para el bottom-nav móvil
   Varias media queries usan `padding` (shorthand) en .dash-content
   y borran el padding-bottom que reserva el hueco del menú fijo.
   Esta regla, al ir la ÚLTIMA y con !important, garantiza que el
   contenido final nunca quede tapado por el bottom-nav.
   El nav real mide ~84px (incluye botón central + safe-area).
   ════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .dash-content {
    padding-bottom: calc(94px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ════════════════════════════════════════════════════════════
   Tabla compacta para widgets estrechos (p.ej. Últimos leads)
   Evita el scroll horizontal: nombre + email apilados y con
   truncado, para que la tabla quepa siempre en su contenedor.
   ════════════════════════════════════════════════════════════ */
.data-table-compact { table-layout: fixed; width: 100%; }
.data-table-compact th,
.data-table-compact td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Nombre + email en dos líneas dentro de la misma celda */
.cell-name-stack {
  display: flex;
  flex-direction: column;
  min-width: 0;          /* permite que el texto se trunque */
  line-height: 1.25;
}
.cell-name-main {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-name-sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* La celda del nombre puede encogerse; las demás van ajustadas */
.data-table-compact .cell-name { width: 55%; }
.data-table-compact .cell-name .avatar { flex-shrink: 0; }

/* ════════════════════════════════════════════════════════════
   MÓVIL — Mejoras de legibilidad y respiración
   Objetivo: que nada quede demasiado pequeño ni apretado.
   · Ningún texto por debajo de ~12px (mínimo legible en móvil)
   · Más espacio entre tarjetas y secciones
   · Jerarquía más clara en títulos
   ════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Subir el suelo de tamaños: los textos secundarios más pequeños
     (labels, metadatos, subs) pasan a un mínimo cómodo de leer. */
  .kpi-hero-sub,
  .kpi-hero-label,
  .cell-name-sub,
  .event-row-meta,
  .roadmap-step-desc,
  .cc-weekly-progress,
  .cc-quick-label,
  .badge,
  .muted,
  .text-muted,
  small {
    font-size: 0.8rem !important;   /* ~12.8px */
    line-height: 1.4;
  }

  /* Etiquetas "eyebrow" en mayúsculas: mínimo legible pero manteniendo
     su carácter de sobre-título (con letter-spacing). */
  .cc-next-eyebrow,
  .cc-challenge-eyebrow,
  .roadmap-eyebrow,
  .section-eyebrow,
  .cc-eyebrow,
  .widget-eyebrow,
  [class*="-eyebrow"] {
    font-size: 0.75rem !important;  /* 12px */
    letter-spacing: 0.08em;
  }

  /* Cualquier metadato/etiqueta suelta que quedara por debajo */
  .cc-streak-label,
  .cc-coach-msg,
  .roadmap-step-title,
  .podium-name,
  .stat-label,
  .biz-card-label,
  .post-type-pill,
  .comm-top-likes,
  .comm-stat-label,
  .comm-stat-num,
  .kpi-trend,
  .notif-row-meta,
  .reco-card-ext,
  .reco-card-tag,
  .podium-revenue,
  .recent-medal-when,
  .event-row-month,
  .chart-bar-value,
  .chart-bar-label,
  .biz-card-sub,
  .engagement-stat-label,
  .text-danger,
  .text-success {
    font-size: 0.82rem !important;
  }
  /* Nota: las iniciales dentro de .avatar-sm se dejan como están
     (es texto dentro de un círculo pequeño, no un problema de lectura). */

  /* Valores y títulos ganan algo de peso visual */
  .kpi-hero-value { font-size: 1.5rem; }
  .kpi-hero-label { color: var(--text-secondary); }

  /* Más aire entre tarjetas apiladas */
  .kpi-hero-grid,
  .kpi-hero-grid-sm {
    gap: 0.85rem;
  }
  .kpi-hero { padding: 1.15rem 1.15rem; }

  /* Separación entre secciones del dashboard: que respiren */
  .command-center,
  .two-col,
  .widget-card,
  .roadmap-card,
  .dash-section {
    margin-bottom: 1.35rem;
  }

  /* Accesos rápidos: más altos y legibles al tacto */
  .cc-quick-item { padding: 1rem 0.6rem; }
  .cc-quick-label { font-size: 0.82rem !important; }

  /* Cabeceras de widget con algo más de presencia */
  .widget-head h3 { font-size: 1.05rem; }

  /* Objetivos semanales y listas: más separación entre filas */
  .cc-weekly-item { padding: 0.7rem 0; }
  .cc-weekly-list { gap: 0.15rem; }
}

/* Pantallas muy estrechas (≤380px): un punto más de holgura */
@media (max-width: 380px) {
  .kpi-hero-value { font-size: 1.35rem; }
  .cc-title { font-size: 1.5rem; }
}

/* Red de seguridad: en móvil, los textos secundarios residuales que
   pudieran quedar muy pequeños suben a un mínimo legible (~11.7px).
   Se excluyen las iniciales de avatar (círculos), legítimamente menores.
   Va al final para cerrar casos sueltos sin enumerar cada clase. */
@media (max-width: 768px) {
  .dash-content [class*="label"]:not([class*="hero"]),
  .dash-content [class*="meta"],
  .dash-content [class*="-when"],
  .dash-content [class*="-sub"]:not(.cc-subtitle),
  .dash-content [class*="-value"]:not(.kpi-hero-value):not(.cc-next-title) {
    font-size: 0.73rem;
  }
}

/* Tabla mini de leads: la columna "Plan" (2ª) alineada a la izquierda */
.leads-mini-table th:nth-child(2),
.leads-mini-table td:nth-child(2) {
  text-align: left;
}

/* Fila de lead resaltada al llegar desde el correo (?id=X) */
.lead-row-highlight {
  animation: lead-highlight 2.5s ease;
}
.lead-row-highlight td {
  background: rgba(255, 0, 80, 0.10) !important;
}
@keyframes lead-highlight {
  0%, 40%   { background: rgba(255, 0, 80, 0.22); }
  100%      { background: rgba(255, 0, 80, 0.06); }
}

/* Separación entre módulos en el admin (antes quedaban muy pegados) */
.admin-module-card {
  margin-bottom: 1.75rem;
  border: 1px solid var(--border-subtle);
}
.admin-module-card:last-child { margin-bottom: 0; }
/* Un poco de aire interior extra en la cabecera del módulo */
.admin-module-card > .widget-head {
  padding-bottom: 0.85rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--border-subtle);
}
@media (max-width: 768px) {
  .admin-module-card { margin-bottom: 1.35rem; }
}
