:root {
  color-scheme: light;
  --bg: #F4F2EE;
  --sup: #FFFFFF;
  --tinta: #15171A;
  --tinta-2: #3A3E44;
  --suave: #6B6F76;
  --linea: #E2DED7;
  --linea-2: #CFCAC1;
  --relleno: #ECE9E3;
  --ok: #1F7A4D;
  --error: #B42318;
  --radio: 18px;
  --sombra: 0 1px 2px rgba(21, 23, 26, .04), 0 6px 24px -12px rgba(21, 23, 26, .12);
  --fuente: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --seguro-abajo: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--tinta);
  font: 16px/1.5 var(--fuente);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { display: block; }
input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--tinta); outline-offset: 2px; }

/* ---------- Barra superior ---------- */
.barra {
  position: sticky; top: 0; z-index: 20;
  background: rgba(244, 242, 238, .88);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.barra-in {
  max-width: 680px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.marca { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; }
.marca-s {
  width: 32px; height: 32px; border-radius: 9px; background: var(--tinta); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 17px;
}
.marca-t { font-weight: 800; letter-spacing: .06em; font-size: 14px; }
.marca-t em { font-style: normal; font-weight: 500; letter-spacing: 0; color: var(--suave); }
.btn-sec {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--linea-2); background: var(--sup);
  border-radius: 999px; padding: 7px 12px 7px 14px; font-size: 14px; font-weight: 600;
}
.btn-sec svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.progreso { height: 3px; background: var(--linea); }
.progreso i { display: block; height: 100%; width: 0; background: var(--tinta); transition: width .35s ease; }

/* ---------- Contenido ---------- */
.app { max-width: 680px; margin: 0 auto; padding: 8px 16px calc(120px + var(--seguro-abajo)); outline: none; }

.sec-cab { padding: 22px 2px 18px; }
.sec-num { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--suave); margin: 0 0 6px; }
.sec-cab h1 { font-size: clamp(28px, 7.4vw, 38px); line-height: 1.08; letter-spacing: -.02em; margin: 0 0 10px; font-weight: 800; }
.sec-cab p { margin: 0; color: var(--tinta-2); font-size: 16px; max-width: 54ch; }

.q {
  background: var(--sup); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 18px 16px 18px; margin: 0 0 12px; box-shadow: var(--sombra);
  scroll-margin-top: 80px; transition: border-color .2s;
}
.q.falta { border-color: var(--error); }
.q-tit { display: block; font-size: 17px; line-height: 1.35; font-weight: 700; margin: 0 0 4px; letter-spacing: -.005em; }
.q-tit .req { color: var(--error); margin-left: 2px; }
.q-ayuda { margin: 0 0 4px; color: var(--suave); font-size: 14.5px; }
.q-cuerpo { margin-top: 12px; }
.q-error { color: var(--error); font-size: 14px; font-weight: 600; margin: 10px 0 0; }
.contador { font-size: 13px; color: var(--suave); font-weight: 600; margin-top: 10px; }

/* Campos de texto */
.campo {
  width: 100%; border: 1px solid var(--linea-2); background: #FCFBF9; border-radius: 12px;
  padding: 13px 14px; font-size: 16px; line-height: 1.4; transition: border-color .15s, background .15s;
  -webkit-appearance: none; appearance: none;
}
.campo::placeholder { color: #9A9EA5; }
.campo:focus { outline: none; border-color: var(--tinta); background: #fff; }
textarea.campo { min-height: 104px; resize: vertical; }
.tres { display: grid; gap: 8px; }
.tres label { display: flex; align-items: center; gap: 10px; }
.tres b { width: 26px; height: 26px; border-radius: 50%; background: var(--relleno); display: grid; place-items: center; font-size: 13px; flex: none; }
.otro-campo { margin-top: 10px; }

/* Chips (opciones cortas) */
.ops-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.op {
  display: inline-flex; align-items: center; gap: 8px; text-align: left;
  border: 1px solid var(--linea-2); background: var(--sup); border-radius: 999px;
  padding: 10px 15px; min-height: 44px; font-size: 15px; font-weight: 600; line-height: 1.25;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.op:active { transform: scale(.97); }
.op[aria-pressed="true"], .op[aria-checked="true"] { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.op[disabled] { opacity: .38; cursor: not-allowed; }
.op .ico { width: 16px; height: 16px; flex: none; }
.op .ico path { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.op:not([aria-pressed="true"]):not([aria-checked="true"]) .ico { display: none; }
.op .punto { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.18); flex: none; }

/* Lista (opciones largas) */
.ops-lista { display: grid; gap: 8px; }
.ops-lista .op { border-radius: 14px; width: 100%; padding: 12px 14px; }
.ops-lista .op::before {
  content: ''; width: 20px; height: 20px; flex: none; border: 1.5px solid var(--linea-2); background: #fff;
}
.ops-lista .op[role="radio"]::before { border-radius: 50%; }
.ops-lista .op[role="checkbox"]::before { border-radius: 6px; }
.ops-lista .op[aria-checked="true"]::before, .ops-lista .op[aria-pressed="true"]::before {
  border-color: #fff; background: #fff; box-shadow: inset 0 0 0 4px var(--tinta);
}
.ops-lista .op .ico { display: none; }

/* Tarjetas */
.tarjetas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tarjetas.texto { grid-template-columns: 1fr; }
.tarjeta {
  position: relative; display: flex; flex-direction: column; text-align: left; gap: 2px;
  border: 1px solid var(--linea-2); background: var(--sup); border-radius: 16px; padding: 10px;
  transition: border-color .15s, box-shadow .15s, transform .1s; min-width: 0;
}
.tarjeta:active { transform: scale(.985); }
.tarjeta[aria-pressed="true"], .tarjeta[aria-checked="true"] { border-color: var(--tinta); box-shadow: 0 0 0 1.5px var(--tinta); }
.tarjeta[disabled] { opacity: .4; cursor: not-allowed; }
.tarjeta .vis {
  height: 92px; border-radius: 10px; background: var(--relleno); display: grid; place-items: center;
  margin-bottom: 8px; overflow: hidden; color: var(--tinta);
}
.tarjeta .vis svg { width: 100%; height: 100%; }
.tarjeta .t-tit { font-weight: 700; font-size: 15px; line-height: 1.25; padding-right: 22px; }
.tarjeta .t-desc { font-size: 13.5px; color: var(--suave); line-height: 1.35; }
.tarjetas.texto .tarjeta { padding: 14px 44px 14px 14px; }
.tarjetas.texto .t-tit { font-size: 16px; }
.tarjetas.texto .t-desc { font-size: 14.5px; }
.marca-check {
  position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--linea-2); background: #fff; display: grid; place-items: center;
}
.tarjetas:not(.texto) .marca-check { top: 16px; right: 16px; }
.marca-check svg { width: 14px; height: 14px; opacity: 0; }
.marca-check path { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tarjeta[aria-pressed="true"] .marca-check, .tarjeta[aria-checked="true"] .marca-check { background: var(--tinta); border-color: var(--tinta); }
.tarjeta[aria-pressed="true"] .marca-check svg, .tarjeta[aria-checked="true"] .marca-check svg { opacity: 1; }
.vis.fuente span { font-size: 40px; line-height: 1; color: var(--tinta); letter-spacing: .02em; }
.vis.paleta { display: flex; padding: 0; background: none; border: 1px solid var(--linea); }
.vis.paleta i { flex: 1; height: 100%; }
.vis.paleta i:first-child { flex: 1.6; }
.vis.paleta.vacia { display: grid; background: repeating-linear-gradient(135deg, #F7F5F1 0 10px, #EFECE6 10px 20px); }
.vis.paleta.vacia span { font-size: 26px; font-weight: 800; color: var(--suave); }

/* Escalas */
.escalas { display: grid; gap: 18px; }
.escala-etq { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 600; color: var(--tinta-2); margin-bottom: 8px; }
.escala-etq span:last-child { text-align: right; }
.escala-pts { position: relative; display: flex; justify-content: space-between; align-items: center; padding: 0 2px; }
.escala-pts::before { content: ''; position: absolute; left: 22px; right: 22px; top: 50%; height: 2px; background: var(--linea); transform: translateY(-50%); }
.pt {
  position: relative; width: 44px; height: 44px; border-radius: 50%; border: 0; background: none; padding: 0;
  display: grid; place-items: center;
}
.pt i { width: 22px; height: 22px; border-radius: 50%; background: var(--sup); border: 2px solid var(--linea-2); transition: all .15s; }
.pt:nth-child(1) i, .pt:nth-child(5) i { width: 28px; height: 28px; }
.pt:nth-child(3) i { width: 16px; height: 16px; }
.pt[aria-checked="true"] i { background: var(--tinta); border-color: var(--tinta); box-shadow: 0 0 0 4px rgba(21,23,26,.12); }

/* Prioridades */
.prio { display: grid; gap: 0; }
.prio-fila { padding: 12px 0; border-top: 1px solid var(--linea); }
.prio-fila:first-child { border-top: 0; padding-top: 2px; }
.prio-txt { font-size: 15px; font-weight: 600; margin-bottom: 8px; line-height: 1.35; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--relleno); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button {
  border: 0; background: none; border-radius: 9px; padding: 8px 4px; min-height: 38px;
  font-size: 13px; font-weight: 700; color: var(--tinta-2); line-height: 1.15;
}
.seg button[aria-checked="true"] { background: var(--sup); color: var(--tinta); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg button[aria-checked="true"][data-n="2"] { background: var(--tinta); color: #fff; }
.prio-leyenda { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--suave); margin: 0 0 6px; }

/* Fotos */
.fotos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.foto { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--relleno); }
.foto img { width: 100%; height: 100%; object-fit: cover; }
.foto .quitar {
  position: absolute; top: 5px; right: 5px; width: 28px; height: 28px; border-radius: 50%; border: 0;
  background: rgba(21,23,26,.78); display: grid; place-items: center;
}
.foto .quitar svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; }
.foto .estado {
  position: absolute; inset: 0; display: grid; place-items: center; background: rgba(244,242,238,.72);
  font-size: 12px; font-weight: 700; color: var(--tinta);
}
.foto .estado.error { background: rgba(180,35,24,.82); color: #fff; padding: 6px; text-align: center; }
.girando { width: 22px; height: 22px; border: 2.5px solid var(--linea-2); border-top-color: var(--tinta); border-radius: 50%; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.agregar-foto {
  aspect-ratio: 1; border: 1.5px dashed var(--linea-2); border-radius: 12px; background: #FBFAF8;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 700; color: var(--tinta-2); position: relative; cursor: pointer;
}
.agregar-foto svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.agregar-foto input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

/* ---------- Pie con navegación ---------- */
.pie {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(244, 242, 238, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--linea);
}
.pie-in {
  max-width: 680px; margin: 0 auto; padding: 10px 16px calc(10px + var(--seguro-abajo));
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.guardado { font-size: 12.5px; color: var(--suave); text-align: center; flex: 1; min-width: 0; }
.btn {
  border-radius: 14px; padding: 13px 20px; font-weight: 700; font-size: 16px; min-height: 50px;
  border: 1px solid var(--linea-2); background: var(--sup); transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn-pri { background: var(--tinta); border-color: var(--tinta); color: #fff; min-width: 132px; }
.btn-pri:disabled { opacity: .6; }
.btn-sec-2[disabled] { visibility: hidden; }
.btn-ancho { width: 100%; }

/* ---------- Portada y final ---------- */
.portada { padding: 34px 2px 0; }
.portada .logo-s {
  width: 64px; height: 64px; border-radius: 18px; background: var(--tinta); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 34px; margin-bottom: 26px;
}
.portada .eti { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--suave); margin: 0 0 10px; }
.portada h1 { font-size: clamp(34px, 9.6vw, 50px); line-height: 1.02; letter-spacing: -.03em; margin: 0 0 16px; font-weight: 800; }
.portada .lead { font-size: 17.5px; color: var(--tinta-2); margin: 0 0 26px; max-width: 46ch; }
.datos { list-style: none; padding: 0; margin: 0 0 28px; display: grid; gap: 0; border-top: 1px solid var(--linea-2); }
.datos li { display: flex; gap: 14px; padding: 14px 2px; border-bottom: 1px solid var(--linea-2); font-size: 15.5px; }
.datos b { min-width: 26px; font-weight: 800; }
.datos span { color: var(--tinta-2); }
.portada .acciones { display: grid; gap: 10px; }
.portada .nota { font-size: 13.5px; color: var(--suave); margin: 18px 0 0; text-align: center; }

.final { padding: 48px 2px 0; text-align: center; }
.final .ok {
  width: 72px; height: 72px; border-radius: 50%; background: var(--tinta); margin: 0 auto 24px; display: grid; place-items: center;
}
.final .ok svg { width: 34px; height: 34px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.final h1 { font-size: clamp(30px, 8vw, 42px); line-height: 1.05; letter-spacing: -.025em; margin: 0 0 14px; }
.final p { color: var(--tinta-2); font-size: 17px; margin: 0 auto 14px; max-width: 42ch; }
.folio {
  display: inline-block; margin: 8px 0 26px; padding: 14px 22px; border-radius: 16px; background: var(--sup);
  border: 1px solid var(--linea-2); font-weight: 800; font-size: 22px; letter-spacing: .06em;
}
.folio small { display: block; font-size: 12px; letter-spacing: .1em; color: var(--suave); font-weight: 700; text-transform: uppercase; }
.final .acciones { display: grid; gap: 10px; max-width: 360px; margin: 0 auto; }

/* ---------- Hoja de secciones ---------- */
.hoja { position: fixed; inset: 0; z-index: 40; }
.hoja-fondo { position: absolute; inset: 0; background: rgba(21,23,26,.42); animation: aparece .2s ease; }
.hoja-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 86vh; overflow: auto;
  background: var(--bg); border-radius: 22px 22px 0 0; padding: 8px 16px calc(18px + var(--seguro-abajo));
  max-width: 680px; margin: 0 auto; animation: sube .25s cubic-bezier(.2,.8,.2,1);
}
@keyframes aparece { from { opacity: 0; } }
@keyframes sube { from { transform: translateY(40px); opacity: 0; } }
.hoja-cab { display: flex; align-items: center; justify-content: space-between; padding: 10px 2px; }
.hoja-cab h2 { margin: 0; font-size: 20px; }
.x { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--linea-2); background: var(--sup); display: grid; place-items: center; }
.x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.hoja-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hoja-lista button {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; border: 1px solid var(--linea);
  background: var(--sup); border-radius: 14px; padding: 12px 14px;
}
.hoja-lista .n { width: 30px; height: 30px; border-radius: 50%; background: var(--relleno); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.hoja-lista .lleno .n { background: var(--tinta); color: #fff; }
.hoja-lista .actual { border-color: var(--tinta); }
.hoja-lista .tt { flex: 1; font-weight: 700; }
.hoja-lista .cc { font-size: 13px; color: var(--suave); font-weight: 600; }

/* ---------- Aviso ---------- */
.aviso {
  position: fixed; left: 50%; bottom: calc(86px + var(--seguro-abajo)); transform: translateX(-50%); z-index: 50;
  background: var(--tinta); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14.5px; font-weight: 600;
  max-width: calc(100% - 32px); box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); animation: aparece .2s ease;
}

@media (min-width: 560px) {
  .q { padding: 22px 22px; }
  .tarjetas.texto { grid-template-columns: 1fr 1fr; }
  .tarjetas:not(.texto) { grid-template-columns: repeat(3, 1fr); }
  .fotos { grid-template-columns: repeat(4, 1fr); }
  .prio-fila { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: center; }
  .prio-txt { margin: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
