/* Onboarding / diagnóstico: capa visual específica de m00_05. */

.diagnostic-intro-card {
  gap: 16px;
  margin: 26px 0 30px;
}

.diagnostic-intro-card > div {
  position: relative;
  min-height: 104px;
  padding: 20px 20px 18px;
  overflow: hidden;
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(16, 24, 40, .045);
}

.diagnostic-intro-card > div::after {
  content: "";
  position: absolute;
  width: 78px;
  height: 78px;
  right: -24px;
  bottom: -28px;
  border-radius: 999px;
  opacity: .18;
}

.diagnostic-intro-card > div:nth-child(1) {
  border-color: #bfdbfe;
  background: linear-gradient(145deg, #eff6ff 0%, #ffffff 74%);
}
.diagnostic-intro-card > div:nth-child(1)::after { background: #3b82f6; }

.diagnostic-intro-card > div:nth-child(2) {
  border-color: #ddd6fe;
  background: linear-gradient(145deg, #f5f3ff 0%, #ffffff 74%);
}
.diagnostic-intro-card > div:nth-child(2)::after { background: #8b5cf6; }

.diagnostic-intro-card > div:nth-child(3) {
  border-color: #bbf7d0;
  background: linear-gradient(145deg, #f0fdf4 0%, #ffffff 74%);
}
.diagnostic-intro-card > div:nth-child(3)::after { background: #22c55e; }

.diagnostic-intro-card strong {
  position: relative;
  z-index: 1;
  font-size: .96rem;
  line-height: 1.3;
}

.diagnostic-intro-card span {
  position: relative;
  z-index: 1;
  margin-top: 7px;
  font-size: .79rem;
  line-height: 1.55;
}

.diagnostic-wizard {
  margin-top: 28px;
  border-color: #d9e2f1;
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  box-shadow: 0 18px 45px rgba(16, 24, 40, .065);
}

.diagnostic-stepper {
  padding: 8px;
  gap: 6px;
  border-bottom-color: #e5eaf2;
  background: #f8fafc;
}

.diagnostic-step-dot {
  min-height: 78px;
  border: 0;
  border-radius: 14px;
  padding: 12px 8px 10px;
  transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.diagnostic-step-dot:last-child { border-right: 0; }

.diagnostic-step-dot > span {
  width: 30px;
  height: 30px;
  margin-bottom: 8px;
  background: #e9eef5;
  color: #667085;
  font-size: .76rem;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.diagnostic-step-dot small {
  font-size: .69rem;
  line-height: 1.25;
}

.diagnostic-step-dot.is-active {
  color: #1746a2;
  background: #ffffff;
  box-shadow: 0 5px 14px rgba(37, 99, 235, .09);
}

.diagnostic-step-dot.is-active > span {
  transform: scale(1.06);
  background: #2563eb;
  color: #fff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, .22);
}

.diagnostic-step-dot.is-complete {
  color: #247047;
}

.diagnostic-step-dot.is-complete > span {
  background: #dcfce7;
  color: #15803d;
}

.diagnostic-step {
  padding: clamp(26px, 4vw, 42px);
}

.diagnostic-step-head {
  position: relative;
  margin: 0 0 30px;
  padding: 20px 22px 20px 24px;
  border: 1px solid #dbe7fb;
  border-left: 5px solid #3b82f6;
  border-radius: 18px;
  background: linear-gradient(135deg, #f5f9ff 0%, #ffffff 72%);
}

.diagnostic-step[data-step="2"] .diagnostic-step-head {
  border-color: #d8e8ff;
  border-left-color: #0ea5e9;
  background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 72%);
}

.diagnostic-step[data-step="3"] .diagnostic-step-head {
  border-color: #e3dcff;
  border-left-color: #7c3aed;
  background: linear-gradient(135deg, #f8f5ff 0%, #ffffff 72%);
}

.diagnostic-step[data-step="4"] .diagnostic-step-head {
  border-color: #d2f1dd;
  border-left-color: #16a34a;
  background: linear-gradient(135deg, #f2fbf5 0%, #ffffff 72%);
}

.diagnostic-step[data-step="5"] .diagnostic-step-head {
  border-color: #fde3b2;
  border-left-color: #f59e0b;
  background: linear-gradient(135deg, #fffaf0 0%, #ffffff 72%);
}

.diagnostic-step-head > span {
  margin-bottom: 5px;
  font-size: .69rem;
  letter-spacing: .12em;
}

.diagnostic-step-head h2 {
  margin: 4px 0 8px;
  font-size: clamp(1.35rem, 2.4vw, 1.62rem);
  line-height: 1.2;
}

.diagnostic-step-head p {
  max-width: 760px;
  font-size: .9rem;
  line-height: 1.65;
}

/* Ritmo vertical consistente: dentro del grid no añadimos márgenes extra. */
.diagnostic-fields {
  gap: 20px 22px;
}

.diagnostic-fields > label {
  margin-top: 0 !important;
}

.diagnostic-step > label,
.diagnostic-step > .diagnostic-fieldset {
  margin-top: 28px;
}

.diagnostic-step > .diagnostic-step-head + label,
.diagnostic-step > .diagnostic-step-head + .diagnostic-fieldset,
.diagnostic-step > .diagnostic-step-head + .diagnostic-fields {
  margin-top: 0;
}

.diagnostic-step label,
.diagnostic-fieldset legend {
  color: #26364d;
  font-size: .88rem;
  font-weight: 760;
  line-height: 1.45;
}

.diagnostic-step label {
  gap: 9px;
}

.diagnostic-step label small,
.diagnostic-fieldset legend small {
  display: inline-block;
  margin-left: 3px;
  color: #667085;
  font-size: .76rem;
  font-weight: 520;
}

.diagnostic-step input[type="text"],
.diagnostic-step select,
.diagnostic-step textarea {
  min-height: 48px;
  padding: 12px 14px;
  border-color: #cbd5e1;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .025);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.diagnostic-step textarea {
  min-height: 112px;
  padding-top: 13px;
  line-height: 1.6;
}

.diagnostic-step input[type="text"]::placeholder,
.diagnostic-step textarea::placeholder {
  color: #98a2b3;
}

.diagnostic-step input[type="text"]:hover,
.diagnostic-step select:hover,
.diagnostic-step textarea:hover {
  border-color: #94a3b8;
}

.diagnostic-step input[type="text"]:focus,
.diagnostic-step select:focus,
.diagnostic-step textarea:focus {
  outline: 0;
  border-color: #4f8df7;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, .12);
  background: #fff;
}

.diagnostic-step input[readonly],
.diagnostic-step select:disabled {
  background: #f7f9fc;
  color: #475467;
}

.diagnostic-fieldset {
  padding: 18px;
  border: 1px solid #e1e7ef;
  border-radius: 18px;
  background: #fbfcfe;
}

.diagnostic-fieldset legend {
  width: auto;
  max-width: calc(100% - 20px);
  margin: 0 0 13px;
  padding: 0 7px;
}

.choice-grid--compact {
  gap: 12px;
}

.diagnostic-wizard .choice-card {
  min-height: 54px;
  padding: 13px 14px;
  border-color: #d9e0ea;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(16, 24, 40, .025);
}

.diagnostic-wizard .choice-card:hover {
  border-color: #8bb5f7;
  background: #f8fbff;
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(37, 99, 235, .07);
}

.diagnostic-wizard .choice-card:has(input:checked) {
  border-color: #6d9df5;
  background: linear-gradient(135deg, #edf5ff 0%, #f8fbff 100%);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .08), 0 4px 12px rgba(37, 99, 235, .055);
}

.diagnostic-wizard .choice-card input[type="checkbox"] {
  accent-color: #2563eb;
}

.diagnostic-wizard .choice-card span {
  font-size: .83rem;
  line-height: 1.48;
}

.diagnostic-fieldset.is-muted {
  opacity: .56;
  background: #f7f8fa;
}

.diagnostic-actions {
  gap: 16px;
  padding: 20px clamp(26px, 4vw, 42px);
  border-top-color: #e1e7ef;
  background: #fff;
}

.diagnostic-actions-right {
  gap: 14px;
}

.diagnostic-actions-right > span {
  padding: 6px 10px;
  border-radius: 999px;
  background: #f2f4f7;
  color: #667085;
  font-size: .75rem;
  font-weight: 700;
}

.diagnostic-actions .btn {
  min-height: 44px;
}

/* Los botones del wizard usan el atributo hidden para alternarse.
   .btn define display:inline-flex en app.css, así que reforzamos hidden aquí. */
.diagnostic-actions button[hidden] {
  display: none !important;
}

#diagnosticError,
#diagnosticNote {
  margin: 20px clamp(26px, 4vw, 42px) 0;
}

.diagnostic-complete {
  margin-top: 28px;
  padding: 20px 22px;
  border-radius: 18px;
  background: linear-gradient(135deg, #effcf3 0%, #ffffff 82%);
  box-shadow: 0 8px 20px rgba(22, 163, 74, .055);
}

@media (max-width: 860px) {
  .diagnostic-intro-card {
    grid-template-columns: 1fr;
  }

  .diagnostic-intro-card > div {
    min-height: 0;
  }

  .diagnostic-stepper {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px;
    scrollbar-width: thin;
  }

  .diagnostic-step-dot {
    flex: 0 0 118px;
  }

  .diagnostic-step-dot small {
    overflow: visible;
    white-space: normal;
    text-overflow: clip;
  }
}

@media (max-width: 720px) {
  .diagnostic-wizard {
    border-radius: 18px;
  }

  .diagnostic-step {
    padding: 22px 18px 26px;
  }

  .diagnostic-step-head {
    margin-bottom: 24px;
    padding: 17px 17px 17px 19px;
    border-radius: 15px;
  }

  .diagnostic-fields.two,
  .choice-grid--compact {
    grid-template-columns: 1fr;
  }

  .diagnostic-fieldset {
    padding: 15px;
  }

  .diagnostic-step > label,
  .diagnostic-step > .diagnostic-fieldset {
    margin-top: 24px;
  }

  .diagnostic-actions {
    padding: 18px;
  }

  #diagnosticError,
  #diagnosticNote {
    margin-left: 18px;
    margin-right: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .diagnostic-step-dot,
  .diagnostic-step-dot > span,
  .diagnostic-wizard .choice-card {
    transition: none;
  }
  .diagnostic-wizard .choice-card:hover {
    transform: none;
  }
}

/* v1.0.1: retícula y ritmo vertical del formulario */
.diagnostic-fields.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
  row-gap: 26px;
  align-items: start;
}

.diagnostic-control {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px !important;
  min-width: 0;
  margin: 0 !important;
}

.diagnostic-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
  min-height: 22px;
  color: #26364d;
  font-size: .88rem;
  font-weight: 760;
  line-height: 1.45;
}

.diagnostic-label small {
  margin: 0 !important;
  color: #667085;
  font-size: .76rem;
  font-weight: 520;
}

.diagnostic-field-full {
  grid-column: 1 / -1;
}

.diagnostic-control > input[type="text"],
.diagnostic-control > select,
.diagnostic-control > textarea {
  width: 100%;
  margin: 0;
  box-sizing: border-box;
}

/* Separación consistente entre bloques fuera de retículas. */
.diagnostic-step > .diagnostic-control,
.diagnostic-step > .diagnostic-fieldset {
  margin-top: 28px !important;
}

.diagnostic-step > .diagnostic-step-head + .diagnostic-control,
.diagnostic-step > .diagnostic-step-head + .diagnostic-fieldset,
.diagnostic-step > .diagnostic-step-head + .diagnostic-fields {
  margin-top: 0 !important;
}

.diagnostic-step > .diagnostic-fieldset + .diagnostic-control,
.diagnostic-step > .diagnostic-control + .diagnostic-fieldset,
.diagnostic-step > .diagnostic-control + .diagnostic-control,
.diagnostic-step > .diagnostic-fieldset + .diagnostic-fieldset {
  margin-top: 28px !important;
}

@media (max-width: 720px) {
  .diagnostic-fields.two {
    grid-template-columns: 1fr;
    row-gap: 22px;
  }

  .diagnostic-field-full {
    grid-column: auto;
  }

  .diagnostic-step > .diagnostic-control,
  .diagnostic-step > .diagnostic-fieldset,
  .diagnostic-step > .diagnostic-fieldset + .diagnostic-control,
  .diagnostic-step > .diagnostic-control + .diagnostic-fieldset,
  .diagnostic-step > .diagnostic-control + .diagnostic-control,
  .diagnostic-step > .diagnostic-fieldset + .diagnostic-fieldset {
    margin-top: 24px !important;
  }
}

/* =========================================================
   Onboarding v3 · 3 pasos + sugerencias IA entre 1 y 2
   ========================================================= */
.diagnostic-wizard--v3 .diagnostic-stepper {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.diagnostic-intro-card--v3 > div {
  min-height: 96px;
}

.diagnostic-privacy-note {
  margin-bottom: 18px;
}

.diagnostic-enterprise-context {
  margin: 18px 0 22px;
  border: 1px solid #dce4ef;
  border-radius: 16px;
  background: #fbfcfe;
  overflow: hidden;
}

.diagnostic-enterprise-context summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  cursor: pointer;
  color: #344054;
  font-size: .82rem;
}

.diagnostic-enterprise-context summary span {
  color: #667085;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .68rem;
}

.diagnostic-enterprise-context summary strong {
  text-align: right;
}

.diagnostic-enterprise-context > div {
  padding: 0 16px 16px;
  border-top: 1px solid #e7ecf3;
  color: #475467;
  font-size: .82rem;
  line-height: 1.55;
}

.diagnostic-enterprise-context > div p {
  margin: 12px 0 0;
}

.diagnostic-ai-handoff {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding: 15px 17px;
  border: 1px solid #d9e7ff;
  border-radius: 15px;
  background: linear-gradient(135deg, #f4f8ff 0%, #ffffff 88%);
}

.diagnostic-ai-handoff__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 999px;
  background: #e8f1ff;
  color: #2563eb;
  font-size: 1rem;
  font-weight: 900;
}

.diagnostic-ai-handoff strong,
.diagnostic-ai-handoff span {
  display: block;
}

.diagnostic-ai-handoff strong {
  color: #1f3a68;
  font-size: .84rem;
}

.diagnostic-ai-handoff span {
  margin-top: 3px;
  color: #667085;
  font-size: .76rem;
  line-height: 1.5;
}

.diagnostic-suggestion-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 22px;
  padding: 13px 15px;
  border: 1px solid #cfe0ff;
  border-radius: 14px;
  background: #f6f9ff;
  color: #344054;
}

.diagnostic-suggestion-status strong,
.diagnostic-suggestion-status span {
  display: block;
}

.diagnostic-suggestion-status strong {
  flex: 0 0 auto;
  color: #1d4ed8;
  font-size: .79rem;
}

.diagnostic-suggestion-status span {
  color: #5f6b7c;
  font-size: .76rem;
  line-height: 1.5;
}

.diagnostic-suggestion-status.is-fallback {
  border-color: #e5e7eb;
  background: #f8fafc;
}

.diagnostic-suggestion-status.is-fallback strong {
  color: #475467;
}

.diagnostic-wizard--v3 .choice-card.is-suggested {
  position: relative;
  border-color: #a9c7fb;
}

.diagnostic-wizard--v3 .choice-card.is-suggested::after {
  content: "Sugerida";
  position: absolute;
  top: 7px;
  right: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #edf4ff;
  color: #2563eb;
  font-size: .56rem;
  font-weight: 800;
  letter-spacing: .02em;
}

.diagnostic-wizard--v3 .choice-card.is-suggested span {
  padding-right: 42px;
}

.diagnostic-fields--optional {
  margin-top: 26px !important;
}

.diagnostic-fields--optional textarea {
  min-height: 96px;
}

.choice-grid--single {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.diagnostic-radio-grid .choice-card {
  min-height: 50px;
}

.diagnostic-radio-grid .choice-card input[type="radio"] {
  accent-color: #2563eb;
}

.diagnostic-radio-grid .choice-card:has(input:checked) {
  border-color: #6d9df5;
  background: linear-gradient(135deg, #edf5ff 0%, #f8fbff 100%);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .08), 0 4px 12px rgba(37, 99, 235, .055);
}

.diagnostic-course-note {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-top: 24px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f8fafc;
  color: #475467;
  font-size: .8rem;
  line-height: 1.5;
}

.diagnostic-course-note strong {
  flex: 0 0 auto;
  color: #344054;
}

@media (max-width: 860px) {
  .diagnostic-wizard--v3 .diagnostic-stepper {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }

  .diagnostic-wizard--v3 .diagnostic-step-dot {
    flex: initial;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .diagnostic-wizard--v3 .diagnostic-step-dot {
    min-height: 66px;
    padding: 9px 5px 8px;
  }

  .diagnostic-wizard--v3 .diagnostic-step-dot > span {
    width: 26px;
    height: 26px;
    margin-bottom: 5px;
  }

  .diagnostic-wizard--v3 .diagnostic-step-dot small {
    font-size: .62rem;
  }

  .diagnostic-ai-handoff,
  .diagnostic-suggestion-status,
  .diagnostic-course-note {
    align-items: flex-start;
  }

  .diagnostic-suggestion-status,
  .diagnostic-course-note {
    display: block;
  }

  .diagnostic-suggestion-status span,
  .diagnostic-course-note span {
    margin-top: 4px;
  }

  .diagnostic-enterprise-context summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .diagnostic-enterprise-context summary strong {
    text-align: left;
  }
}
