/* ===== IG Apex — chat assistant widget (emerald & gold) ===== */
.apx-assist{ position:fixed; right:1.4rem; bottom:1.4rem; z-index:130; }
/* lift the back-to-top button above the launcher so they never overlap */
.to-top{ bottom:5.9rem; }

/* Launcher */
.apx-launcher{
  display:inline-flex; align-items:center; gap:.5rem;
  height:58px; padding:0 22px 0 18px; border:none; border-radius:999px; cursor:pointer;
  background:linear-gradient(180deg,var(--gold-btn,#CBA862),var(--gold-btn2,#A6823C));
  color:#14241E; font-family:var(--mono,inherit); font-size:.72rem; letter-spacing:.1em; text-transform:uppercase; font-weight:700;
  box-shadow:0 12px 30px rgba(166,130,60,.36);
  transition:transform .25s cubic-bezier(.22,1,.36,1), box-shadow .25s;
}
.apx-launcher:hover{ transform:translateY(-2px); box-shadow:0 18px 40px rgba(166,130,60,.5); }
.apx-launcher svg{ width:22px; height:22px; flex:none; }
@media(max-width:560px){ .apx-launcher{ width:58px; padding:0; justify-content:center; } .apx-launcher__label{ display:none; } }

/* Panel */
.apx-panel{
  position:absolute; right:0; bottom:72px; width:362px; max-width:calc(100vw - 2.8rem);
  height:524px; max-height:calc(100vh - 7rem);
  display:flex; flex-direction:column; overflow:hidden;
  background:var(--panel,#FFFDF6); color:var(--ink,#192622);
  border:1px solid rgba(20,83,69,.14); border-radius:20px;
  box-shadow:0 30px 70px rgba(6,43,36,.3);
  opacity:0; transform:translateY(12px) scale(.98); pointer-events:none;
  transition:opacity .28s ease, transform .28s cubic-bezier(.22,1,.36,1);
}
.apx-assist[data-open="true"] .apx-panel{ opacity:1; transform:none; pointer-events:auto; }

.apx-head{
  display:flex; align-items:center; justify-content:space-between; gap:.75rem;
  padding:14px 16px; color:#F3ECD9;
  background:linear-gradient(180deg,var(--burgundy,#145345),var(--burgundy-deep,#062B24));
}
.apx-head__id{ display:flex; align-items:center; gap:10px; min-width:0; }
.apx-ava{ width:36px; height:36px; border-radius:50%; display:grid; place-items:center; flex:none;
  background:rgba(243,236,217,.1); border:1px solid rgba(195,160,91,.5); color:var(--gold-bright,#C3A05B); }
.apx-ava svg{ width:18px; height:18px; }
.apx-title{ display:block; font-family:var(--serif,inherit); font-size:1rem; line-height:1.1; }
.apx-sub{ display:block; font-size:.68rem; letter-spacing:.04em; color:rgba(243,236,217,.72); margin-top:2px; }
.apx-sub::before{ content:'●'; color:#7BD88F; font-size:.6em; vertical-align:middle; margin-right:5px; }
.apx-close{ background:transparent; border:none; color:rgba(243,236,217,.8); cursor:pointer; width:30px; height:30px; border-radius:8px; font-size:1.35rem; line-height:1; }
.apx-close:hover{ background:rgba(243,236,217,.12); color:#fff; }

.apx-body{ flex:1; overflow-y:auto; padding:16px; display:flex; flex-direction:column; gap:10px; background:var(--ink-900,#F7F4EC); }
.apx-msg{ max-width:86%; padding:10px 13px; border-radius:14px; font-size:.86rem; line-height:1.5; }
.apx-msg b{ color:var(--burgundy,#145345); }
.apx-msg--bot{ align-self:flex-start; background:var(--panel,#FFFDF6); border:1px solid rgba(20,83,69,.1);
  border-bottom-left-radius:4px; box-shadow:0 2px 10px rgba(6,43,36,.05); }
.apx-msg--user{ align-self:flex-end; color:#F3ECD9; border-bottom-right-radius:4px;
  background:linear-gradient(180deg,var(--burgundy,#145345),var(--burgundy-deep,#062B24)); }
.apx-msg--user b{ color:#fff; }

.apx-acts{ align-self:flex-start; display:flex; flex-wrap:wrap; gap:8px; }
.apx-act{ display:inline-flex; align-items:center; gap:6px; padding:8px 14px; border-radius:999px; cursor:pointer;
  font-size:.76rem; font-weight:600; background:transparent; border:1px solid var(--burgundy,#145345); color:var(--burgundy,#145345);
  transition:background .2s, color .2s, transform .2s; }
.apx-act:hover{ background:var(--burgundy,#145345); color:#F3ECD9; transform:translateY(-1px); }
.apx-act--gold{ border-color:transparent; color:#14241E;
  background:linear-gradient(180deg,var(--gold-btn,#CBA862),var(--gold-btn2,#A6823C)); }
.apx-act--gold:hover{ filter:brightness(1.06); color:#14241E; }

.apx-chips{ display:flex; flex-wrap:wrap; gap:7px; padding:10px 14px; border-top:1px solid rgba(20,83,69,.08); background:var(--panel,#FFFDF6); }
.apx-chip{ padding:7px 12px; border-radius:999px; cursor:pointer; font-size:.74rem; font-weight:600;
  background:rgba(20,83,69,.06); border:1px solid rgba(20,83,69,.14); color:var(--ink,#192622); transition:background .2s, border-color .2s; }
.apx-chip:hover{ background:rgba(166,130,60,.14); border-color:var(--gold,#A6823C); }

.apx-input{ display:flex; align-items:center; gap:8px; padding:10px 12px; border-top:1px solid rgba(20,83,69,.1); background:var(--panel,#FFFDF6); }
.apx-input input{ flex:1; border:1px solid rgba(20,83,69,.18); border-radius:999px; padding:10px 14px; font-size:.85rem; color:var(--ink,#192622); background:#fff; outline:none; }
.apx-input input:focus{ border-color:var(--gold,#A6823C); }
.apx-send{ flex:none; width:40px; height:40px; border-radius:50%; border:none; cursor:pointer; display:grid; place-items:center; color:#F3ECD9;
  background:linear-gradient(180deg,var(--burgundy,#145345),var(--burgundy-deep,#062B24)); }
.apx-send:hover{ filter:brightness(1.08); }
.apx-send svg{ width:18px; height:18px; }

@media(max-width:560px){
  /* Pin to the real visual viewport via inset, not a 100vh-based height —
     100vh includes the area the mobile browser's address bar can cover,
     which pushed the header off-screen above the fold on iOS Safari. */
  .apx-panel{
    position:fixed; width:auto; height:auto;
    left:12px; right:12px;
    /* Clear the site's own fixed mobile header (~65px) so the two headers
       never overlap. */
    top:calc(env(safe-area-inset-top) + 76px);
    bottom:max(12px, env(safe-area-inset-bottom));
  }
}
@media(prefers-reduced-motion:reduce){ .apx-panel,.apx-launcher{ transition:none; } }
