/* Pantalla «Ejecuciones» (ejecuciones.js): filtros, la lista y el panel con el detalle sobre el tablero. */

/* La lista necesita el ancho de la bandeja. */
[data-shown="executions"] > main.wide { max-width: 72rem; }

.exec-filters { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; margin: 1rem 0; }
.exec-filters label { display: flex; flex-direction: column; gap: 0.25rem; min-width: 9rem; }
/* Cuántas respuestas de la IA no se pudieron usar: un aviso, no un error. */
.exec-invalid { margin: -0.25rem 0 0.75rem; padding-left: 0.6rem; border-left: 3px solid #c8891d; }

.exec-list { display: flex; flex-direction: column; border-top: 1px solid #8883; }
.exec-row {
  display: grid; grid-template-columns: 5.5rem minmax(9rem, 1.3fr) minmax(5rem, 0.7fr) 9.5rem 3.5rem minmax(8rem, 1.6fr);
  gap: 0.75rem; align-items: center; text-align: left; padding: 0.55rem 0.5rem; border: none; border-bottom: 1px solid #8883;
  border-radius: 0; background: none; font: inherit; color: inherit; cursor: pointer;
}
.exec-row:hover, .exec-row:focus-visible { background: #8881; }
.exec-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exec-bot { font-weight: 600; }
.exec-when, .exec-duration, .exec-trigger { color: #888; font-size: 0.9em; }
.exec-detail.is-error, .exec-error { color: oklch(0.52 0.19 25); }
#exec-more { margin-top: 0.75rem; }

.exec-status { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.85em; background: #8882; }
.exec-status.is-success { background: oklch(0.9 0.08 150); color: oklch(0.35 0.1 150); }
.exec-status.is-error { background: oklch(0.9 0.07 25); color: oklch(0.42 0.16 25); }
.exec-status.is-running, .exec-status.is-queued { background: oklch(0.9 0.06 250); color: oklch(0.4 0.12 250); }
.exec-status.is-waiting { background: oklch(0.92 0.08 80); color: oklch(0.42 0.1 70); }

.exec-panel { width: min(72rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); border: 1px solid #8886; border-radius: 12px; padding: 1rem 1.25rem; }
.exec-panel::backdrop { background: #0005; }
.exec-panel-head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.exec-panel-head > div { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.exec-error { margin: 0.25rem 0; overflow-wrap: anywhere; }
.exec-board { height: min(60vh, 34rem); margin: 0.75rem 0; }
/* En solo lectura no hay nada que guardar. */
.exec-board .board-saved { display: none; }
.exec-steps { width: 100%; font-size: 0.9em; }
.exec-steps td { padding: 0.25rem 0.5rem; vertical-align: top; overflow-wrap: anywhere; }

/* En el celular: cada ejecución es una tarjeta y el panel ocupa la pantalla. */
@media (max-width: 720px) {
  .exec-row { grid-template-columns: 1fr auto; grid-template-areas: 'status when' 'bot bot' 'trigger trigger' 'detail detail'; row-gap: 0.2rem; }
  .exec-row > .exec-status { grid-area: status; justify-self: start; }
  .exec-bot { grid-area: bot; }
  .exec-trigger { grid-area: trigger; }
  .exec-when { grid-area: when; text-align: right; }
  .exec-duration { display: none; }
  .exec-detail { grid-area: detail; white-space: normal !important; }
  .exec-filters label { min-width: calc(50% - 0.5rem); flex: 1; }
  .exec-panel { margin: 0; width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
  .exec-board { height: 50vh; }
}
