/* Formulários — wizard, floating labels, toolbar */

.form-wizard {
  --client-action: #7c3aed;
  --client-action-hover: #6d28d9;
  --client-deep: #2e1065;
  max-width: none;
  width: 100%;
  margin: 0;
}

.wizard-progress {
  display: grid;
  gap: 12px;
  margin-bottom: 28px;
}

.wizard-progress__bar {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.wizard-progress__fill {
  height: 100%;
  width: 50%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8b5cf6, var(--client-action));
  transition: width var(--transition-smooth);
}

.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.wizard-step-dot {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #8991a3;
  transition: color var(--transition-fast);
}

.wizard-step-dot__number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 1px solid #d8dbe4;
  border-radius: 50%;
  background: var(--surface);
  color: #7a8395;
  font-size: 12px;
  font-weight: 800;
}

.wizard-step-dot__label {
  display: grid;
  gap: 1px;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.wizard-step-dot__label small {
  color: var(--text-light);
  font-size: var(--text-meta);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.wizard-step-dot.is-active {
  color: var(--client-action);
}

.wizard-step-dot.is-active .wizard-step-dot__number,
.wizard-step-dot.is-complete .wizard-step-dot__number {
  border-color: var(--client-action);
  background: var(--client-action);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

.wizard-step-dot.is-complete {
  color: var(--client-action);
}

.wizard-pane {
  display: none;
  animation: fadeInUp 0.35s ease;
}

.wizard-pane.is-active {
  display: block;
}

.wizard-pane__title {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
  color: var(--text);
}

.wizard-pane__title > span {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.wizard-pane__title > small {
  color: var(--text-light);
  font-size: 12px;
  font-weight: 500;
}

.cliente-form-section {
  margin-bottom: 18px;
  padding: 24px 28px;
  border: 1px solid #e6e7ef;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 10px 32px rgba(46, 16, 101, 0.06);
}

.cliente-form-section--major {
  padding: 26px 30px;
}

.cliente-form-section__header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #ececf3;
}

.cliente-form-section__header--with-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.cliente-form-section__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

.cliente-form-section__title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--client-deep);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.cliente-form-section__title i {
  flex: 0 0 auto;
  color: var(--client-action, #7c3aed);
  font-size: 20px;
}

.form-wizard--single .wizard-pane__title + .cliente-form-section + .wizard-pane__title {
  margin-top: 28px;
}

.form-wizard--single .wizard-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

#form-cliente.cliente-form--readonly input,
#form-cliente.cliente-form--readonly select {
  background: #f8f9fc;
  color: var(--text);
  border-color: #e8eaf0;
  pointer-events: none;
  cursor: default;
}

#form-cliente.cliente-form--readonly select {
  opacity: 1;
}

.cliente-form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px 16px;
}

.cliente-form-grid .form-group {
  min-width: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Dados pessoais — linha 1 */
.cliente-form-grid--identificacao .cliente-field--name {
  grid-column: span 5;
}

.cliente-form-grid--identificacao .cliente-field--cpf,
.cliente-form-grid--identificacao .cliente-field--rg {
  grid-column: span 2;
}

.cliente-form-grid--identificacao .cliente-field--birth {
  grid-column: span 3;
}

/* Dados pessoais — linha 2 */
.cliente-form-grid--identificacao .cliente-field--email,
.cliente-form-grid--identificacao .cliente-field--whatsapp,
.cliente-form-grid--identificacao .cliente-field--phone {
  grid-column: span 4;
}

/* Dados pessoais — linha 3 */
.cliente-form-grid--identificacao .cliente-field--source {
  grid-column: span 4;
}

.cliente-origem-nova {
  margin-top: 8px;
}

.cliente-origem-nova[hidden] {
  display: none !important;
}

.cliente-form-grid--identificacao .cliente-field--note {
  grid-column: span 8;
}

/* Endereço — linha 1 */
.cliente-form-grid--localizacao .cliente-field--address {
  grid-column: span 7;
}

.cliente-form-grid--localizacao .cliente-field--number {
  grid-column: span 2;
}

.cliente-form-grid--localizacao .cliente-field--complement {
  grid-column: span 3;
}

/* Endereço — linha 2 */
.cliente-form-grid--localizacao .cliente-field--district {
  grid-column: span 3;
}

.cliente-form-grid--localizacao .cliente-field--city {
  grid-column: span 4;
}

.cliente-form-grid--localizacao .cliente-field--cep {
  grid-column: span 2;
}

.cliente-form-grid--localizacao .cliente-field--state {
  grid-column: span 3;
}

#form-cliente .form-group label {
  color: #424a5b;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.01em;
}

#form-cliente input,
#form-cliente select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #dfe1e9;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.025);
}

#form-cliente input::placeholder {
  color: #a1a8b6;
}

#form-cliente input:hover,
#form-cliente select:hover {
  border-color: #c9c3d8;
}

#form-cliente input:focus,
#form-cliente select:focus {
  border-color: var(--client-action);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.11);
}

.wizard-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #e8e8ef;
}

.wizard-action-primary,
.wizard-action-secondary,
.wizard-action-clear {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  border-radius: 9px;
  font: 700 12px/1 var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.wizard-action-primary {
  border: 1px solid var(--client-action);
  background: var(--client-action);
  color: #fff;
  box-shadow: 0 7px 16px rgba(124, 58, 237, 0.2);
}

.wizard-action-primary:hover {
  border-color: var(--client-action-hover);
  background: var(--client-action-hover);
  transform: translateY(-1px);
  box-shadow: 0 9px 20px rgba(124, 58, 237, 0.26);
}

.wizard-action-secondary {
  border: 1px solid #d9dce5;
  background: var(--surface);
  color: #50596a;
}

.wizard-action-secondary:hover:not(:disabled) {
  border-color: #bcb4cd;
  background: #faf9fc;
  color: var(--client-deep);
}

.wizard-action-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.wizard-action-clear {
  min-height: 36px;
  margin-right: auto;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: #6f7788;
  font-weight: 650;
}

.wizard-action-clear:hover {
  color: var(--client-action);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.floating-field {
  position: relative;
  margin-bottom: var(--space-4);
}

.floating-field input,
.floating-field select {
  padding: 14px 12px 12px;
  border-radius: var(--radius-sm);
}

.floating-field label {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  pointer-events: none;
  transition: all var(--transition-fast);
  background: var(--surface);
  padding: 0 4px;
}

.floating-field input:focus + label,
.floating-field input:not(:placeholder-shown) + label,
.floating-field select:focus + label,
.floating-field select:not([value=""]) + label {
  top: 0;
  font-size: 11px;
  color: var(--accent);
}

/* Cliente form: manter grupos existentes dentro do wizard */
#form-cliente .form-row {
  margin-bottom: 0;
}

@media (max-width: 920px) {
  .cliente-field--name,
  .cliente-field--email,
  .cliente-field--address {
    grid-column: span 8;
  }

  .cliente-field--cpf,
  .cliente-field--rg,
  .cliente-field--whatsapp,
  .cliente-field--phone,
  .cliente-field--birth,
  .cliente-field--source,
  .cliente-field--number,
  .cliente-field--cep,
  .cliente-field--state {
    grid-column: span 4;
  }

  .cliente-field--note,
  .cliente-field--complement,
  .cliente-field--district,
  .cliente-field--city {
    grid-column: span 6;
  }
}

@media (max-width: 640px) {
  .wizard-steps {
    gap: 12px;
  }

  .wizard-step-dot__label small {
    display: none;
  }

  .cliente-form-section {
    padding: 16px;
  }

  .cliente-form-grid {
    gap: 14px;
  }

  .cliente-form-grid .form-group {
    grid-column: 1 / -1;
  }

  .cliente-field--number,
  .cliente-field--cep,
  .cliente-field--state {
    grid-column: span 6 !important;
  }

  .wizard-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .wizard-action-clear {
    width: 100%;
    order: 3;
    margin: 4px 0 0;
  }

  .wizard-action-secondary,
  .wizard-action-primary {
    flex: 1;
  }
}

[data-theme="dark"] .wizard-progress__bar {
  background: #34145f;
}

[data-theme="blue"] .wizard-progress__bar {
  background: #155e75;
}

:is([data-theme="dark"], [data-theme="blue"]) .cliente-form-section,
:is([data-theme="dark"], [data-theme="blue"]) #form-cliente input,
:is([data-theme="dark"], [data-theme="blue"]) #form-cliente select,
:is([data-theme="dark"], [data-theme="blue"]) .wizard-action-secondary,
:is([data-theme="dark"], [data-theme="blue"]) .wizard-step-dot__number {
  border-color: var(--border);
  background: var(--surface);
}

:is([data-theme="dark"], [data-theme="blue"]) .cliente-form-section__title,
:is([data-theme="dark"], [data-theme="blue"]) #form-cliente .form-group label {
  color: var(--text);
}

:is([data-theme="dark"], [data-theme="blue"]) #form-cliente.cliente-form--readonly input,
:is([data-theme="dark"], [data-theme="blue"]) #form-cliente.cliente-form--readonly select {
  background: var(--bg-secondary);
  border-color: var(--border);
}

.field-hint {
  font-size: 11px;
  color: var(--text-light);
  margin-top: var(--space-1);
}

.field-error {
  font-size: 12px;
  color: var(--danger);
  font-weight: 600;
  margin-top: var(--space-1);
}

input.is-invalid,
select.is-invalid {
  border-color: rgba(220, 38, 38, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}
