:root {
  --fondo: #F6F5F2;
  --tarjeta: #FFFFFF;
  --texto: #16150F;
  --suave: #6B6A63;
  --borde: #E4E2DC;
  --acento: #15663A;
  --acento-oscuro: #0E4A29;
  --verde-claro: #E6F0EA;
  --peligro: #9F1239;
  --radio: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: Manrope, system-ui, sans-serif;
  font-weight: 500;
  line-height: 1.4;
}
#app {
  max-width: 480px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px 40px;
}
.vista { display: flex; flex-direction: column; gap: 16px; }
.vista[hidden] { display: none; }
a { color: var(--acento); font-weight: 700; text-decoration: none; }
a:hover { color: var(--acento-oscuro); }
.nowrap { white-space: nowrap; }

/* Cabeceras */
.cabecera { display: flex; align-items: center; gap: 12px; }
.cabecera-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.negocio { font-size: 17px; font-weight: 800; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.titulo { font-size: 20px; font-weight: 800; line-height: 1.2; }
.fecha, .suave { font-size: 13px; color: var(--suave); font-weight: 600; line-height: 1.4; }
.logo {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 12px; background: var(--acento); color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; letter-spacing: 0.02em; overflow: hidden;
}
.logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.logo.grande { width: 64px; height: 64px; border-radius: 16px; font-size: 22px; }
.boton-icono {
  width: 44px; height: 44px; flex-shrink: 0; padding: 0;
  border-radius: 12px; border: 1px solid var(--borde); background: #FFFFFF; color: var(--texto);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.boton-icono:hover { color: var(--texto); }

/* Campos */
.etiqueta { font-size: 12px; font-weight: 700; color: var(--suave); text-transform: uppercase; letter-spacing: 0.08em; }
.campo { display: flex; flex-direction: column; gap: 8px; }
.fila-entre { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.fila { display: flex; gap: 12px; align-items: center; }
.caja-texto { position: relative; }
textarea, input[type="text"], input[type="tel"] {
  width: 100%; font: inherit; font-weight: 600; font-size: 16px; color: var(--texto);
  background: #FFFFFF; border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px;
}
textarea { min-height: 148px; padding-right: 64px; resize: vertical; line-height: 1.5; display: block; }
textarea:focus, input:focus { outline: 2px solid var(--acento); outline-offset: 1px; }
input.codigo { letter-spacing: 0.08em; font-weight: 700; text-transform: uppercase; }
/* Carta: platos con interruptor */
.enlace { border: 0; background: none; padding: 8px 0; min-height: 44px; font: inherit; font-size: 14px; font-weight: 700; color: var(--acento); cursor: pointer; }
.enlace[hidden] { display: none; }
.secciones { display: flex; flex-direction: column; gap: 12px; }
.seccion { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.seccion strong { font-size: 15px; font-weight: 800; }
.platos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.plato { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--borde); }
.plato:first-child { border-top: 0; }
.interruptor { position: relative; display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; min-height: 48px; cursor: pointer; }
.interruptor input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.pista { width: 44px; height: 26px; border-radius: 13px; background: #D6D3CC; position: relative; flex-shrink: 0; transition: background 0.15s; }
.pista::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #FFFFFF; transition: transform 0.15s; }
.interruptor input:checked + .pista { background: var(--acento); }
.interruptor input:checked + .pista::after { transform: translateX(18px); }
.interruptor input:focus-visible + .pista { outline: 2px solid var(--acento); outline-offset: 2px; }
.plato .nombre { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plato.apagado .nombre { color: var(--suave); font-weight: 600; }
.quitar { width: 44px; height: 44px; flex-shrink: 0; border: 0; background: none; color: var(--suave); display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 10px; padding: 0; }
.quitar:hover { color: var(--peligro); background: var(--fondo); }
.agregar { display: flex; gap: 8px; margin-top: 4px; }
.agregar input { height: 44px; padding: 0 12px; font-size: 15px; border-radius: 12px; }
.boton-mas { width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; border: 0; background: var(--acento); color: #FFFFFF; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.boton-mas:hover { background: var(--acento-oscuro); }
.precio-campo { display: flex; align-items: center; gap: 8px; background: #FFFFFF; border: 1px solid var(--borde); border-radius: var(--radio); padding: 0 14px; height: 52px; max-width: 200px; }
.precio-campo:focus-within { outline: 2px solid var(--acento); outline-offset: 1px; }
.precio-campo .moneda { font-weight: 800; color: var(--suave); }
.precio-campo input { border: 0; padding: 0; height: 100%; font-size: 18px; font-weight: 800; }
.precio-campo input:focus { outline: none; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 28px; }
.chip { font-size: 12px; font-weight: 700; color: var(--acento); background: var(--verde-claro); border-radius: 999px; padding: 4px 10px; }
.chips .suave { font-size: 12px; }
.chips-plantilla { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chip-plantilla {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; min-height: 44px; flex-shrink: 0;
  border: 2px solid var(--borde); border-radius: 12px; background: #FFFFFF; color: var(--texto);
  font: inherit; font-weight: 800; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.chip-plantilla.elegida { border-color: var(--acento); }
.chip-plantilla svg { color: var(--suave); }
.muestra { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(0, 0, 0, 0.1); flex-shrink: 0; }
.muestra-clasico { background: #FFFFFF; border: 4px solid #15663A; }
.muestra-moderno { background: #F2F2F0; border: 4px solid #16150F; }
.muestra-pizarra { background: #1E2622; border-color: #4A3626; }
.muestra-criollo { background: #B3122E; border: 3px solid #F2B705; }
.muestra-chifa { background: #9E1B22; border: 3px solid #D8A657; }
.muestra-marino { background: #0B3C5D; border: 3px solid #F4EFE3; }
.muestra-brasa { background: #1C1917; border: 3px solid #F97316; }
.muestra-cafe { background: #F3E9DA; border: 3px solid #5B3A29; }

/* Tarjetas y botones */
.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px; }
.vista-previa { display: flex; flex-direction: column; gap: 10px; }
#lienzo, .mini, .miniatura { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--borde); display: block; background: #FFFFFF; }
.mini { width: 72px; flex-shrink: 0; }
.acciones { display: flex; flex-direction: column; gap: 10px; }
.boton {
  height: 52px; padding: 0 16px;
  border-radius: var(--radio); border: 1px solid var(--borde); background: #FFFFFF; color: var(--texto);
  font: inherit; font-weight: 700; font-size: 16px;
  display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; text-decoration: none;
}
.boton:hover { color: var(--texto); }
.boton.primario { background: var(--acento); color: #FFFFFF; border-color: var(--acento); }
.boton.primario:hover { background: var(--acento-oscuro); color: #FFFFFF; }
.boton.pequeno { height: 44px; font-size: 14px; align-self: flex-start; }
.boton.peligro { color: var(--peligro); }
.boton:disabled, .boton[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.pie { font-size: 12px; color: var(--suave); font-weight: 600; text-align: center; margin: 0; line-height: 1.4; }

/* Plantillas */
.rejilla { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tarjeta-plantilla {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 8px;
  border: 2px solid var(--borde); border-radius: var(--radio); background: #FFFFFF; color: var(--texto);
  font: inherit; text-align: left; cursor: pointer; text-decoration: none;
}
.tarjeta-plantilla:hover { color: var(--texto); }
.tarjeta-plantilla.elegida { border-color: var(--acento); }
.pie-plantilla { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 0 2px; font-size: 14px; font-weight: 800; }
.pie-textos { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pie-textos .suave { font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gratis { font-size: 11px; color: var(--acento); text-transform: uppercase; letter-spacing: 0.05em; }
.precio { font-size: 11px; color: var(--suave); text-transform: uppercase; letter-spacing: 0.05em; }
.marca, .candado {
  position: absolute; top: 16px; right: 16px; width: 28px; height: 28px; border-radius: 999px;
  color: #FFFFFF; display: flex; align-items: center; justify-content: center;
}
.marca { background: var(--acento); }
.candado { background: rgba(22, 21, 15, 0.75); }
.pronto {
  border: 2px dashed #D6D3CC; background: transparent; cursor: default;
  align-items: center; justify-content: center; text-align: center; min-height: 160px;
  color: var(--suave); font-weight: 700; font-size: 13px;
}

/* Pasos del desbloqueo */
.paso { display: flex; gap: 12px; }
.numero {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 999px;
  background: var(--acento); color: #FFFFFF; font-size: 14px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.paso-cuerpo { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.paso-titulo { font-size: 15px; font-weight: 800; line-height: 1.3; }
.qr {
  width: 96px; height: 96px; flex-shrink: 0; padding: 6px;
  border: 2px dashed #D6D3CC; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 11px; font-weight: 700; color: var(--suave); line-height: 1.3;
}
.qr img { width: 100%; height: 100%; object-fit: contain; }
.qr.con-imagen { border-style: solid; padding: 0; overflow: hidden; }

/* Ajustes */
.colores { display: flex; gap: 10px; flex-wrap: wrap; }
.color { width: 44px; height: 44px; border-radius: 12px; border: 3px solid transparent; position: relative; cursor: pointer; }
.color input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.color:has(input:checked) { border-color: var(--texto); }
.color:has(input:focus-visible) { outline: 2px solid var(--acento); outline-offset: 2px; }
.color-auto { background: #FFFFFF; border-color: #D6D3CC; border-style: dashed; display: flex; align-items: center; justify-content: center; }
.color-auto:has(input:checked) { border-style: solid; border-color: var(--texto); }
.auto-texto { font-size: 11px; font-weight: 800; color: var(--suave); }
.fila-logo { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* Avisos */
.aviso {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--texto); color: #FFFFFF; padding: 12px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 700; max-width: calc(100% - 32px); text-align: center; z-index: 10;
}
.aviso[hidden] { display: none; }
.oculto-visual { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
