:root {
  --crema: #FBF4E9;
  --papel: #FFFDF9;
  --tinta: #33261D;
  --tinta-sutil: #8A7A6D;
  --terracota: #E4572E;
  --terracota-oscuro: #C74521;
  --ambar: #F5A623;
  --teal: #0F7173;
  --teal-oscuro: #0A5658;
  --coral-suave: #FBE3D9;
  --ambar-suave: #FCEFD4;
  --teal-suave: #DCEFEA;
  --borde: #EBDFD2;
  --gradiente: linear-gradient(135deg, #E4572E 0%, #EF7A35 55%, #F5A623 100%);
  --gradiente-teal: linear-gradient(135deg, #0F7173 0%, #14947F 60%, #45B08C 100%);
  --sombra: 0 14px 34px -14px rgba(51, 38, 29, 0.22);
  --radio: 22px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Figtree", system-ui, sans-serif;
  color: var(--tinta);
  background-color: var(--crema);
  background-image:
    radial-gradient(48rem 30rem at -12% -8%, rgba(228, 87, 46, 0.10), transparent 60%),
    radial-gradient(40rem 26rem at 112% 4%, rgba(245, 166, 35, 0.14), transparent 60%),
    radial-gradient(44rem 30rem at 50% 118%, rgba(15, 113, 115, 0.09), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- barra superior ---------- */

.barra {
  background: var(--gradiente);
  color: #fff;
  padding: 1.05rem 1.15rem 1.2rem;
  border-radius: 0 0 26px 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 26px -14px rgba(199, 69, 33, 0.55);
}

.barra::before,
.barra::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.barra::before { width: 150px; height: 150px; top: -70px; right: 12%; }
.barra::after { width: 90px; height: 90px; bottom: -45px; right: 32%; background: rgba(255, 255, 255, 0.08); }

.barra-admin { background: var(--gradiente-teal); box-shadow: 0 10px 26px -14px rgba(10, 86, 88, 0.55); }

.titulo-app {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 1.18rem;
  letter-spacing: 0.01em;
}

.barra-usuario { color: rgba(255, 255, 255, 0.85); font-size: 0.82rem; margin-top: 0.15rem; }

.barra-nav { display: flex; gap: 0.7rem; align-items: center; position: relative; z-index: 1; }

.link-barra {
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid rgba(255, 255, 255, 0.45);
  padding-bottom: 1px;
}

.btn-barra {
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-barra:hover { background: rgba(255, 255, 255, 0.28); }

/* ---------- estructura ---------- */

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.15rem 1rem 3.5rem;
}

.tarjeta {
  background: var(--papel);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 1.5rem 1.35rem;
  margin-bottom: 1.05rem;
  box-shadow: var(--sombra);
}

.centrado { text-align: center; }
.oculto { display: none !important; }
.sutil { color: var(--tinta-sutil); font-size: 0.93rem; line-height: 1.5; }

.anim-entrada { animation: subir 0.5s cubic-bezier(0.22, 0.9, 0.35, 1) both; }
.anim-2 { animation-delay: 0.12s; }

@keyframes subir {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.titulo-serif {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 1.5rem;
  margin: 0 0 0.45rem;
}

.titulo-serif.chico { font-size: 1.2rem; margin: 0; }

h2 { margin: 0 0 0.45rem; }
h3 { margin: 0 0 0.4rem; font-size: 0.95rem; }

/* ---------- formularios ---------- */

label {
  display: block;
  margin: 0.9rem 0;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
}

input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.68rem 0.8rem;
  font: inherit;
  font-weight: 400;
  border: 1.5px solid var(--borde);
  border-radius: 13px;
  background: #fff;
  color: var(--tinta);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea { resize: vertical; line-height: 1.5; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--terracota);
  box-shadow: 0 0 0 3px rgba(228, 87, 46, 0.18);
}

.modo-admin input:focus, .modo-admin select:focus, .modo-admin textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 113, 115, 0.18);
}

/* ---------- botones ---------- */

button { font: inherit; cursor: pointer; }

.btn-primario {
  background: var(--gradiente);
  color: #fff;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.6rem;
  box-shadow: 0 8px 20px -8px rgba(199, 69, 33, 0.6);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-primario:hover { transform: translateY(-1px); box-shadow: 0 11px 24px -8px rgba(199, 69, 33, 0.65); }
.btn-primario:active { transform: translateY(0); }
.btn-primario:disabled { opacity: 0.55; cursor: wait; transform: none; }

.modo-admin .btn-primario {
  background: var(--gradiente-teal);
  box-shadow: 0 8px 20px -8px rgba(10, 86, 88, 0.6);
}

.btn-fantasma {
  background: transparent;
  color: var(--tinta);
  font-weight: 600;
  border: 1.5px solid var(--borde);
  border-radius: 999px;
  padding: 0.7rem 1.3rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.btn-fantasma:hover { border-color: var(--tinta-sutil); background: rgba(51, 38, 29, 0.03); }
.btn-fantasma.mini { padding: 0.35rem 0.85rem; font-size: 0.8rem; }

.btn-peligro {
  background: transparent;
  color: var(--terracota);
  font-weight: 700;
  border: 1.5px solid var(--coral-suave);
  border-radius: 999px;
  padding: 0.7rem 1.3rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-peligro:hover { background: var(--coral-suave); border-color: var(--terracota); }

.ancho { width: 100%; }

.fila-botones { display: flex; gap: 0.6rem; margin-top: 1.05rem; flex-wrap: wrap; align-items: center; }
.fila-botones.centrada { justify-content: center; }

/* ---------- login ---------- */

.tarjeta-login { margin-top: 2.2rem; padding: 2rem 1.6rem; }

.saludo {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 2.6rem;
  margin: 0 0 0.3rem;
  background: var(--gradiente);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- grabacion ---------- */

.boton-grabar {
  width: 136px;
  height: 136px;
  border-radius: 50%;
  border: none;
  background: var(--gradiente);
  color: #fff;
  margin: 1.4rem auto 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 16px 36px -12px rgba(199, 69, 33, 0.65), inset 0 -4px 10px rgba(0, 0, 0, 0.12);
  transition: transform 0.12s ease;
}

.boton-grabar:hover { transform: scale(1.03); }
.boton-grabar:active { transform: scale(0.97); }

.icono-grabar { width: 52px; height: 52px; color: #fff; }

.boton-grabar.grabando { background: linear-gradient(135deg, #C0392B, #E4572E); }

.boton-grabar.grabando::before,
.boton-grabar.grabando::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(228, 87, 46, 0.55);
  animation: onda 1.6s ease-out infinite;
}

.boton-grabar.grabando::after { animation-delay: 0.55s; }

@keyframes onda {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(1.55); opacity: 0; }
}

.estado-grabacion { color: var(--tinta-sutil); font-size: 0.92rem; margin: 0.4rem 0; }

.timer {
  font-family: "Fraunces", Georgia, serif;
  font-size: 2.1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin: 0.2rem 0;
}

audio { width: 100%; margin-top: 0.9rem; }

.separador {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--tinta-sutil);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 1.3rem 0 0.7rem;
}

.separador::before, .separador::after { content: ""; flex: 1; height: 1px; background: var(--borde); }

.subir-archivo {
  display: inline-block;
  color: var(--terracota);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  margin: 0;
}

.subir-archivo input { display: none; }

.error { color: var(--terracota-oscuro); font-size: 0.9rem; margin: 0.7rem 0 0; font-weight: 600; }

/* ---------- gracias ---------- */

.tarjeta-gracias { animation: aparecer 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; padding: 2.4rem 1.6rem; }

@keyframes aparecer {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.sello-gracias {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: var(--gradiente-teal);
  margin: 0 auto 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 30px -12px rgba(10, 86, 88, 0.6);
  animation: aparecer 0.6s 0.15s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}

.sello-gracias svg { width: 44px; height: 44px; }

.titulo-gracias {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 2.2rem;
  margin: 0 0 0.5rem;
}

.texto-gracias { max-width: 30rem; margin: 0 auto 1.4rem; }

/* ---------- mis aportes ---------- */

.cabecera-lista {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.lista-aportes { list-style: none; margin: 0; padding: 0; }

.lista-aportes li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 0.15rem;
  border-bottom: 1px dashed var(--borde);
}

.lista-aportes li:last-child { border-bottom: none; }

.lista-aportes .titulo-aporte { font-weight: 600; font-size: 0.95rem; }
.lista-aportes .meta { color: var(--tinta-sutil); font-size: 0.8rem; margin-top: 0.1rem; }

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
  background: #EFE7DC;
  color: var(--tinta-sutil);
}

.badge.procesando { background: var(--ambar-suave); color: #9A6A0B; }
.badge.pendiente { background: var(--ambar-suave); color: #9A6A0B; }
.badge.aprobado { background: var(--teal-suave); color: var(--teal-oscuro); }
.badge.descartado { background: #EFE7DC; color: var(--tinta-sutil); }
.badge.error { background: var(--coral-suave); color: var(--terracota-oscuro); }

/* ---------- moderacion ---------- */

.salud {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  align-items: center;
  background: var(--papel);
  border: 1px solid var(--borde);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  margin-bottom: 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tinta-sutil);
  box-shadow: var(--sombra);
}

.salud-item { display: flex; align-items: center; gap: 0.4rem; }

.punto {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.punto.ok { background: #2E9E6B; box-shadow: 0 0 0 3px rgba(46, 158, 107, 0.18); }
.punto.mal { background: var(--terracota); box-shadow: 0 0 0 3px rgba(228, 87, 46, 0.18); animation: latido 1.4s ease-in-out infinite; }

@keyframes latido {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.filtros { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 1.05rem; }

.filtro .cuenta {
  display: inline-block;
  min-width: 1.3em;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: rgba(51, 38, 29, 0.08);
  font-size: 0.75rem;
}

.filtro.activo .cuenta { background: rgba(255, 255, 255, 0.25); }

.filtro {
  background: var(--papel);
  border: 1.5px solid var(--borde);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--tinta-sutil);
  transition: all 0.15s ease;
}

.filtro:hover { border-color: var(--teal); color: var(--teal); }

.filtro.activo {
  background: var(--gradiente-teal);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(10, 86, 88, 0.6);
}

.filtro.con-alerta { border-color: var(--terracota); color: var(--terracota-oscuro); }
.filtro.con-alerta .cuenta { background: var(--coral-suave); color: var(--terracota-oscuro); }

.filtro-marcado.activo {
  background: var(--gradiente);
  box-shadow: 0 6px 16px -8px rgba(199, 69, 33, 0.6);
  color: #fff;
}

.alerta-marcado {
  background: var(--coral-suave);
  border: 1.5px solid var(--terracota);
  border-radius: 13px;
  padding: 0.8rem 0.95rem;
  margin: 0 0 0.7rem;
  font-size: 0.9rem;
}

.alerta-marcado strong { color: var(--terracota-oscuro); display: block; margin-bottom: 0.25rem; }
.alerta-marcado p { margin: 0; }

.meta-aporte { color: var(--tinta-sutil); font-size: 0.82rem; margin: 0 0 0.7rem; }

.aviso {
  background: var(--ambar-suave);
  border: 1px solid #EBCF96;
  border-radius: 13px;
  padding: 0.75rem 0.9rem;
  font-size: 0.88rem;
  margin: 0 0 0.6rem;
}

.bloque-ambiguedades {
  background: var(--ambar-suave);
  border: 1px solid #EBCF96;
  border-radius: 13px;
  padding: 0.75rem 0.9rem;
  margin-top: 0.9rem;
  font-size: 0.88rem;
}

.bloque-ambiguedades ul { margin: 0; padding-left: 1.1rem; }

.detalle-transcripcion {
  margin-top: 1rem;
  font-size: 0.9rem;
  border: 1.5px dashed var(--borde);
  border-radius: 13px;
  padding: 0.7rem 0.9rem;
}

.detalle-transcripcion summary { cursor: pointer; color: var(--teal); font-weight: 700; }
.detalle-transcripcion p { margin: 0.6rem 0 0; }

/* Filas plegables de la bandeja de moderacion */

.aporte-item { padding: 0; overflow: hidden; }

.aporte-resumen {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 1.15rem;
  cursor: pointer;
}

.aporte-resumen::-webkit-details-marker { display: none; }

.aporte-resumen::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2.5px solid var(--tinta-sutil);
  border-bottom: 2.5px solid var(--tinta-sutil);
  transform: rotate(45deg);
  flex-shrink: 0;
  transition: transform 0.15s ease;
  margin-left: 0.2rem;
}

.aporte-item[open] > .aporte-resumen::after { transform: rotate(-135deg); }

.aporte-resumen:hover { background: rgba(15, 113, 115, 0.04); }

.aporte-cabecera { min-width: 0; }
.aporte-titulo { font-weight: 700; font-size: 0.97rem; }
.aporte-meta { color: var(--tinta-sutil); font-size: 0.8rem; margin-top: 0.15rem; }

.aporte-chips {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
  max-width: 45%;
}

.chip {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: #EFE7DC;
  color: var(--tinta-sutil);
  white-space: nowrap;
}

.chip.alerta { background: var(--coral-suave); color: var(--terracota-oscuro); }
.chip.aviso-chip { background: var(--ambar-suave); color: #9A6A0B; }

.aporte-cuerpo {
  padding: 0.9rem 1.15rem 1.2rem;
  border-top: 1px dashed var(--borde);
}

.aporte-cuerpo audio { margin-top: 0.2rem; }

.acceso-celular summary { cursor: pointer; color: var(--teal); font-weight: 700; }

.acceso-celular .qr { display: flex; justify-content: center; margin: 1.1rem 0 0.5rem; }

.acceso-celular .qr svg {
  width: 220px;
  height: 220px;
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 13px;
  padding: 10px;
}

.url-acceso {
  font-weight: 700;
  font-size: 1.02rem;
  word-break: break-all;
  margin: 0.4rem 0;
}

/* Registro y verificacion */

.pie-form { margin-top: 1.1rem; text-align: center; }

.link-texto {
  background: none;
  border: none;
  padding: 0;
  color: var(--terracota);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.input-codigo {
  text-align: center;
  font-size: 1.6rem;
  letter-spacing: 0.35em;
  font-variant-numeric: tabular-nums;
}

.centrado-label { text-align: center; }

.codigo-vinculo {
  font-family: "Fraunces", Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  margin: 1rem 0 0.4rem;
}

#tarjeta-whatsapp .btn-primario { margin-top: 0.8rem; }

/* Avisos en vivo para el moderador */

.toasts {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 50;
  width: min(92vw, 420px);
}

.toast {
  background: var(--tinta);
  color: #fff;
  border-radius: 13px;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  box-shadow: 0 12px 28px -10px rgba(0, 0, 0, 0.45);
  border-left: 4px solid #45B08C;
  animation: subir 0.3s ease both;
}

.toast.marcado, .toast.error { border-left-color: var(--terracota); }

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid var(--borde);
  border-top-color: var(--terracota);
  border-radius: 50%;
  margin: 0.5rem auto 1rem;
  animation: girar 0.9s linear infinite;
}

@keyframes girar { to { transform: rotate(360deg); } }
