/* ---------- Flujo de pedido ---------- */
.pedido-app { padding: 28px 0 120px; min-height: 70vh; }
.tarjeta { background: var(--papel); border: 1px solid var(--linea); border-radius: 22px; padding: 32px; box-shadow: var(--sombra); }
.paso-pedido[data-paso="1"] .tarjeta, .confirmar, .listo { max-width: 720px; margin: 0 auto; }
.paso-pedido h1 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); color: var(--selva); }
.ayuda { color: var(--tinta-2); margin: 0 0 20px; font-size: .95rem; }
.opcional { color: var(--tinta-2); font-weight: 400; font-size: .85em; }
.btn-bloque { width: 100%; padding: 1em; font-size: 1.02rem; }
.trampa { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Indicador de pasos */
.pasos-pedido { list-style: none; padding: 0; margin: 0 auto 28px; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.pasos-pedido li { display: flex; align-items: center; gap: 8px; color: var(--tinta-2); font-weight: 500; font-size: .92rem; padding: 6px 14px 6px 6px; border-radius: 999px; }
.pasos-pedido li span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--linea); color: var(--tinta-2); font-weight: 700; font-size: .85rem; }
.pasos-pedido li.actual { background: var(--papel); color: var(--selva); box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.pasos-pedido li.actual span { background: var(--achiote); color: #fff; }
.pasos-pedido li.hecho span { background: var(--hoja); color: #fff; }
@media (max-width: 560px) { .pasos-pedido li:not(.actual) { font-size: 0; gap: 0; padding-right: 6px; } }

/* Tipos */
.opciones-tipo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 8px; }
.opcion-tipo { position: relative; border: 2px solid var(--linea); border-radius: 18px; padding: 20px 14px; text-align: center; cursor: pointer; transition: all .2s; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.opcion-tipo:hover { border-color: var(--hoja); }
.opcion-tipo input { position: absolute; opacity: 0; pointer-events: none; }
.opcion-tipo .ico { width: 54px; height: 54px; border-radius: 16px; background: var(--hoja-claro); color: var(--hoja); display: grid; place-items: center; margin-bottom: 8px; transition: all .2s; }
.opcion-tipo .ico svg { width: 26px; height: 26px; }
.opcion-tipo b { color: var(--selva); font-size: 1rem; }
.opcion-tipo small { color: var(--tinta-2); font-size: .82rem; }
.opcion-tipo:has(input:checked), .opcion-tipo.sel { border-color: var(--achiote); background: #fff7f1; }
.opcion-tipo.sel .ico { background: var(--achiote); color: #fff; }
.opcion-tipo:has(input:focus-visible) { outline: 3px solid rgba(224,99,29,.35); outline-offset: 2px; }
@media (max-width: 560px) {
  .opciones-tipo { grid-template-columns: 1fr; }
  .opcion-tipo { flex-direction: row; text-align: left; padding: 14px; gap: 14px; }
  .opcion-tipo .ico { margin: 0; flex: none; }
  .opcion-tipo b { flex: 1; }
}

/* Formulario */
.form-datos { margin-top: 24px; display: grid; gap: 16px; animation: aparecer .3s ease; }
.fila { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .fila { grid-template-columns: 1fr; } }
.campo label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: var(--selva); }
.campo input, .campo select, .campo textarea { width: 100%; padding: 13px 14px; border: 1.5px solid var(--linea); border-radius: 12px; font: inherit; background: #fffdf9; color: var(--tinta); transition: border-color .2s, box-shadow .2s; }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: none; border-color: var(--hoja); box-shadow: 0 0 0 4px rgba(63,143,58,.12); }
.campo.invalido input, .campo.invalido select { border-color: #d33; }
/* Comprobante: boleta / factura */
.segmento { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.segmento label { margin: 0; cursor: pointer; }
.segmento input { position: absolute; opacity: 0; pointer-events: none; }
.segmento span { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border: 2px solid var(--linea); border-radius: 12px; font-weight: 600; color: var(--tinta-2); transition: all .2s; }
.segmento span svg { width: 18px; height: 18px; }
.segmento.tres { grid-template-columns: repeat(3, 1fr); }
.segmento span small { display: block; font-weight: 500; font-size: .78rem; color: var(--tinta-2); }
.segmento.tres span { flex-wrap: wrap; text-align: center; gap: 2px 6px; padding: 10px 6px; line-height: 1.25; }
.segmento.tres span small { flex-basis: 100%; }
@media (max-width: 420px) { .segmento.tres { grid-template-columns: 1fr; } .segmento.tres span { flex-wrap: nowrap; justify-content: flex-start; padding: 12px 14px; } .segmento.tres span small { flex-basis: auto; } }
/* Estado SUNAT del RUC (verde activo / rojo otro) */
.estado-ruc { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; color: #fff; background: #1f8f3a; }
.estado-ruc.mal { background: #c62828; }
.segmento input:checked + span { border-color: var(--achiote); background: #fff7f1; color: var(--selva); }
.segmento input:focus-visible + span { outline: 3px solid rgba(224,99,29,.35); outline-offset: 2px; }
.doc-entrada { display: flex; gap: 8px; }
.doc-entrada input { flex: 1; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.doc-resultado { border-radius: 12px; padding: 12px 14px; font-size: .93rem; display: flex; gap: 10px; align-items: flex-start; }
.doc-resultado svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.doc-resultado b { display: block; color: var(--selva); font-size: 1rem; }
.doc-resultado small { display: block; color: var(--tinta-2); }
.doc-resultado.ok { background: var(--hoja-claro); }
.doc-resultado.ok svg { color: var(--hoja); }
.doc-resultado.aviso { background: #fff4e0; color: #7a4f0e; }
.doc-resultado.mal { background: #fdecec; color: #a32020; }
.doc-resultado.cargando { background: #f3efe6; color: var(--tinta-2); }
.error { background: #fdecec; color: #a32020; padding: 12px 14px; border-radius: 12px; font-size: .92rem; }

/* Paso 2 */
.resumen-cliente { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; background: var(--selva); color: #dfeee2; border-radius: 16px; padding: 12px 18px; margin-bottom: 20px; font-size: .92rem; }
.resumen-cliente b { color: #fff; }
.resumen-cliente .tipo { background: var(--achiote); color: #fff; border-radius: 999px; padding: 4px 12px; font-weight: 600; }
.resumen-cliente button { margin-left: auto; background: none; border: 0; color: var(--aguaje); font: inherit; font-weight: 600; cursor: pointer; }
.layout-carta { display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: start; }
.barra-carta { position: sticky; top: 72px; z-index: 5; background: var(--crema); padding: 8px 0 12px; }
.buscador { display: flex; align-items: center; gap: 10px; background: var(--papel); border: 1.5px solid var(--linea); border-radius: 14px; padding: 0 14px; color: var(--tinta-2); }
.buscador input { border: 0; outline: 0; padding: 12px 0; font: inherit; flex: 1; background: transparent; min-width: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--linea); background: var(--papel); padding: 8px 16px; border-radius: 999px; font: inherit; font-weight: 600; font-size: .9rem; color: var(--tinta-2); cursor: pointer; }
.chip.activo { background: var(--selva); color: #fff; border-color: var(--selva); }
.grupo-carta { margin-bottom: 28px; scroll-margin-top: 190px; }
.grupo-carta h2 { font-size: 1.5rem; color: var(--selva); margin: 12px 0 12px; }
.item-carta { display: flex; gap: 14px; align-items: center; background: var(--papel); border: 1px solid var(--linea); border-radius: 16px; padding: 12px; margin-bottom: 10px; transition: border-color .2s; }
.item-carta.en-carrito { border-color: var(--hoja); box-shadow: 0 0 0 1px var(--hoja) inset; }
.item-carta img, .item-carta .vacio { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; flex: none; }
.item-carta .vacio { background: linear-gradient(135deg, var(--hoja-claro), #f5e7cf); display: grid; place-items: center; font-family: var(--serif); color: var(--hoja); font-weight: 600; font-size: 1.2rem; }
.item-carta .info { flex: 1; min-width: 0; }
.item-carta h3 { font-family: var(--sans); font-size: 1rem; font-weight: 600; margin: 0 0 2px; letter-spacing: 0; }
.item-carta p { margin: 0 0 4px; color: var(--tinta-2); font-size: .85rem; line-height: 1.4; }
.item-carta .precio { font-weight: 700; color: var(--achiote); }
.sin-resultados { text-align: center; color: var(--tinta-2); padding: 40px 0; }

/* Contador */
.contador { display: flex; align-items: center; gap: 4px; flex: none; }
.contador button { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--hoja); background: #fff; color: var(--hoja); display: grid; place-items: center; cursor: pointer; padding: 0; }
.contador button svg { width: 18px; height: 18px; }
.contador button.mas { background: var(--hoja); color: #fff; }
.contador span { min-width: 26px; text-align: center; font-weight: 700; }
.contador.vacio .menos, .contador.vacio span { display: none; }

/* Carrito */
.carrito { position: sticky; top: 90px; padding: 22px; }
.carrito h2 { font-size: 1.3rem; display: flex; gap: 8px; align-items: center; color: var(--selva); }
.carrito-items { max-height: 46vh; overflow: auto; margin: 0 -6px; padding: 0 6px; }
.linea-carrito { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--linea); font-size: .92rem; }
.linea-carrito .n { flex: 1; min-width: 0; }
.linea-carrito .n small { display: block; color: var(--tinta-2); }
.linea-carrito .contador button { width: 28px; height: 28px; }
.linea-carrito .contador button svg { width: 14px; height: 14px; }
.linea-carrito .st { font-weight: 600; min-width: 64px; text-align: right; }
.carrito-vacio { color: var(--tinta-2); text-align: center; padding: 26px 0; font-size: .92rem; }
.carrito-total, .totales { padding: 14px 0; }
.totales .fila-total, .carrito-total .fila-total { display: flex; justify-content: space-between; color: var(--tinta-2); font-size: .95rem; margin-bottom: 4px; }
.fila-total.grande { color: var(--tinta); font-family: var(--serif); font-size: 1.5rem; font-weight: 600; margin-top: 6px; }
.barra-movil { display: none; }
@media (max-width: 960px) {
  .layout-carta { grid-template-columns: 1fr; }
  .carrito { display: none; }
  .barra-movil { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--selva); color: #fff; border-radius: 18px; padding: 10px 10px 10px 18px; box-shadow: 0 12px 30px rgba(0,0,0,.25); }
  .barra-movil small { display: block; color: #b9cfbf; font-size: .8rem; }
  .barra-movil b { font-family: var(--serif); font-size: 1.25rem; }
  .barra-movil[hidden] { display: none; }
}

/* Paso 3 */
.bloque { border: 1px solid var(--linea); border-radius: 16px; padding: 16px 18px; margin-bottom: 16px; }
.bloque-tit { display: flex; justify-content: space-between; align-items: center; font-weight: 700; color: var(--selva); margin-bottom: 8px; }
.enlace { background: none; border: 0; color: var(--achiote); font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.enlace svg { width: 16px; height: 16px; }
.dato-conf { display: flex; gap: 8px; font-size: .95rem; padding: 2px 0; }
.dato-conf span { color: var(--tinta-2); min-width: 92px; }

/* Paso 4 */
.listo { text-align: center; padding: 48px 28px; }
.listo .check { width: 76px; height: 76px; border-radius: 50%; background: var(--hoja); color: #fff; display: grid; place-items: center; margin: 0 auto 20px; animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
.listo .check svg { width: 40px; height: 40px; stroke-width: 2.5; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.listo .codigo { font-family: var(--serif); font-size: 3rem; font-weight: 700; color: var(--achiote); letter-spacing: .04em; margin: 4px 0 12px; }
.acciones-listo { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.dato-conf svg { width: 16px; height: 16px; color: var(--hoja); vertical-align: -3px; }

/* Compra de productos: comprobante emitido */
.listo-cpe { display: flex; gap: 12px; align-items: center; text-align: left; max-width: 440px; margin: 8px auto 4px; padding: 14px 16px; border-radius: 14px; background: var(--hoja-claro); }
.listo-cpe[hidden] { display: none; }
.listo-cpe svg { width: 30px; height: 30px; flex: none; color: var(--hoja); }
.listo-cpe b { display: block; color: var(--selva); }
.listo-cpe a { font-weight: 600; color: var(--achiote); }
.listo-cpe small { display: block; color: var(--tinta-2); }