/* ============================================================
   Berbaz — tema claro. Paleta de marca: morado primario, turquesa
   secundario, acentos cálidos (amarillo/coral). Códigos facilitados por Jon.
   ============================================================ */

:root {
  --indigo: #3510A8;          /* morado principal (header, botones, pasos) */
  --indigo-dark: #4A20D4;     /* hover de botones */
  --indigo-deep: #24107F;     /* morado oscuro: fondo/degradado del hero */
  --indigo-soft: #F2F3FA;     /* fondos sutiles (cajas info) */
  --violet: #4C1DCC;          /* morado de acento: emisor, etiquetas, enlaces */
  --teal: #00A99D;            /* turquesa secundario (oyente / success) */
  --teal-soft: #d6f3f0;
  --yellow: #FFC72C;
  --coral: #FF4F6D;
  --ink: #1F2937;             /* texto principal */
  --body: #4B5563;            /* texto secundario */
  --muted: #6B7280;
  --bg: #F8F9FC;
  --card: #ffffff;
  --line: #E5E7EB;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(36, 16, 127, 0.05), 0 8px 24px -12px rgba(36, 16, 127, 0.18);
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
[hidden] { display: none !important; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--body);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

h1, h2, h3 { color: var(--ink); letter-spacing: -0.02em; line-height: 1.15; }
a { color: var(--violet); }

/* ---------- marca ---------- */

.brand { display: inline-flex; align-items: center; gap: 0.55rem; text-decoration: none; }
/* Símbolo del logo (infinito+onda) junto al wordmark en las barras superiores. */
.brand-mark { height: 26px; width: auto; display: block; }
.brand-word { font-weight: 800; font-size: 1.35rem; letter-spacing: -0.02em; color: var(--indigo); line-height: 1; }
/* Logo completo sobre el hero morado: tarjeta clara para que se lea bien. */
.brand-badge { background: #fff; padding: 0.4rem 0.7rem; border-radius: 12px; display: inline-flex; align-self: flex-start; box-shadow: 0 6px 16px -8px rgba(0,0,0,0.3); }
.brand-hero { height: 60px; width: auto; display: block; }

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

.btn {
  appearance: none; border: none; cursor: pointer; font-family: inherit;
  font-weight: 700; font-size: 1rem; border-radius: 999px;
  padding: 0.85rem 1.6rem; display: inline-flex; align-items: center; gap: 0.5rem;
  transition: transform 0.12s cubic-bezier(0.22,1,0.36,1), background 0.18s, box-shadow 0.18s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--indigo); color: #fff; box-shadow: 0 10px 20px -10px rgba(53,16,168,0.7); }
.btn-primary:hover { background: var(--indigo-dark); }
.btn-light { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.btn-light:hover { box-shadow: 0 12px 28px -12px rgba(36,16,127,0.35); }
.btn-ghost { background: transparent; color: var(--body); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--muted); color: var(--ink); }
.btn-danger { background: #fff; color: var(--coral); border: 1px solid #f6d2d8; }
.btn-danger:hover { background: #fff5f6; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; justify-content: center; }

/* ---------- topbar (paneles internos) ---------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem clamp(1.25rem, 5vw, 3rem);
  background: var(--card); border-bottom: 1px solid var(--line);
}
.topbar .right { display: flex; align-items: center; gap: 1rem; }
.link-quiet { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.link-quiet:hover { color: var(--ink); }

/* ---------- cards ---------- */

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.wrap { max-width: 720px; margin: 0 auto; padding: clamp(1.5rem, 5vw, 3rem) clamp(1.25rem, 5vw, 2rem); }

/* ---------- indicador de pasos ---------- */

.steps { display: flex; gap: clamp(1rem, 5vw, 3rem); justify-content: center; padding: 1.25rem; flex-wrap: wrap; }
.steps .step { display: flex; align-items: center; gap: 0.55rem; color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.steps .num { width: 26px; height: 26px; border-radius: 50%; background: var(--indigo-soft); color: var(--indigo); display: grid; place-items: center; font-size: 0.85rem; font-weight: 800; }
.steps .step.active { color: var(--ink); }
.steps .step.active .num { background: var(--indigo); color: #fff; }
.steps .step.done .num { background: var(--teal); color: #fff; }

/* ---------- steppers ---------- */

.field { display: flex; gap: 0.9rem; align-items: flex-start; }
.field .icon { width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; }
/* Iconos: círculos sólidos con glifo blanco (emisor morado, oyente turquesa). */
.icon.emit { background: var(--violet); }
.icon.recv { background: var(--teal); }
.icon.engine { background: var(--indigo); }
.field .icon svg, .link-row .avatar svg { width: 22px; height: 22px; fill: #fff; }
.field h3 { font-size: 1.05rem; }
.field p { color: var(--muted); font-size: 0.9rem; }

.stepper { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin-top: 0.9rem; }
.stepper button { appearance: none; border: none; background: #fff; font-size: 1.5rem; height: 56px; cursor: pointer; color: var(--indigo); transition: background 0.15s; }
.stepper button:hover { background: var(--indigo-soft); }
.stepper .val { text-align: center; font-size: 1.5rem; font-weight: 800; color: var(--ink); }

/* ---------- selector de idiomas (chips) ---------- */

.lang-grid { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.9rem; }
.lang-chip {
  appearance: none; cursor: pointer; font-family: inherit; font-weight: 600; font-size: 0.95rem;
  border: 1.5px solid var(--line); background: #fff; color: var(--body);
  border-radius: 999px; padding: 0.5rem 1rem; display: inline-flex; align-items: center; gap: 0.45rem;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.lang-chip:hover { border-color: var(--indigo); }
.lang-chip[aria-pressed="true"] { background: var(--indigo); border-color: var(--indigo); color: #fff; }
/* Motor alternativo ("plan B si falla el principal"): opción secundaria, más discreta */
.lang-chip.engine-alt:not([aria-pressed="true"]) { border-style: dashed; color: var(--muted, #6b6880); font-size: .88em; }

/* Chip "Otros": abre el panel con el resto de idiomas del modelo. */
.lang-chip.more { border-style: dashed; font-weight: 700; }
.lang-chip.more[aria-expanded="true"] { border-style: solid; border-color: var(--indigo); color: var(--indigo); }
.lang-chip.more .caret { font-size: 0.7em; }

/* Panel de "Otros": buscador fijo arriba y lista con scroll acotado. */
.lang-extra { margin-top: 0.7rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff; padding: 0.6rem; }
.lang-search {
  width: 100%; font-family: inherit; font-size: 0.9rem; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 999px; padding: 0.45rem 0.9rem; background: #fff;
}
.lang-search:focus { outline: none; border-color: var(--indigo); }
.lang-extra-list {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  max-height: 13.5rem; overflow-y: auto; overscroll-behavior: contain;
  margin-top: 0.6rem; padding: 0.15rem;
}
.lang-extra-list .lang-chip { font-size: 0.88rem; padding: 0.35rem 0.8rem; }
.lang-extra-empty { margin: 0.6rem 0.2rem 0.2rem; font-size: 0.85rem; }

/* ---------- aviso ---------- */

.note { display: flex; gap: 0.6rem; background: var(--indigo-soft); color: #444444; border-radius: var(--radius-sm); padding: 0.85rem 1rem; font-size: 0.9rem; }
.note.warn { background: #fff5f6; color: #b3293c; }

/* ---------- pills de sección ---------- */

.section-pill { display: inline-block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.3rem 0.7rem; border-radius: 7px; }
.pill-emit { background: var(--violet); color: #fff; }
.pill-recv { background: var(--teal); color: #fff; }

/* ---------- filas de enlace + QR ---------- */

.link-row { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.link-row + .link-row { margin-top: 0.75rem; }
.link-row .avatar { width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 1.2rem; }
.link-row .meta { flex: 1; min-width: 0; }
.link-row .meta .title { font-weight: 700; color: var(--ink); }
.link-row .meta .url { display: flex; align-items: center; gap: 0.4rem; color: var(--violet); font-size: 0.85rem; word-break: break-all; }
.link-row .meta .url a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.link-row .meta .url a:hover { color: var(--indigo); }
.link-row .meta .url button { appearance: none; border: 1px solid var(--line, #ddd); border-radius: 999px; background: #fff; cursor: pointer; color: var(--muted); padding: 2px 8px; font-size: 0.8rem; white-space: nowrap; display: inline-flex; align-items: center; gap: 0.25rem; }
.link-row .meta .url button:hover { color: var(--violet); border-color: var(--violet); }
.link-row .qr { width: 74px; height: 74px; border-radius: 10px; flex: none; }
.link-row .live { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }
/* Móvil: "copiar" baja a la columna del QR y el enlace se queda todo el ancho.
   .meta y .url se "disuelven" (contents) para colocar sus hijos en la rejilla. */
@media (max-width: 560px) {
  .link-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; grid-template-areas: "avatar title qr" "avatar url qr" "avatar live copy"; column-gap: 0.75rem; align-items: start; padding: 0.9rem; }
  .link-row .avatar { grid-area: avatar; }
  .link-row .meta, .link-row .meta .url { display: contents; }
  .link-row .meta .title { grid-area: title; }
  .link-row .meta .url a { grid-area: url; font-size: 0.85rem; color: var(--violet); }
  .link-row .meta .url button { grid-area: copy; justify-self: center; margin-top: 0.4rem; }
  .link-row .live { grid-area: live; }
  .link-row .qr { grid-area: qr; }
}

/* ---------- estado / puntos ---------- */

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.active { background: var(--teal); }
.dot.connecting, .dot.reconnecting { background: var(--yellow); animation: pulse 1.2s infinite; }
.dot.error { background: var(--coral); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- landing (página completa, mismo mundo índigo que la card) ---------- */

.landing {
  min-height: 100dvh; display: flex; flex-direction: column;
  background: linear-gradient(160deg, #3510A8 0%, #2C148F 55%, #24107F 100%);
  color: #fff; position: relative; overflow: hidden;
  padding: clamp(1rem, 2.5vh, 2rem) clamp(1.25rem, 6vw, 5rem);
}

/* Formas de marca a escala de página (dibujadas en CSS, sin imágenes).
   Contenedor fijo con recorte propio: el overflow del body se transfiere al
   viewport y NO recorta, así que las formas con offsets negativos añadían
   ~50px de scroll fantasma bajo el pie. */
.land-shapes { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.land-shapes span { position: absolute; }
.land-shapes .teal {
  width: clamp(140px, 17vw, 260px); height: clamp(140px, 17vw, 260px);
  background: #1CC9B7; border-radius: 50%;
  top: clamp(-70px, -6vw, -40px); right: clamp(-70px, -6vw, -40px); opacity: 0.95;
  animation: drift 16s ease-in-out infinite alternate;
}
.land-shapes .yellow {
  width: clamp(70px, 9vw, 140px); height: clamp(70px, 9vw, 140px);
  background: var(--yellow); border-radius: 50%;
  bottom: 24vh; left: clamp(-40px, -3vw, -18px);
  animation: drift 13s ease-in-out infinite alternate-reverse;
}
.land-shapes .coral {
  width: 0; height: 0;
  border-left: clamp(50px, 6vw, 95px) solid transparent;
  border-right: clamp(50px, 6vw, 95px) solid transparent;
  border-bottom: clamp(88px, 10.5vw, 165px) solid var(--coral);
  bottom: clamp(-30px, -2vw, -14px); right: 26vw; transform: rotate(18deg);
  animation: drift 19s ease-in-out infinite alternate;
}
.land-shapes .dots {
  width: clamp(140px, 16vw, 260px); height: clamp(100px, 11vw, 180px);
  right: 6vw; bottom: 22vh;
  background-image: radial-gradient(rgba(139,92,246,0.85) 2.5px, transparent 2.5px);
  background-size: 22px 22px;
}
.land-shapes .ring {
  width: clamp(220px, 28vw, 440px); height: clamp(220px, 28vw, 440px);
  border: 1.5px solid rgba(255,255,255,0.09); border-radius: 50%;
  top: -8vh; right: -6vw;
}
@keyframes drift {
  from { transform: translate(0, 0) rotate(var(--rot, 0deg)); }
  to { transform: translate(0, 18px) rotate(var(--rot, 0deg)); }
}
.land-shapes .coral { --rot: 18deg; }

/* Composición centrada: cabecera, contenido y pie comparten el mismo carril */
.land-head, .land-foot { width: 100%; max-width: 1080px; margin-inline: auto; }

.land-head { display: flex; align-items: center; gap: 1rem; position: relative; z-index: 5; }
.land-head .brand-hero { height: clamp(48px, 7vh, 72px); }

/* Contenido ligeramente por encima del centro geométrico (menos hueco arriba) */
.land-main { flex: 1; display: flex; align-items: center; position: relative; z-index: 1; padding: clamp(1rem, 2.5vh, 1.75rem) 0 clamp(2rem, 6vh, 4rem); }
.land-grid {
  display: grid; grid-template-columns: 1fr;
  row-gap: clamp(1.5rem, 3.5vh, 2.25rem);
  width: 100%; max-width: 1080px; margin-inline: auto;
}
.land-eyebrow {
  text-transform: uppercase; letter-spacing: 0.16em; font-weight: 700;
  font-size: clamp(0.72rem, 1.5vw, 0.85rem); color: #B9B3F0; margin-bottom: 1rem;
}
.landing h1 {
  color: #fff; font-weight: 800; letter-spacing: -0.025em; line-height: 1.05;
  font-size: clamp(2.4rem, 7.5vw, 4.4rem);
}
.landing .sub {
  color: #D9D7F5; margin-top: clamp(1rem, 2.5vh, 1.5rem);
  font-size: clamp(1.02rem, 2vw, 1.3rem); max-width: 46ch; line-height: 1.55;
}
.land-feats { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; color: #CDC8F5; font-size: clamp(0.88rem, 1.8vw, 1rem); }
.land-feats li { display: inline-flex; align-items: center; gap: 1.1rem; }
.land-feats li + li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--yellow); display: inline-block; }

.land-foot {
  position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.15); font-size: 0.85rem;
}
.land-foot a, .land-foot span { color: rgba(255,255,255,0.7); text-decoration: none; }
.mail-link { display: inline-flex; align-items: center; gap: 0.4rem; }
.mail-link:hover { color: #fff; }

/* Entrada escalonada al cargar */
.land-in { opacity: 0; transform: translateY(16px); animation: landIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.d1 { animation-delay: 0.05s; }
.d2 { animation-delay: 0.15s; }
.d3 { animation-delay: 0.26s; }
.d4 { animation-delay: 0.37s; }
.d5 { animation-delay: 0.5s; }
@keyframes landIn { to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .land-in { animation: none; opacity: 1; transform: none; }
  .land-shapes span { animation: none; }
}

/* Escritorio: el logo respira por arriba, sin exagerar */
@media (min-width: 901px) {
  .land-head { padding-top: clamp(0.75rem, 2.5vh, 1.75rem); }
}

/* Campo de contraseña y botón Sartu en la misma fila (columna única en móvil) */
.login-form {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem; align-items: center; max-width: 560px;
}
.login-error { grid-column: 1 / -1; }

/* Móvil: sin formas decorativas (fondo limpio); botón Sartu a fila completa */
@media (max-width: 640px) {
  .land-shapes { display: none; }
  .land-foot { flex-wrap: wrap; justify-content: center; text-align: center; }
  .login-form { grid-template-columns: 1fr; }
  .login-form .btn { width: 100%; justify-content: center; }
}
.login-form input {
  font-family: inherit; font-size: 1rem; padding: 0.85rem 1rem; border-radius: 12px;
  border: none; background: rgba(255,255,255,0.95); color: var(--ink);
}
.login-form input::placeholder { color: var(--muted); }
.pass-wrap { position: relative; }
.pass-wrap input { width: 100%; padding-right: 2.9rem; }
.pass-toggle {
  position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%);
  appearance: none; background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 0.45rem; display: flex; border-radius: 8px;
}
.pass-toggle:hover { color: var(--ink); }
.login-error { color: #ffd0d6; font-size: 0.88rem; min-height: 1em; }

/* ---------- panel: bloques y grupos ---------- */

.block { padding: clamp(1.25rem, 4vw, 1.75rem); }
.block + .block { margin-top: 1.25rem; }
.block-title { font-size: 1.4rem; font-weight: 800; }
.block-sub { color: var(--muted); margin-top: 0.3rem; }
.group { margin-top: 1.5rem; }
.group + .group { margin-top: 1.75rem; }
.group-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.8rem; }
.row-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; flex-wrap: wrap; }
.divider { height: 1px; background: var(--line); margin: 1.5rem 0; }

/* sesiones recientes (mini cards) */
.session-mini { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.session-mini:hover { border-color: var(--indigo); background: var(--indigo-soft); }
.session-mini + .session-mini { margin-top: 0.6rem; }
.session-mini .langs { font-size: 0.82rem; color: var(--muted); }
.mini-actions { display: flex; align-items: center; gap: 0.35rem; }
.icon-btn {
  appearance: none; background: none; border: none; cursor: pointer;
  font-size: 1rem; padding: 0.35rem; border-radius: 8px; line-height: 1;
}
.icon-btn:hover { background: rgba(53, 16, 168, 0.08); }

.copied-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 0.6rem 1.1rem; border-radius: 999px; font-size: 0.9rem; box-shadow: var(--shadow); opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.copied-toast.show { opacity: 1; }

/* ---------- escenario emisor / oyente ---------- */

.stage { max-width: 560px; margin: 0 auto; padding: clamp(1.5rem, 5vw, 3rem) clamp(1.25rem, 5vw, 2rem); display: flex; flex-direction: column; align-items: center; gap: 1.5rem; min-height: calc(100dvh - 68px); }
.stage .eyebrow { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.stage h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); text-align: center; }

.status-pill { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--muted); font-weight: 600; }

/* micrófono */
.mic-wrap { position: relative; margin: 1rem 0; }
.mic-btn {
  appearance: none; width: clamp(130px, 34vw, 180px); height: clamp(130px, 34vw, 180px);
  border-radius: 50%; border: none; cursor: pointer; position: relative; z-index: 1;
  font-family: inherit; font-weight: 800; font-size: 1.1rem;
  background: var(--indigo); color: #fff; box-shadow: 0 16px 32px -12px rgba(53,16,168,0.7);
  transition: background 0.2s, transform 0.12s;
}
.mic-btn:active { transform: scale(0.97); }
.mic-btn.live { background: var(--coral); box-shadow: 0 16px 32px -12px rgba(255,79,109,0.7); }
.vu-ring { position: absolute; inset: -16px; border-radius: 50%; border: 4px solid var(--coral); opacity: 0; transform: scale(0.9); pointer-events: none; transition: transform 0.08s linear, opacity 0.2s; }

.chips { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: 0.45rem; border: 1px solid var(--line); border-radius: 999px; padding: 0.4rem 0.9rem; font-size: 0.85rem; color: var(--body); background: #fff; }

.transcript { width: 100%; }
.transcript .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.5rem; }
.transcript p { font-size: 1.05rem; color: var(--ink); min-height: 1.5em; max-height: 40vh; overflow-y: auto; white-space: pre-wrap; overscroll-behavior: contain; }

/* oyente: subtítulos */
.listen-start { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin: auto 0; }
.play-btn { width: clamp(120px, 32vw, 160px); height: clamp(120px, 32vw, 160px); border-radius: 50%; border: none; cursor: pointer; background: var(--teal); color: #fff; font-size: 2.5rem; box-shadow: 0 16px 32px -12px rgba(0,169,157,0.55); transition: transform 0.12s; }
.play-btn:active { transform: scale(0.97); }
/* Las líneas se pegan al fondo con un hueco flexible (::before) y NO con
   justify-content: flex-end: con flex-end y overflow, el texto sobrante queda
   por encima del origen del scroll y el oyente no puede subir a releerlo. */
.captions { width: 100%; flex: 1; display: flex; flex-direction: column; gap: 0.8rem; min-height: 45vh; max-height: 60vh; overflow-y: auto; overscroll-behavior: contain; }
.captions::before { content: ""; margin-top: auto; }
.caption-line { font-size: clamp(1.25rem, 4vw, 1.75rem); line-height: 1.35; color: var(--ink); animation: rise 0.4s cubic-bezier(0.22,1,0.36,1); }
.caption-line.past { color: var(--muted); font-size: clamp(1rem, 3vw, 1.3rem); }
.caption-line.current::after { content: ""; display: inline-block; width: 0.5em; height: 1.05em; margin-left: 0.15em; vertical-align: text-bottom; background: var(--teal); animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.bar { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 1rem; }
input[type="range"] { accent-color: var(--teal); width: 130px; }

.error-box { background: #fff5f6; color: #b3293c; border: 1px solid #f6d2d8; border-radius: var(--radius-sm); padding: 1rem 1.2rem; text-align: center; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- cuentas, planes y backoffice ---------- */

.login-form #email { grid-column: 1 / -1; }
.login-links { grid-column: 1 / -1; display: flex; gap: 0.6rem; font-size: 0.88rem; color: rgba(255,255,255,0.75); }
.login-links a { color: #fff; font-weight: 600; text-decoration: none; }
.login-links a:hover { text-decoration: underline; }

/* Formularios en tarjetas (registro, reset, backoffice) */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem 1rem; margin-top: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.f label { display: block; font-size: 0.82rem; font-weight: 700; color: var(--ink); margin-bottom: 0.3rem; }
.f input, .f select, .f textarea {
  font-family: inherit; font-size: 1rem; width: 100%; padding: 0.7rem 0.9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: #fff; color: var(--ink); transition: border-color 0.15s;
}
.f input:focus, .f select:focus, .f textarea:focus { outline: none; border-color: var(--indigo); }
.f .hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }
.form-error { color: #b3293c; font-size: 0.9rem; min-height: 1.2em; margin-top: 0.8rem; }

/* Tarjetas de plan */
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.8rem; margin-top: 1rem; }
.plan-card {
  appearance: none; text-align: left; font-family: inherit; cursor: pointer; background: #fff;
  border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 1rem; transition: border-color 0.15s, transform 0.15s;
}
.plan-card:hover { border-color: var(--indigo); transform: translateY(-1px); }
.plan-card[aria-pressed="true"] { border-color: var(--indigo); background: var(--indigo-soft); }
.plan-card .p-name { font-weight: 800; color: var(--ink); font-size: 1.05rem; }
.plan-card .p-hours { font-size: 1.8rem; font-weight: 800; color: var(--indigo); line-height: 1.1; margin: 0.3rem 0; }
.plan-card .p-price { font-size: 0.9rem; color: var(--body); }
.plan-card .p-sub { font-size: 0.78rem; color: var(--muted); }

/* Alta, paso 1: demo, 40 h y 70 h al mismo nivel; plan personalizado en segundo plano */
.reg-plans { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.reg-plans .plan-card { padding: 1.25rem; display: flex; flex-direction: column; }
.reg-plans .p-price { margin-bottom: 1rem; }
.reg-plans .p-hours { white-space: nowrap; }
.reg-plans .p-choose { margin-top: auto;  align-self: flex-start; background: var(--indigo); color: #fff; font-weight: 700; font-size: 0.9rem; padding: 0.45rem 0.9rem; border-radius: 999px; }
.custom-plan { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.custom-plan summary { cursor: pointer; color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.custom-plan summary:hover { color: var(--ink); }
.custom-plan[open] summary { margin-bottom: 0.6rem; color: var(--ink); }
.chosen-plan { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.8rem; background: var(--indigo-soft); color: var(--indigo); font-weight: 700; font-size: 0.92rem; border-radius: var(--radius-sm); padding: 0.6rem 0.9rem; margin-bottom: 0.8rem; }

/* Saldo de horas */
.balance { display: inline-flex; align-items: center; gap: 0.5rem; background: var(--indigo-soft); color: var(--indigo); font-weight: 700; padding: 0.4rem 0.8rem; border-radius: 999px; font-size: 0.9rem; white-space: nowrap; }
.balance.low { background: #fff7db; color: #8a6100; }
.balance.empty { background: #fff5f6; color: #b3293c; }
.credits-pill { font-size: 0.85rem; font-weight: 600; color: var(--indigo); background: var(--indigo-soft); padding: 0.35rem 0.8rem; border-radius: 999px; }
.credits-pill.low { background: #fff7db; color: #8a6100; }
.credits-pill.empty { background: #fff5f6; color: #b3293c; }

/* Detalle de pago (confirmación de pedido) */
.pay-box { background: var(--indigo-soft); border-radius: var(--radius-sm); padding: 1rem 1.2rem; margin-top: 1rem; }
.pay-box dl { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; font-size: 0.95rem; }
.pay-box dt { color: var(--muted); font-weight: 600; }
.pay-box dd { color: var(--ink); font-weight: 700; word-break: break-all; }

/* Tablas del backoffice */
.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 0.8rem; }
.tbl th, .tbl td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover { background: var(--indigo-soft); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; }
/* Backoffice: tablas anchas (8 columnas de cuentas). Casi todo el ancho de la
   pantalla y poco margen lateral, para que quepan sin scroll horizontal. */
.wrap.wrap-wide { max-width: 1500px; padding-left: clamp(0.75rem, 2vw, 1.5rem); padding-right: clamp(0.75rem, 2vw, 1.5rem); }
.tbl th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.tbl th.sortable:hover { color: var(--ink); }
.tbl th.sortable::after { content: "↕"; margin-left: 0.3rem; opacity: 0.35; }
.tbl th.sortable.asc::after { content: "▲"; opacity: 1; color: var(--indigo); }
.tbl th.sortable.desc::after { content: "▼"; opacity: 1; color: var(--indigo); }
.tag { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--indigo-soft); color: var(--indigo); }
.tag.pending { background: #fff7db; color: #8a6100; }
.tag.paid { background: var(--teal-soft); color: #0b6b63; }
.tag.cancelled, .tag.disabled { background: #f3f4f6; color: var(--muted); }
.wrap-wide { max-width: 1080px; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.inline-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* Formularios: sin hueco muerto antes del botón; error solo si hay texto */
.form-grid .row-actions { margin-top: 0.25rem; }
.form-error:empty { display: none; }
/* Aviso pegado al campo que falta (panel: nombre e idiomas) */
.form-error.field-error { min-height: 0; margin-top: 0.35rem; font-size: 0.85rem; font-weight: 600; }
.f input[aria-invalid="true"] { border-color: #b3293c; }
.f label.check { display: flex; gap: 0.5rem; align-items: flex-start; font-weight: 500; }
.f label.check input { width: auto; margin-top: 0.25rem; }
.f label.check a { color: var(--indigo); font-weight: 700; }

/* Modal propio (sustituye a confirm()) */
.modal-back { position: fixed; inset: 0; background: rgba(31, 41, 55, 0.45); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50; }
.modal { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; max-width: 420px; width: 100%;
  /* Nunca más alto que la pantalla: el contenido largo hace scroll dentro del modal */
  max-height: calc(100dvh - 2rem); overflow-y: auto; overscroll-behavior: contain; }
.modal h3 { font-size: 1.15rem; margin-bottom: 0.4rem; }
.modal p { color: var(--body); font-size: 0.95rem; }
.modal .row-actions { justify-content: flex-end; margin-top: 1.25rem; }

/* Página de términos */
.terms h2 { font-size: 1.1rem; margin-top: 1.4rem; }
.terms p, .terms li { font-size: 0.95rem; color: var(--body); margin-top: 0.4rem; }
.terms ul { padding-left: 1.2rem; }
.f .pass-wrap input { padding-right: 2.9rem; }
.modal .f { margin-top: 0.8rem; }

/* QR de oyentes en la pantalla del emisor */
.qr-block { width: 100%; max-width: 820px; padding: 1.1rem 1.25rem; }
.qr-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.qr-head h2 { font-size: 1.05rem; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-top: 0.9rem; }
.qr-card { text-align: center; }
.qr-card img { width: 100%; max-width: 200px; aspect-ratio: 1; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.qr-lang { font-weight: 800; color: var(--ink); margin-top: 0.4rem; }
.qr-url { font-size: 0.78rem; color: var(--muted); word-break: break-all; }

/* ---------- menú "Gehiago" del header del panel ---------- */
.menu-wrap { position: relative; }
.btn-menu { display: inline-flex; align-items: center; gap: 0.35rem; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 0.42rem 0.95rem; font: inherit; font-weight: 700; font-size: 0.9rem; color: var(--ink); cursor: pointer; }
.btn-menu:hover, .btn-menu[aria-expanded="true"] { border-color: var(--indigo); color: var(--indigo); }
.menu-pop { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 36px rgba(30, 27, 75, 0.16); min-width: 230px; padding: 0.4rem; display: flex; flex-direction: column; z-index: 60; }
.menu-pop a, .menu-pop button { text-align: left; background: none; border: 0; padding: 0.6rem 0.8rem; border-radius: 9px; font: inherit; font-weight: 600; font-size: 0.92rem; color: var(--ink); cursor: pointer; text-decoration: none; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--indigo-soft); color: var(--indigo); }
.menu-sep { height: 1px; background: var(--line); margin: 0.3rem 0.4rem; }

/* ---------- acta de sesión (panel y emisor) ---------- */
.pill-report { background: var(--indigo); color: #fff; }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(53, 16, 168, 0.18); border-top-color: var(--indigo); border-radius: 50%; display: inline-block; animation: spin 0.8s linear infinite; vertical-align: middle; flex: none; }
.btn-primary .spinner { border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; width: 14px; height: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.report-loading { display: flex; align-items: center; gap: 0.6rem; color: var(--body); font-weight: 600; padding: 1rem 0; }
.report-doc { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1.1rem 1.25rem; background: #fff; margin-top: 0.8rem; text-align: left; }
.report-doc h3 { font-size: 1.15rem; color: var(--ink); }
.report-doc p { color: var(--body); font-size: 0.95rem; margin-top: 0.6rem; line-height: 1.55; }
.report-doc h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--indigo); margin-top: 1.1rem; }
.report-doc ul { padding-left: 1.2rem; margin-top: 0.4rem; }
.report-doc li { color: var(--body); font-size: 0.93rem; margin-top: 0.3rem; line-height: 1.5; }
.send-box { margin-top: 1rem; text-align: left; }
.send-to { font-size: 0.9rem; color: var(--ink); font-weight: 600; word-break: break-all; }
.send-edit { display: flex; gap: 0.5rem; margin-top: 0.5rem; align-items: center; }
.send-edit input { flex: 1; }
.link-btn { appearance: none; background: none; border: 0; padding: 0; font: inherit; font-size: 0.85rem; font-weight: 700; color: var(--indigo); cursor: pointer; text-decoration: underline; }
.switch { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.9rem; cursor: pointer; font-size: 0.92rem; color: var(--ink); font-weight: 600; position: relative; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .slider { width: 40px; height: 22px; border-radius: 999px; background: #d1d5db; position: relative; flex: none; transition: background 0.15s; }
.switch .slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch input:checked + .slider { background: var(--indigo); }
.switch input:checked + .slider::after { transform: translateX(18px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--indigo); outline-offset: 2px; }
.acc-sub { font-size: 0.95rem; color: var(--ink); }
/* Selector de idioma del acta (Nire kontua): chips pequeños con bandera */
.lang-pick { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.lang-pick .lang-chip { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.lang-pick select.lang-more { width: auto; border: 1.5px dashed var(--line); border-radius: 999px; padding: 0.35rem 0.7rem; font: inherit; font-size: 0.85rem; color: var(--muted); background: #fff; cursor: pointer; }
.report-doc + .report-doc { margin-top: 0.8rem; }
.report-doc-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.4rem; }

/* "Nire kontua" (modal): un 30 % más ancho que los diálogos genéricos (más chips por fila) */
#accModal .modal { max-width: 900px; }
/* Mi cuenta: actas y glosario general en dos columnas si caben */
.acc-cols { display: grid; grid-template-columns: 1fr; gap: 0 2rem; }
.acc-cols > section { min-width: 0; }
@media (min-width: 820px) {
  .acc-cols { grid-template-columns: 1fr 1fr; }
  .acc-cols-sep { display: none; }
  #amGlossary { min-height: 12rem; }
}
/* Guardar siempre a la vista aunque el modal haga scroll */
.acc-actions { position: sticky; bottom: -1.5rem; background: #fff; margin: 1.25rem -1.5rem -1.5rem; padding: 0.9rem 1.5rem 1.5rem; border-top: 1px solid var(--line); }
/* Móvil: la barra ocuparía dos filas fijas; ahí va al final del scroll */
@media (max-width: 560px) { .acc-actions { position: static; margin: 1.25rem 0 0; padding: 0; border-top: 0; } }
/* "Nire kontua" (modal) */
.acc-dl { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1.2rem; margin: 1rem 0 0.4rem; }
.acc-dl dt { color: var(--muted); font-size: 0.88rem; }
.acc-dl dd { font-weight: 700; color: var(--ink); }

/* ---------- selector de idioma (banderitas) ---------- */
.lang-wrap { position: relative; }
.lang-btn { display: inline-flex; align-items: center; gap: 0.45rem; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 0.35rem 0.7rem; font: inherit; font-weight: 700; font-size: 0.8rem; color: var(--ink); cursor: pointer; }
.lang-btn:hover { border-color: var(--indigo); color: var(--indigo); }
.lang-flag { width: 20px; height: 14px; border-radius: 3px; display: block; flex: none; box-shadow: 0 0 0 1px rgba(30, 27, 75, 0.12); }
.lang-pop { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 36px rgba(30, 27, 75, 0.16); min-width: 170px; padding: 0.4rem; display: flex; flex-direction: column; z-index: 70; }
.lang-pop button { display: flex; align-items: center; gap: 0.6rem; text-align: left; background: none; border: 0; padding: 0.55rem 0.7rem; border-radius: 9px; font: inherit; font-weight: 600; font-size: 0.9rem; color: var(--ink); cursor: pointer; }
.lang-pop button:hover { background: var(--indigo-soft); color: var(--indigo); }
/* En la landing (fondo índigo) el botón va translúcido */
.landing .lang-btn { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.35); color: #fff; }
.landing .lang-btn:hover { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* ---------- chips de emails (destinatarios del acta) ---------- */
.chips-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.55rem; }
.chip-mail { display: inline-flex; align-items: center; gap: 0.3rem; background: var(--indigo-soft); color: var(--indigo); border-radius: 999px; padding: 0.28rem 0.4rem 0.28rem 0.75rem; font-size: 0.85rem; font-weight: 600; }
.chip-mail .chip-x { border: 0; background: none; color: inherit; font-size: 1.05rem; line-height: 1; cursor: pointer; padding: 0 0.35rem; border-radius: 50%; }
.chip-mail .chip-x:hover { background: rgba(53, 16, 168, 0.16); }
.chips-box input.bad { border-color: #e11d48; }

/* turno de preguntas (oyente): mantener pulsado 🎤 */
.qa-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 0.5rem 0 1rem; }
.qa-btn {
  appearance: none; width: clamp(88px, 22vw, 112px); height: clamp(88px, 22vw, 112px); border-radius: 50%; border: none;
  cursor: pointer; font-size: 2.2rem; background: var(--indigo); color: #fff; box-shadow: 0 14px 28px -12px rgba(53,16,168,0.7);
  user-select: none; -webkit-user-select: none; touch-action: none; -webkit-touch-callout: none;
  transition: background 0.2s, transform 0.12s, opacity 0.2s;
}
.qa-btn:active, .qa-btn.requesting { transform: scale(0.96); }
.qa-btn.requesting { background: var(--yellow); color: var(--ink); }
.qa-btn.speaking { background: var(--coral); box-shadow: 0 0 0 10px rgba(255,79,109,0.18), 0 14px 28px -12px rgba(255,79,109,0.7); animation: qa-pulse 1.2s ease-in-out infinite; }
@keyframes qa-pulse { 0%,100% { box-shadow: 0 0 0 6px rgba(255,79,109,0.22); } 50% { box-shadow: 0 0 0 16px rgba(255,79,109,0.08); } }
.qa-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.qa-hint { font-size: 0.88rem; font-weight: 600; text-align: center; }
.qa-hint.warn { color: #b3293c; }
/* pregunta por escrito (oyente): campo + enviar; lo enviado aparece en la lista de preguntas */
.ask-form { display: flex; align-items: flex-end; gap: 0.5rem; width: 100%; max-width: 560px; margin-top: 0.4rem; }
.ask-form textarea {
  flex: 1; min-width: 0; resize: none; font: inherit; font-size: 1rem; line-height: 1.4; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: 1.2rem; padding: 0.65rem 0.95rem; max-height: 120px; overflow-y: auto;
}
.ask-form textarea:focus { outline: none; border-color: var(--indigo); }
.ask-send { flex: none; width: 2.9rem; height: 2.9rem; padding: 0; border-radius: 50%; justify-content: center; }
.ask-send:disabled { opacity: 0.4; cursor: not-allowed; }
/* Oyente: subtítulos + preguntas de la sesión. Móvil: pestañas Subtítulos |
   Preguntas con el micro y el campo siempre abajo; portátil (≥ 900px): los
   subtítulos mandan a la izquierda y las preguntas van en una columna a la
   derecha, con el micro y el campo al pie. */
.listen-layout { display: flex; flex-direction: column; width: 100%; flex: 1; gap: 1rem; min-width: 0; }
.listen-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.listen-tabs { display: flex; gap: 0.25rem; padding: 0.25rem; background: var(--indigo-soft); border-radius: 999px; }
.listen-tab {
  flex: 1; min-width: 0; min-height: 44px; appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 0.92rem; font-weight: 700; color: var(--body); padding: 0.45rem 0.8rem; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
}
.listen-tab[aria-selected="true"] { background: var(--card); color: var(--indigo); box-shadow: var(--shadow); }
.listen-tab:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.tab-badge { min-width: 1.35rem; height: 1.35rem; padding: 0 0.35rem; border-radius: 999px; background: var(--coral); color: #fff; font-size: 0.75rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.listen-layout[data-tab="captions"] .qa-panel { display: none; }
.listen-layout[data-tab="questions"] .captions { display: none; }
.qa-panel { display: flex; flex-direction: column; min-width: 0; min-height: 45vh; }
.qa-panel-title { display: none; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; margin-bottom: 0.6rem; }
.qa-feed-scroll { flex: 1; min-height: 0; max-height: 55vh; overflow-y: auto; overscroll-behavior: contain; }
.qa-feed { list-style: none; display: flex; flex-direction: column; gap: 0.55rem; padding: 3px; }
.qf-item { background: var(--card); border: 1px solid var(--line); border-radius: 0.9rem; padding: 0.6rem 0.8rem; overflow-wrap: anywhere; transition: border-color 0.3s, box-shadow 0.3s; animation: rise 0.3s cubic-bezier(0.22,1,0.36,1); }
.qf-item.mine { background: var(--indigo-soft); border-color: transparent; }
.qf-item.just-sent { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.qf-item.sending { opacity: 0.65; }
.qf-item.failed { background: #fde8ec; }
.qf-text { color: var(--ink); font-size: 0.98rem; line-height: 1.45; }
.qf-item.pending .qf-text { color: var(--body); }
.qf-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.3rem; font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.qf-kind { display: inline-flex; }
.qf-you { background: var(--indigo); color: #fff; border-radius: 999px; padding: 0.05rem 0.55rem; font-weight: 700; }
.qf-tag { border: 1px solid var(--line); border-radius: 999px; padding: 0 0.45rem; background: var(--card); }
.qf-state { color: var(--teal); font-weight: 800; }
.qf-item.failed .qf-state { color: #b3293c; }
.qa-feed-empty { font-size: 0.92rem; padding: 0.4rem 0.2rem; }
.qa-feed-busy { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.2rem; font-size: 0.88rem; font-weight: 600; color: var(--body); }
.rec-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--coral); flex: none; animation: blink 1.1s steps(2) infinite; }
/* Preguntar: caja "Estás preguntando…" con lo que se va entendiendo, encima del micro */
.qa-compose { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
.qa-live-box { border: 1.5px solid var(--coral); background: #fff5f6; border-radius: var(--radius-sm); padding: 0.7rem 0.9rem; }
.qa-live-box.sending { border-color: var(--teal); background: #f0faf9; }
.qa-live-box.sending .rec-dot { background: var(--teal); }
.qa-live-box.empty { border-color: #f6d2d8; }
.qa-live-box.empty .rec-dot { display: none; }
.qa-live-box.empty .qa-live-head { color: #b3293c; font-weight: 700; }
.qa-live-head { display: flex; align-items: center; gap: 0.5rem; font-size: 0.92rem; font-weight: 800; color: var(--ink); }
.qa-live-time { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); }
.qa-live-text { margin-top: 0.35rem; font-size: 1rem; line-height: 1.45; color: var(--ink); max-height: 7.5em; overflow-y: auto; overflow-wrap: anywhere; }
.qa-live-text.placeholder { color: var(--muted); font-style: italic; }
@media (min-width: 900px) {
  .stage.stage-listen { max-width: 1180px; }
  .listen-layout {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas: "main panel" "main compose"; column-gap: 2rem; row-gap: 0;
    height: calc(100dvh - 68px - 6rem); min-height: 520px;
  }
  /* Ocupa las dos filas: sin "contain: size", su contenido (subtítulos) estiraba la fila
     automática del compose y la página entera crecía en vez de hacer scroll dentro */
  .listen-main { grid-area: main; min-height: 0; overflow: hidden; contain: size; }
  .listen-tabs { display: none; }
  .listen-layout[data-tab] .captions, .listen-layout[data-tab] .qa-panel { display: flex; }
  .listen-main .captions { flex: 1; min-height: 0; max-height: none; }
  .qa-panel { grid-area: panel; min-height: 0; background: var(--card); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; padding: 1rem 1rem 0.5rem; }
  .qa-panel-title { display: block; }
  .qa-feed-scroll { max-height: none; }
  .qa-compose { grid-area: compose; background: var(--card); border: 1px solid var(--line); border-top-color: var(--indigo-soft); border-radius: 0 0 var(--radius) var(--radius); padding: 0.75rem 1rem 1rem; }
  .qa-compose .qa-wrap { padding: 0; }
  .qa-compose .qa-btn { width: 72px; height: 72px; font-size: 1.7rem; }
}
/* preguntas del público (emisor): lista anónima de habladas (traducidas) y escritas */
.qa-card { border-color: var(--teal-soft); }
.qa-live { display: inline-flex; align-items: center; gap: 0.35rem; margin-left: 0.6rem; color: var(--teal); text-transform: none; letter-spacing: 0; font-weight: 700; }
.qa-list { list-style: none; display: flex; flex-direction: column; gap: 0.55rem; padding: 3px; margin: -3px; max-height: 62vh; overflow-y: auto; overscroll-behavior: contain; }
.qa-item { display: flex; align-items: flex-start; gap: 0.55rem; background: var(--bg, #f7f7fb); border: 1px solid var(--line); border-radius: 0.9rem; padding: 0.6rem 0.8rem; }
.qa-item.live { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.qa-item .qa-body { flex: 1; min-width: 0; }
.transcript .qa-item p { max-height: none; min-height: 0; overflow: visible; overflow-wrap: anywhere; }
.transcript .qa-item .qa-orig { font-size: 0.85rem; margin-top: 0.2rem; color: var(--muted); }
.transcript p.qa-empty { font-size: 0.92rem; color: var(--muted); min-height: 0; }
/* acta en pantalla: botones de descarga y preguntas-respuestas */
.report-doc-files { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.report-doc .report-qa { padding-left: 1.3rem; margin-top: 0.4rem; }
.report-doc .report-qa li { margin-top: 0.6rem; color: var(--ink); font-size: 0.93rem; line-height: 1.5; }
.report-doc .report-qa li p { margin-top: 0.15rem; font-size: 0.93rem; }

/* Emisor a tres columnas (transcripción | micro | preguntas). En móvil: micro, preguntas, transcripción. */
.stage.stage-wide { max-width: 1440px; }
.emit-layout { display: grid; grid-template-columns: 1fr; gap: 1.5rem; width: 100%; align-items: start; }
.emit-col { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; min-width: 0; }
.emit-center { order: 0; }
.emit-right { order: 1; }
.emit-left { order: 2; }
.emit-left .transcript, .emit-right .qa-card { max-width: none; }
.emit-right { gap: 1rem; }
.emit-right .qa-card { min-height: 9em; }
@media (min-width: 901px) {
  /* Centro estrecho (el botón mide lo mismo; solo pierde aire a los lados) y la
     transcripción, la columna más ancha. */
  .emit-layout { grid-template-columns: minmax(300px, 1.5fr) minmax(280px, 0.95fr) minmax(280px, 1.15fr); }
  .emit-left, .emit-center, .emit-right { order: 0; }
  .emit-left, .emit-right { position: sticky; top: 1rem; }
  .emit-left .transcript p { min-height: 45vh; max-height: 72vh; }
  .emit-right .qa-list { max-height: 34vh; }
}

/* Desplegable de idioma del ponente: chip que abre una lista de chips con bandera. */
.group .lang-select { margin-top: 0.9rem; position: relative; }
.lang-select-btn { min-width: 220px; justify-content: space-between; }
.lang-select-btn .caret { font-size: 0.7em; color: var(--muted); margin-left: auto; }
.lang-select-list { position: absolute; z-index: 20; top: calc(100% + 0.4rem); left: 0; width: min(100%, 340px); max-height: 320px; overflow-y: auto; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; box-shadow: 0 16px 32px -14px rgba(30, 27, 75, 0.35); padding: 0.4rem; display: flex; flex-direction: column; gap: 0.15rem; }
.lang-select-opt { border-radius: 10px; border-color: transparent; padding: 0.45rem 0.7rem; font-size: 0.92rem; text-align: left; }
.lang-select-opt:hover { background: var(--indigo-soft); border-color: transparent; }
.lang-select-opt[aria-selected="true"] { background: var(--indigo); color: #fff; }
.lang-select-opt.lang-select-rest { margin-top: 0.35rem; border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; padding-top: 0.6rem; }
/* --- Panel de diagnóstico (?diag=1) y distintivo de staging --- */
.diag { width: 100%; font-size: 0.78rem; color: var(--muted); }
.diag summary { cursor: pointer; font-weight: 600; }
.diag-log { margin-top: 0.5rem; max-height: 220px; overflow: auto; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.72rem; line-height: 1.5; background: #f6f6fa; border-radius: var(--radius-sm); padding: 0.5rem 0.7rem; white-space: pre-wrap; word-break: break-word; }
.staging-badge { position: fixed; top: 0; left: 50%; transform: translateX(-50%); background: #b3293c; color: #fff; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; padding: 0.15rem 0.7rem; border-radius: 0 0 8px 8px; z-index: 50; }
.dot.paused { background: var(--yellow); }

/* Cabecera de emisor/oyente en móvil estrecho: la píldora de estado en una sola
   línea; el wordmark cede el sitio (queda el símbolo). Sin :has() no cambia nada. */
.status-pill { white-space: nowrap; }
@media (max-width: 480px) {
  .topbar:has(.status-pill) .brand-word { display: none; }
  .topbar:has(.status-pill) .right { gap: 0.6rem; }
}

/* Cabecera del panel (saldo + idioma + menú) en móvil: símbolo sin wordmark,
   huecos justos y el nombre de la cuenta recortado con "…"; el saldo y los
   botones no ceden. Solo el panel (.menu-wrap); sin :has() no cambia nada. */
.btn-menu, .lang-btn { white-space: nowrap; }
#balance { gap: 0.3em; } /* nombre y saldo: un espacio, como antes */
@media (max-width: 560px) {
  .topbar:has(.menu-wrap) { gap: 0.6rem; padding-left: 1rem; padding-right: 1rem; }
  .topbar:has(.menu-wrap) .brand-word { display: none; }
  .topbar:has(.menu-wrap) .right { gap: 0.45rem; min-width: 0; }
  .topbar:has(.menu-wrap) .right > * { flex: none; }
  .topbar:has(.menu-wrap) .balance { flex: 0 1 auto; min-width: 0; padding: 0.4rem 0.65rem; font-size: 0.82rem; }
  .topbar:has(.menu-wrap) .lang-btn, .topbar:has(.menu-wrap) .btn-menu { min-height: 40px; }
  .topbar:has(.menu-wrap) .btn-menu { padding: 0.42rem 0.75rem; }
  .balance-name { overflow: hidden; text-overflow: ellipsis; min-width: 1.5em; }
}

/* Cabecera del backoffice (marca + etiqueta + enlaces) en móvil: sin wordmark
   y huecos justos para que quepan los enlaces. Sin :has() no cambia nada. */
@media (max-width: 480px) {
  .topbar:has(.brand .tag) { gap: 0.6rem; padding-left: 1rem; padding-right: 1rem; }
  .topbar:has(.brand .tag) .brand-word { display: none; }
  .topbar:has(.brand .tag) .right { gap: 0.75rem; }
  .topbar:has(.brand .tag) .link-quiet { white-space: nowrap; }
}

/* ---------- guía de uso: descarga en "Nire kontua" ---------- */
.guide-book { width: 38px; height: 48px; flex: none; }
.acc-top { display: flex; gap: 1rem; align-items: flex-start; }
.acc-top .acc-dl { flex: 1; min-width: 0; }
.acc-top .acc-dl dd { overflow-wrap: anywhere; }
.acc-guide { flex: none; width: 118px; margin-top: 1rem; padding: 0.7rem 0.6rem; border-radius: var(--radius-sm); background: var(--indigo-soft);
             display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.2rem; }
.acc-guide .guide-book { filter: drop-shadow(0 3px 6px rgba(36, 16, 127, 0.2)); width: 32px; height: 40px; margin-bottom: 0.2rem; }
.acc-guide b { font-size: 0.85rem; color: var(--ink); }
.acc-guide .muted { font-size: 0.72rem; }
.acc-guide-dl { display: flex; gap: 0.3rem; margin-top: 0.35rem; }
.acc-guide-dl .btn { padding: 0.25rem 0.55rem; font-size: 0.78rem; }
@media (max-width: 400px) { .acc-top { flex-direction: column; } .acc-guide { width: 100%; margin-top: 0; } }
/* Logo de las actas: la vista previa imita la caja de la cabecera del PDF (200×52, a la izquierda) */
.logo-pick { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.logo-prev { width: 200px; max-width: 100%; height: 52px; padding: 6px 8px; box-sizing: content-box; background: #fff;
             border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.logo-prev img { width: 100%; height: 100%; object-fit: contain; object-position: left center; display: block; }
.logo-btns { display: flex; gap: 0.4rem; }
.logo-def { font-size: 0.75rem; margin: 0.25rem 0 0; }

/* ============================================================
   Edición eventos (eventos.berbaz.com · js/edition.js). Misma app, otra piel:
   paneles neutros y precisos; landing y oyente en oscuro (salas a media luz,
   la pantalla del móvil no deslumbra). Todo cuelga de html[data-edition].
   ============================================================ */
html:not([data-edition="events"]) .ev-only { display: none; }

html[data-edition="events"] {
  --indigo: #5B45FF;
  --indigo-dark: #4A34F0;
  --indigo-deep: #0A0B10;
  --indigo-soft: #F1F0FF;
  --violet: #5B45FF;
  --teal: #12B76A;            /* verde "en directo" */
  --teal-soft: #D3F8E2;
  --ink: #0B0D12;
  --body: #3D4250;
  --muted: #6A7080;
  --bg: #F5F6F8;
  --line: #E4E6EB;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(11, 13, 18, 0.05), 0 10px 28px -18px rgba(11, 13, 18, 0.22);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}
html[data-edition="events"] .btn { border-radius: 10px; }
html[data-edition="events"] .btn-primary { box-shadow: 0 8px 18px -10px rgba(91, 69, 255, 0.65); }
html[data-edition="events"] .brand-word { color: var(--ink); }
html[data-edition="events"] .brand-word::after {
  content: "Events"; display: inline-block; vertical-align: middle; margin: -0.2em 0 0 0.55rem;
  font: 600 0.6rem/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0.3rem 0.4rem;
}
html[data-edition="events"] :is(.section-pill, .land-eyebrow, .transcript .label, .qa-panel-title, .steps .num) {
  font-family: var(--mono); letter-spacing: 0.08em;
}
html[data-edition="events"] .section-pill { border-radius: 5px; }

/* --- landing --- */
html[data-edition="events"] .landing {
  background:
    radial-gradient(55% 45% at 85% 0%, rgba(91, 69, 255, 0.3), transparent 70%),
    radial-gradient(35% 35% at 0% 100%, rgba(18, 183, 106, 0.1), transparent 70%),
    #07080C;
}
/* Rejilla técnica muy tenue, desvanecida hacia los bordes */
html[data-edition="events"] .landing::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 70% 35%, #000 25%, transparent 80%);
  mask-image: radial-gradient(ellipse 75% 65% at 70% 35%, #000 25%, transparent 80%);
}
html[data-edition="events"] :is(.land-shapes, .brand-badge) { display: none; }
html[data-edition="events"] .landing .brand-mark { height: 30px; }
html[data-edition="events"] .landing .brand-word { color: #fff; font-size: 1.5rem; }
html[data-edition="events"] .landing .brand-word::after { color: #A3A8B6; border-color: rgba(255, 255, 255, 0.18); }
html[data-edition="events"] .land-eyebrow { color: #A99BFF; }
html[data-edition="events"] .land-main { padding-top: clamp(1.5rem, 5vh, 3.5rem); }
html[data-edition="events"] .landing h1 { letter-spacing: -0.03em; font-size: clamp(2.4rem, 6.5vw, 4.2rem); }
html[data-edition="events"] .landing .sub { color: #A9AEBC; }
html[data-edition="events"] .login-form input { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.12); color: #fff; border-radius: 10px; }
html[data-edition="events"] .login-form input::placeholder { color: #7C8190; }
html[data-edition="events"] .login-form input:focus { outline: none; border-color: var(--indigo); background: rgba(255, 255, 255, 0.07); }
html[data-edition="events"] .landing .pass-toggle { color: #7C8190; }
html[data-edition="events"] .landing .pass-toggle:hover { color: #fff; }
html[data-edition="events"] .landing .btn-light { background: var(--indigo); color: #fff; box-shadow: 0 10px 24px -12px rgba(91, 69, 255, 0.9); }
html[data-edition="events"] .landing .btn-light:hover { background: var(--indigo-dark); }
html[data-edition="events"] .login-links { color: rgba(255, 255, 255, 0.45); }
html[data-edition="events"] .land-feats { color: #C9CCD6; }
html[data-edition="events"] .land-feats li + li::before { background: var(--teal); }
html[data-edition="events"] .land-foot { border-top-color: rgba(255, 255, 255, 0.08); }
@media (min-width: 960px) {
  html[data-edition="events"] :is(.land-head, .land-foot, .land-grid) { max-width: 1180px; }
  html[data-edition="events"] .land-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); column-gap: clamp(2.5rem, 5vw, 4.5rem); }
  html[data-edition="events"] .land-grid > * { grid-column: 1; }
  html[data-edition="events"] .land-grid > .ev-demo { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
}

/* Demo del hero: el ponente habla en un idioma y cada asistente lo recibe en el suyo */
.ev-demo {
  margin: 0; color: #E8EAF0; border-radius: 18px; padding: 1.2rem 1.35rem 1.4rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 40px 90px -50px rgba(91, 69, 255, 0.7);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.ev-demo-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font: 600 0.7rem/1.3 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: #8D93A3; }
.ev-live { display: inline-flex; align-items: center; gap: 0.45rem; color: #5BE3A0; }
.ev-live .dot { animation: pulse 1.6s infinite; }
.ev-room { letter-spacing: 0.04em; text-transform: none; text-align: right; }
.ev-wave { display: flex; align-items: center; justify-content: space-between; height: 30px; margin: 1.1rem 0 1rem; }
.ev-wave i { width: 3px; height: 100%; border-radius: 3px; background: linear-gradient(#8B7BFF, #5B45FF); transform: scaleY(0.15); animation: evWave 1.3s ease-in-out infinite; }
.ev-wave i:nth-child(2n) { animation-delay: -0.4s; animation-duration: 1.1s; }
.ev-wave i:nth-child(3n) { animation-delay: -0.8s; }
.ev-wave i:nth-child(5n) { animation-delay: -1.1s; animation-duration: 1.6s; }
@keyframes evWave { 0%, 100% { transform: scaleY(0.15); } 50% { transform: scaleY(0.95); } }
.ev-demo b { flex: none; height: fit-content; margin-top: 0.2em; font: 600 0.66rem/1 var(--mono); letter-spacing: 0.06em; padding: 0.32rem 0.4rem; border-radius: 5px; background: rgba(255, 255, 255, 0.08); color: #C9CCD6; }
.ev-src { display: flex; gap: 0.75rem; color: #fff; font-size: 1.12rem; font-weight: 600; line-height: 1.4; }
.ev-src b { background: #5B45FF; color: #fff; }
.ev-out { list-style: none; display: grid; gap: 0.7rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed rgba(255, 255, 255, 0.12); }
.ev-out li { display: flex; gap: 0.75rem; color: #B8BDCA; font-size: 0.97rem; line-height: 1.4; opacity: 0; transform: translateY(6px); animation: landIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.ev-out li:nth-child(1) { animation-delay: 0.9s; }
.ev-out li:nth-child(2) { animation-delay: 1.15s; }
.ev-out li:nth-child(3) { animation-delay: 1.4s; }
.ev-out li:nth-child(4) { animation-delay: 1.65s; }
@media (prefers-reduced-motion: reduce) { .ev-out li { opacity: 1; transform: none; } .ev-wave i { transform: scaleY(0.5); } }
@media (max-width: 640px) { .ev-room { display: none; } .ev-src { font-size: 1.02rem; } }

/* --- oyente en oscuro --- */
html[data-edition="events"] body.page-listen {
  --bg: #08090D; --card: #12141A; --ink: #F2F3F7; --body: #C3C7D2; --muted: #8B90A0;
  --line: #23262F; --indigo-soft: #1A1B25; --teal-soft: rgba(18, 183, 106, 0.18);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
  color-scheme: dark;
}
html[data-edition="events"] .page-listen :is(.lang-btn, .lang-pop, .ask-form textarea) { background: var(--card); }
html[data-edition="events"] .page-listen .lang-pop button:hover { color: #fff; }
html[data-edition="events"] .page-listen .listen-tab[aria-selected="true"] { color: #fff; }
html[data-edition="events"] .page-listen .play-btn { background: var(--indigo); box-shadow: 0 0 0 12px rgba(91, 69, 255, 0.12), 0 24px 60px -18px rgba(91, 69, 255, 0.9); }
html[data-edition="events"] .page-listen .qa-live-box { background: rgba(255, 79, 109, 0.08); }
html[data-edition="events"] .page-listen .qa-live-box.sending { background: rgba(18, 183, 106, 0.08); }
html[data-edition="events"] .page-listen .error-box { background: rgba(255, 79, 109, 0.08); border-color: rgba(255, 79, 109, 0.3); color: #FF9AAB; }
