:root {
  --azul: #1f3a5f;
  --azul-claro: #2f5c95;
  --arena: #f6f3ee;
  --borde: #e3ded6;
  --rombo: #d64545;
  --punto: #2a9dd6;
  --sidebar-ancho: 250px;
  --topbar-alto: 3.15rem;   /* .7rem de padding arriba y abajo + la línea */
  --main-px: 1rem;          /* padding lateral de <main>: px-3 */
  --main-px-md: 1.5rem;     /* …y px-md-4 a partir de 768 px */
}

body {
  background: var(--arena);
  color: #22262b;
  font-size: 0.95rem;
}

/* ── Estructura ────────────────────────────────────────────────────── */
#wrapper { display: flex; min-height: 100vh; }

#sidebar {
  width: var(--sidebar-ancho);
  flex: 0 0 var(--sidebar-ancho);
  background: var(--azul);
  color: #dfe6ef;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
}

#page-content {
  flex: 1 1 auto;
  margin-left: var(--sidebar-ancho);
  min-width: 0;
}

.sidebar-brand a {
  display: flex; align-items: center; gap: .6rem;
  padding: 1.15rem 1.25rem;
  color: #fff; text-decoration: none;
  font-size: 1.05rem; font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-nav { list-style: none; padding: .75rem 0; margin: 0; flex: 1 1 auto; overflow-y: auto; }
.sidebar-section {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  opacity: .55; padding: 1rem 1.25rem .35rem;
}
.sidebar-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem 1.25rem;
  color: #dfe6ef; text-decoration: none;
}
.sidebar-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-link.active { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 #fff; }
.sidebar-link-sm { font-size: .85rem; padding: .4rem 1.25rem; }

.sidebar-footer { border-top: 1px solid rgba(255,255,255,.1); padding: .6rem 0; }
.sidebar-user { display: flex; align-items: center; gap: .6rem; padding: .7rem 1.25rem .2rem; }
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--azul-claro); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: .85rem;
}
.sidebar-user-link {
  display: flex; align-items: center; gap: .6rem; min-width: 0;
  color: inherit; text-decoration: none;
  margin: -.3rem -.5rem; padding: .3rem .5rem; border-radius: 6px;
}
.sidebar-user-link:hover, .sidebar-user-link.active { background: rgba(255,255,255,.12); }
.sidebar-user-info { min-width: 0; }
.sidebar-user-name { font-size: .85rem; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-sub { font-size: .72rem; color: #aebccd; }
.btn-sidebar-logout {
  background: none; border: 0; color: #dfe6ef; padding: .25rem .4rem; border-radius: 4px;
}
.btn-sidebar-logout:hover { background: rgba(255,255,255,.12); color: #fff; }

.topbar {
  display: flex; align-items: center; gap: .75rem;
  background: #fff; border-bottom: 1px solid var(--borde);
  padding: .7rem 1rem;
  position: sticky; top: 0; z-index: 1020;
  min-height: var(--topbar-alto);
}
.topbar-brand { font-weight: 600; }
.topbar-toggle { background: none; border: 0; font-size: 1.35rem; line-height: 1; }
#sidebarOverlay { display: none; }

@media (max-width: 991.98px) {
  #sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  #sidebar.open { transform: none; }
  #page-content { margin-left: 0; }
  #sidebarOverlay.show {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,.4); z-index: 1030;
  }
}

/* ── Panel de inicio ───────────────────────────────────────────────── */
.modulo-card {
  display: flex; align-items: center; gap: 1rem;
  background: #fff; border: 1px solid var(--borde); border-radius: 10px;
  padding: 1.1rem; height: 100%;
  color: inherit; text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.modulo-card:hover { border-color: var(--azul-claro); transform: translateY(-2px); }
.modulo-icono {
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: 10px;
  background: var(--azul); color: #fff;
  display: grid; place-items: center; font-size: 1.3rem;
}
.modulo-texto p { font-size: .85rem; color: #6c757d; margin: 0; }
.modulo-resumen { font-size: .8rem; color: var(--azul-claro); font-weight: 600; }
.modulo-flecha { margin-left: auto; color: #adb5bd; }

/* ── Marcas del folleto ────────────────────────────────────────────── */
.marca { display: inline-block; width: .6rem; height: .6rem; margin-right: .45rem; }
.marca-rombo { background: var(--rombo); transform: rotate(45deg); }
.marca-punto { background: var(--punto); border-radius: 50%; }
.marca-vacia { background: none; }

/* ── Cabecera fija de /lectura/ ────────────────────────────────────── */
/* Se queda pegada bajo la topbar al bajar por la lista. Los márgenes
   negativos compensan el padding de <main> para que el fondo llegue a los
   bordes y las filas no se vean asomar por los lados al pasar por debajo. */
.cabecera-programa {
  position: sticky;
  top: var(--topbar-alto);
  z-index: 15;
  background: var(--arena);
  border-bottom: 1px solid var(--borde);
  margin: -1.5rem calc(-1 * var(--main-px)) 1.75rem;
  padding: 1.25rem var(--main-px) .9rem;
}

@media (min-width: 768px) {
  .cabecera-programa {
    margin-left: calc(-1 * var(--main-px-md));
    margin-right: calc(-1 * var(--main-px-md));
    padding-left: var(--main-px-md);
    padding-right: var(--main-px-md);
  }
}

/* ── Tabla del programa ────────────────────────────────────────────── */
/* Separación amplia entre secciones: el título va pegado a su propia tabla,
   así que necesita aire por arriba para no parecer parte de la anterior. */
.seccion { margin-bottom: 2.75rem; }
.seccion:last-child { margin-bottom: 1rem; }
.seccion-titulo {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--azul);
  padding: .6rem .75rem; margin: 0;
  background: #fff; border: 1px solid var(--borde); border-bottom: 0;
  border-radius: 8px 8px 0 0;
}
.celda-duracion { color: #6c757d; font-size: .85rem; white-space: nowrap; }
.tabla-programa { background: #fff; border: 1px solid var(--borde); border-radius: 0 0 8px 8px; }
.tabla-programa thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: #6c757d; font-weight: 600;
}
.tabla-programa .enlace-lectura { color: inherit; text-decoration: none; font-weight: 500; }
.tabla-programa .enlace-lectura:hover { color: var(--azul-claro); text-decoration: underline; }
.fila-leida { opacity: .5; }
.fila-leida .enlace-lectura { text-decoration: line-through; }

.progress { height: .5rem; }
.progress-bar { background: var(--azul-claro); }

/* ── Reproductor ───────────────────────────────────────────────────── */
.reproductor { max-width: 720px; }
.panel-audio {
  background: #fff; border: 1px solid var(--borde); border-radius: 12px;
  padding: 1.5rem;
}
.pista-actual { text-align: center; margin-bottom: 1rem; }
.pista-nombre { font-size: 1.15rem; font-weight: 600; }
.pista-versiculo { font-size: .85rem; color: #6c757d; min-height: 1.2em; }

.barra-tiempo { width: 100%; }

.controles { display: flex; align-items: center; justify-content: center; gap: .75rem; }
.btn-control {
  background: none; border: 0; font-size: 1.4rem; color: var(--azul);
  width: 44px; height: 44px; border-radius: 50%;
}
.btn-control:hover { background: var(--arena); color: var(--azul-claro); }
.btn-play {
  background: var(--azul); color: #fff; border: 0;
  width: 60px; height: 60px; border-radius: 50%; font-size: 1.9rem;
  display: grid; place-items: center;
}
.btn-play:hover { background: var(--azul-claro); color: #fff; }

.lista-pistas { list-style: none; padding: 0; margin: 0; }
.pista {
  display: flex; align-items: center; gap: .75rem;
  padding: .55rem .85rem;
  background: #fff; border: 1px solid var(--borde); border-bottom: 0;
  cursor: pointer;
}
.pista:first-child { border-radius: 8px 8px 0 0; }
.pista:last-child { border-bottom: 1px solid var(--borde); border-radius: 0 0 8px 8px; }
.pista:hover { background: var(--arena); }
.pista.activa { background: #eaf1fa; font-weight: 600; }
.pista-icono { color: var(--azul-claro); }
.pista-duracion { margin-left: auto; font-size: .8rem; color: #6c757d; }

/* ── Entrar ────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card {
  background: #fff; border: 1px solid var(--borde); border-radius: 12px;
  padding: 2rem; width: 100%; max-width: 380px;
}
.login-brand {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  font-size: 1.25rem; font-weight: 600; color: var(--azul);
  margin-bottom: 1.5rem;
}

/* ── Cuentas ───────────────────────────────────────────────────────── */
.login-card-ancha { max-width: 440px; }
.login-pie { margin-top: 1.25rem; text-align: center; font-size: .88rem; color: #6c757d; }
.login-pie a { color: var(--azul-claro); }
.avisos-sueltos { max-width: 440px; margin: 1rem auto -2.5rem; padding: 0 1rem; position: relative; z-index: 1; }
.form-text { font-size: .8rem; }
.errorlist { list-style: none; padding: 0; margin: .25rem 0 0; color: #b02a37; font-size: .82rem; }

.perfil-card { background: #fff; border: 1px solid var(--borde); border-radius: 10px; padding: 1.5rem; }
.perfil-datos { font-size: .85rem; color: #6c757d; }
.zona-peligro { border-color: #f1c4c8; }

