/*
 * Erisen Studio — Apps (V2.0), folha de estilo das telas dos 10 Apps.
 * ============================================================================
 * Referência: `01_long_to_short.png` … `10_ai_film_director.png`.
 * Nenhuma cor é declarada aqui: tudo sai dos tokens de `tokens.css`, cujos
 * valores foram amostrados pixel a pixel desses mesmos PNGs.
 *
 * Medidas tiradas do mockup (1600x900), e não estimadas:
 *   sidebar 210px · barra do topo 64px · conteúdo começa em x=240
 *   coluna do Argos 316px · espaço entre colunas 22px
 *   card: borda 1px, raio ~14px, respiro 24px
 *   stepper: passo a cada 130px, círculo de 22px
 *
 * Uma diferença consciente: no PNG 01 a coluna de entrada tem 480px porque o
 * player ocupa mais; nos outros nove ela tem entre 265 e 336px. Aqui ela é
 * 320px nos dez — um App não pode ter largura de coluna diferente do outro só
 * porque o desenho de um deles respirava mais.
 */

.spatial-shell { border: 1px solid var(--border-soft); border-radius: 14px; background: var(--surface-1); margin: 18px 0; padding: 20px; }
.spatial-shell > summary { cursor: pointer; color: var(--text-primary); font-weight: 600; min-height: 32px; }
.spatial-editor { color: var(--text-primary); padding-top: 16px; }
.spatial-editor p { color: var(--text-secondary); line-height: 1.55; margin: 10px 0; }
.spatial-heading, .spatial-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.spatial-editor h2 { font-size: 21px; margin: 0; }
.spatial-editor h3 { font-size: 16px; margin: 12px 0; }
.spatial-editor label { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spatial-editor button, .spatial-editor select, .spatial-editor input { min-height: 44px; max-width: 100%; }
.spatial-editor button { border: 1px solid var(--border-soft); padding: 8px 12px; border-radius: 8px; white-space: normal; }
.spatial-editor button:focus-visible, .spatial-editor input:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 3px; }
.spatial-editor input:not([type=checkbox]), .spatial-editor select { background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border-strong); padding: 8px; border-radius: 8px; }
.spatial-form { display: grid; grid-template-columns: 2fr 1fr 1fr 2fr; gap: 12px; margin: 16px 0; }
.spatial-form label { display: grid; }
.spatial-workspace { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 18px; margin: 18px 0; }
.spatial-view { display: block; width: 100%; height: 450px; border: 1px solid var(--border-soft); border-radius: 12px; }
.spatial-elements { max-height: 430px; overflow: auto; display: grid; gap: 6px; }
.spatial-elements button { display: grid; text-align: left; gap: 3px; background: var(--surface-2); }
.spatial-elements span, .spatial-elements small { color: var(--text-secondary); }
.spatial-elements button[aria-pressed=true] { border-color: var(--accent-primary); }
.spatial-command { border-top: 1px solid var(--border-soft); padding-top: 12px; }
.spatial-command form { display: flex; flex-wrap: wrap; gap: 12px; }
.spatial-command form > label:first-child { flex: 1 1 100%; }
.spatial-command input[name=command] { flex: 1; min-width: 180px; }
.spatial-examples, .spatial-saved { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.spatial-proposal, .spatial-message { border: 1px solid var(--border-strong); padding: 14px; border-radius: 10px; margin: 12px 0; }
.spatial-proposal button { margin-right: 8px; }
.spatial-import { margin-top: 16px; }
.spatial-limit { font-size: 13px; }
.spatial-reference { margin: 20px 0; }
@media (max-width: 800px) { .spatial-form { grid-template-columns: 1fr 1fr; } .spatial-workspace { grid-template-columns: 1fr; } .spatial-view { height: 340px; } .spatial-elements { max-height: 230px; } }
@media (max-width: 480px) { .spatial-shell { padding: 12px; } .spatial-form { grid-template-columns: 1fr; } .spatial-view { height: 260px; } }

.app-screen {
  max-width: 1360px;
}
.app-back {
  border: 0;
  padding: 0;
  min-height: 28px;
  gap: 6px;
  color: var(--text-muted);
  font-size: var(--text-label-size);
  margin-bottom: 10px;
}
.app-back:hover {
  color: var(--text-primary);
  background: none;
}
.app-back .icon {
  width: 14px;
  height: 14px;
  transform: rotate(180deg);
}
.app-title {
  font-size: var(--text-h1-size);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.8px;
  margin: 0;
}
.app-tagline {
  color: var(--text-secondary);
  font-size: var(--text-body-size);
  margin: 6px 0 0;
}

/* ------------------------------------------------------------- stepper (§4) */
.app-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 56px;
  list-style: none;
  padding: 0;
  margin: 22px 0 26px;
}
.app-step {
  border: 0;
  background: none;
  padding: 0;
  min-height: 28px;
  gap: 10px;
  color: var(--text-secondary);
  font-size: var(--text-body-sm-size);
}
.app-step:hover {
  background: none;
  color: var(--text-primary);
}
.app-step-n {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: var(--text-label-size);
  font-weight: 600;
}
.app-step[data-state="current"] .app-step-n,
.app-step[data-state="done"] .app-step-n {
  background: var(--accent-primary);
  color: var(--accent-primary-ink);
}
/* Passo já cumprido continua lima no círculo, mas o rótulo não disputa
   atenção com o passo atual — só o atual fica branco e em negrito. */
.app-step[data-state="current"] {
  color: var(--text-primary);
  font-weight: 600;
}

/* --------------------------------------------------------------- 3 colunas */
.app-columns {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.app-card {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 24px;
}
.app-card > h2 {
  font-size: var(--text-h3-size);
  font-weight: 600;
  letter-spacing: -0.3px;
  margin: 0;
}
.app-card-hint {
  color: var(--text-secondary);
  font-size: var(--text-body-sm-size);
  margin: 6px 0 20px;
}
.app-col-input > h2 {
  margin-bottom: 16px;
}
.app-col-plan {
  display: flex;
  flex-direction: column;
  min-height: 560px;
}
.app-plan-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.app-col-cta {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.app-col-input {
  display: flex;
  flex-direction: column;
  min-height: 560px;
}
/* Etiqueta de Estimativa dentro do botão da rodada — ver `ctaEstimate()` em
   apps.js. É irmã de `.generate-estimate` (studio.css) e existe pelo mesmo
   motivo: o valor em reais aparece no botão, mas com rótulo e roupa próprios,
   para nunca ser lido como o valor que vai ser debitado. O valor COTADO, esse
   sim, é escrito no rótulo do botão ("Confirmar e produzir · até R$ X,XX"). */
.app-col-cta .btn-primary {
  flex-wrap: wrap;
  row-gap: 6px;
}
.cta-estimate {
  /* A coluna da esquerda tem 320px fixos nos dez Apps, então a etiqueta SEMPRE
     cabe melhor na própria linha — e é isso que ela faz, centrada sob o rótulo,
     em vez de disputar a mesma linha e quebrar de um App para o outro. A seta,
     quando existe, fica na primeira linha com o rótulo. */
  order: 2;
  flex-basis: 100%;
  justify-content: center;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  background: color-mix(in srgb, currentColor 16%, transparent);
  min-width: 0;
}
.cta-estimate small {
  /* `color: inherit` NÃO é redundante: o reset global tem `small { color:
     var(--muted) }`, e sem esta linha a palavra "ESTIMATIVA" saía cinza sobre o
     accent azul — reprovando contraste no lugar onde ela é a única coisa que
     impede a leitura "é isso que vou pagar". Achado olhando a captura, não o
     verde: o sweep de contraste roda com fixture sem preço, onde a etiqueta
     nem existe. */
  color: inherit;
  font-size: var(--text-label-size);
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.cta-estimate b {
  font-size: var(--text-label-size);
  font-weight: 600;
  white-space: nowrap;
}
.app-col-cta .btn-primary > .icon {
  order: 1;
}

/* ------------------------------------------------------- mídia de entrada */
.app-media {
  position: relative;
  height: 186px;
  border-radius: var(--radius-md);
  background: var(--surface-3);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.app-media.packshot {
  background: #14110c;
}
.app-play {
  width: 0;
  height: 0;
  border-left: 26px solid var(--text-primary);
  border-top: 16px solid transparent;
  border-bottom: 16px solid transparent;
}
.app-play.small {
  border-left-width: 13px;
  border-top-width: 8px;
  border-bottom-width: 8px;
}
.app-face {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: #9c7b68;
}
.app-face.big {
  width: 136px;
  height: 136px;
}
.app-media .app-face + .app-play {
  position: absolute;
  bottom: 26px;
}
.app-pack {
  width: 78px;
  height: 128px;
  background: #16130f;
  border: 1px solid #2c2419;
  display: grid;
  place-items: center;
  color: #c9a96a;
  font-size: var(--text-label-size);
  font-weight: 600;
  letter-spacing: 0.6px;
}
.app-media.wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 14px;
  height: 120px;
}
.app-media.wave i {
  flex: 1;
  min-width: 1px;
  background: #4d7fb8;
  border-radius: 1px;
}
.app-media.wave i[data-beat] {
  background: var(--accent-primary);
}
.app-source-meta {
  color: var(--text-secondary);
  font-size: var(--text-label-size);
  margin: 0 0 14px;
}
.app-source-meta.after {
  margin: 12px 0 0;
}
.app-doc {
  margin-top: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 16px;
  min-height: 118px;
}
.app-doc strong {
  display: block;
  font-size: var(--text-body-sm-size);
}
.app-doc small {
  color: var(--text-secondary);
  font-size: var(--text-label-size);
}
.app-url input {
  background: var(--surface-2);
  border-color: var(--border-soft);
  border-radius: var(--radius-md);
  font-size: var(--text-body-sm-size);
}
.app-url-go {
  margin-top: 12px;
  border-radius: var(--radius-md);
  min-height: 38px;
  padding: 0 20px;
  background: var(--surface-2);
}

/* projeto em andamento (App 10) */
.app-stages {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.app-stage {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 12px 14px;
  font-size: var(--text-body-sm-size);
}
.app-stage-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-muted);
  flex: none;
}
.app-stage[data-tone="success"] .app-stage-dot {
  background: var(--success);
}
.app-stage[data-tone="accent"] .app-stage-dot {
  background: var(--accent-primary);
}
.app-stage-status {
  margin-left: auto;
  color: var(--text-secondary);
  font-size: var(--text-label-size);
}
.app-stage[data-tone="success"] .app-stage-status {
  color: var(--success);
}
.app-stage[data-tone="accent"] .app-stage-status {
  color: var(--accent-primary-text);
}
.app-sections {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 16px;
}
.app-section {
  display: flex;
  justify-content: space-between;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 11px 14px;
  font-size: var(--text-body-sm-size);
}
.app-section span {
  color: var(--text-secondary);
  font-size: var(--text-label-size);
}

/* --------------------------------------------------------- campos e chips */
.app-field {
  margin-top: 22px;
}
.app-field-label {
  font-size: var(--text-body-sm-size);
  font-weight: 600;
  margin: 0 0 10px;
}
.app-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.app-chips.stacked,
.app-checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.app-chip {
  min-height: 34px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: var(--text-body-sm-size);
}
.app-chip:hover:not([aria-pressed="true"]) {
  background: var(--surface-3);
  color: var(--text-primary);
  border-color: var(--border-soft);
}
/* Chip ativo: contorno lima + fundo lima-escuro + texto lima. Os três valores
   são medidos no mockup (borda em y=535, fundo em (300,545)). */
.app-chip[aria-pressed="true"] {
  border-color: var(--accent-primary);
  background: var(--accent-primary-soft);
  color: var(--accent-primary-text);
  font-weight: 600;
}
.app-check {
  justify-content: flex-start;
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: var(--text-body-sm-size);
  gap: 10px;
}
.app-check-box {
  width: 14px;
  color: var(--success);
  font-size: var(--text-label-size);
  flex: none;
}
.app-check[aria-pressed="true"] {
  color: var(--text-primary);
}
.app-check[aria-pressed="false"] .app-check-box::before {
  content: "○";
  color: var(--text-muted);
}
.app-avatars {
  display: flex;
  gap: 10px;
}
.app-avatar {
  border: 0;
  background: none;
  padding: 0;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.app-avatar:hover {
  background: none;
}
.app-avatar-art {
  display: block;
  width: 58px;
  height: 58px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}
.app-avatar-art[data-art="0"] {
  background: #8a6a55;
}
.app-avatar-art[data-art="1"] {
  background: #66707e;
}
.app-avatar-art[data-art="2"] {
  background: #8c6a74;
}
.app-avatar small {
  color: var(--text-secondary);
  font-size: var(--text-label-size);
}
.app-avatar[aria-pressed="true"] .app-avatar-art {
  border-color: var(--accent-primary);
}
.app-avatar[aria-pressed="true"] small {
  color: var(--accent-primary-text);
}

/* ------------------------------------------------------ linhas do "Plano" */
.app-row {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 14px 16px;
  min-height: 0;
  color: inherit;
  font-weight: 400;
}
button.app-row:hover {
  background: var(--surface-3);
  border-color: var(--border-soft);
}
.app-row[data-on="1"] {
  border-color: var(--accent-primary);
}
.app-row-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.app-row-main strong {
  font-size: var(--text-body-size);
  font-weight: 600;
}
.app-row-main small {
  color: var(--text-secondary);
  font-size: var(--text-label-size);
}
.app-row-detail {
  color: var(--text-secondary);
  font-size: var(--text-label-size);
}
.app-row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex: none;
}
.app-score {
  color: var(--success);
  font-size: var(--text-label-size);
  font-weight: 600;
}
.app-tick,
.app-sel {
  color: var(--accent-primary-text);
  font-size: var(--text-label-size);
  font-weight: 600;
  min-height: 14px;
}
.app-thumb {
  width: 68px;
  height: 44px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  display: grid;
  place-items: center;
}
.app-tags {
  letter-spacing: 0.2px;
}
.app-n {
  color: var(--accent-primary-text);
  font-size: var(--text-label-size);
  font-weight: 600;
  min-width: 22px;
  flex: none;
}
.app-row.flat.block .app-n {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
}
.app-time {
  font-size: var(--text-label-size);
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 46px;
  flex: none;
}
.app-time.accent,
.accent {
  color: var(--accent-primary-text);
}
.app-tag {
  align-self: flex-start;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  padding: 3px 12px;
  font-size: var(--text-label-size);
  color: var(--text-secondary);
  margin-top: 4px;
}
.app-dur {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: var(--text-label-size);
  color: var(--text-secondary);
  flex: none;
}
.app-shot-sec {
  font-size: var(--text-body-sm-size);
  min-width: 68px;
  flex: none;
}
.app-row.flat.shot .app-row-detail {
  flex: 1;
}
.ok {
  color: var(--success);
  font-size: var(--text-label-size);
  font-weight: 500;
}
.app-row.flat.chapter .ok {
  align-self: flex-end;
}
.app-bar {
  width: 5px;
  height: 22px;
  border-radius: 3px;
  flex: none;
  background: var(--text-muted);
}
.app-bar[data-tone="success"] {
  background: var(--success);
}
.app-bar[data-tone="accent"] {
  background: var(--accent-primary);
}
.app-bar[data-tone="violet"] {
  background: #9d7bf0;
}
.app-bar[data-tone="info"] {
  background: #4fa8e0;
}
.app-link {
  border: 0;
  background: none;
  padding: 0;
  min-height: 0;
  color: var(--text-secondary);
  font-size: var(--text-label-size);
  flex: none;
}
.app-link:hover {
  color: var(--text-primary);
  background: none;
}
.app-preview {
  position: relative;
  height: 250px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}
.app-caption {
  position: absolute;
  bottom: 44px;
  background: rgba(255, 255, 255, 0.14);
  padding: 10px 18px;
  font-size: var(--text-h3-size);
  font-weight: 700;
  letter-spacing: 0.4px;
}
.app-kicker {
  color: var(--accent-primary-text);
  font-size: var(--text-label-size);
  font-weight: 600;
}
.app-pill-select {
  flex: none;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  padding: 6px 16px;
  font-size: var(--text-label-size);
  color: var(--text-secondary);
}
.app-row[data-on="1"] .app-pill-select {
  border-color: var(--accent-primary);
  color: var(--accent-primary-text);
  background: var(--accent-primary-soft);
}

/* grade 2x2 de keyframes / shots */
.app-grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.app-tile {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.app-tile strong {
  font-size: var(--text-body-sm-size);
  font-weight: 600;
}
.app-tile small {
  color: var(--text-secondary);
  font-size: var(--text-label-size);
}
.app-tile-art {
  display: block;
  height: 86px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.app-tile-art.wide {
  width: 140px;
  height: 66px;
  margin: 0;
  flex: none;
}
.app-tile-art[data-art="warm"] {
  background: #3a2620;
}
.app-tile-art[data-art="sand"] {
  background: #3a3227;
}
.app-tile-art[data-art="cool"] {
  background: #222b33;
}
.app-tile-art[data-art="ember"] {
  background: #33221f;
}
.app-tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.app-tile-foot b {
  font-size: var(--text-label-size);
}

/* tabela bilíngue (App 06) */
.app-table {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 4px 18px;
}
.app-tr {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: var(--text-body-sm-size);
  color: var(--text-secondary);
}
.app-tr:last-child {
  border-bottom: 0;
}
.app-tr.head {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--text-body-sm-size);
}
.app-tr.head .accent {
  font-weight: 600;
}

/* --------------------------------------------- etapas 1, 2, 4 e 5 (miolo) */
.app-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.app-list li {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 13px 16px;
  font-size: var(--text-body-sm-size);
  color: var(--text-secondary);
}
.app-list.check li::before {
  content: "✓";
  color: var(--success);
  margin-right: 10px;
  font-weight: 600;
}
.app-promise {
  color: var(--text-secondary);
  font-size: var(--text-body-sm-size);
  line-height: 1.6;
  margin: 16px 0 0;
}
/* Motion Designer (M4, 28/09): a prévia fica na coluna da decisão, antes de qualquer confirmação.
   Não usa aparência de alerta: é uma explicação revisável, não uma falha nem uma execução em curso. */
.app-motion-preview {
  display: grid;
  gap: 10px;
  margin: 2px 0 4px;
  padding: 14px;
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.app-motion-preview h3 { margin: 0; font-size: var(--text-body-size); }
.app-motion-preview p { margin: 0; color: var(--text-secondary); font-size: var(--text-label-size); line-height: 1.55; }
.app-motion-preview ul { display: grid; gap: 7px; margin: 0; padding-left: 20px; color: var(--text-secondary); font-size: var(--text-label-size); line-height: 1.5; }
.app-motion-preview li { overflow-wrap: anywhere; }
.app-decisions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.app-decision {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 14px 16px;
}
.app-decision-k {
  color: var(--text-secondary);
  font-size: var(--text-body-sm-size);
}
.app-decision strong {
  font-size: var(--text-body-sm-size);
  color: var(--accent-primary-text);
}
.app-costs {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 4px 18px;
}
.app-cost-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: var(--text-body-sm-size);
  color: var(--text-secondary);
}
.app-cost-row:last-child {
  border-bottom: 0;
}
.app-cost-row strong {
  color: var(--text-primary);
}
.app-gate {
  margin-top: 14px;
  border: 1px solid var(--accent-primary-line);
  border-radius: var(--radius-md);
  background: var(--accent-primary-soft);
  padding: 16px;
}
.app-gate strong {
  display: block;
  font-size: var(--text-body-sm-size);
  color: var(--accent-primary-text);
  margin-bottom: 4px;
}
.app-gate p {
  color: var(--text-secondary);
  font-size: var(--text-label-size);
  line-height: 1.6;
  margin: 0;
}
.app-disclaimer {
  color: var(--text-muted);
  font-size: var(--text-label-size);
  line-height: 1.6;
  margin: 14px 0 0;
}
.app-disclaimer code {
  font-family: var(--font-family-mono);
  font-size: var(--text-label-size);
}

/* ------------------------------------------------- Estimativa com Teto (§4) */
.app-estimate {
  margin-top: auto;
  padding-top: 20px;
}
.app-estimate-head,
.app-estimate-body {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.app-estimate-head {
  color: var(--text-secondary);
  font-size: var(--text-label-size);
}
.app-estimate-body {
  margin-top: 8px;
}
.app-estimate-body b {
  color: var(--accent-primary-text);
  font-size: var(--text-h1-size);
  font-weight: 700;
  letter-spacing: -0.6px;
}
.app-estimate-body span {
  color: var(--text-primary);
  font-size: var(--text-body-size);
  font-weight: 600;
}
.app-estimate.pending p {
  color: var(--text-muted);
  font-size: var(--text-label-size);
  line-height: 1.6;
  margin: 6px 0 0;
}
.app-estimate.pending > span {
  color: var(--text-secondary);
  font-size: var(--text-label-size);
}
.app-estimate.fixed {
  display: flex;
  justify-content: flex-end;
}
.app-estimate.fixed .btn-primary {
  min-height: 44px;
  padding: 0 26px;
  border-radius: var(--radius-md);
}
/* O bloco de Estimativa é o rodapé visual da coluna do Plano — no mockup ele
   fica destacado num quadro próprio dentro do card, não solto no fim. */
.app-col-plan > .app-estimate:not(.fixed) {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 18px 20px 20px;
  margin-top: 24px;
}

/* ------------------------------------------------------- painel do Argos */
.app-col-argos {
  padding: 20px;
  position: sticky;
  top: 20px;
}
.app-argos-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.app-argos-seal {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-primary);
  color: var(--accent-primary-ink);
  display: grid;
  place-items: center;
  font-size: 15px;
}
.app-argos-head strong {
  display: block;
  font-size: var(--text-h3-size);
  font-weight: 600;
}
.app-argos-head small {
  color: var(--text-secondary);
  font-size: var(--text-label-size);
}
.app-argos-quote {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 16px;
  color: var(--text-secondary);
  font-size: var(--text-body-sm-size);
  line-height: 1.55;
  margin: 0 0 12px;
}
.app-argos-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.app-argos-action {
  justify-content: flex-start;
  gap: 12px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: var(--text-body-sm-size);
  font-weight: 400;
}
.app-argos-action:hover {
  background: var(--surface-3);
  color: var(--text-primary);
  border-color: var(--border-soft);
}
.app-argos-action span {
  color: var(--text-muted);
}

/* ------------------------------------------------------------- a galeria */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.apps-card {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  min-height: 178px;
  padding: 20px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: var(--surface-1);
  font-weight: 400;
}
.apps-card:hover {
  background: var(--surface-2);
  border-color: var(--accent-primary-line);
}
.apps-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.apps-badge {
  border-radius: var(--radius-pill);
  background: var(--accent-primary-soft);
  color: var(--accent-primary-text);
  font-size: var(--text-label-size);
  font-weight: 600;
  padding: 4px 12px;
}
/* `.apps-risk` foi REMOVIDO em 16/09/2026 junto com o selo de risco dos
   cartões (auditoria UX §2.1). A regra saiu e não fica comentada:
   CSS órfão é convite para alguém remarcar o HTML e "consertar o estilo". A
   razão do produto está em `apps.js`, acima de `gallery()`. */
.apps-card strong {
  font-size: var(--text-body-lg-size);
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-top: 4px;
}
.apps-card small {
  color: var(--text-secondary);
  font-size: var(--text-label-size);
  line-height: 1.5;
}
/* A PORTA no cartão: o App que ainda não produz diz isso aqui, antes do clique.
   Usa --text-secondary e não --text-muted de propósito — não é rodapé, é a
   informação que muda a decisão de quem está escolhendo um App. Sem cor de
   alarme: o App funciona e é navegável; o que falta é a produção. */
.apps-card-door {
  color: var(--text-secondary);
  font-size: var(--text-label-size);
  line-height: 1.5;
  border-left: 2px solid var(--border-soft);
  padding-left: 10px;
  margin-top: 4px;
}
.apps-card-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: var(--text-label-size);
}
.apps-card-foot b {
  color: var(--text-primary);
  font-size: var(--text-body-sm-size);
}
.apps-filter {
  margin: -10px 0 16px;
  font-size: var(--text-body-sm-size);
}
.apps-note {
  color: var(--text-muted);
  font-size: var(--text-body-sm-size);
  line-height: 1.6;
  margin-top: 20px;
  max-width: 760px;
}

/* ----------------------------------------------------------- réguas menores
 * O mockup só existe em 1600px. Abaixo de 1280px o painel do Argos desce para
 * baixo do plano (ele é conselho, não controle — é a coluna que pode esperar);
 * abaixo de 900px tudo empilha. A ordem no empilhamento é Entrada → Plano →
 * Argos, que é a ordem da leitura, não a ordem do grid.
 */
@media (max-width: 1280px) {
  .app-columns {
    grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  }
  .app-col-argos {
    grid-column: 1 / -1;
    position: static;
  }
  .app-argos-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .app-argos-action {
    flex: 1 1 200px;
  }
}
@media (max-width: 900px) {
  .app-columns {
    grid-template-columns: minmax(0, 1fr);
  }
  .app-col-input,
  .app-col-plan {
    min-height: 0;
  }
  .app-steps {
    gap: 8px 24px;
  }
}
@media (max-width: 620px) {
  .app-title {
    font-size: var(--text-h1-size);
  }
  .app-card {
    padding: 18px;
  }
  .app-grid2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .app-tr {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
  .app-steps {
    gap: 4px 14px;
    margin: 14px 0 16px;
  }
  .app-step-l {
    font-size: var(--text-label-size);
  }
  /* Alvo de toque (20/09): passos (28px), chips (34px) e "Todos os Apps" (28px)
     eram menores que o dedo em todos os 16 Apps. 44px no elemento; o círculo
     do número e o texto continuam do mesmo tamanho. */
  .app-back,
  .app-step {
    min-height: 44px;
  }
  .app-chip,
  .app-check,
  .app-argos-action,
  .app-url-go {
    min-height: 44px;
  }
  /* 20/09 (revisão dos consertos): 44px de ALTURA não fazia o alvo. Medido em
     390 nos 16 Apps, os chips de número ("1", "3", "4", "6") ficavam com
     39,2 / 41,2 / 41,5 / 41,3 px de LARGURA em 6 Apps — 48 alvos abaixo de
     44px, e o próprio medidor da revisão (que
     reprova `w < 44 || h < 44`) já os apontava. O alvo é a caixa inteira. */
  .app-chip {
    min-width: 44px;
  }
  .app-link {
    min-height: 44px;
    padding: 0 8px;
  }
  .app-row {
    flex-wrap: wrap;
  }
  .app-tile-art.wide {
    width: 100%;
    height: 90px;
  }
  .app-estimate-body b {
    font-size: var(--text-h2-size);
  }
}

/* Estado honesto da etapa de Produção (ver apps.js). Não é um erro e não pode
   parecer um: é o produto explicando uma recusa deliberada de gastar. */
.app-pending {
  margin-top: 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 18px;
}
.app-pending strong {
  display: block;
  font-size: var(--text-body-sm-size);
  margin-bottom: 6px;
}
.app-pending p {
  color: var(--text-secondary);
  font-size: var(--text-label-size);
  line-height: 1.65;
  margin: 0;
}
.app-pending-next {
  margin-top: 10px !important;
  color: var(--accent-primary-text) !important;
}

/* Ação secundária da coluna de entrada ("Ver Character Bible"). Herdava
   .btn-quiet, que tem borda transparente, e no escuro virava texto solto sem
   parecer clicável — no mockup é um botão com contorno. */
.app-secondary {
  border-color: var(--border-soft);
  background: var(--surface-2);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  min-height: 42px;
}
.app-secondary:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

/* ==========================================================================
 * A TELA DO APP MOVIDA PELA RODADA (apps.js / app-runs.js)
 * --------------------------------------------------------------------------
 * Duas telas moram no mesmo desenho, e a diferença entre elas precisa ser
 * LEGÍVEL antes de qualquer decisão:
 *   · sem rodada — é a demonstração do App, e a faixa `.app-demo` diz isso;
 *   · com rodada — tudo que aparece é da pessoa, e o que ela não preencheu
 *     aparece apagado com "não informado", nunca com o exemplo do mockup.
 * Valor ausente é ESTADO, não defeito: cinza calmo, jamais vermelho de erro.
 * ========================================================================== */

.app-demo {
  border: 1px solid var(--border-soft);
  border-left: 2px solid var(--warning);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 12px 16px;
  margin: 0 0 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.app-demo p {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-label-size);
  line-height: 1.6;
  max-width: 72ch;
}
.app-demo strong {
  color: var(--warning);
}

/* Os campos da Entrada como a rodada os guardou. */
.app-run-inputs {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}
.app-run-input {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 12px 16px;
}
.app-run-input-k {
  color: var(--text-secondary);
  font-size: var(--text-label-size);
}
.app-run-input strong {
  font-size: var(--text-body-sm-size);
  color: var(--text-primary);
  text-align: right;
  overflow-wrap: anywhere;
}
/* "não informado" é verdade, e verdade não grita: fica apagado, não vermelho. */
.app-run-input.is-empty strong,
.app-decision.is-empty strong {
  color: var(--text-muted);
  font-style: italic;
}
.app-req {
  font-weight: 600;
  font-size: var(--text-label-size);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--warning);
}
.app-run-hint {
  color: var(--text-muted);
  font-size: var(--text-label-size);
  line-height: 1.6;
  margin: 10px 0 0;
}
/* Explicação da opção ESCOLHIDA num grupo de chips (§5.1: "Econômica — mais
   rápida e econômica para testes e rascunhos", etc.). Mais clara que a nota:
   ela responde "o que eu acabei de escolher?" e a nota é ressalva. Usa
   --text-secondary (7,6:1 sobre --surface-1), não --text-muted, porque é a
   frase que sustenta a escolha — não é rodapé. */
.app-field-hint {
  color: var(--text-secondary);
  font-size: var(--text-label-size);
  line-height: 1.5;
  margin: 8px 0 0;
}

/* O formulário que começa a rodada. */
.app-form {
  margin-top: 18px;
  border: 1px solid var(--accent-primary-line);
  border-radius: var(--radius-md);
  background: var(--accent-primary-soft);
  padding: 16px 18px;
  display: grid;
  gap: 12px;
}
.app-form .app-field-label {
  margin: 0;
}
.app-form-row {
  display: grid;
  gap: 6px;
}
.app-form-row > span {
  font-size: var(--text-label-size);
  color: var(--text-secondary);
}
.app-form-row input,
.app-form-row select {
  width: 100%;
  min-height: var(--control-height-md);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  color: var(--text-primary);
  padding: 0 12px;
  font-size: var(--text-body-sm-size);
}
.app-form-row input:focus-visible,
.app-form-row select:focus-visible {
  border-color: var(--accent-primary-line);
}

/* O motivo no lugar do botão: bloqueio não vira botão morto. */
.app-blocked-cta {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-label-size);
  line-height: 1.6;
  border-left: 2px solid var(--border-strong);
  padding-left: 10px;
}

/* Plano e aprovações vindos da rodada. */
.app-plan-section + .app-plan-section {
  margin-top: 18px;
}
.app-row.run-item {
  cursor: default;
}
.app-row.run-item[data-selected="1"] .app-tick {
  color: var(--accent-primary-text);
}
.app-approvals {
  margin-top: 18px;
}
.app-approvals .app-field-label {
  margin-bottom: 8px;
}

/* ============================================================================
 * ANEXO na Entrada (V2.3)
 * A regra de leitura deste bloco: o LIMITE aparece antes do botão, e o estado
 * (enviando, gravado, recusado) aparece embaixo, num `role=status` que o leitor
 * de tela anuncia. Descobrir o limite pela recusa é o desenho que faz a pessoa
 * desistir; por isso `.app-attach-rules` nunca fica escondido atrás de clique.
 * ========================================================================== */
.app-attach {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--surface-1);
}
.app-attach + .app-attach {
  margin-top: 10px;
}
.app-attach[data-state="ready"] {
  border-color: var(--accent-primary-line);
}
.app-attach[data-state="impossivel"] {
  background: none;
}
.app-attach > .app-field-label {
  margin: 0;
}
.app-attach-rules {
  margin: 0;
  font-size: var(--text-label-size);
  color: var(--text-muted);
  font-family: var(--font-family-mono);
  letter-spacing: 0.01em;
}
.app-attach-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.app-attach-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  min-width: 0;
}
.app-attach-item[data-opaque="1"] {
  border-style: dashed;
}
.app-attach-name {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
  text-align: left;
}
.app-attach-name strong {
  font-size: var(--text-label-size);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-attach-name small {
  font-size: var(--text-label-size);
  color: var(--text-muted);
}
.app-attach-remove {
  border: 0;
  background: none;
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  min-width: 32px;
  min-height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.app-attach-remove:hover {
  color: var(--text-primary);
}
.app-attach-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.app-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--control-height-md);
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: none;
  color: var(--text-primary);
  font-size: var(--text-label-size);
  cursor: pointer;
}
.app-attach-btn:hover {
  border-color: var(--accent-primary-line);
}
.app-attach-status:empty {
  display: none;
}
.app-attach-status {
  margin: 0;
  font-size: var(--text-label-size);
  line-height: 1.5;
  color: var(--text-secondary);
}
/* O motivo de não dar: fica no lugar do botão, nunca ao lado de um botão morto. */
.app-attach-blocked {
  margin: 0;
  font-size: var(--text-label-size);
  line-height: 1.6;
  color: var(--text-secondary);
  border-left: 2px solid var(--warning);
  padding-left: 10px;
}
.app-attach-loading {
  margin: 0;
  font-size: var(--text-label-size);
  color: var(--text-muted);
}
/* O seletor da Biblioteca abre ABAIXO do campo, não por cima: num celular um
   diálogo sobreposto esconde justamente o campo que se está preenchendo. */
.app-attach-picker {
  border-top: 1px solid var(--border-soft);
  padding-top: 8px;
}
.app-attach-options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}
.app-attach-option {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-primary);
  padding: 8px 10px;
  cursor: pointer;
  min-height: 44px;
}
.app-attach-option:hover {
  border-color: var(--accent-primary-line);
}
.app-attach-group {
  display: grid;
  gap: 10px;
}

/* ┌─ ORDEM DE PRODUÇÃO (o desenho de produção de Apps §7) — 16/09/2026 ────────┐
   │ Uma linha por entrega, com botão SÓ no que está `pronto`. Todo o resto     │
   │ mostra estado e motivo e não é clicável: botão aceso que leva a erro é     │
   │ defeito, e aqui cada clique é uma cobrança.                                │
   └────────────────────────────────────────────────────────────────────────────┘ */
.app-production { display:grid; gap:8px; margin-top:12px; }
.app-production-unit { display:grid; gap:6px; padding:10px; border:1px solid var(--border,#27272a); border-radius:8px; }
.app-production-unit[data-unit-state="concluido"] { border-color:var(--ok,#2f6f4f); }
.app-production-unit[data-unit-state="falhou"] { border-color:var(--bad,#7a3030); }
.app-production-head { display:flex; align-items:baseline; justify-content:space-between; gap:10px; }
.app-production-head strong { font-size:var(--text-label-size); font-weight:500; }
.app-production-state { font-size:var(--text-label-size); line-height:1; padding:4px 7px; border-radius:999px; border:1px solid var(--border,#27272a); white-space:nowrap; }
.app-production-state[data-tone="ok"] { border-color:var(--accent-primary,#3842fd); color:var(--accent-primary-text,#7b86ff); }
.app-production-state[data-tone="run"] { border-style:dashed; }
.app-production-state[data-tone="done"] { border-color:#2f6f4f; }
.app-production-state[data-tone="bad"] { border-color:#7a3030; }
.app-production-reason,.app-production-record { margin:0; font-size:var(--text-label-size); line-height:1.5; color:var(--text-muted,#848992); }
/* 23/09/2026 — A RESSALVA DE CADA ENTREGA (achado 5 da revisão da madrugada). Quieta de propósito:
   do tamanho do motivo, na cor apagada e SEM cor de aviso — nada está quebrado, a entrega sai. O fio
   à esquerda existe só para ela não ser lida como continuação do motivo de cima, que responde outra
   pergunta ("por que ainda não dá para produzir?"); esta responde "o que vou receber, exatamente?". */
.app-production-limit { margin:0; padding-left:9px; border-left:2px solid var(--border,#27272a); font-size:var(--text-label-size); line-height:1.5; color:var(--text-muted,#848992); }
.app-delivery-limits { margin-top:10px; }
.app-production-go,.app-production-retry,.app-production-download { min-height:38px; font-size:var(--text-label-size); justify-content:center; }
.app-production-go:disabled,.app-production-retry:disabled { opacity:.55; cursor:not-allowed; }
/* O FECHO DA RODADA (§13.1). Separado da lista por uma linha porque é uma decisão sobre a rodada
   INTEIRA, não sobre uma entrega — e a frase ao lado existe para dizer que concluir não cobra. */
.app-production-finish { display:grid; gap:6px; margin-top:12px; padding-top:12px; border-top:1px solid var(--border,#27272a); }
.app-production-finish-go { min-height:38px; font-size:var(--text-label-size); justify-content:center; }
.app-production-finish-go:disabled { opacity:.55; cursor:not-allowed; }
.app-production-finished { margin:12px 0 0; padding-top:12px; border-top:1px solid var(--border,#27272a); font-size:var(--text-label-size); line-height:1.5; color:var(--text-muted,#848992); }
/* Nota da capacidade opcional (§7.5): a frase é do servidor e fica ligada ao
   controle desabilitado por `aria-describedby`. */
.app-field-note { margin:6px 0 0; font-size:var(--text-label-size); line-height:1.5; color:var(--text-muted,#848992); }
@media (max-width:600px) { .app-production-go,.app-production-retry,.app-production-download,.app-production-finish-go { min-height:44px; } }

/* Revisão da fonte da narração, na coluna central da Entrada do Avatar Director. */
.app-scene-source { display:grid; gap:12px; min-width:0; margin-top:16px; padding-top:16px; border-top:1px solid var(--border); }
.app-scene-source h3,.app-scene-source h4 { margin:0; font-size:var(--text-body-size); line-height:1.4; }
.app-scene-source p { margin:0; font-size:var(--text-label-size); line-height:1.6; }
.scene-source-text { margin:0; padding:12px; max-height:16rem; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; font-size:var(--text-label-size); line-height:1.6; border:1px solid var(--border); border-radius:8px; }
.scene-source-choice { display:grid; gap:6px; font-size:var(--text-label-size); }
.scene-source-choice select { width:100%; max-width:100%; min-width:0; }
.scene-source-actions { display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-size:var(--text-label-size); }
.scene-source-actions button { min-width:0; flex:1 1 auto; white-space:normal; }
.scene-source-confirm { display:grid; gap:12px; padding:12px; border:1px solid var(--accent-primary); border-radius:8px; }
.scene-source-error { color:var(--text-primary); border-left:2px solid var(--accent-primary); padding-left:10px; }
.scene-source-timings { min-width:0; font-size:var(--text-label-size); }
.scene-source-timings summary { cursor:pointer; min-height:32px; }
.scene-source-words { max-height:14rem; overflow:auto; padding-left:28px; }
.scene-source-words li { padding:4px 0; overflow-wrap:anywhere; }
.scene-source-words small { display:block; font:inherit; color:var(--text-muted); }
@media (max-width:600px) { .app-scene-source button { min-height:44px; white-space:normal; } }
.app-scene-planner { display:grid; gap:16px; min-width:0; margin-top:20px; }
.app-scene-planner h3,.app-scene-planner h4 { margin:0; font-size:var(--text-body-size); }
.app-scene-planner p { margin:0; font-size:var(--text-label-size); line-height:1.6; }
.scene-plan-editor { border:0; padding:0; margin:0; min-width:0; display:grid; gap:16px; }
.scene-plan-words { padding:12px; border:1px solid var(--border); border-radius:8px; line-height:2.3; max-height:15rem; overflow:auto; }
.scene-plan-words button { display:inline; padding:4px 3px; background:transparent; color:var(--text-primary); border:0; border-radius:4px; font:inherit; overflow-wrap:anywhere; }
.scene-plan-words button[aria-pressed="true"] { color:var(--text-primary); background:var(--surface-3); font-weight:700; box-shadow:inset 0 -2px var(--accent-primary); }
.scene-plan-words button:focus-visible { outline:2px solid var(--accent-primary); outline-offset:2px; }
.scene-plan-beats { display:grid; gap:12px; max-height:28rem; overflow:auto; }
.scene-plan-beat { padding:12px; border:1px solid var(--border); border-radius:8px; display:grid; gap:8px; min-width:0; }
.scene-plan-beat p { max-height:6rem; overflow:auto; overflow-wrap:anywhere; }
.scene-plan-controls { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.scene-plan-controls label,.scene-plan-target { display:grid; gap:6px; font-size:var(--text-label-size); min-width:0; }
.scene-plan-controls select,.scene-plan-target input { min-width:0; width:100%; }
.scene-plan-target input { max-width:10rem; }
.scene-plan-result { display:grid; gap:16px; padding-top:16px; border-top:1px solid var(--border); min-width:0; }
.scene-plan-summary { display:flex; gap:8px; justify-content:space-between; flex-wrap:wrap; margin-bottom:12px; font-size:var(--text-label-size); }
.scene-plan-summary span { color:var(--text-muted); }
.scene-plan-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; min-width:0; }
.scene-plan-card { display:grid; align-content:start; gap:10px; padding:14px; border:1px solid var(--border); border-radius:10px; min-width:0; font-size:var(--text-label-size); }
.scene-plan-card-heading { display:flex; flex-wrap:wrap; justify-content:space-between; gap:6px; }
.scene-plan-card-heading span,.scene-plan-visual { color:var(--text-muted); }
.scene-plan-card .scene-plan-speech { font-size:var(--text-body-size); overflow-wrap:anywhere; }
.scene-plan-card dl { margin:0; display:grid; gap:8px; }
.scene-plan-card dl div { display:flex; gap:8px; justify-content:space-between; flex-wrap:wrap; }
.scene-plan-card dt { color:var(--text-muted); }
.scene-plan-card dd { margin:0; overflow-wrap:anywhere; }
.scene-plan-pending { padding-top:10px; border-top:1px solid var(--border); color:var(--text-muted); }
@media (max-width:700px) { .scene-plan-grid,.scene-plan-controls { grid-template-columns:1fr; } .app-scene-planner button { min-height:44px; white-space:normal; } }

/* Imagem inteira para revisão; aprovação sempre separada da escolha. */
.scene-keyframe { display:grid; gap:var(--space-3); padding-top:var(--space-3); border-top:1px solid var(--border); min-width:0; }
.scene-frame-state { color:var(--text-secondary); }
.scene-frame-state[data-state="frame_approved"] { color:var(--success); }
.scene-frame-preview { display:grid; gap:var(--space-2); margin:0; min-width:0; }
.scene-frame-preview img { display:block; width:100%; height:auto; max-height:320px; object-fit:contain; background:var(--surface-2); border-radius:var(--radius-sm); }
.scene-frame-preview figcaption { color:var(--text-muted); overflow-wrap:anywhere; font-size:var(--text-label-size); }
.scene-frame-preview a { display:inline-flex; align-items:center; min-height:44px; width:fit-content; }
.scene-frame-actions { display:flex; flex-wrap:wrap; gap:var(--space-2); }
.scene-keyframe button { min-height:44px; white-space:normal; }
.scene-frame-picker { display:grid; gap:var(--space-3); }
.scene-frame-picker label { display:grid; gap:var(--space-2); color:var(--text-secondary); }
.scene-frame-picker select { min-height:44px; width:100%; min-width:0; }
.scene-frame-error { color:var(--danger); overflow-wrap:anywhere; }
.scene-keyframe :is(button,select,a):focus-visible { outline:2px solid var(--accent); outline-offset:3px; }

/* 22/09/2026 — entregas que o servidor declara indisponíveis, com o motivo. */
.app-outputs-off { margin-top: 12px; padding: 12px 16px; border: 1px dashed var(--border); border-radius: 10px; color: var(--text-secondary); font-size: var(--text-body-sm-size); }
.app-outputs-off ul { margin: 6px 0 0; padding-left: 18px; }
.app-output-note { display: block; font-size: .92em; color: var(--text-muted); margin-top: 2px; }

/* 22/09/2026 (A17/P1.9) — O QUE A PRODUÇÃO NÃO ENTREGA. Mesmo desenho da porta, com o fio em
   --warning: o App produz (não é o aviso de "não produz"), mas entrega menos do que o nome sugere,
   e é isso que muda a decisão de quem vai pagar. Não é cor de erro: nada está quebrado. */
.apps-card-limit {
  color: var(--text-secondary);
  font-size: var(--text-label-size);
  line-height: 1.5;
  border-left: 2px solid var(--warning);
  padding-left: 10px;
  margin-top: 4px;
}
.app-limit-line { border-left: 2px solid var(--warning); padding-left: 10px; }
.app-limit {
  margin-top: 16px;
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-md);
  background: var(--warning-soft);
  padding: 14px 16px;
}
.app-limit strong { display: block; font-size: var(--text-body-sm-size); margin-bottom: 6px; }
.app-limit p { color: var(--text-secondary); font-size: var(--text-label-size); line-height: 1.6; margin: 0; }

/* 22/09/2026 — A HOME DO APP (PRD §33). Um cartão acima das etapas: os caminhos, os modelos de
   direção e as rodadas da conta. Alvos de toque de 44 px, como no resto dos Apps. */
.app-home {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  padding: 18px;
  margin: 0 0 20px;
  display: grid;
  gap: 14px;
}
.app-home h2 { margin: 0; font-size: var(--text-body-size, 1rem); line-height: 1.4; }
.app-home-ctas { display: flex; flex-wrap: wrap; gap: 10px; }
.app-home-ctas button { min-height: 44px; }
.app-home-paths { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.app-home-path {
  display: grid; gap: 4px; text-align: left; min-height: 44px;
  border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  background: var(--surface-2); color: var(--text-primary); padding: 12px 14px; cursor: pointer;
}
.app-home-path small { color: var(--text-secondary); line-height: 1.5; }
.app-home-path[aria-pressed="true"] { border-color: var(--accent-primary); background: var(--accent-primary-soft); }
.app-home-group { margin-top: 6px; }
/* A recotação do que falta: mesmo desenho do bloco de custo, com o botão de autorizar. */
.app-requote { margin-top: 14px; display: grid; gap: 8px; }
.app-requote button { min-height: 44px; justify-self: start; }

/* ------------------------------------------------------------- capas (22/09/2026)
   Cartão da galeria: a capa sangra até a borda do cartão (`margin` negativa igual ao padding), e o
   texto segue embaixo como antes. Cabeçalho do App: faixa larga e baixa com o nome por cima, no
   canto inferior esquerdo — a cena foi pedida com esse canto escuro e calmo; o gradiente garante
   o contraste mesmo quando a arte clareia. */
.apps-card[data-cover] {
  padding-top: 0;
  overflow: hidden;
}
.apps-card-cover {
  display: block;
  margin: 0 -20px 6px;
  aspect-ratio: 2 / 1;
  background: var(--surface-2);
  overflow: hidden;
  border-bottom: 1px solid var(--border-soft);
}
.apps-card-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}
.apps-card[data-cover]:hover .apps-card-cover img {
  transform: scale(1.03);
}
.app-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 220px;
  margin: 2px 0 4px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-1);
}
.app-hero-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 45%;
}
.app-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(6, 8, 11, 0.92) 0%, rgba(6, 8, 11, 0.55) 45%, rgba(6, 8, 11, 0.05) 100%),
    linear-gradient(90deg, rgba(6, 8, 11, 0.7) 0%, rgba(6, 8, 11, 0) 60%);
}
.app-hero-copy {
  position: relative;
  z-index: 1;
  padding: 24px 28px;
  max-width: 720px;
  min-width: 0;
}
.app-hero .app-tagline {
  color: var(--text-primary);
  opacity: 0.86;
}
@media (prefers-reduced-motion: reduce) {
  .apps-card-cover img { transition: none; }
  .apps-card[data-cover]:hover .apps-card-cover img { transform: none; }
}
@media (max-width: 620px) {
  .apps-card-cover {
    margin: 0 -20px 4px;
  }
  .app-hero {
    min-height: 168px;
  }
  .app-hero-copy {
    padding: 18px 16px;
  }
}

/* UX2 — ação principal em duas colunas; retomada e ajuda sob demanda. */
.app-toolbar { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:12px; }
.app-toolbar .app-back { margin:0; min-height:44px; }
.app-drafts.runs-open { position:relative; flex:none; padding:0; margin:0; background:none; border:0; }
.app-drafts>summary { cursor:pointer; min-height:44px; display:flex; align-items:center; gap:8px; padding:8px 12px; list-style:none; color:var(--text-secondary); border:1px solid var(--border-soft); border-radius:var(--radius-sm); }
.app-drafts>summary::-webkit-details-marker { display:none; }
.app-drafts-body { position:absolute; right:0; top:100%; z-index:20; width:360px; max-width:calc(100vw - 48px); padding:16px; background:var(--surface-1); border:1px solid var(--border-soft); border-radius:var(--radius-lg); }
.app-drafts-body h2 { font-size:var(--text-body-size); margin:0 0 12px; }
.app-drafts-body .runs-item { min-height:44px; }
.app-help { grid-column:1/-1; padding:0; }
.app-help>summary,.app-security-details>summary { cursor:pointer; min-height:44px; padding:12px 16px; color:var(--text-secondary); font-size:var(--text-body-size); }
.app-help-body { padding:0 24px 24px; }
.app-help:not([open]) { background:none; border-color:var(--border-soft); }
.app-help .app-argos-actions { display:flex; flex-wrap:wrap; gap:8px; }
.app-help .app-argos-action { width:auto; min-height:44px; }
.app-drafts>summary:focus-visible,.app-help>summary:focus-visible,.app-security-details>summary:focus-visible { outline:2px solid var(--text-primary); outline-offset:2px; }
.app-security-details { margin-top:16px; }
.app-hero { min-height:96px; }
@media(max-width:900px) { .app-columns { grid-template-columns:minmax(0,1fr); } }
