/* Belia — identidad: papel cálido, tinta violeta, chispa coral. */
:root {
  --fondo: #f6f3ee;
  --superficie: #ffffff;
  --superficie-2: #f0ece5;
  --tinta: #1d1a2b;
  --tinta-suave: #5f5b73;
  --tinta-tenue: #8d89a0;
  --linea: rgba(29, 26, 43, .09);
  --acento: #5b3df5;
  --acento-tinta: #ffffff;
  --acento-suave: rgba(91, 61, 245, .1);
  --coral: #ff6b4a;
  --coral-suave: rgba(255, 107, 74, .12);
  --verde: #12805c;
  --verde-suave: rgba(18, 128, 92, .12);
  --rojo: #c4372b;
  --sombra-1: 0 1px 2px rgba(29, 26, 43, .06), 0 2px 8px rgba(29, 26, 43, .05);
  --sombra-2: 0 2px 4px rgba(29, 26, 43, .05), 0 12px 32px -8px rgba(48, 30, 140, .18);
  --radio: 20px;
  --radio-s: 12px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-cajon: cubic-bezier(0.32, 0.72, 0, 1);
  --letra-titulo: "Bricolage Grotesque", system-ui, sans-serif;
  --letra: "Figtree", system-ui, sans-serif;
  --h-1: #7a5cff; --h-2: #ff6b4a; --h-3: #13a37a; --h-4: #e0a100; --h-5: #2f8bd6; --h-6: #d6458f;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --fondo: #100e19; --superficie: #1a1727; --superficie-2: #221f33;
    --tinta: #f2f0fa; --tinta-suave: #b3afc8; --tinta-tenue: #7f7b96; --linea: rgba(242, 240, 250, .09);
    --acento: #8f78ff; --acento-tinta: #120d2b; --acento-suave: rgba(143, 120, 255, .16);
    --coral: #ff8466; --coral-suave: rgba(255, 132, 102, .16); --verde: #3ccf9b; --verde-suave: rgba(60, 207, 155, .14); --rojo: #ff7a6b;
    --sombra-1: 0 1px 2px rgba(0, 0, 0, .4); --sombra-2: 0 2px 6px rgba(0, 0, 0, .35), 0 16px 40px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-tema="oscuro"] {
  --fondo: #100e19; --superficie: #1a1727; --superficie-2: #221f33;
  --tinta: #f2f0fa; --tinta-suave: #b3afc8; --tinta-tenue: #7f7b96; --linea: rgba(242, 240, 250, .09);
  --acento: #8f78ff; --acento-tinta: #120d2b; --acento-suave: rgba(143, 120, 255, .16);
  --coral: #ff8466; --coral-suave: rgba(255, 132, 102, .16); --verde: #3ccf9b; --verde-suave: rgba(60, 207, 155, .14); --rojo: #ff7a6b;
  --sombra-1: 0 1px 2px rgba(0, 0, 0, .4); --sombra-2: 0 2px 6px rgba(0, 0, 0, .35), 0 16px 40px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--fondo); color: var(--tinta); font: 400 16px/1.5 var(--letra);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
#fondo {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vmax 40vmax at 110% -10%, var(--acento-suave), transparent 70%),
    radial-gradient(50vmax 35vmax at -20% 110%, var(--coral-suave), transparent 70%);
}
#fondo::after { /* grano sutil */
  content: ""; position: absolute; inset: 0; opacity: .05; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
#app { max-width: 720px; margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 16px calc(110px + env(safe-area-inset-bottom)); }
h1, h2, h3 { font-family: var(--letra-titulo); letter-spacing: -.02em; margin: 0; }
h1 { font-size: 34px; line-height: 1.1; font-weight: 700; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
.suave { color: var(--tinta-suave); }
.tenue { color: var(--tinta-tenue); font-size: 14px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- piezas ---------- */
.cabecera { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 20px; }
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border: 0; border-radius: 999px; font: 600 16px var(--letra); cursor: pointer; text-decoration: none;
  background: var(--acento); color: var(--acento-tinta); box-shadow: var(--sombra-2);
  transition: transform 160ms var(--ease-out), opacity 160ms ease, background-color 200ms ease;
}
.boton:active { transform: scale(.97); }
.boton[disabled] { opacity: .5; pointer-events: none; }
.boton.secundario { background: var(--superficie); color: var(--tinta); box-shadow: var(--sombra-1); border: 1px solid var(--linea); }
.boton.fantasma { background: transparent; color: var(--tinta-suave); box-shadow: none; padding: 0 12px; }
.boton.peligro { background: transparent; color: var(--rojo); box-shadow: none; }
.boton.ancho { width: 100%; }
.icono-boton {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--linea); background: var(--superficie);
  color: var(--tinta); display: inline-grid; place-items: center; cursor: pointer; box-shadow: var(--sombra-1);
  transition: transform 160ms var(--ease-out);
}
.icono-boton:active { transform: scale(.94); }
.tarjeta { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra-1); padding: 18px; }
.campo { display: grid; gap: 6px; margin-bottom: 14px; }
.campo label { font-size: 14px; font-weight: 600; color: var(--tinta-suave); }
input, textarea, select {
  width: 100%; min-height: 48px; border-radius: var(--radio-s); border: 1px solid var(--linea); background: var(--superficie);
  color: var(--tinta); font: 16px var(--letra); padding: 12px 14px; outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
input:focus, textarea:focus, select:focus { border-color: var(--acento); box-shadow: 0 0 0 4px var(--acento-suave); }
textarea { min-height: 96px; resize: vertical; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; margin: 0 -2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--linea); background: var(--superficie);
  color: var(--tinta-suave); font: 500 15px var(--letra); display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"] { background: var(--tinta); color: var(--fondo); border-color: var(--tinta); }
.chip svg { width: 18px; height: 18px; }
.etiqueta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--acento-suave); color: var(--acento); }
.etiqueta.coral { background: var(--coral-suave); color: var(--coral); }
.etiqueta.verde { background: var(--verde-suave); color: var(--verde); }
.vacio { text-align: center; padding: 40px 16px; }
.vacio img { width: min(240px, 70%); margin: 0 auto 18px; display: block; }
.vacio h3 { margin-bottom: 6px; }

/* ---------- pestañas ---------- */
#pestanas {
  position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; gap: 4px; padding: 6px; border-radius: 999px; z-index: 20;
  background: color-mix(in srgb, var(--superficie) 82%, transparent); border: 1px solid var(--linea);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); box-shadow: var(--sombra-2);
}
.pestana {
  min-width: 64px; min-height: 52px; border: 0; border-radius: 999px; background: transparent; color: var(--tinta-tenue);
  display: grid; justify-items: center; gap: 1px; font: 600 11px var(--letra); padding: 6px 12px; cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease, transform 160ms var(--ease-out);
}
.pestana:active { transform: scale(.95); }
.pestana[aria-current="page"] { background: var(--acento-suave); color: var(--acento); }
.pestana[hidden], #pestanas[hidden] { display: none; }

/* ---------- grabar ---------- */
.escenario { display: grid; justify-items: center; gap: 18px; padding: 44px 0 18px; }
.escenario p { text-align: center; user-select: none; }
.orbe {
  --nivel: 0; position: relative; width: 184px; height: 184px; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  background: radial-gradient(circle at 32% 28%, #9a85ff, #5b3df5 55%, #3a21c7);
  box-shadow: 0 24px 60px -18px rgba(91, 61, 245, .65), inset 0 -10px 30px rgba(0, 0, 0, .25), inset 0 8px 20px rgba(255, 255, 255, .25);
  display: grid; place-items: center; transition: transform 180ms var(--ease-out);
}
.orbe:active { transform: scale(.97); }
.orbe::before, .orbe::after {
  content: ""; position: absolute; inset: -14px; border-radius: 50%; border: 2px solid rgba(124, 99, 255, .28);
  transform: scale(calc(1 + var(--nivel) * .22)); transition: transform 90ms linear; pointer-events: none;
}
.orbe::after { inset: -30px; border-color: rgba(255, 107, 74, .2); transform: scale(calc(1 + var(--nivel) * .38)); }
.orbe svg { width: 64px; height: 64px; stroke-width: 1.6; }
.orbe.grabando { background: radial-gradient(circle at 32% 28%, #ff9f86, #ff6b4a 55%, #d9432a); box-shadow: 0 24px 60px -18px rgba(255, 107, 74, .7), inset 0 -10px 30px rgba(0, 0, 0, .2), inset 0 8px 20px rgba(255, 255, 255, .25); }
.orbe.pausa { filter: saturate(.4); }
.reloj { font: 700 52px/1 var(--letra-titulo); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.onda { width: 100%; height: 64px; display: block; }
.controles { display: flex; gap: 14px; align-items: center; justify-content: center; }
.marca-hecha { animation: destello 420ms var(--ease-out); }
@keyframes destello { from { box-shadow: 0 0 0 0 var(--coral); } to { box-shadow: 0 0 0 16px transparent; } }
.panel-opciones { display: grid; gap: 14px; margin-top: 8px; }
.fila-opcion { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.interruptor { position: relative; width: 52px; height: 32px; flex: none; }
.interruptor input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; min-height: 0; }
.interruptor span { position: absolute; inset: 0; border-radius: 999px; background: var(--superficie-2); border: 1px solid var(--linea); transition: background-color 200ms ease; pointer-events: none; }
.interruptor span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: var(--sombra-1); transition: transform 220ms var(--ease-out); }
.interruptor input:checked + span { background: var(--verde); }
.interruptor input:checked + span::after { transform: translateX(20px); }
.aviso-consentimiento { background: var(--coral-suave); border-radius: var(--radio-s); padding: 12px 14px; font-size: 14px; }

/* ---------- biblioteca ---------- */
.buscador { position: relative; margin-bottom: 12px; }
.buscador svg { position: absolute; left: 14px; top: 13px; color: var(--tinta-tenue); }
.buscador input { padding-left: 44px; border-radius: 999px; }
.lista { display: grid; gap: 10px; margin-top: 14px; }
.item {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 14px; align-items: center; padding: 14px; text-align: left; width: 100%;
  background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra-1);
  color: inherit; font: inherit; cursor: pointer; text-decoration: none; animation: entrar 320ms var(--ease-out) both;
  transition: transform 160ms var(--ease-out);
}
.item:active { transform: scale(.985); }
.item .tipo { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--acento-suave); color: var(--acento); }
.item .tipo.consulta { background: var(--verde-suave); color: var(--verde); }
.item .tipo.clase { background: var(--coral-suave); color: var(--coral); }
.item h3 { font-size: 16px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .meta { font-size: 13px; color: var(--tinta-tenue); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.item .coincidencia { font-size: 13px; color: var(--tinta-suave); margin-top: 6px; }
.grupo-fecha { font: 600 13px var(--letra); color: var(--tinta-tenue); text-transform: uppercase; letter-spacing: .06em; margin: 14px 4px 0; }
@keyframes entrar { from { opacity: 0; transform: translateY(8px); } }
.girando { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--acento-suave); border-top-color: var(--acento); animation: girar 700ms linear infinite; display: inline-block; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- detalle ---------- */
.volver { margin-bottom: 6px; }
.titulo-editable { outline: none; border-radius: 8px; }
.titulo-editable:focus { box-shadow: 0 0 0 4px var(--acento-suave); }
.reproductor { position: sticky; top: 8px; z-index: 5; display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; margin: 16px 0; padding: 10px 14px; border-radius: 999px; background: color-mix(in srgb, var(--superficie) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--linea); box-shadow: var(--sombra-2); }
.reproductor .play { background: var(--acento); color: var(--acento-tinta); border: 0; }
.barra { position: relative; height: 32px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.barra .pista { position: absolute; left: 0; right: 0; height: 6px; border-radius: 3px; background: var(--superficie-2); overflow: hidden; }
.barra .avance { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--acento); border-radius: 3px; }
.barra .marca { position: absolute; top: 6px; width: 4px; height: 20px; border-radius: 2px; background: var(--coral); transform: translateX(-50%); }
.tiempo { font-size: 13px; color: var(--tinta-suave); font-variant-numeric: tabular-nums; min-width: 84px; text-align: right; }
.velocidad { font: 700 13px var(--letra); border: 0; background: none; color: var(--tinta-suave); min-height: 44px; cursor: pointer; }
.segmentos { display: grid; gap: 4px; }
.segmento { display: grid; grid-template-columns: 4px 1fr; gap: 12px; padding: 10px 10px 10px 0; border-radius: var(--radio-s); transition: background-color 200ms ease; }
.segmento .raya { border-radius: 2px; background: var(--color-h, var(--acento)); opacity: .7; }
.segmento .quien { font-size: 13px; font-weight: 600; color: var(--color-h, var(--acento)); display: flex; gap: 8px; align-items: baseline; }
.segmento .quien button { border: 0; background: none; color: inherit; font: inherit; padding: 0; cursor: pointer; }
.segmento .quien time { color: var(--tinta-tenue); font-weight: 500; cursor: pointer; }
.segmento p { font-size: 16.5px; line-height: 1.6; }
.segmento .w { border-radius: 4px; transition: background-color 120ms ease, color 120ms ease; cursor: pointer; }
.segmento .w.ahora { background: var(--acento); color: var(--acento-tinta); }
.segmento.activo { background: var(--acento-suave); }
.herramientas { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.herramienta {
  text-align: left; padding: 14px; border-radius: var(--radio); border: 1px solid var(--linea); background: var(--superficie); color: inherit;
  font: inherit; cursor: pointer; display: grid; gap: 8px; box-shadow: var(--sombra-1); transition: transform 160ms var(--ease-out), border-color 180ms ease;
}
.herramienta:active { transform: scale(.97); }
.herramienta .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--acento-suave); color: var(--acento); }
.herramienta.clinica .ico { background: var(--verde-suave); color: var(--verde); }
.herramienta b { font-size: 15px; }
.herramienta small { color: var(--tinta-tenue); font-size: 13px; line-height: 1.35; }
.herramienta[aria-busy="true"] { border-color: var(--acento); }
.resultado { margin-top: 14px; animation: entrar 300ms var(--ease-out) both; }
.resultado .cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.resultado .acciones { display: flex; gap: 2px; }
.resultado .acciones button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: var(--tinta-suave); cursor: pointer; display: grid; place-items: center; }
.md h2, .md h3 { font-size: 17px; margin: 14px 0 6px; }
.md p { margin: 0 0 10px; }
.md ul { margin: 0 0 10px; padding-left: 20px; }
.md li { margin: 3px 0; }
.md li.check { list-style: none; margin-left: -20px; display: flex; gap: 10px; align-items: flex-start; }
.md li.check input { width: 20px; height: 20px; min-height: 0; margin: 3px 0 0; accent-color: var(--verde); flex: none; }
.chat { display: grid; gap: 10px; }
.burbuja { max-width: 88%; padding: 12px 14px; border-radius: 18px; animation: entrar 260ms var(--ease-out) both; }
.burbuja.yo { justify-self: end; background: var(--acento); color: var(--acento-tinta); border-bottom-right-radius: 6px; }
.burbuja.belia { background: var(--superficie); border: 1px solid var(--linea); border-bottom-left-radius: 6px; }
.preguntar { display: flex; gap: 8px; margin-top: 12px; position: sticky; bottom: 92px; }
.preguntar input { border-radius: 999px; box-shadow: var(--sombra-2); }
.sugerencias { display: flex; flex-wrap: wrap; gap: 8px; }
.ficha-envio { display: grid; gap: 12px; border: 1px dashed color-mix(in srgb, var(--verde) 50%, transparent); background: var(--verde-suave); }
.estado-proceso { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 34px 16px; }
.ondas-proceso { display: flex; gap: 5px; height: 40px; align-items: center; }
.ondas-proceso i { width: 6px; border-radius: 3px; background: var(--acento); animation: latir 1s var(--ease-in-out) infinite; }
.ondas-proceso i:nth-child(2) { animation-delay: .12s; } .ondas-proceso i:nth-child(3) { animation-delay: .24s; }
.ondas-proceso i:nth-child(4) { animation-delay: .36s; } .ondas-proceso i:nth-child(5) { animation-delay: .48s; }
@keyframes latir { 0%, 100% { height: 10px; opacity: .5; } 50% { height: 38px; opacity: 1; } }

/* ---------- hojas, avisos, entrada ---------- */
.velo { position: fixed; inset: 0; background: rgba(10, 8, 20, .4); z-index: 40; opacity: 1; transition: opacity 220ms ease; }
.velo.saliendo { opacity: 0; }
@starting-style { .velo { opacity: 0; } }
.hoja {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 88vh; overflow: auto; margin: 0 auto; max-width: 720px;
  background: var(--superficie); border-radius: 26px 26px 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
  box-shadow: var(--sombra-2); transform: translateY(0); transition: transform 380ms var(--ease-cajon);
}
@starting-style { .hoja { transform: translateY(100%); } }
.hoja.saliendo { transform: translateY(100%); transition-duration: 220ms; }
.hoja .asa { width: 42px; height: 5px; border-radius: 3px; background: var(--linea); margin: 0 auto 14px; }
#avisos { position: fixed; left: 50%; top: max(14px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.aviso { background: var(--tinta); color: var(--fondo); padding: 12px 16px; border-radius: 14px; box-shadow: var(--sombra-2); font-size: 15px; transition: opacity 200ms ease, transform 300ms var(--ease-out); }
@starting-style { .aviso { opacity: 0; transform: translateY(-12px); } }
.aviso.error { background: var(--rojo); color: #fff; }
.entrada { min-height: 86vh; display: grid; align-content: center; gap: 22px; }
.marca-belia { display: flex; align-items: center; gap: 12px; }
.marca-belia img { width: 52px; height: 52px; }
.marca-belia b { font: 700 30px var(--letra-titulo); letter-spacing: -.03em; }
.hero-entrada { width: 100%; max-width: 420px; aspect-ratio: 4 / 3; max-height: 26vh; object-fit: cover; border-radius: 28px; box-shadow: var(--sombra-2); }
.entrada { gap: 16px; }
.entrada h1 { font-size: 28px; }
.pantalla { animation: aparecer 260ms var(--ease-out) both; }
@keyframes aparecer { from { opacity: 0; transform: translateY(6px); } }
.rejilla-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cifra { font: 700 28px var(--letra-titulo); }
.oculto { display: none !important; }

@media (hover: hover) and (pointer: fine) {
  .item:hover, .herramienta:hover { border-color: color-mix(in srgb, var(--acento) 35%, var(--linea)); }
  .chip:hover { border-color: var(--tinta-tenue); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-property: opacity, background-color, color !important; }
}
