/* Recepta · Automatizaciones (automatizaciones.js). Solo tokens: la frase se lee de corrido y cada parte es una lista. */
.au-lista { list-style: none; margin: 0 0 var(--esp-5); padding: 0; display: grid; gap: var(--esp-3); }
.au-item { display: grid; gap: var(--esp-2); border-left: 4px solid var(--perla); }
.au-item.prendida { border-left-color: var(--menta); }
.au-item-cab { display: flex; align-items: center; justify-content: space-between; gap: var(--esp-3); flex-wrap: wrap; }
.au-item-cab h2 { margin: 0; font-size: var(--texto-grande); overflow-wrap: anywhere; min-width: 0; }
.au-frase-texto { margin: 0; color: var(--tinta); overflow-wrap: anywhere; }
.au-item-pie { margin: 0; color: var(--pizarra); font-size: var(--texto-chico); display: flex; flex-wrap: wrap; gap: var(--esp-2); }
.au-error { color: var(--error); overflow-wrap: anywhere; }
.au-item .acciones { flex-wrap: wrap; }

/* Interruptor prendida / pausada */
.au-interruptor { display: inline-flex; align-items: center; gap: var(--esp-2); cursor: pointer; min-height: 44px; position: relative; }
.au-interruptor input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.au-interruptor span { width: 44px; height: 26px; border-radius: var(--radio-pildora); background: var(--perla); position: relative; transition: background var(--rapido) var(--curva); flex: none; }
.au-interruptor span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--hoja); box-shadow: var(--sombra); transition: transform var(--rapido) var(--curva); }
.au-interruptor input:checked + span { background: var(--menta); }
.au-interruptor input:checked + span::after { transform: translateX(18px); }
.au-interruptor input:focus-visible + span { outline: 2px solid var(--foco); outline-offset: 2px; }
.au-interruptor input:disabled + span { opacity: 0.5; }
.au-interruptor b { font-size: var(--texto-chico); color: var(--pizarra); }

/* Plantillas */
.au-plantillas h2 { margin: 0 0 var(--esp-1); font-size: var(--texto-grande); }
.au-plantillas-grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: var(--esp-3); margin-top: var(--esp-3); }
.au-plantilla { display: grid; gap: var(--esp-1); padding: var(--esp-4); border: 1px solid var(--perla); border-radius: var(--radio-tarjeta); background: var(--hoja); color: var(--tinta); text-decoration: none; box-shadow: var(--sombra); min-width: 0; }
.au-plantilla:hover { border-color: var(--cobalto); }
.au-plantilla:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }
.au-plantilla span { font-size: var(--texto-grande); }
.au-plantilla small { color: var(--pizarra); overflow-wrap: anywhere; }

/* Editor: la frase */
.au-editor { display: grid; gap: var(--esp-4); }
.au-nombre { max-width: 480px; }
.au-frase { display: grid; gap: var(--esp-3); }
.au-parte { display: flex; flex-wrap: wrap; align-items: center; gap: var(--esp-2); padding: var(--esp-3); border-radius: var(--radio); background: var(--niebla); border-left: 4px solid var(--cobalto); min-width: 0; }
.au-y { border-left-color: var(--ambar); align-items: flex-start; }
.au-entonces { border-left-color: var(--menta); align-items: flex-start; }
.au-palabra { font-weight: var(--peso-titulo); font-size: var(--texto-grande); min-width: 88px; }
.au-parte select, .au-parte input, .au-parte textarea { max-width: 100%; min-width: 0; }
.au-num { width: 80px; }
.au-ayuda { flex-basis: 100%; color: var(--pizarra); font-size: var(--texto-chico); }
.au-filas { display: grid; gap: var(--esp-2); flex: 1 1 280px; min-width: 0; }
.au-fila { display: flex; flex-wrap: wrap; align-items: center; gap: var(--esp-2); padding: var(--esp-2); background: var(--hoja); border: 1px solid var(--perla); border-radius: var(--radio-chico); min-width: 0; }
.au-icono { flex: none; width: 28px; text-align: center; }
.au-valor { display: inline-flex; align-items: center; gap: var(--esp-1); min-width: 0; }
.au-valor i { font-style: normal; color: var(--pizarra); }
.au-valor input { width: 140px; }
.au-quitar { margin-left: auto; min-width: 40px; }
.au-mas { justify-self: start; }
.au-nada { padding: var(--esp-2) 0; }
.au-mensaje { flex-basis: 100%; display: grid; gap: var(--esp-2); }
.au-mensaje textarea { width: 100%; }
.au-palabras { display: flex; flex-wrap: wrap; gap: var(--esp-1); }
.au-palabras button { min-height: 32px; padding: 0 var(--esp-2); font-size: var(--texto-mini); border-radius: var(--radio-pildora); background: var(--cobalto-suave); color: var(--tinta); border: 0; }
.au-leida { margin: 0; padding: var(--esp-3); border-radius: var(--radio); border: 1px dashed var(--perla); color: var(--tinta); font-size: var(--texto-grande); overflow-wrap: anywhere; }
.au-botones { justify-content: flex-end; flex-wrap: wrap; margin: var(--esp-3) 0; }

/* Prueba */
.au-prueba h2 { margin: 0 0 var(--esp-2); font-size: var(--texto-grande); }
.au-prueba h2 small { color: var(--pizarra); font-weight: var(--peso-normal); font-size: var(--texto-chico); }
.au-resumen-prueba { padding: var(--esp-2) var(--esp-3); border-radius: var(--radio-chico); margin: 0 0 var(--esp-2); }
.au-resumen-prueba.si { background: var(--si-suave); }
.au-resumen-prueba.no { background: var(--ambar-suave); }
.au-resultados { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--esp-2); }
.au-resultados > li { padding: var(--esp-2) var(--esp-3); border-radius: var(--radio-chico); border: 1px solid var(--perla-suave); overflow-wrap: anywhere; }
.au-resultados > li.cumple { border-color: var(--menta); }
.au-resultados > li.no-cumple { color: var(--pizarra); }
.au-resultados > li small { display: block; }
.au-resultados ul, .au-pasos { list-style: none; margin: var(--esp-1) 0 0; padding: 0; display: grid; gap: var(--esp-1); font-size: var(--texto-chico); }
.au-resultados .mal, .au-pasos .mal { color: var(--error); }
.au-pasos .espera { color: var(--ambar-texto); }
.au-pasos li, .au-resultados ul li { overflow-wrap: anywhere; }

/* Historial */
.au-historial { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--esp-3); }
.au-h-cab { display: flex; flex-wrap: wrap; align-items: center; gap: var(--esp-2); }
.au-h-cab b { overflow-wrap: anywhere; }
.au-h-cab small { color: var(--pizarra); margin-left: auto; }
.au-h-registro { margin: var(--esp-1) 0 0; overflow-wrap: anywhere; }

/* Aprobaciones */
.au-subtitulo { font-size: var(--texto-grande); margin: var(--esp-5) 0 var(--esp-2); display: flex; align-items: center; gap: var(--esp-2); }
.au-aprobaciones { display: grid; gap: var(--esp-3); grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); }
.au-aprobar { display: grid; gap: var(--esp-2); align-content: start; }
.au-aprobar header { display: flex; align-items: flex-start; gap: var(--esp-2); }
.au-aprobar header div { display: grid; min-width: 0; flex: 1; }
.au-aprobar header b, .au-aprobar p { overflow-wrap: anywhere; margin: 0; }
.au-aprobar header small { color: var(--pizarra); font-size: var(--texto-chico); }
.au-monto { font-family: var(--fuente-numeros); white-space: nowrap; }
.au-decidir { justify-content: flex-end; flex-wrap: wrap; }
.au-motivo[hidden] { display: none; }
.au-motivo { display: flex; gap: var(--esp-2); flex-wrap: wrap; }
.au-motivo input { flex: 1 1 200px; min-width: 0; }
.au-decididas { list-style: none; margin: 0; padding: var(--esp-2) var(--esp-3); display: grid; }
.au-decididas li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--esp-2); padding: var(--esp-2) 0; border-bottom: 1px solid var(--perla-suave); }
.au-decididas li:last-child { border-bottom: 0; }
.au-decididas b { overflow-wrap: anywhere; min-width: 0; }
.au-decididas small { color: var(--pizarra); }

@media (max-width: 760px) {
  .au-palabra { min-width: 0; flex-basis: 100%; }
  .au-fila > select { flex: 1 1 160px; }
  .au-botones { margin-bottom: 72px; }
  .au-botones > * { flex: 1 1 auto; }
  .au-h-cab small { margin-left: 0; flex-basis: 100%; }
}
