/* MUNLEX Studio — hoja de estilo. Tema oscuro sobrio, sin frameworks. */

:root {
  --fondo: #0f1420;
  --tarjeta: #161d2b;
  --tarjeta-2: #1c2536;
  --campo: #0c111b;
  --borde: #253044;
  --borde-2: #36435c;
  --texto: #e6eaf2;
  --texto-2: #9aa5b8;
  --texto-3: #6b7689;
  --acento: #5b7cff;
  --acento-h: #7390ff;
  --acento-suave: rgba(91, 124, 255, 0.16);
  --terracota: #C4593B;
  --terracota-clara: #f0916f;
  --terracota-suave: rgba(196, 89, 59, 0.16);
  --ok: #3fb97f;
  --ok-suave: rgba(63, 185, 127, 0.16);
  --aviso: #d6a83a;
  --radio: 12px;
  --sombra: 0 10px 30px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
@media (min-width: 760px) { body { padding-bottom: 32px; } }

.oculto { display: none !important; }
a { color: var(--acento); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 0.35em; font-weight: 650; letter-spacing: -0.01em; line-height: 1.25; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 0.95rem; }
p { margin: 0 0 0.8em; }
small, .nota { color: var(--texto-2); font-size: 0.85rem; }
.nota { display: block; margin-top: 4px; }
code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--campo); padding: 1px 5px; border-radius: 4px; }
strong { font-weight: 650; }
.ok { color: var(--ok); }
.alerta { color: var(--terracota-clara) !important; }
.derecha { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- Barra superior y navegación ---------- */
.barra {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  background: var(--fondo);
  border-bottom: 1px solid var(--borde);
  /* Sin backdrop-filter ni transform: crearían un bloque contenedor y la barra fija del celular quedaría pegada aquí. */
}
.marca { font-weight: 750; letter-spacing: 0.1em; font-size: 0.95rem; white-space: nowrap; }
.marca-sub { color: var(--terracota); font-weight: 600; letter-spacing: 0.02em; margin-left: 4px; }
.nav { display: flex; gap: 2px; margin-left: 6px; }
.nav a { color: var(--texto-2); padding: 8px 12px; border-radius: 8px; font-weight: 550; }
.nav a:hover { color: var(--texto); text-decoration: none; }
.nav a.activo { color: var(--texto); background: var(--tarjeta-2); }
.barra-estado { margin-left: auto; color: var(--texto-2); font-size: 0.84rem; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.barra-estado a { color: var(--texto-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra-estado a.alerta { font-weight: 600; }

@media (max-width: 759px) {
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0;
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
    background: var(--tarjeta);
    border-top: 1px solid var(--borde);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .nav a { text-align: center; padding: 10px 0; font-size: 0.74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .barra-estado { font-size: 0.75rem; max-width: 52vw; overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- Contenido ---------- */
.contenido { max-width: 1180px; margin: 0 auto; padding: 20px 16px; }
.vista > header.encabezado {
  display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.encabezado .acciones { margin-left: auto; }
.tarjeta {
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 16px;
}
.tarjeta + .tarjeta, .bloque + .bloque { margin-top: 16px; }
.tarjeta h2 { margin-bottom: 10px; }
.tarjeta h2 small { font-weight: 400; margin-left: 6px; }
.lista { display: grid; gap: 12px; }
.vacio { color: var(--texto-2); padding: 28px 12px; text-align: center; border: 1px dashed var(--borde); border-radius: var(--radio); }
.columnas { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .columnas { grid-template-columns: 1fr 1fr; } .columnas > .tarjeta + .tarjeta { margin-top: 0; } }

/* ---------- Botones ---------- */
.btn {
  appearance: none; -webkit-appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--borde); border-radius: 9px;
  padding: 9px 14px; min-height: 38px;
  font: inherit; font-weight: 600; line-height: 1.2;
  color: var(--texto); background: var(--tarjeta-2);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover { border-color: var(--borde-2); text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
.btn-primario { background: var(--acento); border-color: var(--acento); color: #fff; }
.btn-primario:hover { background: var(--acento-h); border-color: var(--acento-h); }
.btn-terracota { background: var(--terracota); border-color: var(--terracota); color: #fff; }
.btn-terracota:hover { background: #d4663f; }
.btn-peligro { background: transparent; border-color: rgba(196, 89, 59, 0.55); color: var(--terracota-clara); }
.btn-peligro:hover { background: var(--terracota-suave); }
.btn-fantasma { background: transparent; }
.btn-chico { padding: 6px 10px; min-height: 32px; font-size: 0.84rem; }
.btn-bloque { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.acciones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grupo { display: inline-flex; gap: 6px; align-items: center; }
.grupo select { width: auto; }

/* ---------- Etiquetas de estado ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase;
  vertical-align: middle;
}
.badge-nuevo { background: #263047; color: #b7c2d8; }
.badge-corriendo { background: var(--acento-suave); color: #9fb3ff; }
.badge-corriendo::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #9fb3ff; animation: pulso 1.2s infinite ease-in-out; }
.badge-listo { background: var(--ok-suave); color: #6fd4a3; }
.badge-error { background: var(--terracota-suave); color: var(--terracota-clara); }
@keyframes pulso { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ---------- Formularios ---------- */
label { display: block; font-size: 0.84rem; color: var(--texto-2); margin-bottom: 4px; font-weight: 550; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], textarea, select {
  width: 100%;
  background: var(--campo); color: var(--texto);
  border: 1px solid var(--borde); border-radius: 8px;
  padding: 9px 11px; font: inherit; line-height: 1.4;
}
input::placeholder, textarea::placeholder { color: var(--texto-3); }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(91, 124, 255, 0.5); outline-offset: 1px; border-color: var(--acento); }
input:disabled, textarea:disabled, select:disabled { opacity: 0.4; }
textarea { resize: vertical; min-height: 96px; }
textarea.grande { min-height: 300px; line-height: 1.65; font-size: 0.98rem; }
select { appearance: none; -webkit-appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--texto-2) 50%), linear-gradient(135deg, var(--texto-2) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input[type="file"] { width: 100%; color: transparent; font-size: 0.88rem; }  /* el nombre elegido se muestra en una nota propia */
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; color: var(--texto); background: var(--tarjeta-2);
  border: 1px solid var(--borde); border-radius: 8px; padding: 6px 10px; margin-right: 10px; cursor: pointer;
}
input[type="range"] { width: 100%; accent-color: var(--acento); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--acento); vertical-align: -3px; margin-right: 8px; }
.campo { margin-bottom: 14px; }
.campo:last-child { margin-bottom: 0; }
.fila-campos { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.casilla { display: flex; align-items: flex-start; gap: 2px; color: var(--texto); font-size: 0.95rem; margin-bottom: 0; font-weight: 500; cursor: pointer; line-height: 1.4; }
.casilla input { flex: none; margin-top: 2px; }
.casillas { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-top: 6px; }
.rango { display: flex; align-items: center; gap: 12px; }
.rango output { min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; }
.pie-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 16px; }
.pie-form .nota { margin: 0 auto 0 0; }

/* ---------- Tablas editables (letreros, clips) ---------- */
.tabla { width: 100%; border-collapse: collapse; }
.tabla th { text-align: left; font-size: 0.74rem; color: var(--texto-2); font-weight: 650; padding: 4px 6px 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.tabla td { padding: 5px 6px; vertical-align: top; }
.tabla td.quitar { width: 1%; white-space: nowrap; }
.tabla textarea { min-height: 42px; }
.tabla tbody:empty + tfoot td { padding-top: 0; }
.tabla tfoot td { padding-top: 10px; }
.tabla .angosto { width: 110px; }
@media (max-width: 899px) {
  .tabla thead { display: none; }
  .tabla, .tabla tbody, .tabla tfoot, .tabla tr, .tabla td { display: block; }
  .tabla tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    background: var(--tarjeta-2); border: 1px solid var(--borde); border-radius: 10px;
    padding: 12px; margin-bottom: 10px;
  }
  .tabla td { padding: 0; }
  .tabla td.ancho, .tabla td.quitar { grid-column: 1 / -1; }
  .tabla td.quitar { text-align: right; }
  .tabla td[data-etiqueta]::before { content: attr(data-etiqueta); display: block; font-size: 0.74rem; color: var(--texto-2); margin-bottom: 3px; font-weight: 600; }
  .tabla td:has(> :disabled) { display: none; }
  .tabla tfoot tr { background: none; border: 0; padding: 0; display: block; }
}

/* ---------- Lista de proyectos ---------- */
.proyecto-tarjeta { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .proyecto-tarjeta { grid-template-columns: 1fr auto; align-items: center; } }
.proyecto-titulo { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 4px; }
.proyecto-titulo .nombre { font-size: 1.08rem; font-weight: 650; color: var(--texto); }
.proyecto-meta { color: var(--texto-2); font-size: 0.86rem; display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* ---------- Proyecto: pasos ---------- */
.pasos { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.paso {
  background: var(--tarjeta-2); border: 1px solid var(--borde); border-radius: 10px;
  padding: 12px 10px 10px; text-align: center; display: flex; flex-direction: column; gap: 2px;
}
.paso-num { font-size: 0.7rem; color: var(--texto-3); letter-spacing: 0.08em; }
.paso-nombre { font-weight: 650; }
.paso-desc { font-size: 0.76rem; color: var(--texto-3); min-height: 2.4em; }
.paso-estado { font-size: 0.76rem; font-weight: 650; color: var(--texto-2); margin: 4px 0 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.paso .btn { margin-top: auto; }
.paso.hecho { border-color: rgba(63, 185, 127, 0.45); }
.paso.hecho .paso-estado { color: var(--ok); }
.paso.actual { border-color: var(--acento); box-shadow: inset 0 0 0 1px var(--acento); }
.paso.actual .paso-estado { color: #9fb3ff; }
.paso.error { border-color: var(--terracota); }
.paso.error .paso-estado { color: var(--terracota-clara); }
@media (max-width: 759px) {
  .pasos { grid-template-columns: repeat(2, 1fr); }
  .pasos .paso:last-child { grid-column: span 2; }
  .paso-desc { display: none; }
}
.p-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--texto-2); font-size: 0.88rem; margin-top: 6px; }
.p-error { background: var(--terracota-suave); border: 1px solid rgba(196, 89, 59, 0.5); color: #ffd9cc; border-radius: 10px; padding: 10px 14px; margin-top: 12px; font-size: 0.9rem; white-space: pre-wrap; }

/* ---------- Registro (log) ---------- */
.log {
  background: #0a0e17; border: 1px solid var(--borde); border-radius: 10px;
  padding: 12px; margin: 0;
  font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #c6cfdf; max-height: 280px; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}
.log:empty::before { content: "Sin actividad todavía."; color: var(--texto-3); }

/* ---------- Hoja de contactos ---------- */
.hoja { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.escena {
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio);
  overflow: hidden; display: flex; flex-direction: column;
}
.escena-mini { position: relative; aspect-ratio: 3 / 2; background: var(--campo); cursor: zoom-in; }
.hoja.vertical { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.hoja.vertical .escena-mini { aspect-ratio: 2 / 3; }
.escena-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.escena-mini .sin-imagen { position: absolute; inset: 0; display: grid; place-items: center; color: var(--texto-3); font-size: 0.84rem; text-align: center; padding: 12px; }
.escena-num { position: absolute; top: 8px; left: 8px; background: rgba(12, 30, 51, 0.88); color: #fff; padding: 2px 8px; border-radius: 6px; font-weight: 700; font-size: 0.8rem; }
.escena-tiempo { position: absolute; bottom: 8px; right: 8px; background: rgba(0, 0, 0, 0.62); color: #fff; padding: 2px 8px; border-radius: 6px; font-size: 0.74rem; font-variant-numeric: tabular-nums; }
.escena-cuerpo { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.escena-texto { font-size: 0.9rem; line-height: 1.45; }
.escena details { font-size: 0.8rem; color: var(--texto-2); }
.escena details summary { cursor: pointer; color: var(--texto-2); }
.escena details p { margin: 6px 0 0; white-space: pre-wrap; }
.escena textarea { min-height: 58px; font-size: 0.88rem; }
.escena .acciones { justify-content: space-between; }
.escena.regenerando .escena-mini::after {
  content: "Regenerando…"; position: absolute; inset: 0;
  display: grid; place-items: center; background: rgba(15, 20, 32, 0.72);
  color: #fff; font-weight: 650;
}

/* ---------- Tomas ---------- */
.tomas { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.toma { background: var(--tarjeta-2); border: 1px solid var(--borde); border-radius: 10px; padding: 12px; }
.toma label { color: var(--texto); font-size: 0.92rem; }
.toma .nota { min-height: 1.2em; }
.progreso { height: 8px; background: var(--campo); border-radius: 999px; overflow: hidden; border: 1px solid var(--borde); }
.progreso > span { display: block; height: 100%; width: 0; background: var(--acento); transition: width 0.2s; }
.progreso-fila { display: flex; gap: 12px; align-items: center; margin-top: 10px; }
.progreso-fila .progreso { flex: 1; }
.progreso-fila output { min-width: 3.4em; text-align: right; font-size: 0.85rem; color: var(--texto-2); font-variant-numeric: tabular-nums; }

/* ---------- Referencias de estilo ---------- */
.refs { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.ref { background: var(--tarjeta-2); border: 1px solid var(--borde); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.ref-mini { aspect-ratio: 3 / 2; background: var(--campo); position: relative; }
.ref-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-mini.sin-vista::before { content: "Sin vista previa"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--texto-3); font-size: 0.8rem; }
.ref-nombre { font-size: 0.78rem; color: var(--texto-2); padding: 8px 10px 4px; word-break: break-all; }
.ref .btn { margin: 6px 10px 10px; align-self: flex-start; }

/* ---------- Claves ---------- */
.claves { display: grid; gap: 12px; }
.clave { display: grid; gap: 8px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 760px) { .clave { grid-template-columns: 180px 150px 1fr; } }
.clave .nombre { font-weight: 600; }
.lista-simple { margin: 0; padding: 0; list-style: none; color: var(--texto-2); font-size: 0.88rem; display: grid; gap: 4px; }
.lista-simple li { padding: 6px 10px; background: var(--tarjeta-2); border-radius: 8px; word-break: break-all; }

/* ---------- Franja de mensajes ---------- */
.franja {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60;
  width: max-content; max-width: min(640px, calc(100% - 24px));
  display: flex; gap: 12px; align-items: center;
  padding: 10px 14px; border-radius: 10px;
  background: #3a1f19; border: 1px solid var(--terracota); color: #ffd9cc;
  box-shadow: var(--sombra); font-size: 0.92rem;
}
.franja.ok { background: #14301f; border-color: var(--ok); color: #c9f2db; }
.franja.info { background: #1a2440; border-color: var(--acento); color: #d6def8; }
.franja button { appearance: none; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 650; cursor: pointer; opacity: 0.8; padding: 2px 4px; }
.franja button:hover { opacity: 1; }

/* ---------- Modales ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(5, 8, 14, 0.8);
  display: grid; place-items: center; padding: 16px;
}
.modal-caja {
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 14px;
  padding: 24px; width: min(420px, 100%); box-shadow: var(--sombra);
}
.modal-caja h1 { margin-bottom: 4px; }
.modal-caja .acciones { justify-content: flex-end; margin-top: 16px; }
.login-marca { font-weight: 750; letter-spacing: 0.12em; color: var(--texto-2); font-size: 0.8rem; margin-bottom: 14px; }
.visor { cursor: zoom-out; }
.visor figure { margin: 0; display: grid; gap: 10px; justify-items: center; max-width: 100%; }
.visor img { max-width: min(96vw, 1400px); max-height: 84vh; border-radius: 8px; box-shadow: var(--sombra); }
.visor figcaption { color: var(--texto-2); font-size: 0.88rem; text-align: center; max-width: 820px; }

/* ---------- Utilidades de carga ---------- */
.cargando { color: var(--texto-2); font-size: 0.9rem; }
.cargando::after { content: "…"; }

/* ---------- Proyecto: opciones del encabezado (formato, letreros animados, subtítulos) ---------- */
.p-opciones { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-top: 10px; }
.p-opciones .opcion { margin: 0; font-size: 0.88rem; color: var(--texto-2); font-weight: 550; }
.p-opciones .grupo select { width: auto; padding: 6px 30px 6px 10px; font-size: 0.88rem; }
.p-opciones .casilla { color: var(--texto-2); font-size: 0.88rem; }
.p-opciones .nota { flex-basis: 100%; margin: 0; }

/* ---------- Menú desplegable (Cerebro) ---------- */
.cerebro-fila { margin-top: 14px; }
.menu { position: relative; display: inline-block; }
.caret { display: inline-block; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid currentColor; opacity: 0.85; margin-left: 2px; }
.menu-lista {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 25;
  min-width: 300px; max-width: min(92vw, 380px); padding: 6px;
  background: var(--tarjeta-2); border: 1px solid var(--borde-2); border-radius: 12px; box-shadow: var(--sombra);
}
.menu-lista [role="menuitem"] {
  appearance: none; display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
  background: transparent; border: 0; border-radius: 8px; padding: 10px 12px;
  font: inherit; color: var(--texto); cursor: pointer; text-decoration: none;
}
.menu-lista [role="menuitem"]:hover, .menu-lista [role="menuitem"]:focus-visible { background: var(--tarjeta); outline: none; text-decoration: none; }
.menu-lista [role="menuitem"] strong { font-weight: 650; }
.menu-lista [role="menuitem"] small { color: var(--texto-2); font-size: 0.8rem; line-height: 1.35; }
.menu-lista a[role="menuitem"] { border-top: 1px solid var(--borde); border-radius: 0 0 8px 8px; margin-top: 4px; padding-top: 12px; }
@media (max-width: 759px) { .menu-lista { min-width: min(92vw, 320px); } }

/* ---------- Narración: reproductor con resaltado y edición ---------- */
.reproductor audio { width: 100%; display: block; margin-bottom: 10px; border-radius: 10px; }
.palabras {
  background: var(--campo); border: 1px solid var(--borde); border-radius: 10px;
  padding: 12px 14px; max-height: 240px; overflow: auto; position: relative;
  font-size: 1rem; line-height: 1.95; color: var(--texto);
}
.palabra { cursor: pointer; padding: 1px 3px; margin: 0 -1px; border-radius: 5px; transition: background 0.1s; }
.palabra:hover { background: var(--acento-suave); }
.palabra.actual { background: var(--acento); color: #fff; }
.narracion-texto {
  white-space: pre-wrap; background: var(--campo); border: 1px solid var(--borde); border-radius: 10px;
  padding: 12px 14px; max-height: 280px; overflow: auto; font-size: 0.95rem; line-height: 1.65;
}
.narracion-texto:empty::before { content: "Sin narración."; color: var(--texto-3); }
#p-narracion-acciones { margin-top: 10px; }
#form-narracion textarea.grande { min-height: 260px; }

/* ---------- Letreros del proyecto y sugeridos ---------- */
.letreros-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.letreros-lista li {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--tarjeta-2); border: 1px solid var(--borde); border-radius: 10px; padding: 10px 12px;
}
.letreros-lista li .badge { flex: none; margin-top: 3px; }
.letrero-cuerpo { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 0.92rem; }
.letrero-cuerpo strong { font-weight: 600; overflow-wrap: anywhere; }
.letrero-cuerpo .nota { margin: 0; }
.letreros-lista li > .btn, .letreros-lista li > .casilla { flex: none; align-self: center; }
.letreros-lista li.vacio-fila { display: block; color: var(--texto-2); text-align: center; border-style: dashed; background: transparent; }

/* ---------- Pendientes de verificación (LEX) ---------- */
.pendientes {
  background: rgba(214, 168, 58, 0.12); border: 1px solid rgba(214, 168, 58, 0.5); color: #f1dca4;
  border-radius: 10px; padding: 10px 14px; font-size: 0.9rem;
}
.pendientes strong { color: #f6e3b0; }
.pendientes ul { margin: 6px 0 0; padding-left: 20px; }
.pendientes li { margin: 3px 0; }
.pendientes .nota { color: #d9c58f; }

/* ---------- Textos para grabar (guion de LEX en el proyecto) ---------- */
.guion-tomas { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.guion-toma { background: var(--tarjeta-2); border: 1px solid var(--borde); border-radius: 10px; padding: 12px; font-size: 0.92rem; line-height: 1.5; white-space: pre-wrap; }
.guion-toma .etiqueta { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--terracota-clara); margin-bottom: 4px; }
.guion-toma .nota { margin-top: 8px; }

/* ---------- Guion con LEX ---------- */
.columnas.guion { grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) { .columnas.guion { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.guion-esperando { display: flex; gap: 12px; align-items: center; color: var(--texto-2); padding: 18px 6px; }
.spinner { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--borde-2); border-top-color: var(--acento); animation: girar 0.9s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.bloque-texto {
  white-space: pre-wrap; background: var(--campo); border: 1px solid var(--borde); border-radius: 10px;
  padding: 12px 14px; max-height: 420px; overflow: auto; font-size: 0.95rem; line-height: 1.65; margin-bottom: 8px;
}
#g-resultado h3 { margin-top: 18px; }
.lista-puntos { margin: 0 0 8px; padding-left: 20px; font-size: 0.92rem; display: grid; gap: 6px; }
.lista-puntos .nota { margin: 0; }
.lista-puntos .badge { margin-right: 4px; }

/* ---------- Informe del verificador (segundo agente) ---------- */
.verif { font-size: 0.92rem; }
.verif-cabeza { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.verif-hallazgos { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 10px; }
.verif-hallazgos li { background: var(--tarjeta-2); border: 1px solid var(--borde); border-left: 3px solid var(--ok); border-radius: 10px; padding: 10px 12px; }
.verif-hallazgos li.pendiente { border-left-color: var(--terracota-clara); }
.verif-etiquetas { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.verif-dice, .verif-debe { white-space: pre-wrap; line-height: 1.5; margin: 2px 0; }
.verif-dice span, .verif-debe span { color: var(--texto-2); font-size: 0.82rem; }
.verif-dice { color: var(--texto-2); text-decoration: line-through; text-decoration-color: rgba(196, 89, 59, 0.7); }
.verif-dice span { text-decoration: none; display: inline-block; }
.verif-lista { margin-top: 8px; }
.verif-lista summary { cursor: pointer; color: var(--texto-2); font-size: 0.88rem; }
.verif-lista ul { margin-top: 8px; }

/* ---------- Guía de inicio (Proyectos) ---------- */
.guia { margin-bottom: 16px; }
.guia summary { cursor: pointer; }
.guia summary small { margin-left: 6px; }
.guia-pasos { margin: 12px 0; padding-left: 22px; display: grid; gap: 6px; font-size: 0.92rem; color: var(--texto-2); }
.guia-pasos strong { color: var(--texto); }

/* ---------- Ajustes: estado del cerebro ---------- */
.cerebro-estado { display: grid; gap: 8px; margin-bottom: 14px; }
.cerebro-estado .fila { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--tarjeta-2); border: 1px solid var(--borde); border-radius: 8px; padding: 8px 12px; font-size: 0.92rem; }
.cerebro-estado .aviso { background: var(--terracota-suave); border: 1px solid rgba(196, 89, 59, 0.5); color: #ffd9cc; border-radius: 8px; padding: 8px 12px; font-size: 0.88rem; line-height: 1.45; }
.radios { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
input[type="radio"] { width: 18px; height: 18px; accent-color: var(--acento); vertical-align: -3px; margin-right: 8px; }

/* ---------- Hoja de contactos: imagen de referencia por escena ---------- */
.oculto-visual { position: absolute !important; left: 0; top: 0; width: 1px !important; height: 1px !important; opacity: 0; overflow: hidden; pointer-events: none; }
.escena { position: relative; }  /* contiene al campo de archivo oculto; si no, ensancha la página en el celular */
.ref-fila { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.ref-fila a.nota { font-size: 0.8rem; color: var(--acento); }

/* ---------- Ayuda flotante (chat con el cerebro) ---------- */
.ayuda-boton {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 45;
  appearance: none; border: 0; border-radius: 999px; padding: 12px 20px; min-height: 44px;
  background: var(--terracota); color: #fff; font: inherit; font-weight: 700; letter-spacing: 0.01em;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); cursor: pointer; transition: background 0.15s;
}
.ayuda-boton:hover { background: #d4663f; }
.ayuda-boton:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.ayuda-panel {
  position: fixed; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 46;
  width: min(400px, calc(100vw - 32px)); height: min(560px, calc(100vh - 110px));
  display: flex; flex-direction: column;
  background: var(--tarjeta); border: 1px solid var(--borde-2); border-radius: 14px; box-shadow: var(--sombra);
  overflow: hidden;
}
.ayuda-cabecera { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--borde); }
.ayuda-cabecera .nota { font-size: 0.8rem; }
.ayuda-mensajes { flex: 1; overflow: auto; padding: 12px; display: grid; gap: 8px; align-content: start; }
.ayuda-vacio { color: var(--texto-2); font-size: 0.88rem; line-height: 1.5; padding: 6px 4px; }
.msg { max-width: 88%; padding: 8px 12px; border-radius: 12px; font-size: 0.92rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.usuario { justify-self: end; background: var(--acento); color: #fff; border-bottom-right-radius: 4px; }
.msg.asistente { justify-self: start; background: var(--tarjeta-2); border: 1px solid var(--borde); border-bottom-left-radius: 4px; }
.msg.pensando { color: var(--texto-2); font-style: italic; }
.ayuda-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px; border-top: 1px solid var(--borde); background: var(--tarjeta); }
.ayuda-form textarea { flex: 1; min-height: 44px; max-height: 120px; resize: none; font-size: 0.92rem; }
@media (max-width: 759px) {
  .ayuda-boton { bottom: calc(74px + env(safe-area-inset-bottom)); right: 12px; padding: 11px 16px; }
  .ayuda-panel { right: 8px; left: 8px; width: auto; bottom: calc(128px + env(safe-area-inset-bottom)); height: min(520px, calc(100vh - 200px)); }
}
