/* =========================================
   Wizard — setup / nova instalação
   Design system Smarta (dark + azul vibrante)
   ========================================= */

.wizard-container {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.wizard-container.hidden {
  display: none;
}

body.wizard-open .app-shell {
  display: none;
}

.wiz-card {
  width: 100%;
  max-width: 540px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 44px 36px;
  text-align: center;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.02);
  position: relative;
  overflow: hidden;
}

.wiz-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 0%,
    var(--primary-soft),
    transparent 60%
  );
  pointer-events: none;
}

.wiz-card > * { position: relative; }

.wiz-logo {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.8px;
  margin-bottom: 28px;
  line-height: 1;
}

.wiz-logo .logo-dm { color: var(--text); }
.wiz-logo .logo-smart { color: var(--primary); }
.wiz-logo .logo-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  margin-left: 6px;
  box-shadow: 0 0 12px var(--primary-glow);
}

.wiz-title {
  font-size: var(--fs-xxl);
  font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -1px;
  line-height: 1.1;
}

.wiz-subtitle {
  font-size: var(--fs);
  color: var(--text-2);
  margin-bottom: 28px;
  line-height: 1.6;
}

.wiz-subtitle-error {
  color: var(--danger);
}

.wiz-note {
  font-size: var(--fs-sm);
  color: var(--text-2);
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 24px;
  line-height: 1.5;
  text-align: left;
}

.wiz-form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 8px;
}

.wiz-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wiz-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}

.wiz-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  color: var(--text);
  font-size: var(--fs);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.wiz-input::placeholder {
  color: var(--text-3);
}

.wiz-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
  background: var(--bg-elev-2);
}

.wiz-textarea {
  resize: vertical;
  min-height: 110px;
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 13px;
  word-break: break-all;
  line-height: 1.5;
}

.wiz-hint {
  font-size: var(--fs-xs);
  color: var(--text-3);
  line-height: 1.5;
}

.wiz-hint strong {
  color: var(--text-2);
}

.wiz-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 12px;
}

.wiz-actions-stack {
  flex-direction: column;
}

.wiz-btn {
  padding: 15px 26px;
  border-radius: var(--r);
  border: none;
  font-size: var(--fs);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  letter-spacing: -0.1px;
}

.wiz-btn:active {
  transform: translateY(1px);
}

.wiz-btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 24px -8px var(--primary-glow);
}

.wiz-btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 12px 28px -8px var(--primary-glow);
}

.wiz-btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}

.wiz-btn-ghost:hover {
  background: var(--bg-elev-2);
  color: var(--text);
  border-color: var(--bg-elev-3);
}

/* =========================================
   Status: loading / success / error
   ========================================= */

.wiz-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 24px;
  animation: wiz-spin 1s linear infinite;
}

@keyframes wiz-spin {
  to { transform: rotate(360deg); }
}

.wiz-check {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-weight: 700;
  box-shadow: 0 0 0 8px var(--primary-soft);
}

.wiz-error-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-weight: 700;
  box-shadow: 0 0 0 8px var(--danger-soft);
}

/* =========================================
   Discover / Zone Edit (03-03)
   ========================================= */

.wiz-card-wide {
  max-width: 720px;
}

.wiz-empty-zones {
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-sm);
  padding: 24px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--r);
}

.wiz-zones-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
  text-align: left;
}

.wiz-zone-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
}

.wiz-zone-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wiz-zone-icon svg {
  width: 22px;
  height: 22px;
}

.wiz-zone-info {
  flex: 1;
  min-width: 0;
}

.wiz-zone-name {
  font-size: var(--fs);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.wiz-zone-meta {
  font-size: var(--fs-xs);
  color: var(--text-2);
  margin-top: 2px;
}

.wiz-zone-del {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.wiz-zone-del:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
}

.wiz-btn-text {
  background: transparent;
  color: var(--text-3);
  border: none;
  padding: 10px;
}

.wiz-btn-text:hover {
  color: var(--text);
}

.wiz-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.wiz-zone-form {
  max-height: 72vh;
  overflow-y: auto;
}

.wiz-icon-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 8px;
}

@media (max-width: 620px) {
  .wiz-icon-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.wiz-icon-pick {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  cursor: pointer;
  padding: 6px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.wiz-icon-pick svg {
  width: 24px;
  height: 24px;
}

.wiz-icon-pick:hover {
  border-color: var(--primary);
  color: var(--text);
}

.wiz-icon-pick.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.wiz-entities {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 360px;
  overflow-y: auto;
  padding: 4px;
  margin: 0 -4px;
}

.wiz-domain-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wiz-domain-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-3);
  padding: 0 4px;
}

.wiz-domain-label span {
  color: var(--primary);
  font-weight: 600;
}

.wiz-domain-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wiz-entity-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: var(--fs-sm);
  transition: background 0.15s, border-color 0.15s;
}

.wiz-entity-row:hover {
  border-color: var(--bg-elev-3);
}

.wiz-entity-row.is-on {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.wiz-entity-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.wiz-entity-name {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wiz-entity-id {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 11px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.wiz-entity-critical {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.wiz-entity-critical input {
  width: 12px;
  height: 12px;
}

.wiz-entity-critical input:checked + span {
  color: var(--danger);
  font-weight: 700;
}

.wiz-entity-critical input:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

@media (max-width: 620px) {
  .wiz-entity-row {
    grid-template-columns: auto 1fr auto;
  }
  .wiz-entity-id {
    display: none;
  }
}

/* =========================================
   Mobile
   ========================================= */

@media (max-width: 540px) {
  .wiz-card {
    padding: 32px 22px;
    border-radius: var(--r);
  }

  .wiz-title {
    font-size: 28px;
  }

  .wiz-actions {
    flex-direction: column;
  }

  .wiz-actions .wiz-btn {
    width: 100%;
  }
}
