/* Brota — estilos. Marca: loto con gota. Orquídea, índigo noche, lila y azul brillo.
   (Los nombres de variables son internos; los valores son la paleta actual.) */
:root {
  --terracota: #7B3FE4;      /* orquídea: acción principal */
  --terracota-osc: #5E27C2;
  --salvia: #3E63F2;         /* azul brillo: progreso / hecho */
  --salvia-clara: #E5EAFF;
  --durazno: #DCC8FF;        /* lila */
  --durazno-claro: #F2EAFF;
  --crema: #F7F4FF;          /* fondo lavanda */
  --papel: #FFFFFF;
  --cacao: #1C0F4D;          /* índigo noche: texto */
  --cacao-suave: #645C8A;
  --linea: #E6DFF6;
  --ambar: #D98A1F;
  --rojo: #C2365C;
  --noche: #190A5A;
  --degrade: linear-gradient(135deg, #9A45F5 0%, #2A1083 45%, #190A5A 72%, #2F57EE 100%);
  --radio: 18px;
  --sombra: 0 1px 2px rgba(28, 15, 77, .06), 0 6px 18px rgba(28, 15, 77, .07);
  --titulos: 'Avenir Next', 'Segoe UI Semibold', 'Segoe UI', 'Helvetica Neue', system-ui, sans-serif;
  --texto: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--crema); color: var(--cacao); font-family: var(--texto); font-size: 16px; line-height: 1.45; -webkit-tap-highlight-color: transparent; }
body { min-height: 100dvh; }
a { color: var(--terracota-osc); }
h1, h2, h3 { font-family: var(--titulos); font-weight: 600; letter-spacing: -.01em; margin: 0 0 .4em; line-height: 1.15; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; }
p { margin: 0 0 .7em; }
small, .suave { color: var(--cacao-suave); }
.oculto { display: none !important; }

/* Estructura */
#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; background: var(--crema); }
.cabecera { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; background: rgba(247, 244, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; }
.marca { display: flex; align-items: center; gap: 8px; font-family: var(--titulos); font-size: 1.45rem; font-weight: 700; color: var(--cacao); text-decoration: none; }
.marca svg, .marca img { width: 32px; height: 32px; border-radius: 9px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--durazno); color: var(--cacao); display: grid; place-items: center; font-weight: 700; text-decoration: none; border: 2px solid var(--papel); box-shadow: var(--sombra); }
main { flex: 1; padding: 6px 16px 110px; }
.nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--papel); border-top: 1px solid var(--linea); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: .7rem; color: var(--cacao-suave); text-decoration: none; border-radius: 12px; }
.nav a svg { width: 24px; height: 24px; }
.nav a.activo { color: var(--terracota); font-weight: 600; }
.nav a.activo svg { stroke: var(--terracota); }

/* Tarjetas */
.tarjeta { background: var(--papel); border-radius: var(--radio); padding: 16px; margin: 0 0 14px; box-shadow: var(--sombra); border: 1px solid var(--linea); }
.tarjeta.durazno { background: var(--durazno-claro); border-color: #E4D3FF; }
.tarjeta.salvia { background: var(--salvia-clara); border-color: #CBD6FF; }
.tarjeta.terracota { background: var(--degrade); color: #fff; border: none; }
.tarjeta.terracota .suave, .tarjeta.terracota small { color: #E4D6FF; }
.titulo-seccion { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 18px 2px 8px; }
.titulo-seccion h2 { margin: 0; }
.fila { display: flex; align-items: center; gap: 10px; }
.entre { justify-content: space-between; }
.envolver { flex-wrap: wrap; }
.grilla2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.centro { text-align: center; }

/* Botones y campos */
.btn { appearance: none; border: none; border-radius: 999px; padding: 12px 18px; font: inherit; font-weight: 600; cursor: pointer; background: var(--terracota); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; min-height: 44px; }
.btn:hover { background: var(--terracota-osc); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.sec { background: var(--papel); color: var(--cacao); border: 1.5px solid var(--linea); }
.btn.sec:hover { border-color: var(--terracota); }
.btn.salvia { background: var(--salvia); }
.btn.chico { padding: 7px 12px; min-height: 34px; font-size: .9rem; }
.btn.bloque { width: 100%; }
.btn.texto { background: none; color: var(--terracota-osc); padding: 6px 4px; min-height: 0; }
label { display: block; font-weight: 600; font-size: .92rem; margin: 10px 0 6px; }
input[type=text], input[type=number], input[type=search], input[type=date], input[type=time], select, textarea {
  width: 100%; font: inherit; color: var(--cacao); background: var(--papel); border: 1.5px solid var(--linea); border-radius: 14px; padding: 11px 13px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--terracota); box-shadow: 0 0 0 3px rgba(123, 63, 228, .15); }
textarea { min-height: 96px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--linea); background: var(--papel); color: var(--cacao); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: .92rem; cursor: pointer; }
.chip.on { background: var(--cacao); color: var(--crema); border-color: var(--cacao); }
.opcion { width: 100%; text-align: left; border: 1.5px solid var(--linea); background: var(--papel); border-radius: 16px; padding: 14px; margin: 0 0 10px; font: inherit; color: inherit; cursor: pointer; display: block; }
.opcion strong { display: block; margin-bottom: 2px; }
.opcion.on { border-color: var(--terracota); background: var(--durazno-claro); box-shadow: 0 0 0 2px rgba(123, 63, 228, .2); }
.interruptor { position: relative; width: 52px; height: 30px; flex: none; }
.interruptor input { opacity: 0; width: 0; height: 0; }
.interruptor span { position: absolute; inset: 0; background: var(--linea); border-radius: 999px; transition: .2s; cursor: pointer; }
.interruptor span::before { content: ''; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.interruptor input:checked + span { background: var(--salvia); }
.interruptor input:checked + span::before { transform: translateX(22px); }

/* Rutina del día */
.momento { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--crema); margin-bottom: 10px; cursor: pointer; border: 1.5px solid transparent; }
.momento.hecho { background: var(--salvia-clara); border-color: #CBD6FF; }
.momento .icono { font-size: 1.6rem; width: 44px; height: 44px; display: grid; place-items: center; background: var(--papel); border-radius: 50%; flex: none; }
.momento .info { flex: 1; min-width: 0; }
.momento .info small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.check { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--cacao-suave); display: grid; place-items: center; flex: none; color: transparent; font-weight: 700; }
.hecho .check { background: var(--salvia); border-color: var(--salvia); color: #fff; }
.semana { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; margin-top: 8px; }
.dia small { display: block; font-size: .72rem; margin-bottom: 4px; }
.punto { width: 30px; height: 30px; margin: 0 auto; border-radius: 50%; background: var(--linea); position: relative; overflow: hidden; }
.punto .m, .punto .n { position: absolute; left: 0; right: 0; height: 50%; }
.punto .m { top: 0; } .punto .n { bottom: 0; }
.punto .on { background: var(--salvia); }
.punto.hoy { outline: 2px solid var(--terracota); outline-offset: 2px; }
.punto.futuro { background: transparent; border: 1.5px dashed var(--linea); }
.anillo { --p: 0; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--salvia) calc(var(--p) * 1%), var(--linea) 0); flex: none; }
.anillo > div { width: 66px; height: 66px; border-radius: 50%; background: var(--papel); display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; }
.racha { font-size: 1.5rem; font-weight: 700; font-family: var(--titulos); }

/* Pasos */
.paso { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--linea); }
.paso:last-child { border-bottom: none; }
.paso .num { width: 32px; height: 32px; border-radius: 50%; background: var(--durazno); display: grid; place-items: center; font-weight: 700; flex: none; }
.paso .cuerpo { flex: 1; min-width: 0; }
.etiqueta { display: inline-block; font-size: .74rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--crema); color: var(--cacao-suave); margin: 2px 4px 2px 0; }
.etiqueta.sal { background: var(--salvia-clara); color: #2337A8; }
.etiqueta.amb { background: #FBEBCD; color: #8A5A12; }
.etiqueta.roj { background: #F7DDD6; color: var(--rojo); }
.etiqueta.dur { background: var(--durazno-claro); color: var(--terracota-osc); }
.aviso { padding: 11px 13px; border-radius: 14px; margin-bottom: 8px; font-size: .93rem; border-left: 4px solid var(--ambar); background: #FDF5E6; }
.aviso.importante { border-color: var(--rojo); background: #FBE9E4; }
.aviso.separar { border-color: var(--terracota); background: var(--durazno-claro); }
.aviso.sugerencia { border-color: var(--salvia); background: var(--salvia-clara); }
.pestanas { display: flex; gap: 6px; background: var(--papel); padding: 5px; border-radius: 999px; border: 1px solid var(--linea); margin-bottom: 14px; }
.pestanas button { flex: 1; border: none; background: none; font: inherit; font-weight: 600; padding: 9px 6px; border-radius: 999px; color: var(--cacao-suave); cursor: pointer; font-size: .92rem; }
.pestanas button.on { background: var(--cacao); color: var(--crema); }
.calendario-noches { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; font-size: .74rem; text-align: center; }
.calendario-noches div { background: var(--crema); border-radius: 10px; padding: 6px 2px; min-height: 58px; }
.calendario-noches b { display: block; margin-bottom: 3px; }

/* Productos */
.producto { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--papel); border: 1px solid var(--linea); border-radius: 16px; margin-bottom: 10px; text-decoration: none; color: inherit; cursor: pointer; }
.producto .foto { width: 52px; height: 52px; border-radius: 14px; background: var(--durazno-claro); display: grid; place-items: center; font-size: 1.6rem; flex: none; }
.producto .datos { flex: 1; min-width: 0; }
.producto .datos strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.producto .datos small { display: block; }
.producto.sel { border-color: var(--terracota); box-shadow: 0 0 0 2px rgba(123, 63, 228, .25); }
.puntaje { min-width: 52px; text-align: center; font-weight: 700; border-radius: 12px; padding: 6px 4px; font-size: .95rem; }
.puntaje small { display: block; font-size: .62rem; font-weight: 600; color: inherit; opacity: .85; }
.p-alto { background: var(--salvia-clara); color: #2337A8; }
.p-medio { background: #FBEBCD; color: #7A4F0E; }
.p-bajo { background: #F7DDD6; color: var(--rojo); }
.medidor { --p: 0; width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c, var(--salvia)) calc(var(--p) * 1%), var(--linea) 0); margin: 0 auto 8px; }
.medidor > div { width: 96px; height: 96px; border-radius: 50%; background: var(--papel); display: grid; place-items: center; text-align: center; font-weight: 700; font-size: 1.7rem; font-family: var(--titulos); line-height: 1; }
.medidor small { display: block; font-size: .7rem; font-family: var(--texto); font-weight: 600; color: var(--cacao-suave); margin-top: 3px; }
.precio { font-weight: 700; }
.tabla-precios a { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--linea); color: inherit; text-decoration: none; }
.tabla-precios a:last-child { border-bottom: none; }
.tabla-precios .mejor { color: var(--salvia); font-weight: 700; }
.comparar { width: 100%; border-collapse: collapse; font-size: .92rem; }
.comparar th, .comparar td { padding: 10px 6px; border-bottom: 1px solid var(--linea); vertical-align: top; text-align: left; }
.comparar th { font-weight: 600; color: var(--cacao-suave); width: 28%; font-size: .85rem; }
.ganador { background: var(--salvia-clara); }

/* Escáner */
.visor { position: relative; border-radius: 20px; overflow: hidden; background: #000; aspect-ratio: 4/3; margin-bottom: 12px; }
.visor video { width: 100%; height: 100%; object-fit: cover; display: block; }
.visor .marco { position: absolute; inset: 28% 12%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.visor .linea { position: absolute; left: 14%; right: 14%; top: 50%; height: 2px; background: var(--terracota); animation: barrido 1.6s ease-in-out infinite alternate; }
@keyframes barrido { from { transform: translateY(-40px); } to { transform: translateY(40px); } }
.filtros { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 10px 0; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
.filtros .chip { white-space: nowrap; }
.barra-comparar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 82px; width: calc(100% - 32px); max-width: 488px; z-index: 25; background: var(--cacao); color: var(--crema); border-radius: 18px; padding: 10px 12px 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }

/* Evolución */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--papel); border: 1px solid var(--linea); border-radius: 16px; padding: 12px 8px; text-align: center; }
.stat b { display: block; font-family: var(--titulos); font-size: 1.45rem; }
.stat small { font-size: .74rem; }
.mes { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; text-align: center; font-size: .78rem; }
.mes .cab { color: var(--cacao-suave); font-weight: 600; padding-bottom: 2px; }
.mes button { aspect-ratio: 1; border: none; border-radius: 10px; font: inherit; font-size: .8rem; background: var(--crema); color: var(--cacao); cursor: pointer; }
.mes button.uno { background: var(--durazno); }
.mes button.dos { background: var(--salvia); color: #fff; }
.mes button.hoy { outline: 2px solid var(--terracota); }
.mes button:disabled { opacity: .35; cursor: default; }
.contador { display: flex; align-items: center; gap: 10px; }
.contador button { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--linea); background: var(--papel); font-size: 1.2rem; cursor: pointer; }
.contador output { min-width: 40px; text-align: center; font-weight: 700; font-size: 1.1rem; }
.escala { display: flex; gap: 6px; }
.escala button { flex: 1; border: 1.5px solid var(--linea); background: var(--papel); border-radius: 12px; padding: 8px 0; font-size: 1.15rem; cursor: pointer; }
.escala button.on { border-color: var(--terracota); background: var(--durazno-claro); }
.fotos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fotos figure { margin: 0; position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 3/4; background: var(--linea); cursor: pointer; }
.fotos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fotos figcaption { position: absolute; left: 0; right: 0; bottom: 0; font-size: .7rem; color: #fff; padding: 14px 6px 4px; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.fotos figure.sel { outline: 3px solid var(--terracota); }
.antes-despues { position: relative; aspect-ratio: 3/4; border-radius: 16px; overflow: hidden; background: #000; touch-action: none; }
.antes-despues img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.antes-despues .despues { clip-path: inset(0 0 0 var(--x, 50%)); }
.antes-despues .divisor { position: absolute; top: 0; bottom: 0; left: var(--x, 50%); width: 3px; background: #fff; transform: translateX(-1px); }
.antes-despues .rot { position: absolute; top: 8px; font-size: .75rem; color: #fff; background: rgba(0,0,0,.5); padding: 2px 8px; border-radius: 999px; }
.barras { display: flex; align-items: flex-end; gap: 3px; height: 64px; }
.barras div { flex: 1; background: var(--durazno); border-radius: 4px 4px 0 0; min-height: 2px; }
.barras div.hoy { background: var(--terracota); }

/* Asistente */
.chat { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.burbuja { max-width: 86%; padding: 11px 14px; border-radius: 18px; font-size: .96rem; line-height: 1.5; }
.burbuja p:last-child { margin: 0; }
.burbuja ul { margin: 4px 0 8px; padding-left: 20px; }
.burbuja.yo { align-self: flex-end; background: var(--terracota); color: #fff; border-bottom-right-radius: 6px; }
.burbuja.brota { align-self: flex-start; background: var(--papel); border: 1px solid var(--linea); border-bottom-left-radius: 6px; }
.burbuja .fuente { display: block; margin-top: 6px; font-size: .75rem; color: var(--cacao-suave); }
.escribiendo span { display: inline-block; width: 7px; height: 7px; background: var(--cacao-suave); border-radius: 50%; margin: 0 2px; animation: rebote 1s infinite; }
.escribiendo span:nth-child(2) { animation-delay: .15s; } .escribiendo span:nth-child(3) { animation-delay: .3s; }
@keyframes rebote { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-5px); opacity: 1; } }
.redactar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 74px; width: 100%; max-width: 520px; padding: 10px 14px; background: linear-gradient(transparent, var(--crema) 30%); display: flex; gap: 8px; z-index: 15; }
.redactar textarea { min-height: 48px; max-height: 140px; border-radius: 24px; padding: 12px 16px; }
.redactar .btn { border-radius: 50%; width: 48px; height: 48px; padding: 0; flex: none; }

/* Desafíos */
.pin { font-family: var(--titulos); font-size: 2.4rem; letter-spacing: .18em; font-weight: 700; }
.tabla-vivo { list-style: none; margin: 0; padding: 0; }
.tabla-vivo li { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--linea); transition: background .6s; }
.tabla-vivo li.nuevo { background: var(--salvia-clara); }
.tabla-vivo .pos { width: 26px; font-weight: 700; color: var(--cacao-suave); }
.tabla-vivo .nom { flex: 1; font-weight: 600; }
.tabla-vivo .ok { color: var(--salvia); font-weight: 700; }
.qr { width: 180px; height: 180px; border-radius: 12px; background: var(--crema); display: block; margin: 0 auto; }

/* Bienvenida */
.bienvenida { min-height: 100dvh; display: flex; flex-direction: column; padding: 24px 20px 32px; }
.bienvenida.portada { background: var(--degrade); color: #F7F1FF; }
.bienvenida.portada h1 { color: #fff; }
.bienvenida.portada .suave, .bienvenida.portada .legal { color: #D9CCFF; }
.bienvenida.portada .btn.texto { color: #E9DDFF; }
.bienvenida.portada .btn:not(.texto) { background: #fff; color: var(--noche); }
.bienvenida.portada .etiqueta { background: rgba(255, 255, 255, .14); color: #F3EDFF; }
.bienvenida .hero { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.bienvenida h1 { font-size: 2.3rem; }
.progreso-quiz { height: 6px; background: var(--linea); border-radius: 99px; overflow: hidden; margin: 6px 0 22px; }
.progreso-quiz div { height: 100%; background: var(--terracota); transition: width .3s; }
.codigo { font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-size: 1.35rem; letter-spacing: .08em; background: var(--papel); border: 2px dashed var(--terracota); border-radius: 14px; padding: 14px; text-align: center; font-weight: 700; user-select: all; }

/* Hoja inferior y avisos */
.fondo-hoja { position: fixed; inset: 0; background: rgba(28, 15, 77, .45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.hoja { background: var(--crema); width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto; border-radius: 24px 24px 0 0; padding: 10px 18px 28px; animation: subir .22s ease-out; }
.hoja .tirador { width: 44px; height: 5px; border-radius: 99px; background: var(--linea); margin: 0 auto 14px; }
@keyframes subir { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.tostada { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--cacao); color: var(--crema); padding: 11px 18px; border-radius: 999px; z-index: 60; font-size: .92rem; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: calc(100% - 32px); text-align: center; }
.legal { font-size: .78rem; color: var(--cacao-suave); text-align: center; margin: 18px 8px; }
.vacio { text-align: center; padding: 26px 12px; color: var(--cacao-suave); }
.vacio .grande { font-size: 2.6rem; display: block; margin-bottom: 6px; }
.cargando { text-align: center; padding: 40px; color: var(--cacao-suave); }

@media (min-width: 560px) {
  body { background: #ECE6FA; }
  #app { box-shadow: 0 0 0 1px var(--linea); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
