/* ==========================================================================
   View: Campaña, stage 4 - Revisar y lanzar (SPEC 3.2.4) and its launch review dialog. Owner: slice S5. Adapted from the prototype's "Review & launch" section
   and the .sum rules of its dialogs.css.
   Rules (SPEC 16.9): tokens only, no !important, breakpoints 761 and 1100, selectors at most three compounds deep, no :has().
   Everything here is prefixed by what it draws (launch-, check, will, opts, sum, issues) and scoped to #stage-lanzar or #campaignReviewModal, so no other
   stage can pick it up by accident.
   ========================================================================== */

/* ---------- the two columns ---------- */
/* Side by side only when each column keeps a readable width: from 1100 px the rail (252) and the route column (292) leave about 480 px, too narrow for a pair;
   the columns stack there and pair up once there is room (about 1320 px). An intrinsic grid, not one more breakpoint (SPEC 16.9 allows only 761 and 1100). */
@media (min-width: 1100px) {
  #stage-lanzar .stage-grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); }
}
#stage-lanzar .inline-status:empty { display: none; }
#stage-lanzar .inline-status { flex-wrap: wrap; align-items: center; }
#stage-lanzar .inline-status__text { flex: 1 1 calc(100% - 28px); }       /* the sentence takes the line, Reintentar and Copiar detalle wrap under it */

/* ---------- the launch panel: one box, four states ---------- */
.launch-box { display: grid; gap: var(--sp-4); padding: var(--sp-5); border-radius: var(--r-xl); border: 1px solid var(--accent-line); background: radial-gradient(120% 120% at 100% 0%, var(--accent-soft), transparent 55%), linear-gradient(180deg, var(--hero-top), var(--hero-bottom)); }
.launch-box[data-state="blocked"] { border-color: var(--line-strong); background: var(--s1); }
.launch-box[data-state="paused"] { border-color: var(--warn-line); }
.launch-box__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.launch-box h2 { font-size: var(--fs-xl); }
.launch-box__lead { color: var(--ink-2); }
.launch-box__lead b { color: var(--ink); }
.launch-box__status { font-size: var(--fs-sm); color: var(--ink-2); }
.launch-run { display: grid; gap: 8px; }
.launch-run__text { display: flex; justify-content: space-between; gap: 12px; font-size: var(--fs-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.launch-run__text b { color: var(--ink); }
.launch-run__meta { font-size: var(--fs-sm); color: var(--muted); }
.launch-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.launch-actions > .btn { flex: 1 1 200px; }
.launch-box > .why { align-items: center; }
.launch-box > .why .icon { color: var(--info); margin-top: 0; }

/* ---------- Antes de lanzar: six check rows ---------- */
.checks { display: grid; }
.checks .check { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; min-height: 68px; padding: 12px 0; }
.checks .check + .check { border-top: 1px solid var(--line); }
.check__mark { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.check__mark .icon { width: 18px; height: 18px; stroke-width: 3; }
.check--todo .check__mark { background: var(--s2); color: var(--warn); border: 2px dashed var(--warn-line); }
.check--note .check__mark { background: var(--info-soft); color: var(--info); border: 2px solid var(--info-line); }
.check__title { font-weight: 650; }
.check__sub { font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.check .btn { white-space: nowrap; }

/* ---------- Qué pasará al lanzar ---------- */
.will { display: grid; gap: 10px; }
.will li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; color: var(--ink-2); }
.will .icon { color: var(--accent); margin-top: 3px; }
.will .num { white-space: nowrap; }
.launch-rate { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.launch-rate__k { font-size: var(--fs-sm); color: var(--muted); }
.launch-rate__v { font-weight: 700; }
.launch-rate__note { grid-column: 1 / -1; display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-sm); color: var(--muted); }
.launch-rate__note .icon { color: var(--info); margin-top: 2px; }

/* ---------- Opciones de la campaña ---------- */
.launch-opts .acc__value { overflow-wrap: anywhere; }
.opts > .switch-row { border-top: 1px solid var(--line); }
.opts > .switch-row:first-child { border-top: 0; }
/* the legacy compat rule of view-campana.css (:where(main) input[type="checkbox"] { width: 22px }) outranks .switch: put the real size back for this stage */
#stage-lanzar .switch { width: 52px; height: 32px; }
.switch[aria-disabled="true"], .range[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.switch-row[aria-busy="true"] { opacity: .8; }
#stage-lanzar .field__label b { color: var(--accent); }

/* ---------- the launch review dialog ---------- */
#campaignReviewNotes:empty { display: none; }
#campaignReviewModal .issues { display: grid; gap: 8px; margin-top: 6px; }
#campaignReviewModal .issues li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
/* the core pulls every button of an .alert 6px out of its row (.alert .btn, for a button beside a title); here each row is a sentence and its fix, so the 44 px button
   takes its own height and two fixes in a column never touch */
#campaignReviewModal .issues .btn { margin-block: 0; }
#campaignReviewModal .issues__text { flex: 1 1 200px; }
#campaignReviewModal .alert > span:last-child:empty { display: none; }
#campaignReviewModal .sum { display: grid; }
#campaignReviewModal .sum__row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start; padding: 12px 0; }
#campaignReviewModal .sum__row + .sum__row { border-top: 1px solid var(--line); }
#campaignReviewModal .sum__row .row__icon { width: 36px; height: 36px; border-radius: 10px; }
#campaignReviewModal .sum__k { font-size: var(--fs-sm); color: var(--muted); }
#campaignReviewModal .sum__v { font-weight: 650; overflow-wrap: anywhere; }
#campaignReviewModal .sum__v small { display: block; font-weight: 400; color: var(--muted); font-size: var(--fs-sm); }
#campaignReviewModal .dialog__foot .btn { white-space: normal; }
/* the reason the confirm is off sits in the footer, which never scrolls away: the line takes the whole first row, the buttons the next one */
#campaignReviewModal .dialog__foot { flex-wrap: wrap; }
#campaignReviewWhy { flex: 1 0 100%; align-items: center; }
#campaignReviewWhy .icon { color: var(--info); margin-top: 0; }
/* a sheet on a phone at 200% text: the two footer buttons share the row while they fit and stack when they do not (a button is never wider than the sheet) */
@media (max-width: 760px) {
  #campaignReviewModal .dialog__foot .btn { flex: 1 1 150px; min-width: 0; }
}

/* ---------- a refusal beside the buttons of the Inicio hero (SPEC 8.1, 37-error-en-su-sitio) ---------- */
/* Inicio calls Pausar, Reanudar, Parar and the launch without saying which button it was, so runControl puts a line (.launch-slot) between the facts and the hero's
   buttons, the place the prototype draws it. It is a box like the prototype's alert; the sentence takes the line, Reintentar wraps under it. */
.launch-slot { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 8px; margin: 0; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--danger-line); background: var(--danger-soft); color: var(--ink); font-size: var(--fs-sm); }
.launch-slot:empty { display: none; }
.launch-slot .icon { margin-top: 2px; color: var(--danger); }
.launch-slot .inline-status__text { flex: 1 1 calc(100% - 28px); }
.launch-slot .inline-status__text > span:first-child { font-weight: 700; }      /* what failed, like the title of the prototype's alert */
