/* catalogo — estilos compartidos (mobile-only "phone-shaped"). Client-first. */
:root {
  --bg: #f5f5f4; --surface: #fff; --ink: #18181b; --ink-soft: #52525b;
  --ink-mute: #a1a1aa; --line: #e7e5e4; --brand: #1d4ed8; --brand-dark: #1e3a8a;
  --ok: #15803d; --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--bg); font-size: 16px; line-height: 1.4;
  -webkit-font-smoothing: antialiased; padding-bottom: 104px;
}
.wrap { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); }

/* Header */
header { background: #0b0b0c; color: #fff; padding: 14px 16px 12px; position: sticky; top: 0; z-index: 10; }
.hdr-brand { font-size: 12px; opacity: .65; letter-spacing: .06em; text-transform: uppercase; }
.hdr-title { font-size: 22px; font-weight: 800; margin-top: 2px; letter-spacing: -.02em; }
.hdr-meta { font-size: 12px; opacity: .7; margin-top: 4px; }

/* Greeting / search */
.intro { padding: 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.intro h1 { margin: 0 0 4px; font-size: 17px; font-weight: 700; }
.intro p { margin: 0 0 12px; color: var(--ink-soft); font-size: 14px; }
.search { position: relative; }
.search input {
  width: 100%; padding: 12px 14px 12px 40px; font-size: 15px; border: 1px solid var(--line);
  border-radius: 10px; font-family: inherit; background: #fafaf9; color: var(--ink);
}
.search input:focus { outline: none; border-color: var(--ink); background: #fff; }
.search::before {
  content: "🔍"; position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  font-size: 14px; opacity: .5;
}

/* Section chips */
.cats {
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; scrollbar-width: none;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 64px; z-index: 9;
}
.cats::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; font-size: 13px; color: var(--ink-soft); font-weight: 600; white-space: nowrap;
  cursor: pointer; font-family: inherit;
}
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* List */
.section-head {
  padding: 18px 16px 6px; font-size: 11px; font-weight: 800; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .08em; background: var(--bg);
}
.item {
  display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 12px; padding: 12px 14px;
  background: var(--surface); border-bottom: 1px solid var(--line); align-items: start;
}
.item-img {
  width: 80px; height: 80px; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.item-img img { max-width: 100%; max-height: 100%; display: block; }
.item-img.empty::after { content: "📦"; font-size: 30px; opacity: .25; }
.item-body { min-width: 0; }
.item-tag {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .04em; color: #fff;
  background: var(--brand); padding: 2px 7px; border-radius: 4px; margin: 0 5px 5px 0;
}
.tag-new { background: var(--brand); }
.tag-offer { background: #ea580c; }
.chip-offer { color: #ea580c; border-color: #fdba74; font-weight: 800; }
.chip-offer.active { background: #ea580c; color: #fff; border-color: #ea580c; }
.item-name { font-weight: 700; font-size: 14px; line-height: 1.3; margin: 0 0 3px; color: var(--ink); }
.item-meta { font-size: 11px; color: var(--ink-mute); margin-bottom: 8px; }
.price-block { margin-bottom: 10px; }
.price-unit { font-size: 19px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.price-unit small { font-size: 11px; font-weight: 600; color: var(--ink-mute); }
.price-calc { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--ink-soft); line-height: 1.5; }
.price-calc span { display: block; }
.price-calc b { color: var(--ink); font-weight: 800; font-size: 13px; }
.buy-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.buy-unit { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.buy-sub { font-size: 12px; color: var(--ok); font-weight: 800; margin-right: auto; text-align: right; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: #fff; overflow: hidden; flex: 0 0 auto; }
.stepper button {
  width: 32px; height: 34px; border: 0; background: transparent; font-size: 19px; font-weight: 600;
  color: var(--ink); cursor: pointer; padding: 0; line-height: 1; font-family: inherit;
}
.stepper button:active { background: #f4f4f5; }
.stepper button:disabled { color: var(--ink-mute); }
.stepper-val { min-width: 26px; text-align: center; font-weight: 700; font-size: 15px; }
.item.has-qty { background: #eff6ff; }
.item.has-qty .item-img { border-color: var(--brand); }
.empty-search { padding: 48px 24px; text-align: center; color: var(--ink-mute); }
.how { margin-top: 12px; font-size: 12.5px; color: var(--ink-soft); background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 10px 12px; line-height: 1.45; }
.how b { color: var(--ink); }

/* Footbar */
.footbar {
  position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(0,0,0,.07); z-index: 20;
}
.footbar-inner { max-width: 480px; margin: 0 auto; }
.footbar-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.footbar-label { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.footbar-total { font-size: 20px; font-weight: 800; color: var(--ink); }
.btn {
  display: block; width: 100%; padding: 15px 16px; border-radius: 12px; border: 0; font-size: 16px;
  font-weight: 700; cursor: pointer; transition: transform .08s ease; font-family: inherit;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:disabled { background: var(--ink-mute); cursor: not-allowed; }

/* Sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s; }
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%) translateY(100%); width: 100%; max-width: 480px;
  background: var(--bg); z-index: 51; max-height: 92vh; border-radius: 18px 18px 0 0; transition: transform .25s ease;
  display: flex; flex-direction: column;
}
.sheet.open { transform: translateX(-50%) translateY(0); }
.sheet-hdr { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--line); background: #fff; border-radius: 18px 18px 0 0; }
.sheet-hdr h2 { margin: 0; font-size: 17px; font-weight: 700; }
.sheet-close { width: 32px; height: 32px; border: 0; background: transparent; font-size: 26px; color: var(--ink-soft); cursor: pointer; line-height: 1; }
.sheet-body { flex: 1; overflow-y: auto; padding: 16px; }
.summary { background: #fff; border-radius: var(--radius); border: 1px solid var(--line); padding: 4px 0; margin-bottom: 16px; }
.sum-row { display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; padding: 10px 14px; align-items: center; border-bottom: 1px solid var(--line); }
.sum-row:last-child { border-bottom: 0; }
.sum-img { width: 46px; height: 46px; background: #fff; border: 1px solid var(--line); border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.sum-img img { max-width: 100%; max-height: 100%; }
.sum-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.sum-qty { font-size: 11px; color: var(--ink-mute); margin-top: 2px; }
.sum-price { font-size: 13px; font-weight: 700; white-space: nowrap; }
.sum-totals { padding: 12px 14px; background: #fafaf9; border-top: 1px solid var(--line); font-size: 13px; }
.sum-tot-row { display: flex; justify-content: space-between; margin-bottom: 4px; color: var(--ink-soft); }
.sum-tot-row.grand { font-size: 16px; font-weight: 800; color: var(--ink); margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); margin-bottom: 0; }

/* Form */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; letter-spacing: .02em; }
.form-group label .req { color: var(--brand); }
.form-group input, .form-group textarea {
  width: 100%; padding: 12px 14px; font-size: 15px; border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; background: #fff; color: var(--ink);
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--ink); }
.form-group textarea { resize: vertical; min-height: 60px; }
.prefill-card { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.prefill-label { font-size: 10px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; font-weight: 800; margin-bottom: 6px; }
.prefill-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.prefill-main strong { display: block; font-size: 15px; color: var(--ink); font-weight: 800; }
.prefill-main small { display: block; color: var(--ink-soft); font-size: 12px; margin-top: 2px; word-break: break-all; }
.link-btn { background: none; border: 0; color: var(--brand); font-weight: 700; font-size: 12px; padding: 4px 0; cursor: pointer; font-family: inherit; white-space: nowrap; }
.hidden { display: none !important; }
.sheet-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; }

/* Done */
.done { text-align: center; padding: 32px 20px; }
.done-icon { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; background: var(--ok); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 32px; }
.done h2 { margin: 0 0 8px; font-size: 22px; }
.done p { color: var(--ink-soft); margin: 0 0 16px; }
.done-detail { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: left; font-size: 13px; color: var(--ink-soft); margin-top: 16px; }
.done-detail strong { color: var(--ink); }

.foot-note { text-align: center; font-size: 11px; color: var(--ink-mute); padding: 16px; }
.loading { padding: 60px 20px; text-align: center; color: var(--ink-mute); }

/* Landing */
.landing { padding: 48px 20px; text-align: center; }
.landing h1 { font-size: 26px; margin: 0 0 8px; }
.landing p { color: var(--ink-soft); margin: 0 0 28px; }
.landing-cards { display: grid; gap: 12px; max-width: 380px; margin: 0 auto; }
.landing-card { display: flex; align-items: center; gap: 14px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); text-align: left; transition: border-color .15s; }
.landing-card:hover { border-color: var(--ink); }
.landing-card .lc-dot { width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto; }
.landing-card b { font-size: 17px; }
.landing-card small { display: block; color: var(--ink-mute); font-weight: 400; font-size: 12px; margin-top: 2px; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
