:root {
  --fondo: #f6f3ee;
  --tarjeta: #ffffff;
  --linea: #eadfd2;
  --texto: #1c140e;
  --suave: #8a7768;
  --naranja: #ee8b2f;
  --usuario: #fff1e2;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: #ebe4da;
  color: var(--texto);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

button, textarea { font: inherit; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.app {
  width: min(760px, 100%);
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--fondo);
}

.barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--linea);
}

.logo {
  height: 64px;
  width: auto;
  background: transparent;
}

.barra-acciones { display: flex; gap: 14px; align-items: center; }

.enlace {
  border: 0;
  background: transparent;
  color: var(--naranja);
  font-weight: 700;
  cursor: pointer;
}

#cuenta-carrito {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--naranja);
  color: #1a1006;
  font-size: 12px;
}

.panel-carrito {
  background: #fff;
  border-bottom: 1px solid var(--linea);
  padding: 12px 16px 14px;
  max-height: 46vh;
  overflow: auto;
}

.panel-cabeza {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

#lineas-carrito { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

#lineas-carrito li {
  display: grid;
  grid-template-columns: 48px 1fr auto auto auto;
  gap: 8px;
  align-items: center;
}

#lineas-carrito .vacio { display: block; color: var(--suave); }

#lineas-carrito img, #lineas-carrito .foto-producto {
  width: 48px;
  height: 48px;
  font-size: 24px;
}

.unidades { display: flex; align-items: center; gap: 6px; }

.unidades button, .borrar, .agregar {
  border: 0;
  border-radius: 999px;
  background: #f3ece4;
  cursor: pointer;
  font-weight: 700;
}

.unidades button { width: 28px; height: 28px; }

.borrar { padding: 6px 10px; color: #8a3b2a; }

.pregunta-carrito {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--linea);
}

.pregunta-carrito p { margin: 0 0 8px; font-weight: 700; }

.agregar {
  background: var(--naranja);
  color: #1a1006;
  padding: 10px 14px;
}

.agregar:disabled { opacity: 0.6; cursor: default; }

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 12px;
}

.saludo {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.saludo p {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 700;
}

.estrella { color: var(--naranja); font-size: 22px; }

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

.ideas button, .burbuja, .ficha {
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-radius: 18px;
}

.ideas button {
  text-align: left;
  padding: 16px;
  cursor: pointer;
  color: var(--texto);
  font-weight: 700;
}

.ideas button span {
  display: block;
  margin-top: 4px;
  color: var(--suave);
  font-weight: 500;
  font-size: 14px;
}

.ideas button:hover { border-color: var(--naranja); }

.turno { display: flex; margin: 12px 0; }

.turno.usuario { justify-content: flex-end; }

.burbuja {
  max-width: min(560px, 92%);
  padding: 12px 14px;
  white-space: pre-wrap;
}

.usuario .burbuja {
  background: var(--usuario);
  border-color: #f3d7b8;
}

.agente .burbuja { border-radius: 18px 18px 18px 6px; }

.usuario .burbuja { border-radius: 18px 18px 6px 18px; }

.ficha { margin-top: 10px; overflow: hidden; }

.ficha img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #efe7dc;
}

.ficha-cuerpo { padding: 12px 14px 14px; }

.ficha h2 { margin: 0; font-size: 20px; }

.meta { margin: 4px 0 10px; color: var(--naranja); font-weight: 700; }

.mercado, .pasos, .carrito { list-style: none; margin: 0; padding: 0; }

.carrito { display: flex; flex-direction: column; gap: 8px; }

.carrito li {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--linea);
  border-radius: 14px;
}

.carrito img, .foto-producto {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  background: #fff4e8;
}

.foto-producto {
  display: grid;
  place-items: center;
  font-size: 30px;
}

.carrito strong { display: block; font-size: 15px; }

.carrito small { color: var(--suave); }

.carrito b { color: var(--naranja); font-size: 16px; white-space: nowrap; }

.total {
  margin: 10px 0 0;
  text-align: right;
  font-weight: 800;
}

.mercado li + li, .pasos li + li { margin-top: 6px; }

.mercado label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  cursor: pointer;
}

.mercado small { color: var(--suave); }

.mercado input { accent-color: var(--naranja); width: 16px; height: 16px; }

.listo { color: #a89888; text-decoration: line-through; }

.pasos { margin-top: 8px; counter-reset: paso; }

.pasos li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
}

.pasos li::before {
  counter-increment: paso;
  content: counter(paso);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--naranja);
  color: #1a1006;
  font-size: 12px;
  font-weight: 800;
}

.escribiendo { color: var(--suave); }

.composer {
  padding: 8px 12px 10px;
  background: #fff;
  border-top: 1px solid var(--linea);
}

.composer textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--linea);
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 16px;
  background: #fff;
  color: var(--texto);
}

.composer textarea:focus {
  outline: 2px solid var(--naranja);
  border-color: transparent;
}

.composer-acciones {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.icono {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f3ece4;
  cursor: pointer;
}

.icono svg { width: 20px; height: 20px; fill: #5c4b3d; }

.enviar { background: var(--naranja); }

.enviar svg { fill: #1a1006; }

.icono:disabled { opacity: 0.45; cursor: default; }

.nota {
  margin: 8px 0 0;
  text-align: center;
  color: var(--suave);
  font-size: 12px;
}

@media (max-width: 640px) {
  .saludo p { font-size: 20px; }
  .ideas { grid-template-columns: 1fr; }
}
