/* Construtor de modelos (construa-um-modelo.qmd). Cores do styles.css. */
.cm {
  --cm-num: #1c6e8c;
  --cm-fator: #a15e3f;
  margin: 1.5rem 0;
}
.cm-grade-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .cm-grade-layout { grid-template-columns: minmax(0, 1fr); }
}
.cm-painel, .cm-resultado {
  background: var(--bsl-bg-card, #fff);
  border: 1px solid var(--bsl-border, #e3dccd);
  border-radius: 8px;
  padding: 1rem 1.1rem;
}
.cm-painel { position: sticky; top: 4.5rem; }
@media (max-width: 900px) { .cm-painel { position: static; } }
.cm-rot {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--bsl-muted, #6c757d);
  margin: .9rem 0 .35rem;
}
.cm-painel > .cm-rot:first-child { margin-top: 0; }
.cm-nota { font-size: .85rem; color: var(--bsl-muted, #6c757d); margin: .35rem 0 0; }
.cm-hipotese, .cm-select { font-size: .92rem; }

/* fichas */
.cm-pool, .cm-zona-chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.cm-pool {
  min-height: 2.6rem;
  padding: .45rem;
  border-radius: 6px;
  background: var(--bsl-bg-soft, #f3eee3);
}
.cm-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .28rem .6rem;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  background: #fff;
  font: inherit;
  font-size: .88rem;
  cursor: grab;
  line-height: 1.2;
}
.cm-chip:active { cursor: grabbing; }
.cm-chip:focus-visible { outline: 3px solid var(--bsl-accent, #1c6e8c); outline-offset: 2px; }
.cm-num { color: var(--cm-num); }
.cm-fator { color: var(--cm-fator); }
.cm-chip-nome { font-family: var(--bs-font-monospace, monospace); color: var(--bs-body-color, #2d3748); }
.cm-chip-tipo { font-size: .7rem; font-weight: 600; text-transform: uppercase; }
.cm-x { font-size: 1rem; line-height: 1; color: var(--bsl-muted, #6c757d); }
.cm-mini { padding: 0 .4rem; font-size: .7rem; cursor: default; font-weight: 600; }
.cm-legenda-tipos { font-size: .8rem; color: var(--bsl-muted, #6c757d); margin-top: .35rem; }

/* caixas */
.cm-zona {
  border: 2px dashed var(--bsl-border, #e3dccd);
  border-radius: 8px;
  padding: .5rem .6rem .6rem;
  transition: border-color .15s, background-color .15s;
}
.cm-zona.cm-sobre { border-color: var(--bsl-accent, #1c6e8c); background: #eef6f9; }
.cm-zona-titulo { font-size: .82rem; font-weight: 600; margin-bottom: .35rem; }
.cm-zona-chips { min-height: 2rem; }
.cm-vazio { font-size: .85rem; color: #555c63; font-style: italic; }
.cm-til { text-align: center; font-family: var(--bs-font-monospace, monospace); font-size: 1.3rem; color: var(--bsl-muted, #6c757d); line-height: 1.6; }
.cm-op { font-family: var(--bs-font-monospace, monospace); font-weight: 700; color: var(--bsl-accent-dark, #144f64); }
.cm-ops { display: flex; gap: .4rem; margin-top: .55rem; }
.cm-opbtn {
  flex: 1;
  border: 1.5px solid var(--bsl-accent, #1c6e8c);
  background: #fff;
  color: var(--bsl-accent, #1c6e8c);
  border-radius: 6px;
  padding: .3rem .4rem;
  font-size: .85rem;
}
.cm-opbtn.ativo { background: var(--bsl-accent, #1c6e8c); color: #fff; }
.cm-limpar { padding-left: 0; margin-top: .4rem; }

/* resultado */
.cm-instrucao { color: var(--bsl-muted, #6c757d); font-style: italic; margin: 0; }
.cm-formula code {
  display: block;
  font-size: 1.35rem;
  padding: .55rem .8rem;
  background: var(--bsl-bg-soft, #f3eee3);
  border-radius: 6px;
  color: var(--bsl-accent-dark, #144f64);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
@media (max-width: 560px) { .cm-formula code { font-size: 1.1rem; } }
.cm-teste {
  margin-top: 1rem;
  border-left: 4px solid #96661f;
  padding: .3rem 0 .1rem .8rem;
}
.cm-teste-nome { font-size: 1.15rem; font-weight: 700; color: #96661f; }
.cm-teste p { margin: .25rem 0 0; }
.cm-equacao { margin-top: 1rem; }
.cm-eq { font-family: var(--bs-font-monospace, monospace); font-size: .98rem; line-height: 1.8; overflow-wrap: anywhere; }
.cm-coef { font-weight: 700; }
.cm-detalhes { margin-top: .9rem; }
.cm-detalhes summary { font-weight: 600; cursor: pointer; }
.cm-coefs { margin: .5rem 0 0; padding-left: 1.2rem; font-size: .92rem; }
.cm-coefs li { margin-bottom: .3rem; }
.cm-figura { margin: 1rem 0 0; }
.cm-figura figcaption { font-size: .85rem; color: var(--bsl-muted, #6c757d); }
.cm-svg { width: 100%; height: auto; background: var(--bsl-bg-page, #faf7f0); border-radius: 6px; }
.cm-eixo { stroke: #8a8172; stroke-width: 1; }
.cm-grade { stroke: #e6e0d3; stroke-width: 1; }
.cm-tick { font-size: 12px; fill: #4a5568; }
.cm-rotulo { font-size: 13px; fill: #2d3748; font-family: var(--bs-font-monospace, monospace); }
.cm-ponto { fill-opacity: .6; }
.cm-ajuste { stroke-width: 3; }
.cm-media { stroke-width: 4; stroke-linecap: round; }
.cm-ligacao { fill: none; stroke-width: 1.5; stroke-dasharray: 4 3; }
.cm-codigo { margin-top: 1rem; }
.cm-codigo-topo { display: flex; justify-content: space-between; align-items: end; }
.cm-codigo-topo .cm-rot { margin: 0 0 .35rem; }
.cm-codigo pre { margin: 0; font-size: .85rem; overflow-x: auto; }
.cm-alerta {
  margin-top: 1rem;
  padding: .6rem .8rem;
  border-radius: 6px;
  background: #fbf0e6;
  border-left: 4px solid #a15e3f;
  font-size: .92rem;
}
.cm-alerta.cm-pequeno { margin-top: .3rem; padding: .3rem .6rem; font-size: .85rem; }

/* saída do R (webR) */
.cm-r { margin-top: 1.2rem; padding-top: .2rem; border-top: 1px solid var(--bsl-border, #e3dccd); }
.cm-sub { font-weight: 600; margin: .9rem 0 .3rem; font-size: .92rem; }
.cm-saida { font-size: .78rem; line-height: 1.35; max-height: 26rem; overflow: auto; margin: 0; }
.cm-igual {
  margin-top: .5rem;
  padding: .45rem .7rem;
  border-radius: 6px;
  background: #edf3e8;
  border-left: 4px solid #527238;
  font-size: .9rem;
}
.cm-residuos { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem; }
.cm-residuos figure { margin: 0; }
.cm-residuos figcaption { font-size: .82rem; color: var(--bsl-muted, #6c757d); margin-top: .25rem; }
.cm-ref { stroke: #a15e3f; stroke-width: 1.5; stroke-dasharray: 5 4; }

/* tamanho do efeito e texto do resultado */
.cm-efeitos { font-size: .86rem; margin: .4rem 0 .2rem; background: transparent; }
.cm-efeitos th { font-weight: 600; color: var(--bsl-muted, #6c757d); border-bottom-width: 1px; }
.cm-efeitos td:nth-child(2) { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.cm-efeitos td:nth-child(3) { white-space: nowrap; }
.cm-sub-topo { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: 1.2rem; }
.cm-relato {
  margin: .3rem 0 .2rem;
  padding: .7rem .9rem;
  background: var(--bsl-bg-soft, #f3eee3);
  border-left: 4px solid #6b4c8a;
  border-radius: 0 6px 6px 0;
  font-size: .95rem;
  line-height: 1.55;
}

/* regressão múltipla */
.cm-simples { stroke-width: 2; stroke-dasharray: 6 4; }
.cm-legenda-parcial { font-size: .82rem; color: var(--bsl-muted, #6c757d); margin-bottom: .4rem; }
.cm-traco { display: inline-block; width: 26px; height: 0; vertical-align: middle; border-top: 3px solid #a15e3f; }
.cm-traco-simples { border-top: 2px dashed #8a8172; }
.cm-colin { margin-top: 1rem; }
.cm-ruim td { background: #fbf0e6; }

/* figuras pequenas (resíduos, efeitos parciais): o viewBox de 320 encolhe na
   tela, então a letra é maior em unidades do SVG para sair com ~12–13 px */
.cm-svg-peq .cm-tick { font-size: 15px; }
.cm-svg-peq .cm-rotulo { font-size: 16px; }

/* montagem do modelo na ordem da fórmula: [resposta] ~ [preditores] */
.cm-montagem { margin-bottom: 1.1rem; padding-bottom: .9rem; border-bottom: 1px solid var(--bsl-border, #e3dccd); }
.cm-montagem > .cm-rot:first-child { margin-top: 0; }
.cm-barra {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(0, 2fr);
  gap: .6rem;
  align-items: stretch;
}
.cm-barra .cm-til { align-self: center; font-size: 2rem; line-height: 1; padding: 0 .1rem; }
@media (max-width: 560px) {
  .cm-barra { grid-template-columns: minmax(0, 1fr); }
  .cm-barra .cm-til { font-size: 1.5rem; }
}
