/* ==========================================================================
   MedByte — Versión Web (SOBRE EL MOCKUP medbyte_web_lite).
   CSS extraído del <style> del mockup y adaptado:
     - Tema por sistema por omisión + interruptor (data-theme).
     - Fuentes locales (sin Google Fonts).
     - Primero móvil (≤768 px) sin tocar el diseño de escritorio.
     - Componentes nuevos por datos reales (carrusel, controles de video,
       fichas "Nuevo en MedByte", "Colegas en MedByte", pie legal, toast,
       estados de carga/error). Se conservan clases, colores y acomodo.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Fuentes locales (OFL; ver /fonts/*.txt)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('/fonts/PlusJakartaSans-Variable.ttf') format('truetype');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono-Variable.ttf') format('truetype');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   VARIABLES DE TEMA — mismos colores del mockup.
   Por omisión sigue al sistema; el interruptor fija data-theme.
   ========================================================================== */
:root {
  /* Oscuro por omisión (fallback) */
  --bg-body: #070A12;
  --bg-surface: #0D1322;
  --bg-card: #0F1626;
  --bg-hover: rgba(255, 255, 255, 0.035);
  --bg-subtle: rgba(255, 255, 255, 0.04);
  --bg-glass: rgba(13, 19, 34, 0.86);
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border-subtle: rgba(255, 255, 255, 0.075);
  --border-focus: rgba(0, 198, 255, 0.28);
  --brand-primary: #0052FF;
  --brand-accent: #38BDF8;
  --accent-emc: #F59E0B;
  --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.35);
}

/* Claro: cuando el sistema lo pide y el usuario no forzó oscuro */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg-body: #F8FAFC;
    --bg-surface: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-hover: #F1F5F9;
    --bg-subtle: #F1F5F9;
    --bg-glass: rgba(255, 255, 255, 0.90);
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #64748B;
    --border-subtle: #E2E8F0;
    --border-focus: rgba(0, 82, 255, 0.25);
    --brand-primary: #0052FF;
    --brand-accent: #0284C7;
    --accent-emc: #D97706;
    --shadow-soft: 0 2px 14px rgba(15, 23, 42, 0.04);
  }
}

/* Interruptor: claro forzado */
:root[data-theme="light"] {
  --bg-body: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-hover: #F1F5F9;
  --bg-subtle: #F1F5F9;
  --bg-glass: rgba(255, 255, 255, 0.90);
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --border-subtle: #E2E8F0;
  --border-focus: rgba(0, 82, 255, 0.25);
  --brand-primary: #0052FF;
  --brand-accent: #0284C7;
  --accent-emc: #D97706;
  --shadow-soft: 0 2px 14px rgba(15, 23, 42, 0.04);
}

/* Interruptor: oscuro forzado (por si el sistema es claro) */
:root[data-theme="dark"] {
  --bg-body: #070A12;
  --bg-surface: #0D1322;
  --bg-card: #0F1626;
  --bg-hover: rgba(255, 255, 255, 0.035);
  --bg-subtle: rgba(255, 255, 255, 0.04);
  --bg-glass: rgba(13, 19, 34, 0.86);
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border-subtle: rgba(255, 255, 255, 0.075);
  --border-focus: rgba(0, 198, 255, 0.28);
  --brand-primary: #0052FF;
  --brand-accent: #38BDF8;
  --accent-emc: #F59E0B;
  --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Accesibilidad: enlace de salto y foco visible */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand-primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 300;
}
.skip-link:focus { left: 12px; top: 12px; }

:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ==========================================================================
   1. HEADER SUPERIOR DE 1 SOLA LÍNEA
   ========================================================================== */
.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 62px;
  background: var(--bg-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
}

.header-container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  white-space: nowrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
}

.brand-logo-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #070A12;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  flex-shrink: 0;
}

.brand-logo-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tag-web {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.2px;
}

.header-center-status {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  flex-shrink: 0;
}

.header-center-status strong {
  color: var(--text-primary);
  font-weight: 700;
}
.cortesia-compacta { display: none; }

.status-dots {
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-subtle);
  transition: all 0.25s ease;
}

.status-dot.active { background: var(--brand-accent); }
.status-dot.limit { background: var(--accent-emc); }

.header-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.segmented-switcher {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 2px;
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.seg-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.theme-toggle-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}
.theme-toggle-btn svg { width: 15px; height: 15px; }

.btn-primary-app {
  background: var(--brand-primary);
  color: #FFFFFF;
  border: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  height: 34px;
  padding: 0 16px;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.btn-primary-app:hover { background: #0045D8; }
.btn-primary-app svg { width: 15px; height: 15px; }
.btn-primary-app .lbl-short { display: none; }

/* ==========================================================================
   2. LAYOUT DE 3 COLUMNAS
   ========================================================================== */
.main-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 230px minmax(0, 600px) 300px;
  gap: 28px;
  justify-content: center;
  align-items: start;
}

/* --- MODO VISTA MÓVIL (botón Escritorio/Móvil en escritorio) --- */
body.mobile-view .main-grid {
  max-width: 430px;
  grid-template-columns: minmax(0, 1fr);
  padding: 12px;
}
body.mobile-view .left-column,
body.mobile-view .right-column,
body.mobile-view .header-center-status {
  display: none;
}
body.mobile-view .header-container { padding: 0 14px; }
body.mobile-view .mobile-tail { display: flex; }

/* ==========================================================================
   COLUMNA IZQUIERDA
   ========================================================================== */
.left-column {
  position: sticky;
  top: 86px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.side-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.side-nav-item.active {
  color: var(--text-primary);
  font-weight: 700;
  background: var(--bg-subtle);
}

.nav-label-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
  flex-shrink: 0;
}

.nav-subtle-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.qr-minimal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.qr-card-heading {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.qr-card-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 14px;
}

.qr-box {
  width: 118px;
  height: 118px;
  margin: 0 auto 14px auto;
  padding: 7px;
  background: #FFFFFF;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
}

.qr-box img,
.qr-box canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.qr-stores-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.store-mini-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s;
}

.store-mini-btn:hover { border-color: var(--text-muted); }
.store-mini-btn small { display: block; color: var(--text-muted); font-weight: 600; font-size: 9px; }

/* ==========================================================================
   COLUMNA CENTRAL: FEED
   ========================================================================== */
.center-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.feed-tabs {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 0 8px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  overflow-x: auto;
  box-shadow: var(--shadow-soft);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.feed-tabs::-webkit-scrollbar { display: none; }

.feed-tab-item {
  flex: 1;
  text-align: center;
  padding: 14px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: color 0.15s ease;
  background: none;
  border: none;
  font-family: inherit;
}

.feed-tab-item:hover { color: var(--text-primary); }

.feed-tab-item.active {
  color: var(--text-primary);
  font-weight: 700;
}

.feed-tab-item.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 24%;
  right: 24%;
  height: 2.5px;
  background: var(--brand-primary);
  border-radius: 99px;
}

/* Tarjeta de publicación */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.post-top {
  padding: 18px 20px 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.author-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.author-img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: var(--bg-subtle);
}

.author-text { min-width: 0; }

.author-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}
.author-name-row .nm {
  overflow: hidden;
  text-overflow: ellipsis;
}

.verified-check {
  width: 15px;
  height: 15px;
  background: var(--brand-primary);
  color: #FFFFFF;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.verified-check svg { width: 9px; height: 9px; }

.author-sub-row {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.post-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.step-indicator-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: 9999px;
  white-space: nowrap;
}

.btn-follow-subtle {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 9999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-follow-subtle:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.post-caption {
  padding: 0 20px 14px 20px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Marco multimedia */
.media-frame {
  margin: 0 20px 14px 20px;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 16 / 10;
  background: #050811;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}

.media-frame > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
  display: block;
}

.media-frame:hover > img { transform: scale(1.015); }

.media-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #050811;
  display: block;
}

.media-pill {
  position: absolute;
  top: 12px;
  background: rgba(7, 10, 18, 0.78);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #F8FAFC;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  z-index: 2;
}
.media-pill.right { right: 12px; }
.media-pill.left { left: 12px; }

.play-trigger {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 3;
}
.play-trigger .circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(7, 10, 18, 0.75);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
}
.play-trigger .circle svg { width: 22px; height: 22px; }
.media-frame:hover .play-trigger .circle {
  transform: scale(1.07);
  background: var(--brand-primary);
  border-color: #FFFFFF;
}

/* Controles propios del video (visibles al reproducir) */
.media-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 22px 12px 10px 12px;
  background: linear-gradient(to top, rgba(5, 8, 17, 0.9) 0%, transparent 100%);
  display: none;
  align-items: center;
  gap: 10px;
  z-index: 4;
}
.media-frame.playing .media-controls { display: flex; }
.media-frame.playing { cursor: default; }
.mc-btn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  padding: 4px;
}
.mc-btn svg { width: 18px; height: 18px; }
.mc-track {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 99px;
  overflow: hidden;
  cursor: pointer;
}
.mc-fill { width: 0; height: 100%; background: #fff; }
.mc-time { color: #E2E8F0; font-size: 11px; font-weight: 600; min-width: 34px; text-align: right; }

/* Carrusel (reels de fotos con música y publicaciones con varias imágenes) */
.carousel { position: absolute; inset: 0; }
.carousel-track {
  display: flex;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track img {
  width: 100%;
  height: 100%;
  flex: 0 0 100%;
  object-fit: cover;
  scroll-snap-align: start;
}
.carousel-dots {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  z-index: 2;
  pointer-events: none;
}
.carousel-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
}
.carousel-dots span.on { background: #fff; }

.carousel-audio {
  margin: 0 20px 14px 20px;
  padding: 9px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.carousel-audio svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Barra de interacción */
.post-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.icon-action {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.icon-action svg { width: 16px; height: 16px; }
.icon-action:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.icon-action.likes svg { color: var(--text-secondary); }

.btn-open-app {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s;
}
.btn-open-app:hover { border-color: var(--brand-accent); }

/* ==========================================================================
   3. TARJETA DE BLOQUEO (cortesía agotada)
   ========================================================================== */
.locked-card-container {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  box-shadow: var(--shadow-soft);
  min-height: 320px;
}

.locked-blur-layer {
  filter: blur(10px);
  opacity: 0.32;
  pointer-events: none;
  user-select: none;
}

.locked-overlay-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 28px;
  background: linear-gradient(180deg, rgba(7, 10, 18, 0.25) 0%, rgba(7, 10, 18, 0.92) 60%, #070A12 100%);
  color: #FFFFFF;
}

:root[data-theme="light"] .locked-overlay-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.95) 55%, #FFFFFF 100%);
  color: #0F172A;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .locked-overlay-panel {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.95) 55%, #FFFFFF 100%);
    color: #0F172A;
  }
}

.locked-logo-badge {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #070A12;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 8px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(0, 82, 255, 0.25);
}

.locked-logo-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.locked-title {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.3;
  max-width: 420px;
  margin-bottom: 8px;
}

.locked-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  max-width: 430px;
  margin-bottom: 20px;
}
.locked-overlay-panel .locked-subtitle { color: inherit; opacity: 0.85; }

.btn-continue-app-large {
  background: var(--brand-primary);
  color: #FFFFFF;
  border: none;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 13px 26px;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn-continue-app-large:hover {
  background: #0045D8;
  transform: translateY(-1px);
}

/* ==========================================================================
   COLUMNA DERECHA
   ========================================================================== */
.right-column {
  position: sticky;
  top: 86px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.search-bar-subtle {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  text-align: left;
}
.search-bar-subtle svg { width: 15px; height: 15px; flex-shrink: 0; }

.search-bar-subtle input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px;
  width: 100%;
  cursor: pointer;
  pointer-events: none;
}

.side-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.side-card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  letter-spacing: -0.2px;
}

.topic-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  width: 100%;
  text-align: left;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  font-family: inherit;
  display: block;
}

.topic-row:first-of-type { padding-top: 0; }
.topic-row:last-of-type { border-bottom: none; padding-bottom: 0; }
.topic-row:hover .topic-name { color: var(--brand-accent); }

.topic-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.topic-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  transition: color 0.15s;
}
.topic-sponsor {
  font-size: 10.5px;
  color: var(--accent-emc);
  font-weight: 600;
  margin-top: 3px;
}

.specialist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
}

.specialist-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.specialist-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-subtle);
}

.specialist-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
}
.specialist-name .verified-check { width: 13px; height: 13px; }
.specialist-name .verified-check svg { width: 8px; height: 8px; }

.specialist-role {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pie legal discreto */
.legal-footer {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.7;
  padding: 4px 6px 0 6px;
  text-align: center;
}
.legal-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}
.legal-footer a:hover { color: var(--text-primary); text-decoration: underline; }
.legal-footer .sep { margin: 0 6px; opacity: 0.6; }

/* ==========================================================================
   Estados (cargando, error, vacío)
   ========================================================================== */
.feed-status {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
}
.feed-status .btn-retry {
  margin-top: 14px;
  background: var(--brand-primary);
  color: #fff;
  border: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 9px;
  cursor: pointer;
}
.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--brand-accent);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: mb-spin 0.8s linear infinite;
}
@keyframes mb-spin { to { transform: rotate(360deg); } }

.shared-flag {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 12px;
}
.shared-flag svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--brand-accent); }

/* ==========================================================================
   4. DIÁLOGO PROPIO ("Continúa en la app MedByte")
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 18, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open { display: flex; }

.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  padding: 28px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  max-height: 92vh;
  overflow-y: auto;
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close-btn svg { width: 14px; height: 14px; }

.modal-badge-top {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-accent);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 4px 12px;
  border-radius: 9999px;
  margin-bottom: 12px;
}

.modal-heading {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 8px;
}

.modal-copy {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 20px;
}

.modal-qr-panel {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  margin-bottom: 20px;
}

.modal-qr-thumb {
  width: 68px;
  height: 68px;
  background: #FFFFFF;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid #E2E8F0;
  flex-shrink: 0;
}

.modal-qr-thumb img,
.modal-qr-thumb canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.modal-qr-panel .mq-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}
.modal-qr-panel .mq-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.modal-dismiss-link {
  display: inline-block;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}

.modal-dismiss-link:hover { color: var(--text-secondary); }

/* ==========================================================================
   Toast propio
   ========================================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Cola móvil (QR + tiendas + legal al final del feed) — oculta en escritorio */
.mobile-tail { display: none; flex-direction: column; gap: 20px; }

/* ==========================================================================
   ADAPTACIÓN A ESCRITORIO ESTRECHO (idéntica al mockup)
   ========================================================================== */
@media (max-width: 1040px) {
  .main-grid { grid-template-columns: 210px minmax(0, 1fr); }
  .right-column { display: none; }
  body:not(.mobile-view) .mobile-tail { display: flex; }
}

/* ==========================================================================
   PRIMERO MÓVIL (teléfono real, ≤768 px)
   ========================================================================== */
@media (max-width: 768px) {
  .main-grid {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
    gap: 16px;
    max-width: 100%;
  }
  .left-column,
  .right-column { display: none; }
  .header-container { padding: 0 16px; gap: 8px; }
  .brand-group { min-width: 0; }

  /* En móvil: sin selector Escritorio/Móvil, píldora de cortesía compacta */
  .segmented-switcher { display: none; }
  .header-center-status {
    display: flex;
    padding: 5px 10px;
    font-size: 11px;
    gap: 7px;
    flex-shrink: 1;
    min-width: 0;
  }
  .header-center-status .cortesia-texto { display: none; }
  .cortesia-compacta { display: inline; font-weight: 700; color: var(--text-primary); }
  .brand-title .tag-web { display: none; }
  .theme-toggle-btn .theme-text { display: none; }
  .theme-toggle-btn { padding: 0 9px; }
  .btn-primary-app .lbl-full { display: none; }
  .btn-primary-app .lbl-short { display: inline; }

  /* Áreas táctiles cómodas */
  .feed-tab-item { padding: 14px 14px; min-height: 44px; }
  .btn-open-app, .icon-action, .btn-follow-subtle { min-height: 40px; }

  /* Pie de tarjeta: sin solapar el botón de acción */
  .post-footer { gap: 6px; padding: 10px 14px; }
  .footer-left { gap: 2px; }
  .icon-action { padding: 6px 7px; }
  .icon-action.share span { display: none; }

  .mobile-tail { display: flex; }
  .post-caption { font-size: 15px; }
}

@media (max-width: 360px) {
  .header-container { gap: 6px; padding: 0 12px; }
  .main-grid { padding: 12px; }
  .theme-toggle-btn { padding: 0 8px; }
  .btn-primary-app { padding: 0 11px; }
  .header-center-status { padding: 5px 8px; gap: 5px; }
}

/* Reduce el movimiento si el usuario lo pide */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .spinner { animation: mb-spin 0.8s linear infinite; }
}

/* Enlace compartido: la marca queda bajo el encabezado fijo, no tapada por él. */
.shared-flag { scroll-margin-top: 72px; }
/* En teléfono, las etiquetas "Contenido N de 2" / "Compartido contigo" de la tarjeta le quitaban
   el espacio al nombre del autor; ahí la cortesía ya se ve en la píldora del encabezado y la marca
   "Compartido contigo" va arriba de la tarjeta. */
@media (max-width: 480px) {
  .post-top-actions .step-indicator-tag { display: none; }
}

/* ==========================================================================
   CORTINA "Continúa en la app" (29-sep): sube desde abajo al asomarse la 4.ª
   tarjeta, ocupa ~¼ de pantalla y bloquea el scroll. Debajo del diálogo (300).
   ========================================================================== */
/* <html> oculto frena el scroll de la página. <body> vuelve a `visible` a propósito: trae
   overflow-x:hidden y, en cuanto <html> deja de ser visible, eso lo volvería contenedor de
   scroll y el menú lateral y la columna derecha (sticky) se irían. Toque/rueda: en JS. */
html.scroll-bloqueado { overflow: hidden; overscroll-behavior: none; }
html.scroll-bloqueado body { overflow: visible; }

.cortina-app {
  position: fixed; inset: 0; z-index: 250;
  display: flex; flex-direction: column; justify-content: flex-end;
  /* Toda la pantalla se oscurece (no sólo una franja) y ya no se puede tocar lo de atrás. */
  background: rgba(4, 9, 21, 0);
  transition: background 0.38s ease;
}
.cortina-app.abierta { background: rgba(4, 9, 21, 0.72); }

.cortina-panel {
  width: 100%; min-height: 25vh;
  background: var(--bg-surface); color: var(--text-primary);
  border-top: 1px solid var(--border-subtle);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.55);
  padding: 10px 24px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; justify-content: center; gap: 16px;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.cortina-app.abierta .cortina-panel { transform: translateY(0); }
/* La hoja va de lado a lado; su contenido, centrado. */
.cortina-cuerpo, .cortina-boton { width: 100%; max-width: 720px; margin-left: auto; margin-right: auto; }

.cortina-asa { width: 40px; height: 4px; border-radius: 9999px; background: var(--border-subtle); margin: 0 auto 2px; }
.cortina-cuerpo { display: flex; align-items: center; gap: 16px; }
.cortina-logo {
  width: 52px; height: 52px; flex-shrink: 0; object-fit: contain; padding: 9px;
  border-radius: 14px; background: #070A12; border: 1px solid rgba(255, 255, 255, 0.12);
}
.cortina-textos { flex: 1; min-width: 0; }
.cortina-textos h2 { margin: 0 0 4px; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.cortina-textos p { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--text-secondary); }
.cortina-qr {
  width: 96px; height: 96px; flex-shrink: 0; padding: 6px; border-radius: 12px; background: #FFFFFF;
}
.cortina-qr:empty { display: none; }
.cortina-boton { width: 100%; min-height: 48px; font-size: 15px; }

:root[data-theme="light"] .cortina-app.abierta { background: rgba(15, 23, 42, 0.55); }
:root[data-theme="light"] .cortina-panel { box-shadow: 0 -12px 36px rgba(15, 23, 42, 0.18); }

@media (max-width: 480px) {
  .cortina-panel { padding-left: 16px; padding-right: 16px; gap: 14px; }
  .cortina-logo { width: 44px; height: 44px; padding: 7px; }
  .cortina-textos h2 { font-size: 16.5px; }
  .cortina-textos p { font-size: 13px; }
}

/* Sólo para lectores de pantalla y buscadores (el <h1> de la página). */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   PÁGINA DE SOPORTE (medbyte.app/soporte)
   Reutiliza los tokens del sitio (claro/oscuro por sistema + data-theme).
   Primero móvil; sin scroll horizontal a 320 px.
   ========================================================================== */

/* Color de error, acotado a esta página, con su versión clara/oscura. */
.soporte-body { --danger: #F87171; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .soporte-body { --danger: #DC2626; }
}
:root[data-theme="light"] .soporte-body { --danger: #DC2626; }

.soporte-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-body);
  color: var(--text-primary);
}

.soporte-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-glass);
}

.soporte-main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px 48px;
}

.soporte-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  padding: 24px;
}

.soporte-titulo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  color: var(--text-primary);
}
.soporte-intro {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0 0 20px;
}

/* ── Campos ── */
.campo { margin-bottom: 16px; }
.campo label {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.campo input,
.campo textarea {
  width: 100%;
  font-family: inherit;
  font-size: 16px;            /* 16 px: evita el zoom de iOS al enfocar */
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 14px;
  min-height: 48px;           /* área táctil cómoda (≥ 44 px) */
}
.campo textarea {
  min-height: 120px;
  resize: vertical;
}
.campo input::placeholder,
.campo textarea::placeholder { color: var(--text-muted); }
.campo input:focus,
.campo textarea:focus {
  outline: none;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px var(--border-focus);
}
.campo input[aria-invalid="true"],
.campo textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

.campo-error {
  font-size: 12.5px;
  color: var(--danger);
  margin: 6px 0 0;
}
.campo-pie {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.campo-pie .campo-error { flex: 1; }
.contador {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── Campo trampa (honeypot): fuera de pantalla, NO display:none ── */
.campo-trampa {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.soporte-privacidad {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 4px 0 18px;
}
.soporte-privacidad a { color: var(--text-secondary); }
.soporte-privacidad a:hover { color: var(--text-primary); }

/* ── Aviso general (red/servidor) ── */
.soporte-aviso {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

/* ── Botón enviar ── */
.soporte-enviar {
  width: 100%;
  min-height: 48px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: var(--brand-primary);
  border: none;
  border-radius: 28px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.05s ease;
}
.soporte-enviar:hover { opacity: 0.92; }
.soporte-enviar:active { transform: translateY(1px); }
.soporte-enviar:disabled { opacity: 0.6; cursor: default; }

/* ── Tarjeta de éxito ── */
.soporte-ok { text-align: center; }
.ok-logo {
  width: 68px; height: 68px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: #070A12;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex; align-items: center; justify-content: center;
  padding: 8px;
}
.soporte-ok .soporte-intro { margin-bottom: 22px; }
.soporte-volver {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: var(--brand-primary);
  border-radius: 28px;
  text-decoration: none;
}
.soporte-volver:hover { opacity: 0.92; }

/* Pantallas muy estrechas (320 px): menos relleno, sin desbordes. */
@media (max-width: 360px) {
  .soporte-card { padding: 20px 16px; }
  .soporte-main { padding: 16px 12px 40px; }
}

/* El renglón "Soporte" del menú es un <a> (los demás son <button>): sin subrayado. */
a.side-nav-item { text-decoration: none; }
