// Sections with i18n via window.t(key) and window.PAGE_LANG

const IG_URL = "https://www.instagram.com/mgs.moradebre/";
const GOOGLE_URL = "https://share.google/VvNFIz33wXpdJLj3O";
const WA_URL = "https://wa.me/34650543538";
const waLink = () => `${WA_URL}?text=${encodeURIComponent(window.t("waMessage"))}`;
const TEL = "+34650543538";
const TEL_DISPLAY = "650 54 35 38";
const EMAIL = "albafabregatsole@mgs.es";

// D33 footer + D37 RGPD: slugs legales por idioma. Cada index.html define
// window.PAGE_LANG; el helper legalUrl("aviso"|"privacy"|"cookies"|"transparencia")
// devuelve la ruta absoluta a la página legal correspondiente.
const LEGAL_SLUGS = {
  es: { aviso: "/es/aviso-legal/", privacy: "/es/privacidad/", cookies: "/es/cookies/", transparencia: "/es/transparencia/" },
  ca: { aviso: "/ca/avis-legal/", privacy: "/ca/privacitat/", cookies: "/ca/galetes/", transparencia: "/ca/transparencia/" },
  en: { aviso: "/en/legal-notice/", privacy: "/en/privacy/", cookies: "/en/cookies/", transparencia: "/en/transparency/" },
  nl: { aviso: "/nl/juridische-kennisgeving/", privacy: "/nl/privacy/", cookies: "/nl/cookies/", transparencia: "/nl/transparantie/" },
};
const THANKS_SLUGS = {
  es: "/es/gracias/",
  ca: "/ca/gracies/",
  en: "/en/thanks/",
  nl: "/nl/bedankt/",
};
const legalUrl = (key) => {
  const lang = (typeof window !== "undefined" && window.PAGE_LANG) || "es";
  return (LEGAL_SLUGS[lang] || LEGAL_SLUGS.es)[key] || "#";
};

// Language switcher
function LangSwitcher({ compact, tokens }) {
  const cur = window.PAGE_LANG || "es";
  const stored = typeof sessionStorage !== "undefined" ? sessionStorage.getItem("alba_section") : "";
  const hashOrSection = () => {
    // keep current hash when switching
    if (typeof window !== "undefined" && window.location.hash) return window.location.hash;
    return "";
  };
  return (
    <div role="group" aria-label={window.t("langLabel")} style={{
      display: "inline-flex", gap: 4, alignItems: "center",
      background: compact ? "rgba(255,255,255,.1)" : "rgba(255,255,255,.12)",
      border: compact ? "1px solid rgba(255,255,255,.2)" : "1px solid rgba(255,255,255,.25)",
      borderRadius: 4, padding: 2,
    }}>
      {window.LANGS.map(l => {
        const active = l.code === cur;
        return (
          <a key={l.code}
             href={`/${l.code}/${hashOrSection()}`}
             aria-current={active ? "page" : undefined}
             title={l.name}
             translate="no" className="notranslate"
             style={{
               minWidth: 44, minHeight: 44,
               display: "inline-flex", alignItems: "center", justifyContent: "center",
               padding: "10px 12px", fontSize: 13, fontWeight: 700, letterSpacing: ".06em",
               color: active ? (tokens ? tokens.primaryBlue : "#003082") : "#fff",
               background: active ? "#fff" : "transparent",
               textDecoration: "none", borderRadius: 3,
             }}>
            {l.label}
          </a>
        );
      })}
    </div>
  );
}

// ---------- NAV ----------
function Nav({ tokens }) {
  const [open, setOpen] = React.useState(false);
  const [scrolled, setScrolled] = React.useState(false);
  React.useEffect(() => {
    const onScroll = () => setScrolled(window.scrollY > 10);
    onScroll();
    window.addEventListener("scroll", onScroll, { passive: true });
    return () => window.removeEventListener("scroll", onScroll);
  }, []);

  const items = [
    [window.t("navQuien"), "#quien-soy"],
    [window.t("navProductos"), "#productos"],
    [window.t("navPorQue"), "#por-que"],
    [window.t("navOficina"), "#oficina"],
    [window.t("navTestim"), "#testimonios"],
    [window.t("navContacto"), "#contacto"],
    [window.t("navFaq"), "#faq"],
  ];

  return (
    <header style={{
      position: "sticky", top: 0, zIndex: 40,
      background: scrolled ? "rgba(255,255,255,.96)" : "#ffffff",
      backdropFilter: scrolled ? "saturate(140%) blur(8px)" : "none",
      borderBottom: scrolled ? "1px solid #E9E9E9" : "1px solid transparent",
      transition: "all .25s ease",
    }}>
      <div style={{ background: tokens.primaryBlue, color: "#fff", fontSize: 13 }}>
        <div className="wrap" style={{
          display: "flex", gap: 32, justifyContent: "flex-end",
          padding: "8px 24px", alignItems: "center", flexWrap: "wrap",
        }}>
          <a href={`tel:${TEL}`} className="top-bar-contact" style={topLink}>
            <IconPhone size={15} sw={1.8} /> {TEL_DISPLAY}
          </a>
          <a href={`mailto:${EMAIL}`} className="top-bar-contact" style={topLink}>
            <IconMail size={15} sw={1.8} /> {EMAIL}
          </a>
          <LangSwitcher compact tokens={tokens}/>
        </div>
      </div>
      <div className="wrap" style={{
        display: "flex", alignItems: "center", justifyContent: "space-between",
        padding: "16px 24px", gap: 24,
      }}>
        <a href="#top" aria-label="Alba Fabregat" style={{ textDecoration: "none" }}>
          <AlbaLogo size={85}/>
        </a>
        <nav style={{ display: "none", gap: 26 }} className="nav-desktop">
          {items.map(([l, h]) => (
            <a key={h} href={h} style={navLink(tokens)}>{l}</a>
          ))}
        </nav>
        <div style={{ display: "flex", alignItems: "center", gap: 10 }}>
          <a href="#contacto" style={{
            display: "none",
            padding: "10px 18px", background: tokens.ctaOrange, color: "#fff",
            borderRadius: 4, textDecoration: "none", fontWeight: 700, fontSize: 15,
            letterSpacing: ".01em",
          }} className="cta-desktop">
            {window.t("navCTA")}
          </a>
          <button aria-label="Menu" onClick={() => setOpen(true)}
            style={{
              display: "inline-flex", background: "transparent", border: "1.5px solid #E9E9E9",
              width: 44, height: 44, borderRadius: 4, alignItems: "center", justifyContent: "center",
              color: tokens.primaryBlue, cursor: "pointer",
            }}
            className="menu-btn"
          >
            <IconMenu />
          </button>
        </div>
      </div>

      {open && (
        <div role="dialog" aria-modal="true"
             style={{ position: "fixed", inset: 0, zIndex: 60, background: "rgba(0,20,60,.4)" }}
             onClick={() => setOpen(false)}>
          <div onClick={(e) => e.stopPropagation()}
               style={{
                 position: "absolute", top: 0, right: 0, bottom: 0, width: "min(86vw, 380px)",
                 background: "#fff", padding: "20px 22px", display: "flex", flexDirection: "column", gap: 6,
               }}>
            <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 10 }}>
              <AlbaLogo size={53}/>
              <button aria-label="Close" onClick={() => setOpen(false)}
                style={{
                  background: "transparent", border: "none", cursor: "pointer",
                  color: tokens.primaryBlue,
                  width: 44, height: 44,
                  display: "inline-flex", alignItems: "center", justifyContent: "center",
                  padding: 0,
                }}>
                <IconClose size={19}/>
              </button>
            </div>
            {items.map(([l, h]) => (
              <a key={h} href={h} onClick={() => setOpen(false)}
                 style={{
                   padding: "10px 6px", borderBottom: "1px solid #F4F4F4",
                   color: tokens.titleBlue, textDecoration: "none", fontWeight: 600, fontSize: 17,
                 }}>{l}</a>
            ))}
            <a href="#contacto" onClick={() => setOpen(false)}
               style={{
                 marginTop: 12, padding: "12px 18px", background: tokens.ctaOrange, color: "#fff",
                 borderRadius: 4, textDecoration: "none", fontWeight: 700, textAlign: "center",
               }}>{window.t("navCTA")}</a>
            <div style={{ marginTop: 12, background: tokens.primaryBlue, borderRadius: 4, padding: 6, alignSelf: "flex-start" }}>
              <LangSwitcher compact tokens={tokens}/>
            </div>
            <div style={{ display: "flex", gap: 12, marginTop: 12 }}>
              <a href={IG_URL} target="_blank" rel="noopener noreferrer" aria-label="Instagram"
                 style={socialPill(tokens)}><IconInstagram size={18}/></a>
              <a href={GOOGLE_URL} target="_blank" rel="noopener noreferrer" aria-label="Google"
                 style={socialPill(tokens)}><IconGoogle size={18}/></a>
              <a href={waLink()} target="_blank" rel="noopener noreferrer" aria-label="WhatsApp"
                 style={socialPill(tokens)}><IconWhatsapp size={18}/></a>
            </div>
          </div>
        </div>
      )}

      <style>{`
        @media (min-width: 1024px) {
          .nav-desktop { display: flex !important; }
          .cta-desktop { display: inline-flex !important; }
          .menu-btn { display: none !important; }
        }
      `}</style>
    </header>
  );
}

const topLink = {
  display: "inline-flex", alignItems: "center", gap: 6, color: "#fff",
  textDecoration: "none",
  minHeight: 44, padding: "10px 8px",
};
const navLink = (t) => ({
  textDecoration: "none", color: "#222", fontWeight: 600, fontSize: 15,
  paddingBottom: 4, borderBottom: "2px solid transparent",
});
const socialPill = (t) => ({
  width: 44, height: 44, borderRadius: 999,
  background: "#F4F4F4", color: t.primaryBlue,
  display: "inline-flex", alignItems: "center", justifyContent: "center",
  textDecoration: "none",
});

// ---------- HERO ----------
function Hero({ tokens }) {
  return (
    <section id="top" style={{ position: "relative", background: "#001a4a", color: "#fff", overflow: "hidden" }}>
      <div style={{
        position: "absolute", inset: 0,
        backgroundImage: `url('../assets/alba.jpg')`,
        backgroundSize: "cover",
        backgroundPosition: "center 28%",
        filter: "saturate(1.05)",
      }} aria-hidden="true" />
      <div style={{
        position: "absolute", inset: 0,
        background: `linear-gradient(100deg, ${hex(tokens.primaryBlue, tokens.heroOverlay + .15)} 0%, ${hex(tokens.primaryBlue, tokens.heroOverlay)} 55%, ${hex(tokens.primaryBlue, tokens.heroOverlay - .15)} 100%)`,
      }} aria-hidden="true" />

      {tokens.showDecor && (
        <svg aria-hidden="true" viewBox="0 0 600 600" style={{
          position: "absolute", right: -80, top: -80, width: 520, opacity: .22,
        }}>
          <path d="M120 300 C 200 80, 500 80, 560 300 C 520 520, 240 540, 120 300 Z"
                fill="none" stroke={tokens.ctaOrange} strokeWidth="2"/>
          <path d="M160 300 C 220 140, 460 140, 520 300"
                fill="none" stroke={tokens.ctaOrange} strokeWidth="2"/>
        </svg>
      )}

      <div className="wrap hero-wrap" style={{
        position: "relative", zIndex: 2, padding: "56px 24px 72px",
        display: "grid", gap: 32,
      }}>
        <div style={{ maxWidth: 760 }}>
          <div style={pillStyle}>
            <span style={{ width: 6, height: 6, background: tokens.ctaOrange, borderRadius: 99 }}/>
            {window.t("heroBadge")}
          </div>
          <h1 style={{
            fontFamily: "Fraunces, 'Source Serif 4', Georgia, serif",
            fontWeight: 500, fontSize: "clamp(40px, 6.5vw, 68px)",
            lineHeight: 1.04, letterSpacing: "-0.02em", margin: "20px 0 18px",
            textWrap: "balance",
          }}>
            {window.t("heroTitle")}{" "}
            <em style={{ color: "#ffd9b3", fontStyle: "italic", fontWeight: 500 }}>{window.t("heroTitleAccent")}</em>
          </h1>
          <p style={{ fontSize: 19, maxWidth: 560, opacity: .92, margin: "0 0 32px" }}>
            {window.t("heroLead")}
          </p>
          <div style={{ display: "flex", flexWrap: "wrap", gap: 12 }}>
            <a href="#contacto" style={ctaPrimary(tokens)}>
              {window.t("heroCTA1")}
              <IconArrow size={18} sw={2}/>
            </a>
            <a href="#oficina" style={ctaGhost}>
              {window.t("heroCTA2")}
            </a>
          </div>
        </div>

        <div style={{
          display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(180px, 1fr))",
          gap: 2, marginTop: 40,
          border: "1px solid rgba(255,255,255,.22)",
          background: "rgba(255,255,255,.06)",
          backdropFilter: "blur(4px)",
          borderRadius: 4,
        }}>
          {[
            [window.t("heroStat1K"), window.t("heroStat1V")],
            [window.t("heroStat2K"), window.t("heroStat2V")],
            [window.t("heroStat3K"), window.t("heroStat3V")],
            [window.t("heroStat4K"), window.t("heroStat4V")],
          ].map(([k, v], i) => (
            <div key={i} style={{
              padding: "20px 22px",
              borderLeft: i > 0 ? "1px solid rgba(255,255,255,.18)" : "none",
            }}>
              <div style={{ fontSize: 22, fontWeight: 700, letterSpacing: "-.01em" }}>{k}</div>
              <div style={{ fontSize: 13.5, opacity: .82, marginTop: 4 }}>{v}</div>
            </div>
          ))}
        </div>
      </div>

      <style>{`
        @media (min-width: 768px) {
          #top > .hero-wrap { padding: 96px 24px 120px !important; gap: 40px !important; }
        }
      `}</style>
    </section>
  );
}

function hex(base, a) {
  const r = parseInt(base.slice(1,3), 16);
  const g = parseInt(base.slice(3,5), 16);
  const b = parseInt(base.slice(5,7), 16);
  return `rgba(${r},${g},${b},${Math.max(0, Math.min(1, a))})`;
}

const pillStyle = {
  display: "inline-flex", alignItems: "center", gap: 10,
  padding: "7px 14px", background: "rgba(255,255,255,.12)",
  border: "1px solid rgba(255,255,255,.25)", borderRadius: 99,
  fontSize: 13, fontWeight: 600, letterSpacing: ".04em", textTransform: "uppercase",
};
const ctaPrimary = (t) => ({
  display: "inline-flex", alignItems: "center", gap: 10,
  padding: "15px 24px", background: t.ctaOrange, color: "#fff",
  borderRadius: 4, textDecoration: "none", fontWeight: 700, fontSize: 16,
  boxShadow: "0 6px 22px rgba(255,133,0,.35)",
  transition: "transform .15s ease, box-shadow .15s ease",
});
const ctaGhost = {
  display: "inline-flex", alignItems: "center", gap: 10,
  padding: "14px 24px", background: "transparent", color: "#fff",
  border: "1.5px solid rgba(255,255,255,.75)", borderRadius: 4,
  textDecoration: "none", fontWeight: 700, fontSize: 16,
};

// ---------- QUIÉN SOY ----------
function QuienSoy({ tokens }) {
  const badge = window.t("quienBadge").split("|");
  return (
    <section id="quien-soy" style={{ background: "#fff", padding: "64px 0" }}>
      <div className="wrap" style={{
        display: "grid", gap: 32,
        gridTemplateColumns: "1fr",
      }}>
        <div style={{ position: "relative" }}>
          <div style={{
            position: "relative", aspectRatio: "3/4", overflow: "hidden",
            borderRadius: 2,
          }}>
            <img src={(window.__resources && window.__resources.alba) || "../assets/alba-quiensoy.jpg"} alt="Alba Fabregat"
                 style={{ width: "100%", height: "100%", objectFit: "cover", objectPosition: "50% 30%" }}/>
          </div>
          <div style={{
            position: "absolute", bottom: -18, left: -18, width: 90, height: 90,
            background: tokens.ctaOrange,
            display: "grid", placeItems: "center",
            color: "#fff", fontWeight: 700, textAlign: "center", lineHeight: 1.1,
            fontSize: 13, letterSpacing: ".06em",
          }}>
            <div>{badge[0]}<br/>{badge[1]}<br/><span style={{fontSize:18, fontWeight:800}}>{badge[2]}</span></div>
          </div>
          <div style={{
            position: "absolute", top: 24, right: -24, width: 48, height: 48,
            border: `2px solid ${tokens.primaryBlue}`, borderRadius: 0,
          }} aria-hidden="true"/>
        </div>
        <div>
          <div style={eyebrow(tokens)}>{window.t("quienEyebrow")}</div>
          <h2 style={h2Style(tokens)}>
            {window.t("quienTitle")}<br/>
            <em style={{ fontStyle: "italic", color: tokens.primaryBlue, fontWeight: 500 }}>{window.t("quienTitleAccent")}</em>
          </h2>
          <p style={pLead}>{window.t("quienP1")}</p>
          <p style={pBody}>{window.t("quienP2")}</p>
          <div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(170px,1fr))", gap: 14, marginTop: 30 }}>
            {[window.t("quienCheck1"), window.t("quienCheck2"), window.t("quienCheck3")].map((t, i) => (
              <div key={i} style={{
                display: "flex", gap: 10, alignItems: "flex-start",
                padding: "14px 16px", background: "#F4F4F4", borderLeft: `3px solid ${tokens.ctaOrange}`,
              }}>
                <IconCheck size={20} stroke={tokens.ctaOrange} sw={2.2}/>
                <span style={{ fontSize: 14.5, fontWeight: 600, color: tokens.primaryBlue }}>{t}</span>
              </div>
            ))}
          </div>
        </div>
      </div>

      <style>{`
        @media (min-width: 768px) {
          #quien-soy { padding: 110px 0 !important; }
          #quien-soy > .wrap {
            grid-template-columns: minmax(260px, 1fr) 1.15fr !important;
            gap: 56px !important;
          }
        }
      `}</style>
    </section>
  );
}

const eyebrow = (t) => ({
  fontSize: 13, fontWeight: 700, letterSpacing: ".18em", textTransform: "uppercase",
  color: t.ctaOrange, marginBottom: 14,
  display: "inline-flex", alignItems: "center", gap: 10,
});
const h2Style = (t) => ({
  fontFamily: "Fraunces, 'Source Serif 4', Georgia, serif",
  fontWeight: 700, fontSize: "clamp(32px, 4.2vw, 48px)", lineHeight: 1.08,
  color: t.titleBlue, margin: "0 0 22px", letterSpacing: "-.015em",
});
const pLead = { fontSize: 19, lineHeight: 1.55, color: "#222", margin: "0 0 14px" };
const pBody = { fontSize: 16.5, lineHeight: 1.65, color: "#444", margin: 0 };

// ---------- PRODUCTOS ----------
const PRODUCTS_PART_KEYS = [
  ["p_accident", IconAccident], ["p_savings", IconSavings], ["p_auto", IconCar],
  ["p_travel", IconTravel], ["p_comm", IconBuilding], ["p_deceso", IconDeceso],
  ["p_home", IconHome], ["p_invest", IconInvest], ["p_pet", IconPet],
  ["p_mob", IconMobility], ["p_sports", IconSports], ["p_scoot", IconScooter],
  ["p_health", IconHealth], ["p_life", IconHeart],
];
const PRODUCTS_EMP_KEYS = [
  ["e_accident", IconAccident], ["e_agri", IconAgri], ["e_auto", IconCar],
  ["e_shop", IconShop], ["e_const", IconConstruction], ["e_poll", IconPollution],
  ["e_horeca", IconRestaurant], ["e_office", IconOffice], ["e_pyme", IconPyme],
  ["e_rc", IconShield], ["e_tech", IconTech], ["e_life", IconHeart],
];

function Productos({ tokens }) {
  const [tab, setTab] = React.useState("part");
  const [productsModal, setProductsModal] = React.useState(null); // null | "particular" | "empresa"
  const [familyModal, setFamilyModal] = React.useState(null);     // null | familyKey
  const productsModalTriggerRef = React.useRef(null);
  const familyModalTriggerRef = React.useRef(null);
  const keys = tab === "part" ? PRODUCTS_PART_KEYS : PRODUCTS_EMP_KEYS;

  // D39 — cerrar modales si el viewport pasa a tablet/desktop (≥768)
  React.useEffect(() => {
    const mq = window.matchMedia("(min-width: 768px)");
    const update = () => {
      if (mq.matches) {
        setProductsModal(null);
        setFamilyModal(null);
      }
    };
    mq.addEventListener("change", update);
    return () => mq.removeEventListener("change", update);
  }, []);

  // D39 — bloquear scroll del body + notificar a sticky bar mientras hay modal abierto
  React.useEffect(() => {
    const open = productsModal !== null;
    document.body.style.overflow = open ? "hidden" : "";
    window.dispatchEvent(new CustomEvent("alba:productsModal", { detail: { open } }));
    return () => {
      document.body.style.overflow = "";
      window.dispatchEvent(new CustomEvent("alba:productsModal", { detail: { open: false } }));
    };
  }, [productsModal]);

  // D39 — Esc cierra el modal full-screen SOLO si el modal central no está abierto
  React.useEffect(() => {
    if (productsModal === null) return;
    const onKey = (e) => {
      if (e.key === "Escape" && familyModal === null) {
        closeProductsModal();
      }
    };
    window.addEventListener("keydown", onKey);
    return () => window.removeEventListener("keydown", onKey);
  }, [productsModal, familyModal]);

  const openProductsModal = (group, e) => {
    productsModalTriggerRef.current = e.currentTarget;
    setProductsModal(group);
  };
  const closeProductsModal = () => {
    setProductsModal(null);
    setTimeout(() => productsModalTriggerRef.current && productsModalTriggerRef.current.focus(), 0);
  };
  const openFamilyModal = (familyKey, e) => {
    familyModalTriggerRef.current = e.currentTarget;
    setFamilyModal(familyKey);
  };
  const closeFamilyModal = () => {
    setFamilyModal(null);
    setTimeout(() => familyModalTriggerRef.current && familyModalTriggerRef.current.focus(), 0);
  };

  return (
    <section id="productos" style={{ background: "#F4F4F4", padding: "64px 0" }}>
      <div className="wrap">
        <div style={{ display: "flex", justifyContent: "space-between", alignItems: "flex-end", gap: 30, flexWrap: "wrap", marginBottom: 36 }}>
          <div>
            <div style={eyebrow(tokens)}>{window.t("prodEyebrow")}</div>
            <h2 style={{ ...h2Style(tokens), margin: 0, maxWidth: 620 }}>
              {window.t("prodTitle")}<br/>
              <em style={{ fontStyle: "normal", fontWeight: 500 }}>{window.t("prodTitleAccent")}</em>
            </h2>
          </div>
          <p style={{ maxWidth: 360, color: "#555", fontSize: 16, margin: 0 }}>
            {window.t("prodLead")}
          </p>
        </div>

        {/* D39 — mobile <768: 2 botones grandes */}
        <div className="prod-mobile-buttons">
          <button type="button" onClick={(e) => openProductsModal("particular", e)} style={mobileBtnStyle(tokens)}>
            <div style={{ flex: 1 }}>
              <div style={{ fontFamily: "Fraunces, Georgia, serif", fontSize: 22, fontWeight: 700, color: tokens.primaryBlue, lineHeight: 1.15 }}>
                {window.t("prodMobileBtnPart")}
              </div>
              <div style={{ fontSize: 14, color: "#666", marginTop: 6, lineHeight: 1.4 }}>
                {window.t("prodMobileBtnPartSub")}
              </div>
            </div>
            <IconArrow size={20} sw={2} stroke={tokens.ctaOrange}/>
          </button>
          <button type="button" onClick={(e) => openProductsModal("empresa", e)} style={mobileBtnStyle(tokens)}>
            <div style={{ flex: 1 }}>
              <div style={{ fontFamily: "Fraunces, Georgia, serif", fontSize: 22, fontWeight: 700, color: tokens.primaryBlue, lineHeight: 1.15 }}>
                {window.t("prodMobileBtnEmp")}
              </div>
              <div style={{ fontSize: 14, color: "#666", marginTop: 6, lineHeight: 1.4 }}>
                {window.t("prodMobileBtnEmpSub")}
              </div>
            </div>
            <IconArrow size={20} sw={2} stroke={tokens.ctaOrange}/>
          </button>
        </div>

        {/* Tablet+desktop ≥768: tabs + cards (sin cambios respecto a Lote 5) */}
        <div className="prod-tabs-grid">
          <div role="tablist" style={{
            display: "flex", gap: 4, marginBottom: 32, overflowX: "auto",
            borderBottom: "1px solid #E9E9E9",
            scrollbarWidth: "none",
          }} className="product-tabs">
            {[
              ["part", window.t("prodTabPart"), PRODUCTS_PART_KEYS.length],
              ["emp",  window.t("prodTabEmp"),  PRODUCTS_EMP_KEYS.length],
            ].map(([id, label, count]) => {
              const active = tab === id;
              return (
                <button key={id} role="tab" aria-selected={active} onClick={() => setTab(id)}
                  style={{
                    flex: "none", padding: "14px 24px",
                    background: "transparent", border: "none", cursor: "pointer",
                    fontFamily: "inherit", fontSize: 16, fontWeight: 700,
                    color: active ? tokens.primaryBlue : "#777",
                    borderBottom: `3px solid ${active ? tokens.ctaOrange : "transparent"}`,
                    marginBottom: -1, transition: "all .2s ease",
                    display: "inline-flex", alignItems: "center", gap: 10,
                    whiteSpace: "nowrap",
                  }}>
                  {label}
                  <span style={{
                    fontSize: 12, fontWeight: 700,
                    background: active ? tokens.ctaOrange : "#E9E9E9",
                    color: active ? "#fff" : "#555",
                    padding: "2px 8px", borderRadius: 99,
                  }}>{count}</span>
                </button>
              );
            })}
          </div>

          <div key={tab} style={{
            display: "grid", gap: 2,
            gridTemplateColumns: "repeat(auto-fit, minmax(280px, 1fr))",
            background: "#E9E9E9",
            border: "1px solid #E9E9E9",
            animation: "prodFade .35s ease",
          }}>
            {keys.map(([k, Icon], i) => (
              <ProductCard key={tab + "-" + i} Icon={Icon}
                title={window.t(k + "_t")} desc={window.t(k + "_d")} ext={window.t(k + "_e")}
                tokens={tokens}/>
            ))}
          </div>
        </div>

        {/* CTA inline — D39: visible también en mobile bajo los 2 botones.
            id="cta-inline-products" lo usa StickyBottomBar (Lote 8, D24 ampliada)
            para ocultar la sticky bar mientras este bloque entra en viewport. */}
        <a id="cta-inline-products" href="#contacto" className="prod-cta-block" style={{
          marginTop: 32,
          background: "#fff",
          border: "0.5px solid #E9E9E9",
          borderRadius: 4,
          padding: "24px 32px",
          alignItems: "center", justifyContent: "space-between",
          gap: 24, flexWrap: "wrap",
          textDecoration: "none", color: "inherit",
        }}>
          <div style={{ fontFamily: "Fraunces, Georgia, serif", fontSize: 22, fontWeight: 700, color: tokens.primaryBlue }}>
            {window.t("prodCTATitle")}
          </div>
          <span style={ctaPrimary(tokens)}>
            {window.t("prodCTABtn")}
            <IconArrow size={18} sw={2}/>
          </span>
        </a>
      </div>

      {productsModal && (
        <FullScreenProductsModal
          group={productsModal}
          onClose={closeProductsModal}
          onSelectFamily={openFamilyModal}
          tokens={tokens}
        />
      )}
      {familyModal && (
        <FamilyProductsModal
          familyKey={familyModal}
          group={productsModal}
          onClose={closeFamilyModal}
          tokens={tokens}
        />
      )}

      <style>{`
        .product-tabs::-webkit-scrollbar { display: none; }
        @keyframes prodFade {
          from { opacity: 0; transform: translateY(6px); }
          to   { opacity: 1; transform: translateY(0); }
        }
        .prod-mobile-buttons { display: grid; gap: 14px; }
        .prod-tabs-grid { display: none; }
        .prod-cta-block { display: flex; }
        @media (min-width: 768px) {
          #productos { padding: 110px 0 !important; }
          .prod-mobile-buttons { display: none; }
          .prod-tabs-grid { display: block; }
        }
      `}</style>
    </section>
  );
}

const mobileBtnStyle = (t) => ({
  display: "flex", alignItems: "center", gap: 16,
  padding: "20px 22px",
  background: "#fff",
  border: `1.5px solid ${t.primaryBlue}`,
  borderRadius: 4,
  cursor: "pointer",
  fontFamily: "inherit",
  textAlign: "left",
  width: "100%",
  minHeight: 88,
  boxShadow: "0 1px 0 #E9E9E9",
});

// D39 — Modal full-screen Particulares / Empresas
function FullScreenProductsModal({ group, onClose, onSelectFamily, tokens }) {
  const closeBtnRef = React.useRef(null);
  const titleId = "fs-modal-title";

  React.useEffect(() => {
    closeBtnRef.current && closeBtnRef.current.focus();
  }, []);

  const keys = group === "particular" ? PRODUCTS_PART_KEYS : PRODUCTS_EMP_KEYS;
  const titleText = group === "particular"
    ? `${window.t("prodTabPart")} (${keys.length})`
    : `${window.t("prodTabEmp")} (${keys.length})`;

  return (
    <div role="dialog" aria-modal="true" aria-labelledby={titleId}
      onClick={onClose}
      style={{
        position: "fixed", inset: 0, zIndex: 110,
        background: "#fff",
        display: "flex", flexDirection: "column",
      }}>
      <div onClick={(e) => e.stopPropagation()}
        style={{ display: "flex", flexDirection: "column", height: "100%" }}>
        <div style={{
          background: tokens.primaryBlue, color: "#fff",
          padding: "23px 20px 16px",
          display: "flex", alignItems: "center", justifyContent: "space-between",
          gap: 16, flexShrink: 0,
        }}>
          <div id={titleId} style={{
            fontFamily: "Fraunces, Georgia, serif",
            fontSize: 22, fontWeight: 700, letterSpacing: "-.01em",
          }}>
            {titleText}
          </div>
          <button ref={closeBtnRef} type="button"
            aria-label={window.t("modalCloseAria")} onClick={onClose}
            style={{
              background: "transparent", border: "none", color: "#fff",
              width: 44, height: 44, cursor: "pointer",
              display: "inline-flex", alignItems: "center", justifyContent: "center",
              padding: 0, flexShrink: 0,
            }}>
            <IconClose size={26}/>
          </button>
        </div>
        <div style={{ flex: 1, overflowY: "auto", background: "#fff" }}>
          {keys.map(([k]) => {
            const items = (window.MGS_PRODUCTS[group] && window.MGS_PRODUCTS[group][k]) || [];
            return (
              <button key={k} type="button" onClick={(e) => onSelectFamily(k, e)}
                style={{
                  width: "100%", display: "flex", alignItems: "center", justifyContent: "space-between",
                  gap: 12,
                  padding: "16px 20px",
                  background: "transparent", border: "none",
                  borderBottom: "1px solid #F4F4F4",
                  cursor: "pointer", fontFamily: "inherit",
                  textAlign: "left", minHeight: 56,
                  color: "#222",
                }}>
                <span style={{ fontSize: 16.5, fontWeight: 600, color: tokens.primaryBlue }}>
                  {window.t(k + "_t")}{" "}
                  <span style={{ color: "#999", fontWeight: 500 }}>({items.length})</span>
                </span>
                <span aria-hidden="true" style={{ color: tokens.ctaOrange, fontSize: 24, fontWeight: 600, lineHeight: 1 }}>›</span>
              </button>
            );
          })}
        </div>
      </div>
    </div>
  );
}

// D39 — Modal central productos individuales (capa 2)
function FamilyProductsModal({ familyKey, group, onClose, tokens }) {
  const closeBtnRef = React.useRef(null);
  const titleId = "central-modal-title";

  React.useEffect(() => {
    closeBtnRef.current && closeBtnRef.current.focus();
  }, []);

  const items = (window.MGS_PRODUCTS[group] && window.MGS_PRODUCTS[group][familyKey]) || [];

  // NO se cierra con tap fuera ni Esc — decisión Sandra 28/04. Solo botón X.
  return (
    <div role="dialog" aria-modal="true" aria-labelledby={titleId}
      style={{
        position: "fixed", inset: 0, zIndex: 120,
        background: "rgba(0, 20, 60, .85)",
        display: "flex", alignItems: "center", justifyContent: "center",
        padding: 16,
      }}>
      <div style={{
        background: "#fff", borderRadius: 4,
        width: "100%", maxWidth: 420,
        maxHeight: "calc(100vh - 32px)",
        overflowY: "auto",
        boxShadow: "0 20px 50px rgba(0,0,0,.35)",
      }}>
        <div style={{
          background: "#F4F4F4",
          padding: "39px 20px 24px",
          display: "flex", alignItems: "flex-start", justifyContent: "space-between",
          gap: 12,
        }}>
          <div id={titleId} style={{
            fontSize: 12.5, fontWeight: 700, letterSpacing: ".12em", textTransform: "uppercase",
            color: tokens.primaryBlue, lineHeight: 1.8,
            flex: 1,
          }}>
            {window.t(familyKey + "_t")} · {items.length} {window.t("modalProductsWord")}
          </div>
          <button ref={closeBtnRef} type="button"
            aria-label={window.t("modalCloseAria")} onClick={onClose}
            style={{
              background: "transparent", border: "none",
              width: 44, height: 44, cursor: "pointer",
              color: tokens.primaryBlue,
              display: "inline-flex", alignItems: "center", justifyContent: "center",
              padding: 0, flexShrink: 0,
            }}>
            <IconClose size={22}/>
          </button>
        </div>
        <ul style={{ listStyle: "none", padding: 0, margin: 0 }}>
          {items.map((item, i) => (
            <li key={i} style={{
              padding: "14px 20px",
              borderBottom: i < items.length - 1 ? "1px solid #F4F4F4" : "none",
              fontSize: 15.5, color: "#222",
            }}>
              {item}
            </li>
          ))}
        </ul>
      </div>
    </div>
  );
}

function ProductCard({ Icon, title, desc, ext, tokens }) {
  return (
    <article style={{
      display: "block", padding: "34px 30px 30px", background: "#fff",
      color: "inherit",
    }}>
      <div style={{
        width: 52, height: 52, display: "grid", placeItems: "center",
        background: "#FFF3E5", color: tokens.ctaOrange,
        borderRadius: 4, marginBottom: 22,
      }}>
        <Icon size={26} sw={1.7}/>
      </div>
      <div style={{ fontFamily: "Fraunces, Georgia, serif", fontSize: 24, fontWeight: 700, color: tokens.primaryBlue, letterSpacing: "-.01em" }}>{title}</div>
      <div style={{ fontSize: 15.5, color: "#333", marginTop: 8, lineHeight: 1.5 }}>{desc}</div>
      <div style={{ fontSize: 14, color: "#777", marginTop: 6, lineHeight: 1.5 }}>{ext}</div>
    </article>
  );
}

// ---------- POR QUÉ ----------
function PorQue({ tokens }) {
  const items = [
    [window.t("porque1K"), window.t("porque1V")],
    [window.t("porque2K"), window.t("porque2V")],
    [window.t("porque3K"), window.t("porque3V")],
    [window.t("porque4K"), window.t("porque4V")],
  ];
  return (
    <section id="por-que" style={{ background: tokens.primaryBlue, color: "#fff", padding: "64px 0", position: "relative", overflow: "hidden" }}>
      {tokens.showDecor && (
        <svg aria-hidden="true" viewBox="0 0 600 600" style={{ position: "absolute", left: -120, bottom: -120, width: 420, opacity: .18 }}>
          <circle cx="300" cy="300" r="260" fill="none" stroke={tokens.ctaOrange} strokeWidth="1.5"/>
          <circle cx="300" cy="300" r="200" fill="none" stroke={tokens.ctaOrange} strokeWidth="1.5"/>
          <circle cx="300" cy="300" r="140" fill="none" stroke={tokens.ctaOrange} strokeWidth="1.5"/>
        </svg>
      )}
      <div className="wrap" style={{ position: "relative" }}>
        <div style={{ maxWidth: 680, marginBottom: 60 }}>
          <div style={{ ...eyebrow(tokens), color: tokens.ctaOrange }}>{window.t("porqueEyebrow")}</div>
          <h2 style={{ ...h2Style(tokens), color: "#fff" }}>
            {window.t("porqueTitle")}<br/>
            <em style={{ fontStyle: "normal", fontWeight: 500, color: "#ffd9b3" }}>{window.t("porqueTitleAccent")}</em>
          </h2>
        </div>
        <div style={{
          display: "grid", gap: 1,
          gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))",
          background: "rgba(255,255,255,.18)",
        }}>
          {items.map(([k, v], i) => (
            <div key={i} style={{
              padding: "34px 30px", background: tokens.primaryBlue,
              display: "flex", flexDirection: "column", gap: 10,
            }}>
              <div style={{
                width: 44, height: 44, border: `1.5px solid ${tokens.ctaOrange}`,
                display: "grid", placeItems: "center", borderRadius: 4, marginBottom: 10,
              }}>
                <span style={{ color: tokens.ctaOrange, fontWeight: 700 }}>0{i+1}</span>
              </div>
              <div style={{ fontFamily: "Fraunces, Georgia, serif", fontSize: 21, fontWeight: 700, lineHeight: 1.2 }}>{k}</div>
              <div style={{ fontSize: 15, opacity: .82, lineHeight: 1.55 }}>{v}</div>
            </div>
          ))}
        </div>
      </div>
      <style>{`
        @media (min-width: 768px) {
          #por-que { padding: 110px 0 !important; }
        }
      `}</style>
    </section>
  );
}

// ---------- OFICINA ----------
// D44 — bloqueo previo del iframe Google Maps. Hasta consentimiento de la categoría
// "marketing" del banner cookies, se muestra placeholder con CTA "Cargar mapa".
function Oficina({ tokens }) {
  const mapsEmbed = `https://www.google.com/maps?q=${encodeURIComponent("Carrer d'Antoni Asens 23, Móra d'Ebre")}&output=embed`;
  const [mapLoaded, setMapLoaded] = React.useState(false);

  React.useEffect(() => {
    const check = () => {
      try {
        if (window.CookieConsent
            && typeof window.CookieConsent.acceptedCategory === "function"
            && window.CookieConsent.acceptedCategory("marketing")) {
          setMapLoaded(true);
        }
      } catch (e) {}
    };
    check();
    const onConsent = () => check();
    const onChange = () => check();
    window.addEventListener("cc:onConsent", onConsent);
    window.addEventListener("cc:onChange", onChange);
    // Polling defensivo: CookieConsent.run se inicializa en window.load (async).
    // Si Oficina monta antes, los eventos pueden no haber sido registrados aún.
    let i = 0;
    const interval = setInterval(() => { check(); if (++i > 20) clearInterval(interval); }, 300);
    return () => {
      window.removeEventListener("cc:onConsent", onConsent);
      window.removeEventListener("cc:onChange", onChange);
      clearInterval(interval);
    };
  }, []);

  return (
    <section id="oficina" style={{ background: "#fff", padding: "64px 0" }}>
      <div className="wrap" style={{
        display: "grid", gap: 32,
        gridTemplateColumns: "1fr", alignItems: "stretch",
      }}>
        <div style={{ position: "relative", minHeight: 460 }}>
          {mapLoaded ? (
            <iframe
              src={mapsEmbed}
              title="Map"
              style={{ border: 0, width: "100%", height: "100%", minHeight: 460, filter: "saturate(.9)" }}
              loading="lazy"
              referrerPolicy="no-referrer-when-downgrade"
            />
          ) : (
            <div role="region" aria-label={window.t("mapsPHTitle")} style={{
              width: "100%", height: "100%", minHeight: 460,
              background: "#F4F4F4", border: "1px solid #E5E5E5",
              display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center",
              padding: "24px", textAlign: "center", gap: 14,
            }}>
              <IconPin size={48} stroke={tokens.primaryBlue} sw={1.6}/>
              <div style={{ fontWeight: 700, fontSize: 17, color: tokens.primaryBlue }}>
                {window.t("mapsPHTitle")}
              </div>
              <p style={{ fontSize: 14, color: "#555", maxWidth: 380, margin: 0, lineHeight: 1.5 }}>
                {window.t("mapsPHText")}
              </p>
              <button
                type="button"
                onClick={() => setMapLoaded(true)}
                style={{
                  marginTop: 4,
                  background: tokens.ctaOrange, color: "#fff",
                  border: 0, padding: "12px 22px", fontWeight: 700, fontSize: 14,
                  cursor: "pointer", letterSpacing: ".02em", minHeight: 44,
                }}
              >
                {window.t("mapsPHBtn")}
              </button>
            </div>
          )}
          <div style={{
            position: "absolute", top: 16, left: 16,
            background: "#fff", padding: "10px 14px",
            fontSize: 13, fontWeight: 700, color: tokens.primaryBlue,
            boxShadow: "0 4px 14px rgba(0,0,0,.12)",
            display: "flex", alignItems: "center", gap: 8,
          }}>
            <IconPin size={16} stroke={tokens.ctaOrange} sw={2}/>
            {window.t("ofiBadge")}
          </div>
        </div>
        <div>
          <div style={eyebrow(tokens)}>{window.t("ofiEyebrow")}</div>
          <h2 style={h2Style(tokens)}>
            {window.t("ofiTitle")}<br/>
            <em style={{ fontStyle: "normal", color: tokens.primaryBlue, fontWeight: 500 }}>{window.t("ofiTitleAccent")}</em>
          </h2>

          <div style={{ display: "grid", gap: 18, marginTop: 8 }}>
            <InfoRow icon={IconPin} title={window.t("ofiAddressL")} tokens={tokens}>
              {window.t("ofiAddress")}
            </InfoRow>
            <InfoRow icon={IconClock} title={window.t("ofiScheduleL")} tokens={tokens}>
              {window.t("ofiSchedule")}<br/>
              <span style={{ color: "#777", fontSize: 14 }}>{window.t("ofiScheduleSub")}</span>
            </InfoRow>
            <InfoRow icon={IconPhone} title={window.t("ofiPhoneL")} tokens={tokens}>
              <a href={`tel:${TEL}`} style={linkBlue(tokens)}>{TEL_DISPLAY}</a>
              <span style={{ color: "#999", margin: "0 10px" }}>·</span>
              <a href={WA_URL} target="_blank" rel="noopener noreferrer" style={{ ...linkBlue(tokens), display: "inline-flex", alignItems: "center", gap: 6 }}>
                <IconWhatsapp size={16}/> WhatsApp
              </a>
            </InfoRow>
            <InfoRow icon={IconMail} title={window.t("ofiEmailL")} tokens={tokens}>
              <a href={`mailto:${EMAIL}`} style={linkBlue(tokens)}>{EMAIL}</a>
            </InfoRow>

            <div style={{
              marginTop: 8, padding: "22px 22px",
              background: "#F4F4F4", borderLeft: `4px solid ${tokens.ctaOrange}`,
            }}>
              <div style={{ fontSize: 13, fontWeight: 700, color: tokens.ctaOrange, letterSpacing: ".12em", textTransform: "uppercase", marginBottom: 10 }}>
                {window.t("ofiSocialTitle")}
              </div>
              <div style={{ display: "grid", gap: 10, gridTemplateColumns: "1fr 1fr" }}>
                <a href={IG_URL} target="_blank" rel="noopener noreferrer" style={socialCard(tokens)}>
                  <IconInstagram size={22}/>
                  <div>
                    <div style={{ fontWeight: 700, color: tokens.primaryBlue }}>{window.t("ofiSocialIG")}</div>
                    <div style={{ fontSize: 12.5, color: "#666" }}>{window.t("ofiSocialIGSub")}</div>
                  </div>
                </a>
                <a href={GOOGLE_URL} target="_blank" rel="noopener noreferrer" style={socialCard(tokens)}>
                  <IconGoogle size={22}/>
                  <div>
                    <div style={{ fontWeight: 700, color: tokens.primaryBlue }}>{window.t("ofiSocialGG")}</div>
                    <div style={{ fontSize: 12.5, color: "#666" }}>{window.t("ofiSocialGGSub")}</div>
                  </div>
                </a>
              </div>
            </div>
          </div>

          <a href={`https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent("Carrer d'Antoni Asens 23, 43740 Móra d'Ebre, Tarragona")}`}
             target="_blank" rel="noopener noreferrer"
             style={{ ...ctaPrimary(tokens), marginTop: 28 }}>
            {window.t("ofiHowTo")} <IconArrow size={18} sw={2}/>
          </a>
        </div>
      </div>
      <style>{`
        @media (min-width: 768px) {
          #oficina { padding: 110px 0 !important; }
          #oficina > .wrap {
            grid-template-columns: 1.1fr 1fr !important;
            gap: 40px !important;
          }
        }
      `}</style>
    </section>
  );
}

function InfoRow({ icon: I, title, children, tokens }) {
  return (
    <div style={{ display: "flex", gap: 16, padding: "14px 0", borderBottom: "1px solid #F4F4F4" }}>
      <div style={{
        width: 42, height: 42, flexShrink: 0,
        background: "#FFF3E5", color: tokens.ctaOrange,
        display: "grid", placeItems: "center", borderRadius: 4,
      }}>
        <I size={20} sw={1.8}/>
      </div>
      <div style={{ flex: 1 }}>
        <div style={{ fontSize: 12.5, fontWeight: 700, letterSpacing: ".1em", textTransform: "uppercase", color: "#999" }}>{title}</div>
        <div style={{ fontSize: 16, color: "#222", marginTop: 4 }}>{children}</div>
      </div>
    </div>
  );
}
const linkBlue = (t) => ({ color: t.titleBlue, textDecoration: "underline", fontWeight: 600 });
const socialCard = (t) => ({
  display: "flex", alignItems: "center", gap: 12,
  padding: "12px 14px", background: "#fff", borderRadius: 4,
  textDecoration: "none", color: "inherit",
  border: "1px solid transparent",
  transition: "all .15s ease",
});

// ---------- TESTIMONIOS ----------
function Testimonios({ tokens }) {
  const TESTI = [
    { t: window.t("test1T"), n: window.t("test1N"), r: window.t("test1R") },
    { t: window.t("test2T"), n: window.t("test2N"), r: window.t("test2R") },
    { t: window.t("test3T"), n: window.t("test3N"), r: window.t("test3R") },
  ];
  const [i, setI] = React.useState(0);
  React.useEffect(() => {
    const id = setInterval(() => setI(x => (x+1) % TESTI.length), 7000);
    return () => clearInterval(id);
  }, []);
  return (
    <section id="testimonios" style={{ background: "#F4F4F4", padding: "64px 0" }}>
      <div className="wrap">
        <div style={{ textAlign: "center", maxWidth: 640, margin: "0 auto 56px" }}>
          <div style={eyebrow(tokens)}>{window.t("testEyebrow")}</div>
          <h2 style={{ ...h2Style(tokens), margin: 0 }}>
            {window.t("testTitle")}<br/>
            <em style={{ fontStyle: "normal", color: tokens.primaryBlue, fontWeight: 500 }}>{window.t("testTitleAccent")}</em>
          </h2>
        </div>

        <div style={{
          display: "grid", gap: 20,
          gridTemplateColumns: "repeat(auto-fit, minmax(280px, 1fr))",
        }}>
          {TESTI.map((tt, idx) => (
            <article key={idx} style={{
              background: "#fff", padding: "34px 30px 28px", position: "relative",
              borderTop: `3px solid ${i === idx ? tokens.ctaOrange : "transparent"}`,
              transition: "border-color .3s ease, transform .2s ease",
              transform: i === idx ? "translateY(-4px)" : "none",
              boxShadow: i === idx ? "0 14px 30px rgba(0,48,130,.08)" : "0 1px 0 #E9E9E9",
            }}>
              <div style={{ color: tokens.primaryBlue, opacity: .18, marginBottom: 6 }}>
                <IconQuote size={54}/>
              </div>
              <p style={{
                margin: 0, fontFamily: "Fraunces, Georgia, serif",
                fontSize: 19, lineHeight: 1.45, color: "#222",
                textWrap: "pretty",
              }}>
                {tt.t}
              </p>
              <div style={{ marginTop: 22, paddingTop: 18, borderTop: "1px solid #F4F4F4" }}>
                <div style={{ fontWeight: 700, color: tokens.primaryBlue, fontSize: 15.5 }}>{tt.n}</div>
                <div style={{ color: "#777", fontSize: 13, marginTop: 2 }}>{tt.r}</div>
              </div>
            </article>
          ))}
        </div>

        <div style={{ textAlign: "center", marginTop: 40 }}>
          <a href={GOOGLE_URL} target="_blank" rel="noopener noreferrer"
             style={{
               display: "inline-flex", alignItems: "center", gap: 10,
               padding: "12px 20px", background: "#fff",
               color: tokens.primaryBlue, textDecoration: "none",
               fontWeight: 700, fontSize: 15,
               border: "1.5px solid #E9E9E9", borderRadius: 4,
             }}>
            <IconGoogle size={18}/> {window.t("testGoogle")}
            <IconArrow size={16} sw={2}/>
          </a>
        </div>
      </div>
      <style>{`
        @media (min-width: 768px) {
          #testimonios { padding: 110px 0 !important; }
        }
      `}</style>
    </section>
  );
}

// ---------- FORMULARIO ----------
function Contacto({ tokens }) {
  const [form, setForm] = React.useState({ nombre: "", telefono: "", email: "", grupo: "", tipo: "", mensaje: "", privacy: false, _hp: "" });
  const [errors, setErrors] = React.useState({});
  const [sent, setSent] = React.useState(false);
  const [submitting, setSubmitting] = React.useState(false);
  const [submitError, setSubmitError] = React.useState("");

  const set = (k) => (e) => setForm(f => ({ ...f, [k]: e.target.type === "checkbox" ? e.target.checked : e.target.value }));

  const submit = async (e) => {
    e.preventDefault();
    if (submitting) return;

    // Honeypot anti-spam (D-CRM-E): un bot rellena _hp, una persona no lo ve.
    // Aborto silencioso (UI dice "enviado") para no dar señal al bot.
    if (form._hp && form._hp.length > 0) {
      console.warn("[form] honeypot triggered, abort silently");
      setSent(true);
      return;
    }

    const errs = {};
    if (!form.nombre.trim()) errs.nombre = window.t("errName");
    if (!/^[0-9\s+()-]{7,}$/.test(form.telefono)) errs.telefono = window.t("errPhone");
    if (!/^\S+@\S+\.\S+$/.test(form.email)) errs.email = window.t("errEmail");
    if (!form.grupo) errs.grupo = window.t("errGroup");
    if (!form.tipo) errs.tipo = window.t("errType");
    if (!form.privacy) errs.privacy = window.t("errPrivacy");
    setErrors(errs);
    if (Object.keys(errs).length > 0) return;

    const sb = window.__SUPABASE_CLIENT__;
    const cfg = window.__SUPABASE__;
    if (!sb || !cfg) {
      console.error("[form] Supabase client not ready");
      setSubmitError(window.t("errSubmit"));
      return;
    }

    setSubmitting(true);
    setSubmitError("");

    // "_advisory" = el usuario pide asesoramiento general, no producto concreto → no mandamos product_key.
    const productKey = (form.tipo === "_advisory" || !form.tipo) ? null : form.tipo;

    try {
      const { data, error } = await sb.rpc("submit_landing_lead", {
        p_user_id: cfg.albaUserId,
        p_lead_name: form.nombre.trim(),
        p_lead_phone: form.telefono.trim(),
        p_lead_email: form.email.trim(),
        p_notes: form.mensaje || "",
        p_subsource: window.LANDING_SUBSOURCE || "direct",
        p_landing_lang: window.PAGE_LANG || "es",
        p_landing_grupo: form.grupo,
        p_landing_product_key: productKey,
      });

      if (error) {
        console.error("[form] RPC error:", error);
        setSubmitError(window.t("errSubmit"));
        setSubmitting(false);
        return;
      }

      console.log("[form] opportunity created, id =", data);

      // GA4 evento de conversión (D29). No-op si analytics no consentido.
      if (typeof window.trackEvent === "function") {
        window.trackEvent("form_submit", {
          lang: window.PAGE_LANG || "es",
          grupo: form.grupo,
          product_key: productKey || "_advisory",
        });
      }

      // Redirect a página de gracias (D28). El setSent es safety net por si
      // el navegador bloquea el redirect; UI muestra confirmación inline.
      setSubmitting(false);
      setSent(true);
      var lang = window.PAGE_LANG || "es";
      var thanks = THANKS_SLUGS[lang] || THANKS_SLUGS.es;
      window.location.href = thanks;
    } catch (err) {
      console.error("[form] network error:", err);
      setSubmitError(window.t("errSubmit"));
      setSubmitting(false);
    }
  };

  const PART_KEYS = [
    "p_accident", "p_savings", "p_travel", "p_auto", "p_comm",
    "p_deceso", "p_home", "p_invest", "p_pet", "p_mob",
    "p_sports", "p_scoot", "p_health", "p_life"
  ];
  const EMP_KEYS = [
    "e_accident", "e_agri", "e_auto", "e_shop", "e_const",
    "e_poll", "e_horeca", "e_office", "e_pyme", "e_rc",
    "e_tech", "e_life"
  ];
  const familiaKeys = form.grupo === "particular" ? PART_KEYS
                    : form.grupo === "empresa"   ? EMP_KEYS
                    : [];
  const familias = familiaKeys
    .map(k => ({ key: k, label: window.t(k + "_t") }))
    .sort((a, b) => a.label.localeCompare(b.label, window.PAGE_LANG || "es"));

  return (
    <section id="contacto" style={{ background: "#fff", padding: "64px 0" }}>
      <div className="wrap" style={{
        display: "grid", gridTemplateColumns: "1fr", gap: 32,
      }}>
        <div>
          <div style={eyebrow(tokens)}>{window.t("contactEyebrow")}</div>
          <h2 style={h2Style(tokens)}>
            {window.t("contactTitle")}<br/>
            <em style={{ fontStyle: "italic", color: tokens.primaryBlue, fontWeight: 500 }}>{window.t("contactTitleAccent")}</em>
          </h2>
          <p style={pLead}>{window.t("contactLead")}</p>

          <div className="contact-quicklinks" style={{ marginTop: 30, display: "grid", gap: 14 }}>
            <QuickLink href={`tel:${TEL}`} icon={IconPhone} label={TEL_DISPLAY} sub={window.t("qlCallSub")} tokens={tokens}/>
            <QuickLink href={WA_URL} external icon={IconWhatsapp} label={window.t("qlWALabel")} sub={window.t("qlWASub")} tokens={tokens}/>
            <QuickLink href={`mailto:${EMAIL}`} icon={IconMail} label={EMAIL} sub={window.t("qlEmailSub")} tokens={tokens}/>
            <QuickLink href={IG_URL} external icon={IconInstagram} label={window.t("qlIGLabel")} sub={window.t("qlIGSub")} tokens={tokens}/>
            <QuickLink href={GOOGLE_URL} external icon={IconGoogle} label={window.t("qlGGLabel")} sub={window.t("qlGGSub")} tokens={tokens}/>
          </div>
        </div>

        <form onSubmit={submit} noValidate style={{
          background: "#F4F4F4", padding: "36px 36px 30px",
          borderTop: `3px solid ${tokens.ctaOrange}`,
        }}>
          {sent ? (
            <div style={{ textAlign: "center", padding: "40px 0" }}>
              <div style={{
                width: 70, height: 70, margin: "0 auto 20px",
                background: tokens.ctaOrange, color: "#fff",
                display: "grid", placeItems: "center", borderRadius: 99,
              }}>
                <IconCheck size={32} sw={3}/>
              </div>
              <h3 style={{ fontFamily: "Fraunces, Georgia, serif", fontSize: 26, color: tokens.primaryBlue, margin: "0 0 10px" }}>
                {window.t("fOK1")} {form.nombre.split(" ")[0]}{window.t("fOK2")}
              </h3>
              <p style={{ color: "#444", margin: 0 }}>{window.t("fOKSub")}</p>
              <button onClick={() => { setSent(false); setForm({ nombre: "", telefono: "", email: "", tipo: "", mensaje: "", privacy: false }); }}
                      style={{ marginTop: 24, background: "transparent", border: `1.5px solid ${tokens.primaryBlue}`, color: tokens.primaryBlue, padding: "10px 18px", fontWeight: 700, cursor: "pointer", borderRadius: 4 }}>
                {window.t("fReset")}
              </button>
            </div>
          ) : (
            <>
              {/* Honeypot anti-spam (D-CRM-E). Bot rellena este campo, persona no lo ve. */}
              <input
                type="text"
                name="website"
                tabIndex={-1}
                autoComplete="off"
                value={form._hp}
                onChange={set("_hp")}
                aria-hidden="true"
                style={{ position: "absolute", left: "-9999px", top: "-9999px", opacity: 0, width: 1, height: 1, pointerEvents: "none" }}
              />
              <div className="contact-form-grid" style={{ display: "grid", gap: 16, gridTemplateColumns: "1fr" }}>
                <Field label={window.t("fName")} err={errors.nombre} full required>
                  <input value={form.nombre} onChange={set("nombre")} style={inputStyle(!!errors.nombre)} placeholder={window.t("fNamePH")}/>
                </Field>
                <Field label={window.t("fPhone")} err={errors.telefono} required>
                  <input value={form.telefono} onChange={set("telefono")} style={inputStyle(!!errors.telefono)} placeholder={window.t("fPhonePH")}/>
                </Field>
                <Field label={window.t("fEmail")} err={errors.email} required>
                  <input value={form.email} onChange={set("email")} style={inputStyle(!!errors.email)} placeholder={window.t("fEmailPH")}/>
                </Field>
                <Field label={window.t("fGroup")} err={errors.grupo} full required>
                  <select value={form.grupo}
                          onChange={(e) => {
                            setForm(f => ({ ...f, grupo: e.target.value, tipo: "" }));
                          }}
                          style={inputStyle(!!errors.grupo)}>
                    <option value="">{window.t("fGroupPH")}</option>
                    <option value="particular">{window.t("fGroupParticular")}</option>
                    <option value="empresa">{window.t("fGroupEmpresa")}</option>
                  </select>
                </Field>
                <Field label={window.t("fType")} err={errors.tipo} full required>
                  <select value={form.tipo} onChange={set("tipo")} style={inputStyle(!!errors.tipo)}>
                    <option value="">
                      {form.grupo === "" ? window.t("fTypePHEmpty") : window.t("fTypePH")}
                    </option>
                    <option value="_advisory">{window.t("fTypeAdvisory")}</option>
                    {familias.map(f => (
                      <option key={f.key} value={f.key}>{f.label}</option>
                    ))}
                  </select>
                </Field>
                <Field label={window.t("fMsg")} full>
                  <textarea value={form.mensaje} onChange={set("mensaje")} rows={4} style={{ ...inputStyle(false), resize: "vertical", minHeight: 100 }} placeholder={window.t("fMsgPH")}/>
                </Field>
              </div>

              <label style={{
                display: "flex", gap: 10, alignItems: "flex-start",
                marginTop: 8, fontSize: 13.5, color: "#666", cursor: "pointer",
              }}>
                <input type="checkbox" checked={form.privacy} onChange={set("privacy")} style={{ marginTop: 3, accentColor: tokens.ctaOrange }}/>
                <span>
                  {window.t("fPrivacy1")} <a href={legalUrl("privacy")} target="_blank" rel="noopener" style={linkBlue(tokens)}>{window.t("fPrivacyLink")}</a>{window.t("fPrivacy2")}
                  {errors.privacy && <span style={{ color: "#c62828", display: "block", marginTop: 4 }}>{errors.privacy}</span>}
                </span>
              </label>

              {submitError && (
                <div role="alert" style={{
                  marginTop: 16, padding: "12px 16px",
                  background: "#FFEBEE", border: "1px solid #FFC9CD",
                  borderLeft: "4px solid #C62828", borderRadius: 4,
                  color: "#6B0000", fontSize: 14, lineHeight: 1.45,
                }}>
                  {submitError}
                </div>
              )}
              <button type="submit" disabled={submitting} style={{
                marginTop: 20, width: "100%",
                padding: "16px 24px",
                background: submitting ? "#B5B5BA" : tokens.ctaOrange, color: "#fff",
                border: "none", borderRadius: 4, fontWeight: 800, fontSize: 16,
                letterSpacing: ".02em", cursor: submitting ? "wait" : "pointer",
                boxShadow: submitting ? "none" : "0 4px 14px rgba(255,133,0,.3)",
              }}>
                {submitting ? window.t("fSending") : window.t("fSubmit")}
              </button>
              <p style={{ fontSize: 12.5, color: "#999", textAlign: "center", margin: "12px 0 0" }}>
                {window.t("fResponsible")}
              </p>
            </>
          )}
        </form>
      </div>
      <style>{`
        @media (min-width: 600px) {
          .contact-form-grid { grid-template-columns: 1fr 1fr !important; }
        }
        @media (min-width: 768px) {
          #contacto { padding: 110px 0 !important; }
        }
        @media (min-width: 1024px) {
          #contacto > .wrap {
            grid-template-columns: 1fr 1.1fr !important;
            gap: 60px !important;
          }
        }
      `}</style>
    </section>
  );
}

function Field({ label, err, full, required, children }) {
  return (
    <div style={{ gridColumn: full ? "1 / -1" : "auto", display: "flex", flexDirection: "column", gap: 6 }}>
      <label style={{ fontSize: 13, fontWeight: 700, color: "#444", letterSpacing: ".02em" }}>
        {label}
        {required && <span aria-hidden="true" style={{ color: "#f97316", marginLeft: 2 }}>*</span>}
      </label>
      {children}
      {err && <span style={{ fontSize: 12.5, color: "#c62828" }}>{err}</span>}
    </div>
  );
}
const inputStyle = (hasErr) => ({
  padding: "12px 14px", fontSize: 16, border: `1.5px solid ${hasErr ? "#c62828" : "#E9E9E9"}`,
  background: "#fff", borderRadius: 4, fontFamily: "inherit",
  color: "#1d1d1f", width: "100%",
  transition: "border-color .15s ease",
});

function QuickLink({ href, icon: I, label, sub, external, tokens }) {
  const [hover, setHover] = React.useState(false);
  return (
    <a href={href}
       target={external ? "_blank" : undefined}
       rel={external ? "noopener noreferrer" : undefined}
       onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
       style={{
         display: "flex", alignItems: "center", gap: 14,
         padding: "14px 16px", background: hover ? "#fff" : "#F4F4F4",
         border: `1.5px solid ${hover ? tokens.ctaOrange : "transparent"}`,
         textDecoration: "none", color: "inherit",
         transition: "all .15s ease",
       }}>
      <div style={{
        width: 42, height: 42, flexShrink: 0, display: "grid", placeItems: "center",
        background: "#fff", color: tokens.ctaOrange, border: "1px solid #E9E9E9",
        borderRadius: 4,
      }}>
        <I size={20} sw={1.8}/>
      </div>
      <div style={{ flex: 1, minWidth: 0 }}>
        <div style={{ fontWeight: 700, color: tokens.primaryBlue, fontSize: 15.5, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{label}</div>
        <div style={{ fontSize: 13, color: "#777" }}>{sub}</div>
      </div>
      <IconArrow size={16} sw={2} stroke={tokens.ctaOrange}/>
    </a>
  );
}

// ---------- FOOTER ----------
function Footer({ tokens }) {
  const prodLinks = [
    [window.t("typeHogar"), "#productos"], [window.t("typeAuto"), "#productos"],
    [window.t("typeVida"), "#productos"], [window.t("typeSalud"), "#productos"],
    [window.t("typeNegocio"), "#productos"], [window.t("typePatin"), "#productos"],
  ];
  const offLinks = [
    [window.t("fOfComo"), "#oficina"], [window.t("fOfHor"), "#oficina"],
    ["Instagram", IG_URL, true], ["Google", GOOGLE_URL, true],
  ];
  const legalLinks = [
    [window.t("fLg1"), legalUrl("aviso")], [window.t("fLg2"), legalUrl("privacy")],
    [window.t("fLg3"), legalUrl("cookies")], [window.t("fLg4"), legalUrl("transparencia")],
  ];
  return (
    <footer style={{ background: tokens.primaryBlue, color: "#fff", paddingTop: 70 }}>
      <div className="wrap footer-grid" style={{
        display: "grid", gap: 32, paddingBottom: 50,
        gridTemplateColumns: "1fr",
      }}>
        <div>
          <AlbaLogo variant="light" size={85}/>
          <p style={{ fontSize: 14, opacity: .78, lineHeight: 1.6, margin: "18px 0 22px", maxWidth: 320 }}>
            {window.t("footerDesc")}
          </p>
          <div style={{ display: "flex", gap: 10, marginBottom: 18 }}>
            <SocialIcon href={IG_URL} label="Instagram"><IconInstagram size={18}/></SocialIcon>
            <SocialIcon href={GOOGLE_URL} label="Google"><IconGoogle size={18}/></SocialIcon>
            <SocialIcon href={waLink()} label="WhatsApp"><IconWhatsapp size={18}/></SocialIcon>
            <SocialIcon href={`mailto:${EMAIL}`} label="Email"><IconMail size={18}/></SocialIcon>
          </div>
          <LangSwitcher tokens={tokens}/>
        </div>
        <div className="footer-col-hide-mobile">
          <FooterCol title={window.t("footerProducts")} links={prodLinks}/>
        </div>
        <div className="footer-col-hide-mobile">
          <FooterCol title={window.t("footerOffice")}   links={offLinks}/>
        </div>
        <FooterCol title={window.t("footerLegal")}    links={legalLinks}/>
      </div>
      <div style={{ borderTop: "1px solid rgba(255,255,255,.15)" }}>
        <div className="wrap" style={{
          display: "flex", gap: 20, flexWrap: "wrap", justifyContent: "space-between",
          padding: "22px 24px", fontSize: 13, opacity: .75,
        }}>
          <div>{window.t("footerCopy")}</div>
          <div>{window.t("footerCity")}</div>
        </div>
      </div>
      <style>{`
        .footer-col-hide-mobile { display: none; }
        @media (min-width: 600px) {
          .footer-grid { grid-template-columns: 1fr 1fr !important; gap: 40px !important; }
          .footer-col-hide-mobile { display: block; }
        }
        @media (min-width: 1024px) {
          .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr !important; }
        }
      `}</style>
    </footer>
  );
}

function FooterCol({ title, links }) {
  return (
    <div>
      <div style={{ fontSize: 13, fontWeight: 700, letterSpacing: ".14em", textTransform: "uppercase", marginBottom: 16, color: "#ffd9b3" }}>{title}</div>
      <ul style={{ listStyle: "none", padding: 0, margin: 0, display: "grid", gap: 10 }}>
        {links.map(([l, h, ext], i) => (
          <li key={i}>
            <a href={h} {...(ext ? { target: "_blank", rel: "noopener noreferrer" } : {})}
               style={{ color: "#fff", opacity: .82, textDecoration: "none", fontSize: 14.5 }}>
              {l}
            </a>
          </li>
        ))}
      </ul>
    </div>
  );
}

function SocialIcon({ href, label, children }) {
  return (
    <a href={href} target="_blank" rel="noopener noreferrer" aria-label={label}
       style={{
         width: 44, height: 44, borderRadius: 99,
         display: "inline-grid", placeItems: "center",
         background: "rgba(255,255,255,.1)",
         border: "1px solid rgba(255,255,255,.2)",
         color: "#fff", textDecoration: "none",
       }}>
      {children}
    </a>
  );
}

function FloatingCTA({ tokens }) {
  const [show, setShow] = React.useState(false);
  React.useEffect(() => {
    const mq = window.matchMedia("(min-width: 768px)");
    const update = () => setShow(mq.matches);
    update();
    mq.addEventListener("change", update);
    return () => mq.removeEventListener("change", update);
  }, []);
  if (!show) return null;
  return (
    <a href={waLink()} target="_blank" rel="noopener noreferrer" aria-label="WhatsApp"
       style={{
         position: "fixed", right: 20, bottom: 20, zIndex: 50,
         width: 56, height: 56, borderRadius: 99,
         background: "#25D366", color: "#fff",
         display: "grid", placeItems: "center",
         boxShadow: "0 8px 24px rgba(0,0,0,.25)",
         textDecoration: "none",
       }}>
      <IconWhatsapp size={28} sw={1.8}/>
    </a>
  );
}

function StickyBottomBar({ tokens }) {
  const [isMobile, setIsMobile] = React.useState(false);
  const [hideOnForm, setHideOnForm] = React.useState(false);
  const [hideOnHero, setHideOnHero] = React.useState(false);
  const [hideOnModal, setHideOnModal] = React.useState(false);
  const [hideOnCTA, setHideOnCTA] = React.useState(false);

  React.useEffect(() => {
    const mq = window.matchMedia("(max-width: 767px)");
    const update = () => setIsMobile(mq.matches);
    update();
    mq.addEventListener("change", update);
    return () => mq.removeEventListener("change", update);
  }, []);

  // D39 — ocultar mientras modal full-screen de productos está abierto
  React.useEffect(() => {
    const onModal = (e) => setHideOnModal(!!(e.detail && e.detail.open));
    window.addEventListener("alba:productsModal", onModal);
    return () => window.removeEventListener("alba:productsModal", onModal);
  }, []);

  React.useEffect(() => {
    if (!isMobile) return;
    const observers = [];
    const watch = (id, setHidden, threshold) => {
      const target = document.getElementById(id);
      if (!target) return;
      const obs = new IntersectionObserver(
        ([entry]) => setHidden(entry.isIntersecting),
        { threshold }
      );
      obs.observe(target);
      observers.push(obs);
    };
    watch("contacto", setHideOnForm, 0.1);
    watch("top", setHideOnHero, 0);
    watch("cta-inline-products", setHideOnCTA, 0.1);
    return () => observers.forEach(o => o.disconnect());
  }, [isMobile]);

  if (!isMobile || hideOnForm || hideOnHero || hideOnModal || hideOnCTA) return null;

  const btnBase = {
    flex: 1,
    display: "inline-flex", alignItems: "center", justifyContent: "center", gap: 10,
    padding: "16px 14px",
    fontSize: 14.5, fontWeight: 700, letterSpacing: ".02em", color: "#fff",
    textDecoration: "none", minHeight: 56,
  };

  return (
    <div role="group" aria-label="Quick contact" style={{
      position: "fixed", left: 0, right: 0, bottom: 0,
      zIndex: 50, display: "flex",
      background: "#fff",
      borderTop: "1px solid #E9E9E9",
      boxShadow: "0 -4px 16px rgba(0,0,0,.08)",
    }}>
      <a href={`tel:${TEL}`} style={{ ...btnBase, background: tokens.primaryBlue }}>
        <IconPhone size={18} sw={2}/>
        {window.t("stickyCall")}
      </a>
      <a href={waLink()} target="_blank" rel="noopener noreferrer"
         style={{ ...btnBase, background: tokens.ctaOrange }}>
        <IconWhatsapp size={18} sw={2}/>
        WhatsApp
      </a>
    </div>
  );
}

// ---------- FAQ (D35, Lote 9) ----------
// BORRADOR — respuestas redactadas por Code el 29/04 con datos de SPEC.
// Sandra debe revisar con Alba antes de publicar (ajustes de tono / matices reales).
function FAQ({ tokens }) {
  const items = [1, 2, 3, 4, 5, 6, 7];
  return (
    <section id="faq" style={{ background: "#fff", padding: "64px 0" }}>
      <div className="wrap">
        <div style={{ marginBottom: 36, maxWidth: 720 }}>
          <div style={eyebrow(tokens)}>{window.t("faqEyebrow")}</div>
          <h2 style={h2Style(tokens)}>
            {window.t("faqTitle")}<br/>
            <em style={{ fontStyle: "normal", color: tokens.primaryBlue, fontWeight: 500 }}>{window.t("faqTitleAccent")}</em>
          </h2>
        </div>
        <div style={{ display: "grid", gap: 8, maxWidth: 820 }}>
          {items.map(i => (
            <details key={i} style={{
              background: "#F4F4F4",
              borderLeft: `3px solid ${tokens.ctaOrange}`,
              padding: "14px 20px",
            }}>
              <summary style={{
                cursor: "pointer", fontWeight: 700,
                color: tokens.primaryBlue, fontSize: 16,
                listStyle: "none", display: "flex",
                justifyContent: "space-between", alignItems: "center",
                gap: 12, minHeight: 28,
              }}>
                <span>{window.t("faq" + i + "Q")}</span>
                <span aria-hidden="true" className="faq-toggle" style={{ color: tokens.ctaOrange, fontSize: 22, lineHeight: 1, flexShrink: 0 }}>+</span>
              </summary>
              <p style={{ margin: "12px 0 0", color: "#444", fontSize: 15.5, lineHeight: 1.6 }}>
                {window.t("faq" + i + "A")}
              </p>
            </details>
          ))}
        </div>
      </div>
      <style>{`
        #faq summary::-webkit-details-marker { display: none; }
        #faq details > summary > .faq-toggle { transition: transform .2s ease; }
        #faq details[open] > summary > .faq-toggle { transform: rotate(45deg); }
        @media (min-width: 768px) {
          #faq { padding: 110px 0 !important; }
        }
      `}</style>
    </section>
  );
}

Object.assign(window, { Nav, Hero, QuienSoy, Productos, FAQ, PorQue, Oficina, Testimonios, Contacto, Footer, FloatingCTA, StickyBottomBar });
