:root {
  --efe-blue: #0a6ff0;        /* barra principal efe.com.pe */
  --efe-blue-600: #0860d4;
  --efe-blue-50: #eaf3ff;
  --efe-navy: #0b3a75;        /* botón carrito / banners */
  --efe-navy-900: #082a56;
  --efe-orange: #f7a21b;      /* botón de búsqueda / pills */
  --efe-orange-600: #e8900a;
  --ink: #1b2a3d;
  --muted: #64748b;
  --line: #e3e8ef;
  --bg: #f4f6f9;
  --white: #fff;
  --radius: 16px;
  --shadow: 0 12px 40px rgba(8, 42, 86, .22);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}
button { font: inherit; cursor: pointer; }

/* ---------- Tienda (maqueta) ---------- */
.topbar {
  background: var(--efe-blue);
  color: #fff; font-weight: 700; font-size: 13px;
  display: flex; justify-content: center; gap: 28px;
  padding: 7px 16px; border-bottom: 1px solid rgba(255,255,255,.18);
  flex-wrap: wrap;
}
.header { background: var(--efe-blue); }
.header__inner {
  max-width: 1340px; margin: 0 auto; padding: 14px 16px;
  display: flex; align-items: center; gap: 18px;
}
.logo {
  width: 58px; height: 58px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; flex: none;
  color: var(--efe-blue); font-weight: 900; font-size: 24px; font-style: italic; letter-spacing: -1px;
}
.logo span { color: var(--efe-orange); }
.btn-cat {
  border: 2px solid #fff; background: transparent; color: #fff;
  border-radius: 6px; padding: 10px 20px; font-weight: 800; flex: none;
}
.search { flex: 1; display: flex; min-width: 0; }
.search input {
  flex: 1; min-width: 0; border: 0; border-radius: 6px 0 0 6px;
  padding: 14px 18px; font: inherit; font-size: 15px; outline: none;
}
.search button {
  border: 0; background: var(--efe-orange); color: var(--efe-navy);
  width: 50px; border-radius: 0 6px 6px 0;
}
.search button:hover { background: var(--efe-orange-600); }
.header__links { display: flex; align-items: center; gap: 20px; color: #fff; font-weight: 700; font-size: 14px; flex: none; }
.cart { background: var(--efe-navy); border-radius: 6px; padding: 12px 14px; }

.hero {
  max-width: 1340px; margin: 24px auto 0; padding: 48px 40px;
  border-radius: 24px; color: #fff;
  background: radial-gradient(circle at 85% 20%, #2b8cff 0, transparent 45%),
              linear-gradient(120deg, var(--efe-navy-900), var(--efe-navy) 45%, var(--efe-blue));
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center;
}
.hero__badge {
  display: inline-block; background: var(--efe-orange); color: var(--efe-navy-900);
  font-weight: 900; font-size: 12px; padding: 6px 12px; border-radius: 999px; letter-spacing: .3px;
}
.hero h1 { font-size: clamp(28px, 4vw, 46px); line-height: 1.1; margin: 16px 0 12px; font-weight: 700; }
.hero h1 strong { font-weight: 900; color: #fff; }
.hero p { font-size: 17px; opacity: .92; max-width: 560px; line-height: 1.5; }
.hero__chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 22px; }
.hero__chips .chip { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.35); }
.hero__chips .chip:hover { background: rgba(255,255,255,.22); }
.btn-primary {
  background: var(--efe-orange); color: var(--efe-navy-900); border: 0;
  padding: 14px 26px; border-radius: 999px; font-weight: 900; font-size: 16px;
  box-shadow: 0 6px 18px rgba(247,162,27,.4);
}
.btn-primary:hover { background: var(--efe-orange-600); }
.hero__art { position: relative; min-height: 260px; }
.hero__art .bubble {
  position: absolute; max-width: 300px; padding: 14px 18px; border-radius: 18px;
  font-weight: 700; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.b1 { top: 10px; right: 20px; background: var(--efe-blue); color: #fff; border-bottom-right-radius: 4px; }
.b2 { top: 100px; left: 10px; background: #fff; color: var(--ink); border-bottom-left-radius: 4px; }
.b3 { top: 190px; right: 50px; background: var(--efe-blue); color: #fff; border-bottom-right-radius: 4px; }

.section-title { text-align: center; font-weight: 400; font-size: 30px; color: var(--efe-navy-900); margin: 40px 16px 20px; }
.section-title strong { font-weight: 900; }
.cats {
  max-width: 1100px; margin: 0 auto; padding: 0 16px;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px;
}
.cat {
  background: #fff; border-radius: 14px; padding: 22px 8px; text-align: center; font-size: 34px;
  box-shadow: 0 2px 10px rgba(8,42,86,.06);
}
.cat span { display: block; font-size: 14px; font-weight: 800; color: var(--efe-navy); margin-top: 8px; }
.promo {
  margin-top: 40px; background: var(--efe-navy); color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 28px; flex-wrap: wrap;
  padding: 26px 16px 120px;
}
.promo strong { font-size: clamp(22px, 3.4vw, 44px); font-weight: 900; }
.promo .pill { background: var(--efe-orange); color: #fff; font-weight: 900; padding: 10px 26px; border-radius: 999px; }

/* ---------- Chips ---------- */
.chip {
  border: 1.5px solid var(--efe-blue); background: #fff; color: var(--efe-blue);
  border-radius: 999px; padding: 7px 14px; font-weight: 800; font-size: 13px; text-align: left;
}
.chip:hover { background: var(--efe-blue-50); }

/* ---------- Launcher ---------- */
.launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  background: var(--efe-orange); color: var(--efe-navy-900); border: 0;
  padding: 14px 22px 14px 18px; border-radius: 999px; font-weight: 900; font-size: 16px;
  box-shadow: var(--shadow);
}
.launcher:hover { background: var(--efe-orange-600); }
.launcher.is-hidden { display: none; }

/* ---------- Panel de chat ---------- */
.chat {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  width: 420px; height: min(700px, calc(100vh - 48px));
  background: #fff; border-radius: 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
  transition: width .25s ease, height .25s ease;
}
.chat[hidden] { display: none; }
.chat.is-wide { width: min(860px, calc(100vw - 48px)); height: calc(100vh - 48px); }

.chat__head {
  background: var(--efe-blue); color: #fff;
  display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px;
}
.chat__avatar {
  width: 42px; height: 42px; border-radius: 50%; background: #fff; flex: none;
  display: grid; place-items: center; color: var(--efe-blue);
  font-weight: 900; font-style: italic; font-size: 15px;
}
.chat__title { flex: 1; min-width: 0; line-height: 1.2; }
.chat__title strong { font-size: 17px; font-weight: 900; display: block; }
.chat__title small { font-size: 12.5px; opacity: .9; font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3ee08f; margin-right: 4px; vertical-align: 1px; }
.chat__actions { display: flex; gap: 4px; }
.chat__actions button {
  background: transparent; border: 0; color: #fff; width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center;
}
.chat__actions button:hover { background: rgba(255,255,255,.18); }

.chat__body {
  flex: 1; overflow-y: auto; padding: 18px 14px 8px; background: var(--bg);
  display: flex; flex-direction: column; gap: 12px;
}
.chat__body > * { flex: none; }

.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.msg__bubble {
  padding: 11px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.5;
  max-width: 86%; overflow-wrap: anywhere;
}
.msg--user { justify-content: flex-end; }
.msg--user .msg__bubble { background: var(--efe-blue); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg--bot .msg__bubble { background: #fff; color: var(--ink); border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(8,42,86,.08); }
.msg--bot .mini-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--efe-blue); color: #fff; flex: none;
  display: grid; place-items: center; font-size: 10px; font-weight: 900; font-style: italic;
}
.msg--error .msg__bubble { background: #fff4e5; color: #8a4b00; border: 1px solid #ffd59a; }

.msg__bubble p { margin: 0 0 8px; }
.msg__bubble p:last-child { margin-bottom: 0; }
.msg__bubble ul, .msg__bubble ol { margin: 4px 0 8px; padding-left: 20px; }
.msg__bubble li { margin: 3px 0; }
.msg__bubble a { color: var(--efe-blue); font-weight: 700; }
.msg__bubble strong { color: var(--efe-navy-900); }

.welcome-chips { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding-left: 36px; }

/* typing */
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--efe-blue); opacity: .35; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.typing-label { font-size: 12px; color: var(--muted); margin-left: 6px; }

/* ---------- Tarjetas de producto ---------- */
.products {
  display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px 36px;
  scroll-snap-type: x mandatory;
}
.chat.is-wide .products { flex-wrap: wrap; overflow-x: visible; }
.card {
  flex: none; width: 196px; background: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: 0 2px 10px rgba(8,42,86,.10); display: flex; flex-direction: column;
  scroll-snap-align: start; border: 1px solid var(--line);
}
.card__img { position: relative; background: #fff; aspect-ratio: 1 / 1; display: grid; place-items: center; padding: 10px; }
.card__img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.card__img .ph { font-size: 44px; opacity: .5; }
.card__badge {
  position: absolute; top: 8px; left: 8px; background: var(--efe-orange); color: #fff;
  font-weight: 900; font-size: 12px; padding: 3px 8px; border-radius: 6px;
}
.card__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card__cat { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__name {
  font-size: 13px; font-weight: 800; color: var(--efe-navy-900); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: 50px;
}
.card__price { font-size: 20px; font-weight: 900; color: var(--efe-navy-900); margin-top: 2px; }
.card__before { font-size: 12px; color: var(--muted); font-weight: 700; }
.card__before s { margin-left: 2px; }
.card__tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.tag { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: var(--efe-blue-50); color: var(--efe-blue-600); }
.card__btn {
  margin-top: auto; display: block; text-align: center; text-decoration: none;
  background: var(--efe-blue); color: #fff; font-weight: 800; font-size: 13px;
  padding: 9px; border-radius: 8px;
}
.card__btn:hover { background: var(--efe-blue-600); }
.card__btn-wrap { padding-top: 8px; margin-top: auto; }

/* ---------- Input ---------- */
.chat__input {
  display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); background: #fff;
}
.chat__input textarea {
  flex: 1; resize: none; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 11px 14px; font: inherit; font-size: 14.5px; max-height: 120px; outline: none; color: var(--ink);
}
.chat__input textarea:focus { border-color: var(--efe-blue); }
.chat__input button {
  width: 44px; height: 44px; flex: none; border: 0; border-radius: 12px;
  background: var(--efe-orange); color: var(--efe-navy-900); display: grid; place-items: center;
}
.chat__input button:hover { background: var(--efe-orange-600); }
.chat__input button:disabled, .chat__input textarea:disabled { opacity: .55; cursor: not-allowed; }
.chat__foot { font-size: 11px; color: var(--muted); text-align: center; padding: 0 12px 8px; background: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .header__links span:not(.cart) { display: none; }
  .hero { grid-template-columns: 1fr; margin: 16px; padding: 32px 20px; }
  .hero__art { display: none; }
  .cats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .topbar { gap: 14px; font-size: 12px; }
  .btn-cat span { display: none; }
  .btn-cat { padding: 10px 12px; }
  .logo { width: 46px; height: 46px; font-size: 19px; }
  .header__inner { gap: 10px; }
  .chat, .chat.is-wide { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; }
  #btnExpand { display: none; }
  .launcher { right: 16px; bottom: 16px; }
  .card { width: 168px; }
}
