/* ¿Qué comemos? — Mi.pa / Blue Mint brand · mobile-first */
:root {
  --ink: #0B1F2A;
  --ink-soft: #12303D;
  --mint: #0EA5A4;
  --mint-dark: #0B8483;
  --mint-soft: #E6FBFA;
  --cream: #FBFAF6;
  --card: #FFFFFF;
  --line: #E6EAEC;
  --text: #0B1F2A;
  --dim: #5A6B72;
  --bot: #F2F4F5;
  --good: #1B9E5A;
  --warn: #C9781A;
  --danger: #C0392B;
  --r-sm: 8px; --r-md: 14px; --r-lg: 22px; --r-pill: 999px;
  --maxw: 480px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--cream);
  color: var(--text);
  overscroll-behavior-y: none;
}
#app { max-width: var(--maxw); margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
button { font-family: inherit; cursor: pointer; border: none; }

/* ---------- generic ---------- */
.btn {
  background: var(--mint); color: #fff; font-weight: 800; font-size: 16px;
  border-radius: var(--r-pill); padding: 15px 20px; width: 100%;
  box-shadow: 0 6px 18px rgba(14,165,164,.28);
}
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #fff; color: var(--mint-dark); border: 1.5px solid var(--line); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--mint-dark); box-shadow: none; font-weight: 700; }
.btn:disabled { opacity: .5; }
.price { font-weight: 800; color: var(--mint-dark); }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: var(--r-pill); background: var(--mint-soft); color: var(--mint-dark); }
.pill.warn { background: #FBEFD9; color: var(--warn); }
.dim { color: var(--dim); font-size: 13px; }
.hr { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 5;
}
.topbar .logo { font-weight: 900; letter-spacing: -.4px; font-size: 17px; }
.topbar .logo .q { color: var(--mint); }
.topbar .spacer { flex: 1; }
.topbar .cartbtn { position: relative; background: var(--ink-soft); color: #fff; border-radius: var(--r-pill); padding: 8px 14px; font-weight: 800; font-size: 13px; }
.topbar .cartbtn .badge { position: absolute; top: -6px; right: -6px; background: var(--mint); color: var(--ink); border-radius: var(--r-pill); font-size: 11px; min-width: 18px; height: 18px; line-height: 18px; text-align: center; font-weight: 900; }
.topbar .back { background: transparent; color: var(--mint); font-size: 22px; padding: 0 4px; }

/* ---------- onboarding ---------- */
.onb { flex: 1; background: var(--ink); color: #fff; padding: 0 24px calc(env(safe-area-inset-bottom) + 24px); display: flex; flex-direction: column; justify-content: center; text-align: left; }
.onb .mark { width: 76px; height: 76px; border-radius: 20px; background: linear-gradient(135deg, var(--mint), var(--mint-dark)); display: flex; align-items: center; justify-content: center; font-size: 40px; margin-bottom: 22px; box-shadow: 0 10px 30px rgba(14,165,164,.4); }
.onb h1 { font-size: 32px; font-weight: 900; margin: 0 0 8px; letter-spacing: -1px; }
.onb .sub { font-size: 16px; color: #B9C6CC; line-height: 1.5; margin-bottom: 26px; }
.onb ul { list-style: none; padding: 0; margin: 0 0 30px; }
.onb li { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; font-size: 15px; color: #E6EDEF; }
.onb li .dot { color: var(--mint); font-weight: 900; }
.onb .legal { font-size: 11px; color: #7C8B92; margin-top: 14px; text-align: center; }

/* ---------- chat ---------- */
.chat { flex: 1; display: flex; flex-direction: column; }
.chatlog { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; padding: 11px 14px; border-radius: 18px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.msg.bot { background: var(--bot); color: var(--text); align-self: flex-start; border-bottom-left-radius: 5px; }
.msg.user { background: var(--mint); color: #fff; align-self: flex-end; border-bottom-right-radius: 5px; }
.msg.bot table { border-collapse: collapse; margin: 6px 0; font-size: 13px; width: 100%; }
.msg.bot th, .msg.bot td { border: 1px solid var(--line); padding: 4px 7px; text-align: left; }
.msg.bot strong { font-weight: 800; }
.msg.bot h3 { font-size: 15px; margin: 8px 0 4px; }
.typing { align-self: flex-start; background: var(--bot); border-radius: 18px; padding: 12px 16px; display: flex; gap: 5px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: #9AA9AF; animation: bounce 1.2s infinite; }
.typing span:nth-child(2){ animation-delay:.2s } .typing span:nth-child(3){ animation-delay:.4s }
@keyframes bounce { 0%,60%,100%{transform:translateY(0);opacity:.5} 30%{transform:translateY(-5px);opacity:1} }

.suggests { display: flex; gap: 8px; overflow-x: auto; padding: 6px 14px 4px; }
.suggests button { flex: 0 0 auto; background: #fff; border: 1.5px solid var(--line); color: var(--mint-dark); border-radius: var(--r-pill); padding: 9px 14px; font-size: 13px; font-weight: 700; }

.composer { display: flex; gap: 8px; padding: 8px 12px calc(env(safe-area-inset-bottom) + 10px); background: var(--cream); border-top: 1px solid var(--line); }
.composer input { flex: 1; border: 1.5px solid var(--line); border-radius: var(--r-pill); padding: 13px 16px; font-size: 15px; background: #fff; outline: none; }
.composer input:focus { border-color: var(--mint); }
.composer .send { background: var(--mint); color: #fff; border-radius: 50%; width: 46px; height: 46px; font-size: 19px; flex: 0 0 auto; box-shadow: 0 4px 12px rgba(14,165,164,.3); }

/* cart preview bar inside chat */
.cartbar { margin: 0 14px 8px; background: #fff; border: 1.5px solid var(--mint); border-radius: var(--r-md); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.cartbar .info { flex: 1; }
.cartbar .info b { font-size: 15px; } .cartbar .info .dim { font-size: 12px; }
.cartbar .go { background: var(--mint); color: #fff; border-radius: var(--r-pill); padding: 10px 16px; font-weight: 800; font-size: 14px; }

/* ---------- screens ---------- */
.screen { flex: 1; overflow-y: auto; padding: 16px 16px calc(env(safe-area-inset-bottom) + 90px); }
.screen h2 { font-size: 20px; margin: 4px 0 2px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; margin-bottom: 12px; }
.card h3 { margin: 0 0 8px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; }
.row .n { color: var(--text); font-size: 14px; } .row .n small { color: var(--dim); }
.totals .row { padding: 4px 0; font-size: 14px; }
.totals .grand { font-size: 18px; font-weight: 900; border-top: 1.5px solid var(--line); margin-top: 6px; padding-top: 10px; }
.note { background: var(--mint-soft); color: var(--mint-dark); border-radius: var(--r-sm); padding: 10px 12px; font-size: 12.5px; line-height: 1.4; margin-top: 8px; }
.note.warn { background: #FBEFD9; color: var(--warn); }

.footbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: var(--maxw); padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px); background: linear-gradient(to top, var(--cream) 70%, transparent); }

/* payment method chips */
.pm { display: flex; flex-direction: column; gap: 10px; }
.pm label { display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 14px; background: #fff; }
.pm label.on { border-color: var(--mint); background: var(--mint-soft); }
.pm input { accent-color: var(--mint); width: 20px; height: 20px; }
.pm .pmname { font-weight: 700; } .pm .pmdesc { font-size: 12px; color: var(--dim); }
.provider { margin-top: 12px; background: var(--ink); color: #fff; border-radius: var(--r-md); padding: 14px; font-size: 14px; }
.provider b { color: var(--mint); }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; color: var(--dim); }
.field input { width: 100%; border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; font-size: 15px; outline: none; }
.field input:focus { border-color: var(--mint); }

/* tracking */
.track-steps { list-style: none; padding: 0; margin: 8px 0; }
.track-steps li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.track-steps .bullet { width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 13px; background: var(--line); color: var(--dim); }
.track-steps li.done .bullet { background: var(--good); color: #fff; }
.track-steps li.active .bullet { background: var(--mint); color: #fff; }
.track-steps .lab b { display: block; font-size: 15px; } .track-steps .lab .dim { font-size: 12px; }

/* toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--r-pill); font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .25s; z-index: 20; max-width: 90%; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* browse grid (discovery) */
.merchants { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.merch { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; }
.merch .emoji { font-size: 26px; } .merch b { display: block; font-size: 14px; margin: 6px 0 2px; }
.merch .dim { font-size: 11px; }

.banner { background: #FBEFD9; color: var(--warn); font-size: 12px; text-align: center; padding: 7px 12px; font-weight: 600; }
