/* ============================================================
   Terra Sentinel Industrial — Nova produção (wizard 10 etapas)
   Produto → Receita → Volume → Planta → Compatibilidade →
   Equipamentos → Instrumentação → Terra AI → Revisão → Criar lote
   Carregar DEPOIS de preconfig.css / preconfig2.css.
   ============================================================ */

.preconfig3-main { max-width: 1080px; }

/* ================= STEPPER ================= */
.pc3-stepper {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.pc3-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 64px;
  cursor: default;
}

.pc3-step .pc3s-num {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 800;
  background: var(--ts-surface-2);
  border: 1.5px solid var(--ts-border-strong);
  color: var(--ts-muted);
  transition: all 0.15s ease;
}

.pc3-step .pc3s-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ts-muted);
  text-align: center;
  white-space: nowrap;
}

.pc3-step.done .pc3s-num {
  background: var(--ts-primary);
  border-color: var(--ts-primary);
  color: #fff;
}

.pc3-step.active .pc3s-num {
  border-color: var(--ts-primary);
  color: var(--ts-primary);
  box-shadow: 0 0 0 3px rgba(21, 166, 106, 0.15);
}

.pc3-step.active .pc3s-label { color: var(--ts-primary); }

.pc3-step-line {
  flex: 1;
  min-width: 12px;
  height: 2px;
  background: var(--ts-border);
  margin-top: 14px;
}

.pc3-step-line.done { background: var(--ts-primary); }

/* ================= PRODUTO ================= */
.pc3-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 8px 0 18px;
}

.pc3-product {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 18px;
  border: 1.5px solid var(--ts-border);
  border-radius: 12px;
  background: var(--ts-surface);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.pc3-product i { font-size: 30px; color: var(--ts-muted); }

.pc3-product strong { font-size: 14.5px; color: var(--ts-text); }

.pc3-product small { font-size: 11px; color: var(--ts-muted); font-weight: 700; }

.pc3-product.selected {
  border-color: var(--ts-primary);
  background: var(--ts-primary-soft);
  box-shadow: 0 0 0 3px rgba(21, 166, 106, 0.12);
}

.pc3-product.selected i, .pc3-product.selected strong { color: var(--ts-primary); }

.pc3-product:disabled { opacity: 0.45; cursor: not-allowed; }

/* ================= RECEITAS ================= */
.pc3-recipes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin: 8px 0 18px;
}

.pc3-recipe {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 16px 16px 14px;
  border: 1.5px solid var(--ts-border);
  border-radius: 12px;
  background: var(--ts-surface);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.pc3-recipe:hover { border-color: var(--ts-primary); }

.pc3-recipe.selected {
  border-color: var(--ts-primary);
  background: var(--ts-primary-soft);
  box-shadow: 0 0 0 3px rgba(21, 166, 106, 0.12);
}

.pc3-recipe-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.pc3-recipe-name { font-size: 15px; font-weight: 800; color: var(--ts-text); }

.pc3-recipe-style { font-size: 11.5px; color: var(--ts-muted); font-weight: 600; }

.pc3-recipe-specs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.pc3-recipe .f-spec {
  background: var(--ts-surface-2);
  border-radius: 8px;
  padding: 6px 6px;
  text-align: center;
}

.pc3-recipe .f-spec span {
  display: block;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ts-muted);
}

.pc3-recipe .f-spec strong { font-size: 12px; color: var(--ts-text); }

.pc3-recipe-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ts-muted);
  font-weight: 700;
}

/* ================= MODO TESTE ================= */
.pc3-testmode { margin-bottom: 14px; }

.pc3-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ts-muted);
  line-height: 1.5;
  background: var(--ts-surface-2);
  border: 1px solid var(--ts-border);
  border-radius: 9px;
  padding: 10px 13px;
  cursor: pointer;
}

.pc3-check input { margin-top: 2px; accent-color: var(--ts-primary); }

.pc3-check b { color: var(--ts-text); }

/* ================= VOLUME ================= */
.pc3-volume-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
  margin-bottom: 16px;
}

.pc3-volume-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ts-muted);
}

.pc3-volume-grid select,
.pc3-volume-grid input {
  width: 100%;
  min-height: 42px;
  background: var(--ts-surface);
  border: 1px solid var(--ts-border-strong);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--ts-text);
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
}

.pc3-volume-grid input:focus,
.pc3-volume-grid select:focus {
  outline: none;
  border-color: var(--ts-primary);
  box-shadow: 0 0 0 3px rgba(21, 166, 106, 0.14);
}

.pc3-volume-input { display: flex; gap: 8px; }

.pc3-volume-input input { flex: 1; }

.pc3-volume-input select { width: 90px; }

.pc3-scale-box {
  border: 1px solid var(--ts-border);
  border-radius: 10px;
  background: var(--ts-surface-2);
  padding: 13px 15px;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--ts-muted);
  line-height: 1.7;
}

.pc3-scale-box b { color: var(--ts-text); }

.pc3-scale-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 6px 14px;
  margin-top: 6px;
}

.pc3-scale-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
}

.pc3-scale-row span:first-child { color: var(--ts-muted); font-weight: 600; }

.pc3-scale-row span:last-child { color: var(--ts-text); }

/* ================= PLANTA ================= */
.pc3-plants {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin: 8px 0 18px;
}

.pc3-plant {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1.5px solid var(--ts-border);
  border-radius: 12px;
  background: var(--ts-surface);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pc3-plant i { font-size: 20px; color: var(--ts-muted); }

.pc3-plant strong { display: block; font-size: 14px; color: var(--ts-text); }

.pc3-plant small { font-size: 11px; color: var(--ts-muted); font-weight: 700; }

.pc3-plant.selected {
  border-color: var(--ts-primary);
  background: var(--ts-primary-soft);
  box-shadow: 0 0 0 3px rgba(21, 166, 106, 0.12);
}

.pc3-plant.selected i, .pc3-plant.selected strong { color: var(--ts-primary); }

/* ================= COMPATIBILIDADE ================= */
.pc3-score {
  display: flex;
  align-items: center;
  gap: 18px;
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 16px;
  border: 1.5px solid var(--ts-border);
}

.pc3-score.ok { background: var(--ts-primary-soft); border-color: rgba(21, 166, 106, 0.4); }
.pc3-score.no { background: var(--ts-danger-soft); border-color: rgba(217, 71, 71, 0.45); }

.pc3-score-ring {
  width: 92px;
  height: 92px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--ts-primary) calc(var(--pct) * 1%), var(--ts-border) 0);
  flex-shrink: 0;
}

.pc3-score-ring.no { background: conic-gradient(#c0392b calc(var(--pct) * 1%), var(--ts-border) 0); }

.pc3-score-ring span {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: var(--ts-surface);
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 850;
  color: var(--ts-text);
}

.pc3-score-info strong { display: block; font-size: 17px; color: var(--ts-text); margin-bottom: 3px; }

.pc3-score-info p { margin: 0; font-size: 12.5px; color: var(--ts-muted); line-height: 1.55; }

.pc3-issues { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.pc3-issue {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--ts-border);
  border-radius: 9px;
  padding: 10px 13px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ts-text);
  background: var(--ts-surface);
}

.pc3-issue i { margin-top: 2px; }

.pc3-issue.err { border-color: rgba(217, 71, 71, 0.5); background: var(--ts-danger-soft); }
.pc3-issue.err i { color: #c0392b; }
.pc3-issue.warn i { color: #b07d16; }
.pc3-issue.ok i { color: var(--ts-primary); }

.pc3-issue b { display: block; }

.pc3-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ts-muted);
  font-size: 13.5px;
  font-weight: 700;
  padding: 26px;
  justify-content: center;
}

.pc3-loading i { font-size: 18px; }

/* ================= EQUIPAMENTOS ================= */
.pc3-eq-group { margin-bottom: 16px; }

.pc3-eq-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ts-text);
  margin-bottom: 8px;
}

.pc3-eq-title .f-level { margin-left: auto; }

.pc3-eq-card {
  border: 1.5px solid var(--ts-border);
  border-radius: 10px;
  background: var(--ts-surface);
  overflow: hidden;
}

.pc3-eq-card.missing { border-color: rgba(217, 71, 71, 0.5); }

.pc3-eq-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--ts-border);
  cursor: pointer;
  transition: background 0.12s ease;
}

.pc3-eq-option:last-child { border-bottom: none; }

.pc3-eq-option:hover { background: var(--ts-surface-2); }

.pc3-eq-option.selected { background: var(--ts-primary-soft); }

.pc3-eq-option input { accent-color: var(--ts-primary); }

.pc3-eq-option .pc3-eq-info { flex: 1; }

.pc3-eq-option .pc3-eq-info b { font-size: 13px; color: var(--ts-text); display: block; }

.pc3-eq-option .pc3-eq-info small { font-size: 11px; color: var(--ts-muted); font-weight: 700; }

.pc3-eq-option .pc3-eq-avail { font-size: 10.5px; font-weight: 800; }

.pc3-eq-option .pc3-eq-avail.av { color: var(--ts-primary); }
.pc3-eq-option .pc3-eq-avail.busy { color: #b07d16; }
.pc3-eq-option .pc3-eq-avail.off { color: #c0392b; }

.pc3-eq-none {
  padding: 14px;
  font-size: 12.5px;
  color: #c0392b;
  font-weight: 700;
  background: var(--ts-danger-soft);
}

/* ================= INSTRUMENTAÇÃO ================= */
.pc3-inst-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.pc3-inst {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--ts-border);
  border-radius: 9px;
  padding: 11px 13px;
  background: var(--ts-surface);
  font-size: 12.5px;
}

.pc3-inst i { font-size: 15px; }

.pc3-inst.ok i { color: var(--ts-primary); }
.pc3-inst.warn i { color: #b07d16; }
.pc3-inst.err i { color: #c0392b; }

.pc3-inst b { display: block; color: var(--ts-text); }

.pc3-inst small { font-size: 11px; color: var(--ts-muted); font-weight: 700; }

.pc3-inst .f-level { margin-left: auto; }

/* ================= TERRA AI ================= */
.pc3-ai-panel {
  border: 1px solid var(--ts-border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  background: linear-gradient(180deg, var(--ts-surface) 0%, var(--ts-surface-2) 100%);
}

.pc3-ai-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.pc3-ai-head i { font-size: 20px; color: var(--ts-primary); }

.pc3-ai-head b { font-size: 15px; color: var(--ts-text); }

.pc3-ai-head small { display: block; font-size: 11px; color: var(--ts-muted); font-weight: 700; }

.pc3-ai-msg {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ts-text);
  background: var(--ts-surface);
  border: 1px solid var(--ts-border);
  border-radius: 9px;
  padding: 13px 15px;
  margin-bottom: 10px;
}

.pc3-ai-msg .ok { color: var(--ts-primary); font-weight: 800; }

.pc3-ai-points { display: flex; flex-direction: column; gap: 6px; }

.pc3-ai-point {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ts-text);
  line-height: 1.5;
}

.pc3-ai-point i { color: var(--ts-primary); margin-top: 3px; font-size: 12px; }

.pc3-ai-unavailable {
  font-size: 13px;
  color: var(--ts-muted);
  background: var(--ts-surface-2);
  border: 1px dashed var(--ts-border-strong);
  border-radius: 9px;
  padding: 13px 15px;
  line-height: 1.55;
}

/* ================= REVISÃO ================= */
.pc3-review-sec { margin-bottom: 16px; }

.pc3-review-sec h3 {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ts-muted);
  margin: 0 0 8px;
}

.pc3-review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
}

.pc3-review-item {
  background: var(--ts-surface-2);
  border: 1px solid var(--ts-border);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 12.5px;
}

.pc3-review-item span {
  display: block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ts-muted);
}

.pc3-review-item b { color: var(--ts-text); }

.pc3-review-item .warn { color: #b07d16; }
.pc3-review-item .err { color: #c0392b; }

.pc3-justify {
  margin-top: 10px;
}

.pc3-justify label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ts-muted);
}

.pc3-justify textarea {
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--ts-border-strong);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--ts-surface);
  color: var(--ts-text);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}

.pc3-justify textarea:focus {
  outline: none;
  border-color: var(--ts-primary);
  box-shadow: 0 0 0 3px rgba(21, 166, 106, 0.14);
}

/* ================= FINAL ================= */
.pc3-final-summary {
  border: 1px solid var(--ts-border);
  border-radius: 12px;
  background: var(--ts-surface-2);
  padding: 18px 20px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ts-text);
}

.pc3-final-summary b { color: var(--ts-text); }

/* ================= RESPONSIVO ================= */
@media (max-width: 720px) {
  .pc3-stepper { gap: 2px; }
  .pc3-step { min-width: 52px; }
  .pc3-step .pc3s-label { font-size: 8px; }
  .pc3-volume-grid { grid-template-columns: 1fr; }
  .pc3-score { flex-direction: column; text-align: center; }
  .pc3-score-ring { width: 76px; height: 76px; }
  .pc3-score-ring span { width: 58px; height: 58px; font-size: 18px; }
}

/* ── Terra AI — ETAPA 8 (assistente conectado ao OpenClaw) ── */
.pc3-ai-status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px;
  font-weight: 800; letter-spacing: .05em; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--ts-border, #2b3a4e); }
.pc3-ai-status-pill .d { width: 8px; height: 8px; border-radius: 50%; background: #3fb950; }
.pc3-ai-status-pill.ok { color: #3fb950; border-color: #3fb95055; background: #3fb95011; }
.pc3-ai-status-pill.attention { color: #d29922; border-color: #d2992255; background: #d2992211; }
.pc3-ai-status-pill.attention .d { background: #d29922; }
.pc3-ai-status-pill.blocked { color: #f85149; border-color: #f8514955; background: #f8514911; }
.pc3-ai-status-pill.blocked .d { background: #f85149; }
.pc3-ai-status-pill.insufficient { color: #58a6ff; border-color: #58a6ff55; background: #58a6ff11; }
.pc3-ai-status-pill.insufficient .d { background: #58a6ff; }
.pc3-ai-status-pill.off { color: #8b949e; border-color: #8b949e55; }
.pc3-ai-status-pill.off .d { background: #8b949e; }
.pc3-ai-score { display: flex; align-items: center; gap: 14px; margin: 12px 0; padding: 12px 14px;
  border: 1px solid var(--ts-border, #2b3a4e); border-radius: 12px; background: #131c29; }
.pc3-ai-score .num { font-size: 30px; font-weight: 800; color: #3fb950; line-height: 1; }
.pc3-ai-score .num.no { color: #f85149; }
.pc3-ai-score .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8b949e; }
.pc3-ai-score .desc { font-size: 12.5px; color: #c9d4e0; }
.pc3-ai-section { margin-top: 10px; }
.pc3-ai-section h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: #8b949e; margin: 0 0 6px; }
.pc3-ai-list { display: flex; flex-direction: column; gap: 5px; }
.pc3-ai-item { display: flex; gap: 8px; font-size: 12.5px; line-height: 1.45; color: #c9d4e0; }
.pc3-ai-item .ok { color: #3fb950; }
.pc3-ai-item .warn { color: #d29922; }
.pc3-ai-item .rec { color: #58a6ff; }
.pc3-ai-summary { font-size: 13.5px; line-height: 1.6; color: #e6edf3; margin-top: 10px;
  padding: 10px 12px; border-left: 3px solid #2f81f7; background: #131c29; border-radius: 0 10px 10px 0; }
.pc3-ai-detail { margin-top: 10px; border: 1px solid var(--ts-border, #2b3a4e); border-radius: 10px;
  background: #0f1620; padding: 10px 12px; font-size: 12px; color: #8b949e; white-space: pre-wrap;
  word-break: break-word; max-height: 260px; overflow: auto; display: none; }
.pc3-ai-detail.open { display: block; }
.pc3-ai-toggle { margin-top: 8px; font-size: 11.5px; color: #58a6ff; background: none;
  border: 1px solid #2b3a4e; border-radius: 8px; padding: 5px 12px; cursor: pointer; }
.pc3-ai-toggle:hover { border-color: #58a6ff; }
