/* _form.css v12.3 — Neuralizando (escopo #esteves-form) */

/* ========== PALETAS ========== */

:root,
:root[data-theme="dark"],
html[data-theme="dark"] {
  --bg:            #0a0f1a;
  --card:          #0f1624;
  --text:          #e6f0ff;
  --muted:         #9fb2d0;
  --line:          #1f2b3e;
  --input-bg:      #111a2b;
  --input-bd:      #21324a;
  --input-border:  #21324a;
  --input-focus:   #45f6c6;
  --brand1:        #45f6c6;
  --brand2:        #22a2ff;
  --ok:            #34d399;
  --err:           #ff6b6b;
  --warn:          #f59e0b;
  --shadow:        0 6px 22px rgba(0,0,0,.35);
}

:root[data-theme="light"],
html[data-theme="light"] {
  --bg:            #f6f8fc;
  --card:          #ffffff;
  --text:          #0a1120;
  --muted:         #627089;
  --line:          #dbe2ee;
  --input-bg:      #ffffff;
  --input-bd:      #c8d4e6;
  --input-border:  #c8d4e6;
  --input-focus:   #1e90ff;
  --brand1:        #1e90ff;
  --brand2:        #6be2ff;
  --ok:            #059669;
  --err:           #dc2626;
  --warn:          #b45309;
  --shadow:        0 8px 22px rgba(10,17,32,.08);
}

/* ========== RESET ========== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
body.nlz-modal-open { overflow: hidden; }

/* ========== WRAPPER ========== */

.nlz-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* ========== BRANDBAR ========== */

.brandbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-text .brand-name {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: .1em;
  color: var(--text);
  display: block;
}

.brand-text .brand-sub {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 2px;
  display: block;
}

.brand-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.brand-right .badge {
  border: 1px solid var(--line);
  border-radius: 50px;
  padding: 5px 12px;
  font-size: .78rem;
  color: var(--muted);
  background: var(--input-bg);
}

/* ========== TÍTULOS DE SEÇÃO ========== */

#esteves-form h2 {
  color: var(--text);
  opacity: .9;
  margin: 28px 0 10px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

/* ========== GRID ========== */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

.form-grid .full { grid-column: 1 / -1; }

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: 1; }
}

/* ========== GRUPOS DE CAMPO ========== */

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-group label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  opacity: .85;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ========== INPUTS / SELECT / TEXTAREA ========== */

.field-group input,
.field-group select,
.field-group textarea,
#esteves-form input:not([type=hidden]):not([type=submit]):not([type=button]),
#esteves-form select,
#esteves-form textarea {
  width: 100%;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-bd);
  border-radius: 10px;
  padding: 11px 13px;
  min-height: 44px;
  font-size: .95rem;
  line-height: 1.25;
  outline: none;
  font-family: inherit;
  transition: border .2s, box-shadow .2s;
}

#esteves-form input::placeholder,
#esteves-form textarea::placeholder { color: var(--muted); opacity: .7; }

#esteves-form input:focus,
#esteves-form select:focus,
#esteves-form textarea:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--input-focus) 25%, transparent);
}

/* Select: seta */
#esteves-form select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% + 2px),
    calc(100% - 12px) calc(50% + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2.4rem;
}

/* Date picker dark */
#esteves-form input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(.6);
}

/* Autofill */
#esteves-form input:-webkit-autofill,
#esteves-form input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset;
  transition: background-color 9999s ease-out 0s;
}

/* Erro por campo */
#esteves-form input[data-invalid="true"],
#esteves-form input[aria-invalid="true"],
#esteves-form select[aria-invalid="true"] {
  border-color: var(--err) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 18%, transparent) !important;
}

/* Dica */
.field-hint {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 3px;
}

#handle-hint {
  font-size: .78rem;
  color: var(--brand1);
  margin-top: 3px;
  min-height: 1em;
}

/* ========== STATUS ========== */

#status {
  min-height: 1.2em;
  font-size: .92rem;
  color: var(--muted);
  margin-top: 10px;
}
#status.ok  { color: var(--ok); }
#status.err { color: var(--err); }

/* ========== BOTÕES ========== */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(90deg, var(--brand1), var(--brand2));
  color: #04141a;
  font-weight: 800;
  font-size: 1rem;
  border: none;
  border-radius: 999px;
  padding: 14px 32px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: opacity .2s, transform .2s;
  width: 100%;
  margin-top: 8px;
}

.btn-primary:hover { opacity: .88; transform: translateY(-1px); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }

#btn-menor {
  background: linear-gradient(135deg, #93c5fd, #60a5fa);
  color: #fff;
  font-weight: 700;
  font-size: .88rem;
  border: none;
  border-radius: 50px;
  padding: 9px 18px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(96,165,250,.35);
  transition: all .25s ease;
  white-space: nowrap;
}
#btn-menor:hover { opacity: .88; transform: translateY(-1px); }

/* ========== TRUST ========== */

.trust-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: .82rem;
  color: var(--muted);
}

/* ========== MODAIS ========== */

#nlz-overlay, #minor-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, #000 65%, transparent);
  backdrop-filter: blur(4px);
  padding: 16px;
  z-index: 99999;
}
#nlz-overlay[aria-hidden="true"],
#minor-overlay[aria-hidden="true"] { display: none; }

#nlz-modal, #minor-modal {
  width: min(94vw, 560px);
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px 20px;
  max-height: 90vh;
  overflow-y: auto;
}

#nlz-modal .nlz-icon {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--brand1) 30%, transparent);
  margin-bottom: 10px;
}

#nlz-modal h3 { font-size: 1.1rem; margin: 0 0 6px; }
#nlz-modal .proto-row { margin: 8px 0 4px; font-size: .9rem; color: var(--muted); }
#nlz-protocolo {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--brand1);
  background: color-mix(in srgb, var(--brand1) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand1) 35%, transparent);
  border-radius: 8px;
  padding: 4px 12px;
  letter-spacing: .08em;
  margin-top: 4px;
}

#nlz-modal.is-error {
  border-color: var(--err);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--err) 18%, transparent);
}
#nlz-modal.is-error .nlz-icon {
  background: color-mix(in srgb, var(--err) 25%, transparent);
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
  justify-content: flex-end;
}

.btn-modal {
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 700;
  font-size: .88rem;
  cursor: pointer;
  transition: opacity .2s, transform .2s;
}
.btn-modal.primary {
  background: linear-gradient(90deg, var(--brand1), var(--brand2));
  color: #04141a;
  box-shadow: var(--shadow);
}
.btn-modal.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-modal:hover { opacity: .85; transform: translateY(-1px); }

/* Modal menor */
#minor-modal h3 { font-size: 1.1rem; margin: 0 0 6px; }
#minor-modal .minor-desc { font-size: .88rem; color: var(--muted); margin-bottom: 16px; }

.minor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-top: 8px;
}
.minor-grid .full { grid-column: 1 / -1; }

.minor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

#minor-cancel {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
  font-size: .88rem;
}
#minor-save {
  background: linear-gradient(90deg, var(--brand1), var(--brand2));
  color: #04141a;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: 700;
  cursor: pointer;
  font-size: .88rem;
  box-shadow: var(--shadow);
}

#minor-status {
  margin-top: 8px;
  font-size: .88rem;
  color: var(--muted);
}
#minor-status.ok  { color: var(--ok); }
#minor-status.err { color: var(--err); }

@media (max-width: 600px) {
  .minor-grid { grid-template-columns: 1fr; }
  .minor-grid .full { grid-column: 1; }
  .minor-actions { flex-direction: column; }
  #minor-cancel, #minor-save { width: 100%; text-align: center; }
}

/* ========== WIZARD ========== */

.wz-section { display: none; animation: wzFadeIn .28s ease; }
.wz-section.active { display: block; }

@keyframes wzFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wz-steps { padding: 20px 0 0; margin-bottom: 8px; }
.wz-steps-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.wz-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  z-index: 1;
}

.wz-step-bubble {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--input-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .25s ease;
  position: relative;
}

.wz-step-num { font-size: .82rem; font-weight: 700; color: var(--muted); transition: opacity .2s; }
.wz-step-check {
  position: absolute; inset: 0;
  width: 100%; height: 100%; padding: 7px;
  color: #04141a; opacity: 0; transition: opacity .2s;
}
.wz-step-label {
  font-size: .68rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap; transition: color .25s;
}

.wz-step.active .wz-step-bubble {
  border-color: var(--brand1);
  background: color-mix(in srgb, var(--brand1) 15%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand1) 12%, transparent);
}
.wz-step.active .wz-step-num  { color: var(--brand1); }
.wz-step.active .wz-step-label { color: var(--brand1); }

.wz-step.done .wz-step-bubble { border-color: var(--brand1); background: var(--brand1); }
.wz-step.done .wz-step-num    { opacity: 0; }
.wz-step.done .wz-step-check  { opacity: 1; }
.wz-step.done .wz-step-label  { color: var(--ok); }

.wz-connector {
  flex: 1;
  height: 2px;
  background: var(--line);
  margin: 0 4px;
  margin-bottom: 22px;
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.wz-connector::after {
  content: '';
  position: absolute; inset: 0;
  background: var(--brand1);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s ease;
}
.wz-connector.filled::after { transform: scaleX(1); }

.wz-progress-bar {
  height: 3px; background: var(--line);
  border-radius: 3px; margin-top: 12px; overflow: hidden;
}
.wz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand1), var(--brand2));
  border-radius: 3px;
  transition: width .4s cubic-bezier(.4,0,.2,1);
  width: 0%;
}

.wz-section-header {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 22px 0 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.wz-section-icon { font-size: 1.7rem; line-height: 1; flex-shrink: 0; margin-top: 2px; }
.wz-title  { font-size: 1.05rem !important; font-weight: 700; color: var(--text) !important; margin: 0 0 3px !important; opacity: 1 !important; }
.wz-subtitle { font-size: .85rem; color: var(--muted); margin: 0; line-height: 1.5; }

.wz-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 20px 0 8px; flex-wrap: wrap;
}
.wz-nav-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-left: auto; }

.wz-btn-back {
  background: transparent; color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 11px 22px; font-weight: 700; font-size: .92rem;
  cursor: pointer; min-width: 100px; transition: all .2s;
}
.wz-btn-back:hover { border-color: var(--muted); }

.wz-btn-next, .wz-btn-submit {
  background: linear-gradient(90deg, var(--brand1), var(--brand2));
  color: #04141a; border: none; border-radius: 999px;
  padding: 12px 28px; font-weight: 800; font-size: .96rem;
  cursor: pointer; min-width: 140px; box-shadow: var(--shadow);
  transition: opacity .2s, transform .2s;
}
.wz-btn-next:hover, .wz-btn-submit:hover { opacity: .88; transform: translateY(-1px); }
.wz-btn-submit.is-loading { opacity: .7; pointer-events: none; }

.wz-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 12px 0 0; color: var(--muted);
  font-size: .8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
}
.wz-divider::before, .wz-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* Review */
.wz-review {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px; margin-top: 10px;
}
.wz-review-group {
  background: var(--input-bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px;
}
.wz-review-group.full { grid-column: 1 / -1; }
.wz-review-group-title {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--brand1);
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.wz-review-row { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.wz-review-row:last-child { margin-bottom: 0; }
.wz-review-key { font-size: .7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.wz-review-val { font-size: .88rem; color: var(--text); font-weight: 500; word-break: break-word; }
.wz-review-val:empty::before { content: '—'; color: var(--muted); opacity: .5; }
.wz-review-val.missing { color: var(--err); font-style: italic; }

/* Menor inline */
.wz-menor-pergunta { margin: 18px 0 0; animation: wzFadeIn .28s ease; }
.wz-menor-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--brand2) 8%, var(--input-bg));
  border: 1px solid color-mix(in srgb, var(--brand2) 30%, transparent);
  border-radius: 14px; flex-wrap: wrap;
}
.wz-menor-icon { font-size: 1.7rem; flex-shrink: 0; }
.wz-menor-texto { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; }
.wz-menor-texto strong { font-size: .92rem; color: var(--text); }
.wz-menor-texto span   { font-size: .8rem; color: var(--muted); }
.wz-menor-acoes { display: flex; gap: 8px; flex-shrink: 0; }
.wz-menor-btn-sim, .wz-menor-btn-nao {
  border-radius: 50px; padding: 8px 18px;
  font-size: .85rem; font-weight: 700;
  cursor: pointer; border: none; transition: all .2s ease;
}
.wz-menor-btn-sim { background: linear-gradient(90deg, var(--brand1), var(--brand2)); color: #04141a; box-shadow: var(--shadow); }
.wz-menor-btn-sim:hover { opacity: .88; transform: translateY(-1px); }
.wz-menor-btn-nao { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.wz-menor-btn-nao:hover { color: var(--text); border-color: var(--muted); }
.wz-menor-card.confirmado-sim { border-color: var(--brand1); background: color-mix(in srgb, var(--brand1) 8%, var(--input-bg)); }
.wz-menor-card.confirmado-nao { border-color: var(--ok);    background: color-mix(in srgb, var(--ok) 8%, var(--input-bg)); opacity: .75; }

/* Validação inline */
@keyframes wzShake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}
.wz-shake { animation: wzShake .42s cubic-bezier(.36,.07,.19,.97) both; }

.wz-field-error > input,
.wz-field-error > select,
.wz-field-error > textarea {
  border-color: var(--err) !important;
  outline: 2px solid var(--err) !important;
  outline-offset: -1px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--err) 30%, transparent),
              0 0 12px color-mix(in srgb, var(--err) 45%, transparent) !important;
  animation: wzFieldPulse 1.4s ease-in-out 2;
}
@keyframes wzFieldPulse {
  0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--err) 30%, transparent),
                         0 0 12px color-mix(in srgb, var(--err) 45%, transparent); }
  50%      { box-shadow: 0 0 0 6px color-mix(in srgb, var(--err) 50%, transparent),
                         0 0 20px color-mix(in srgb, var(--err) 65%, transparent); }
}

/* Toast bloqueio etapa */
.wz-step-block-toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: var(--err, #dc2626); color: #fff;
  padding: 12px 20px; border-radius: 10px;
  font-weight: 600; font-size: .92rem;
  box-shadow: 0 6px 24px rgba(0,0,0,.28);
  z-index: 999999;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  max-width: 92vw; text-align: center;
}
.wz-step-block-toast.show {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

.wz-error-msg {
  display: flex; align-items: center; gap: 5px;
  margin-top: 5px; font-size: .78rem; font-weight: 600;
  color: var(--err); line-height: 1.4;
}

/* ========== RESPONSIVO GERAL ========== */

@media (max-width: 720px) {
  .brandbar { flex-direction: column; align-items: center; text-align: center; }
  .brand-left { justify-content: center; }
  .brand-right { flex-direction: column; align-items: center; gap: 4px; }
  #btn-menor { width: 100%; max-width: 280px; justify-content: center; }
  .brand-right .badge { border: none; background: transparent; font-size: .75rem; }
}

@media (max-width: 600px) {
  .wz-step-label { display: none; }
  .wz-step-bubble { width: 28px; height: 28px; }
  .wz-step-check { padding: 5px; }
  .wz-step-num { font-size: .75rem; }
  .wz-connector { margin-bottom: 16px; }
  .wz-review { grid-template-columns: 1fr; }
  .wz-review-group.full { grid-column: 1; }
  .wz-nav { flex-direction: column-reverse; align-items: stretch; }
  .wz-nav-right { flex-direction: column; margin-left: 0; width: 100%; }
  .wz-btn-back, .wz-btn-next, .wz-btn-submit { width: 100%; text-align: center; justify-content: center; }
  .wz-section-header { flex-direction: column; gap: 8px; }
  .wz-menor-card { flex-direction: column; align-items: flex-start; }
  .wz-menor-acoes { width: 100%; }
  .wz-menor-btn-sim, .wz-menor-btn-nao { flex: 1; text-align: center; }
}

@media (max-width: 400px) {
  .wz-steps-track { gap: 0; }
  .wz-connector { min-width: 10px; }
}
