/* Páginas del flujo: diagnóstico, materiales y orden. Usa los tokens de styles.css. */
:root {
  --head: #dfe7ea;
  --ok: #3f9a5f;
  --ok-bg: #e8f4ec;
  --error: #b8461f;
}

.app { background: var(--cream); min-height: 100vh; }
.app .blobs { position: fixed; }
.blob--app-peach {
  width: 340px; height: 340px; background: var(--peach);
  right: -110px; top: 90px;
  animation: drift-a 18s ease-in-out infinite alternate;
}
.blob--app-lavender {
  width: 120px; height: 120px; background: var(--lavender-row);
  left: 6%; top: 46%;
  animation: drift-b 14s ease-in-out infinite alternate;
}
.blob--app-mint {
  width: 220px; height: 220px; background: var(--mint);
  left: -80px; bottom: -90px;
  animation: drift-c 20s ease-in-out infinite alternate;
}

.app-header {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1100px; margin: 0 auto;
  padding: 28px 24px 20px;
}
.app-header img { display: block; height: 24px; width: auto; }
.app-header__link { font-size: 14px; color: var(--ink-soft); transition: color .2s; }
.app-header__link:hover { color: var(--orange); }

.app-main {
  position: relative; z-index: 1;
  max-width: 680px; margin: 0 auto;
  padding: 8px 16px 80px;
}
[hidden] { display: none !important; }

/* ---------- Tarjeta base ---------- */
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(120, 80, 50, .06);
  overflow: hidden;
}
.panel__head {
  display: flex; align-items: center; gap: 12px;
  background: var(--head);
  padding: 16px 24px;
  font-size: 17px; font-weight: 500;
}
.panel__head svg { width: 20px; height: 20px; flex: none; }
.panel__head .btn { margin-left: auto; }
.panel__body { padding: 24px; }

.btn--dark { background: var(--ink); color: var(--white); height: 36px; padding: 0 18px; font-size: 14px; }
.btn--dark:hover { background: #1f2a2f; }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { background: #e9e6e3; color: var(--muted); box-shadow: none; cursor: not-allowed; transform: none; }
.btn:focus-visible, .opt:has(input:focus-visible), .pkg-tab:focus-visible, .link:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.link { color: var(--ink-soft); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--orange); }
.muted { color: var(--muted); }

/* ---------- Portada del cuestionario ---------- */
.intro { text-align: center; padding: 48px 32px 40px; }
.intro__icon {
  display: grid; place-items: center;
  width: 56px; height: 56px; margin: 0 auto 20px;
  border-radius: 14px; background: var(--peach); color: var(--orange);
}
.intro__icon svg { width: 26px; height: 26px; }
.intro h1 { font-size: 28px; font-weight: 500; line-height: 1.25; }
.intro p { margin-top: 10px; color: var(--ink-soft); }
.intro .btn { margin-top: 28px; min-width: 200px; }
.intro__meta { margin-top: 14px; font-size: 13px; color: var(--muted); }
.intro__resume { margin-top: 12px; }

/* ---------- Cuestionario ---------- */
.quiz { padding: 28px 28px 24px; }
.quiz__top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.quiz__block { color: var(--orange-deep); font-weight: 500; }
.bar { height: 4px; border-radius: 4px; background: #efe9e4; margin-top: 10px; overflow: hidden; }
.bar__fill { height: 100%; width: 0; background: var(--orange); border-radius: inherit; transition: width .35s ease; }

.q { margin-top: 32px; border: 0; min-width: 0; }
.q.is-entering { animation: q-in .3s ease both; }
@keyframes q-in { from { opacity: 0; transform: translateY(10px); } }
.q__title { font-size: 22px; font-weight: 500; line-height: 1.3; padding: 0; }
.q__help { margin-top: 6px; font-size: 14px; color: var(--ink-soft); }
.q__field { margin-top: 22px; }
.q__error { margin-top: 10px; font-size: 13px; color: var(--error); min-height: 1em; }

.input, .textarea, .select {
  width: 100%;
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--white);
  border: 1px solid #ddd3cc; border-radius: 10px;
  padding: 12px 14px;
  transition: border-color .2s, box-shadow .2s;
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2355636a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
  padding-right: 40px;
}
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(226, 101, 58, .15); }
.is-invalid { border-color: var(--error); }

.opts { display: grid; gap: 10px; }
.opt {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e6ded8; border-radius: 10px;
  background: var(--white);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.opt:hover { border-color: #d3c6bd; background: #fffaf7; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt__key {
  display: grid; place-items: center; flex: none;
  width: 24px; height: 24px; border-radius: 6px;
  border: 1px solid #ddd3cc;
  font-size: 12px; font-weight: 500; color: var(--ink-soft);
}
.opt__text { flex: 1; font-size: 15px; }
.opt__check { width: 18px; height: 18px; color: var(--orange); opacity: 0; transition: opacity .15s; }
.opt:has(input:checked) { border-color: var(--orange); background: var(--peach-row); }
.opt:has(input:checked) .opt__key { background: var(--orange); border-color: var(--orange); color: var(--white); }
.opt:has(input:checked) .opt__check { opacity: 1; }

.quiz__nav { display: flex; align-items: center; gap: 12px; margin-top: 28px; }
.quiz__nav .btn--primary { margin-left: auto; }
.quiz__hint { font-size: 12px; color: var(--muted); }

/* ---------- Analizando ---------- */
.loading { text-align: center; padding: 64px 24px; }
.loading__dots { display: inline-flex; gap: 8px; }
.loading__dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); animation: dot 1s ease-in-out infinite; }
.loading__dots span:nth-child(2) { animation-delay: .15s; }
.loading__dots span:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }
.loading p { margin-top: 18px; color: var(--ink-soft); }

/* ---------- Diagnóstico ---------- */
.diag-for { font-size: 14px; color: var(--ink-soft); }
.diag-for strong { color: var(--ink); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { font-size: 12px; padding: 4px 12px; border-radius: 999px; background: var(--gray-card); border: 1px solid #ebe5e0; color: var(--ink); }
.diag-text { margin-top: 20px; display: grid; gap: 12px; font-size: 15px; line-height: 1.65; }

.pkg {
  position: relative;
  margin-top: 28px;
  border: 1px solid #e6ded8; border-radius: 12px;
  padding: 22px 20px 18px;
}
.pkg--rec { border: 2px solid var(--orange); }
.pkg__badge {
  position: absolute; top: -11px; left: 18px;
  font-size: 11px; font-weight: 500;
  background: var(--orange); color: var(--white);
  padding: 2px 10px; border-radius: 999px;
}
.pkg__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pkg__name { font-size: 19px; font-weight: 500; }
.pkg__price { font-size: 22px; font-weight: 500; white-space: nowrap; }
.pkg--rec .pkg__price { color: var(--orange); }
.pkg__price small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.pkg__list { margin-top: 14px; display: grid; gap: 8px; }
.pkg__list li { display: flex; gap: 10px; font-size: 14px; color: var(--ink-soft); line-height: 1.45; }
.pkg__list svg { width: 18px; height: 18px; flex: none; color: var(--ok); margin-top: 1px; }

.pkg-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.pkg-tab {
  position: relative;
  padding: 12px 8px; border-radius: 10px;
  border: 1px solid #e6ded8; background: var(--white);
  text-align: center; transition: border-color .15s, background .15s;
}
.pkg-tab:hover { border-color: #d3c6bd; }
.pkg-tab[aria-pressed="true"] { border: 2px solid var(--orange); background: var(--peach-row); padding: 11px 7px; }
.pkg-tab__name { display: block; font-size: 13px; color: var(--ink-soft); }
.pkg-tab__price { display: block; font-size: 16px; font-weight: 500; }
.pkg-tab__rec { display: block; font-size: 10px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; color: var(--orange-deep); margin-top: 2px; }

.compare { display: grid; gap: 14px; margin-top: 4px; }
.compare .pkg { margin-top: 18px; }

.fineprint { margin-top: 18px; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; margin-top: 18px; }
.actions .btn { white-space: normal; text-align: center; height: auto; min-height: 46px; padding: 10px 18px; }
.after-actions { margin-top: 18px; text-align: center; }
#choose-error { margin-top: 10px; text-align: center; }
.confirm {
  display: flex; gap: 12px; align-items: flex-start;
  margin-top: 18px; padding: 16px 18px;
  border-radius: 12px; background: var(--ok-bg);
}
.confirm svg { width: 22px; height: 22px; flex: none; color: var(--ok); margin-top: 1px; }
.confirm__title { font-size: 15px; font-weight: 500; }
.confirm__text { font-size: 14px; color: var(--ink-soft); margin: 2px 0 6px; }

/* ---------- Materiales ---------- */
.status-line { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.status-line svg { width: 18px; height: 18px; }
.status-line--ok { color: var(--ok); }
.status-line--pending { color: var(--orange-deep); }
.lead { margin-top: 6px; font-size: 14px; color: var(--ink-soft); }
.progress { margin-top: 20px; }
.progress__row { display: flex; justify-content: space-between; font-size: 13px; }
.progress__row strong { font-weight: 600; }

.items { margin-top: 18px; border-top: 1px solid #f0ebe6; }
.item { border-bottom: 1px solid #f0ebe6; }
.item__row { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 14px; padding: 16px 0; }
.item__icon {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--gray-card); color: var(--muted);
}
.item__icon svg { width: 18px; height: 18px; }
.item.is-done .item__icon { background: var(--ok-bg); color: var(--ok); }
.item__title { font-size: 15px; font-weight: 500; }
.item__title small { font-weight: 400; color: var(--muted); }
.item__desc { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.item__action { height: 36px; padding: 0 16px; font-size: 14px; }
.chip-ok {
  display: inline-flex; align-items: center; gap: 6px; max-width: 180px;
  height: 32px; padding: 0 12px; border-radius: 999px;
  background: var(--ok-bg); color: var(--ok); font-size: 13px; font-weight: 500;
}
.chip-ok span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-ok svg { width: 15px; height: 15px; flex: none; }
.item__panel { padding: 4px 0 20px 50px; display: grid; gap: 14px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.field label small { font-weight: 400; color: var(--muted); }
.field .textarea { min-height: 90px; font-size: 15px; }
.field .input { font-size: 15px; padding: 10px 12px; }
.field__help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--orange); }

.file {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px dashed #d8ccc3; border-radius: 10px; padding: 12px;
}
.file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file__btn { height: 34px; padding: 0 14px; font-size: 13px; cursor: pointer; }
.file:focus-within .file__btn { outline: 2px solid var(--orange); outline-offset: 2px; }
.file__name { font-size: 13px; color: var(--ink-soft); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file__remove { font-size: 13px; color: var(--error); text-decoration: underline; }
.panel-actions { display: flex; gap: 10px; align-items: center; }
.panel-actions .btn { height: 38px; font-size: 14px; }
.form-error { font-size: 13px; color: var(--error); }

.note {
  display: flex; gap: 12px; align-items: flex-start;
  margin-top: 22px; padding: 14px 16px;
  border-radius: 10px; background: var(--green-row);
  font-size: 14px; color: var(--ink-soft);
}
.note svg { width: 20px; height: 20px; flex: none; color: var(--ok); margin-top: 1px; }
.submit { margin-top: 20px; }
.submit .btn { height: 50px; }
.save-later { display: block; margin: 14px auto 0; font-size: 14px; color: var(--ink-soft); }
.save-later:hover { color: var(--orange); }
.toast { margin-top: 12px; text-align: center; font-size: 13px; color: var(--ok); min-height: 1em; }

/* ---------- Flujo de la orden ---------- */
.flow-intro { font-size: 14px; color: var(--ink-soft); }
.flow-intro strong { color: var(--ink); font-weight: 500; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 18px; font-size: 13px; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.role--ia { background: var(--lavender-row); color: #4e46b8; }
.role--neurea { background: var(--head); color: var(--ink); }
.role--cliente { background: var(--ok-bg); color: #2f7a4a; }
.legend .role--ia { background: var(--violet-dot); }
.legend .role--neurea { background: #9fb1b8; }
.legend .role--cliente { background: var(--green-dot); }

.steps-flow { margin-top: 20px; }
.flow-step { position: relative; display: grid; grid-template-columns: 34px 1fr auto; gap: 14px; padding-bottom: 20px; }
.flow-step:last-child { padding-bottom: 0; }
.flow-step::before {
  content: ""; position: absolute; left: 16px; top: 34px; bottom: 0; width: 2px;
  background: #eee7e1; transition: background .3s;
}
.flow-step:last-child::before { display: none; }
.flow-step__dot {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid #e3dbd4; background: var(--white); color: transparent;
  transition: border-color .3s, background .3s, color .3s;
}
.flow-step__dot svg { width: 16px; height: 16px; }
.flow-step__title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 15px; font-weight: 500; }
.role { font-size: 11px; font-weight: 500; padding: 2px 9px; border-radius: 999px; }
.flow-step__desc { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.flow-step__state { font-size: 12px; color: var(--muted); padding-top: 6px; white-space: nowrap; }
.flow-step.is-done .flow-step__dot { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.flow-step.is-done::before { background: var(--ok); }
.flow-step.is-done .flow-step__state { color: var(--ok); }
.flow-step.is-current .flow-step__dot { border-color: var(--orange); background: var(--peach-row); }
.flow-step.is-current .flow-step__dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--orange); animation: dot 1.2s ease-in-out infinite; }
.flow-step.is-current .flow-step__state { color: var(--orange-deep); }
.flow-step.is-pending .flow-step__title, .flow-step.is-pending .flow-step__desc { opacity: .6; }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .app-header { padding: 20px 16px 12px; }
  .app-header img { height: 20px; }
  .app-main { padding: 4px 12px 56px; }
  .panel__head { padding: 14px 18px; font-size: 16px; }
  .panel__body, .quiz { padding: 20px 18px; }
  .intro { padding: 36px 20px 32px; }
  .intro h1 { font-size: 24px; }
  .q__title { font-size: 19px; }
  .quiz__hint { display: none; }
  .actions { grid-template-columns: 1fr; }
  .pkg-tabs { gap: 6px; }
  .pkg-tab__price { font-size: 14px; }
  .pkg__head { flex-direction: column; gap: 2px; }
  .item__row { grid-template-columns: 32px 1fr; }
  .item__icon { width: 32px; height: 32px; }
  .item__action, .item__row .chip-ok { grid-column: 2; justify-self: start; }
  .item__panel { padding-left: 0; }
  .flow-step { grid-template-columns: 34px 1fr; }
  .flow-step__state { grid-column: 2; padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .q.is-entering, .loading__dots span, .flow-step.is-current .flow-step__dot::after { animation: none; }
  .bar__fill { transition: none; }
}
