/* ENVOI help-desk chatbot (js/chatbot.js) */
.has-bot .wa { bottom: calc(5.3rem + env(safe-area-inset-bottom)); width: 3rem; height: 3rem; right: 1.3rem; }
.has-bot .wa svg { width: 1.5rem; height: 1.5rem; }
.has-bot.bot-open .wa { display: none; }

.bot-fab {
  position: fixed;
  right: 1.1rem;
  bottom: calc(1.1rem + env(safe-area-inset-bottom));
  z-index: 60;
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #0a6cf0, #22a6f0);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 14px 30px -8px rgba(10, 108, 240, 0.55);
  transition: transform 0.3s var(--ease);
}
.bot-fab::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(10, 108, 240, 0.45);
  animation: bot-ping 2.6s ease-out infinite;
}
.bot.is-open .bot-fab::after { animation: none; opacity: 0; }
.bot-fab:hover { transform: scale(1.07); }
.bot-fab-ic { position: absolute; display: grid; transition: transform 0.35s var(--ease), opacity 0.25s; }
.bot-fab-ic svg { width: 1.6rem; height: 1.6rem; }
.bot-fab .is-close { opacity: 0; transform: rotate(-90deg) scale(0.6); }
.bot.is-open .bot-fab .is-chat { opacity: 0; transform: rotate(90deg) scale(0.6); }
.bot.is-open .bot-fab .is-close { opacity: 1; transform: none; }
@keyframes bot-ping { 0% { transform: scale(1); opacity: 0.9; } 80%, 100% { transform: scale(1.55); opacity: 0; } }

.bot-teaser {
  position: fixed;
  right: 5.1rem;
  bottom: calc(1.55rem + env(safe-area-inset-bottom));
  z-index: 60;
  max-width: 15rem;
  padding: 0.65rem 1.9rem 0.65rem 0.9rem;
  border: 1px solid #e3ebf6;
  border-radius: 14px 14px 4px 14px;
  background: #fff;
  color: var(--ink);
  font-size: 0.84rem;
  line-height: 1.4;
  cursor: pointer;
  box-shadow: 0 14px 30px -14px rgba(10, 50, 120, 0.4);
  animation: bot-pop 0.45s var(--ease) both;
}
.bot-teaser b { color: var(--blue); }
.bot-teaser-x { position: absolute; top: 0.2rem; right: 0.35rem; border: 0; background: none; color: #94a3b8; font-size: 1.1rem; line-height: 1; cursor: pointer; }

.bot-panel {
  position: fixed;
  right: 1.1rem;
  bottom: calc(5.4rem + env(safe-area-inset-bottom));
  z-index: 61;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 2rem));
  height: min(580px, calc(100dvh - 7.5rem));
  border: 1px solid #dfe8f5;
  border-radius: 20px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 30px 70px -24px rgba(10, 40, 100, 0.45);
  transform-origin: 100% 100%;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.3s var(--ease);
}
.bot.is-open .bot-panel { opacity: 1; transform: none; pointer-events: auto; }
.bot-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.8rem 0.7rem 0.8rem 0.95rem;
  background: linear-gradient(120deg, #0a6cf0, #1b9cf2 60%, #22c3ee);
  color: #fff;
}
.bot-av { position: relative; flex: 0 0 auto; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: rgba(255, 255, 255, 0.18); }
.bot-av svg { width: 1.25rem; height: 1.25rem; }
.bot-av i { position: absolute; right: 0; bottom: 0; width: 0.65rem; height: 0.65rem; border-radius: 50%; background: #22c55e; border: 2px solid #1b8cf0; }
.bot-who { flex: 1 1 auto; display: grid; line-height: 1.25; min-width: 0; }
.bot-who strong { font-size: 0.95rem; }
.bot-who span { display: flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; opacity: 0.92; }
.bot-who b { width: 0.42rem; height: 0.42rem; border-radius: 50%; background: #86efac; animation: bot-blink 1.6s ease-in-out infinite; }
.bot-hbtn { display: grid; place-items: center; width: 2rem; height: 2rem; border: 0; border-radius: 9px; background: transparent; color: #fff; cursor: pointer; transition: background-color 0.2s; }
.bot-hbtn:hover { background: rgba(255, 255, 255, 0.18); }
.bot-hbtn svg { width: 1.05rem; height: 1.05rem; }

.bot-log {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 0.9rem 0.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, #f6f9fe, #fff);
}
.bot-msg {
  max-width: 86%;
  padding: 0.6rem 0.8rem;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.bot-msg.bot { align-self: flex-start; background: #fff; color: var(--ink); border: 1px solid #e3ebf6; border-bottom-left-radius: 4px; }
.bot-msg.me { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.bot-msg a { color: var(--blue); font-weight: 600; }
.bot-msg.is-new { animation: bot-pop 0.35s var(--ease) both; }
.bot-msg.bot.is-new { transform-origin: 0 100%; }
.bot-msg.me.is-new { transform-origin: 100% 100%; }
.bot-link { display: inline-block; margin-top: 0.3rem; text-decoration: none; }
.bot-dots { display: flex; gap: 0.25rem; padding: 0.75rem 0.85rem; }
.bot-dots i { width: 0.4rem; height: 0.4rem; border-radius: 50%; background: #9db6dd; animation: bot-dot 0.9s ease-in-out infinite; }
.bot-dots i:nth-child(2) { animation-delay: 0.15s; }
.bot-dots i:nth-child(3) { animation-delay: 0.3s; }

.bot-track { display: grid; gap: 0.3rem; min-width: 14rem; }
.bt-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.bt-st { padding: 0.15rem 0.55rem; border-radius: 99px; background: #e9f9ef; color: #15803d; font-size: 0.76rem; font-weight: 700; }
.bt-awb { font-size: 0.72rem; color: var(--muted); }
.bt-row { font-size: 0.8rem; color: #334155; }
.bt-ev { list-style: none; margin: 0.25rem 0 0; padding: 0 0 0 0.8rem; border-left: 2px solid #dbe7fb; display: grid; gap: 0.35rem; }
.bt-ev li { position: relative; font-size: 0.76rem; line-height: 1.35; }
.bt-ev li::before { content: ''; position: absolute; left: calc(-0.8rem - 5px); top: 0.3rem; width: 8px; height: 8px; border-radius: 50%; background: #cfe0fb; }
.bt-ev li:first-child::before { background: var(--blue); box-shadow: 0 0 0 3px rgba(10, 108, 240, 0.18); }
.bt-ev span { display: block; color: var(--muted); font-size: 0.7rem; }

.bot-chips { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.4rem 0.8rem 0.55rem; }
.bot-chips:empty { display: none; }
.bot-chip {
  padding: 0.36rem 0.7rem;
  border: 1px solid #cfe0fb;
  border-radius: 99px;
  background: #fff;
  color: var(--blue);
  font: 600 0.78rem/1.3 var(--font);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  animation: bot-pop 0.3s var(--ease) both;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.bot-chip:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.bot-chip.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.bot-chip.wa { background: #25d366; border-color: #25d366; color: #fff; }

.bot-form { display: flex; gap: 0.45rem; padding: 0.6rem 0.75rem 0.75rem; border-top: 1px solid #edf2f9; }
.bot-form input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid #dfe8f5;
  border-radius: 12px;
  font: 400 0.86rem var(--font);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.bot-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(10, 108, 240, 0.12); }
.bot-form button { flex: 0 0 auto; display: grid; place-items: center; width: 2.6rem; border: 0; border-radius: 12px; background: var(--blue); color: #fff; cursor: pointer; }
.bot-form button svg { width: 1.1rem; height: 1.1rem; }

@keyframes bot-pop { from { opacity: 0; transform: translateY(6px) scale(0.94); } }
@keyframes bot-dot { 50% { transform: translateY(-3px); opacity: 0.5; } }
@keyframes bot-blink { 50% { opacity: 0.35; } }

/* phones: the chat takes the whole screen */
@media (max-width: 560px) {
  .bot-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
  .bot.is-open .bot-fab { display: none; }
  .bot-form input { font-size: 16px; }
  .bot-teaser { right: 4.9rem; max-width: 12.5rem; font-size: 0.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .bot *, .bot *::after, .bot-fab::after { animation: none !important; transition: none !important; }
}

/* live chat with the team */
.bot-msg.agent { align-self: flex-start; background: #ecfdf3; color: var(--ink); border: 1px solid #bbf7d0; border-bottom-left-radius: 4px; }
.bot-agent { display: block; margin-bottom: 0.15rem; color: #15803d; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.01em; }
.bot.is-live .bot-head { background: linear-gradient(120deg, #0a6cf0, #0f9f6e); }
.bot-badge {
  position: absolute;
  top: -0.2rem;
  right: -0.2rem;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  border: 2px solid #fff;
  border-radius: 99px;
  background: #ef4444;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  display: grid;
  place-items: center;
  animation: bot-pop 0.35s var(--ease) both;
}
.bot-badge[hidden] { display: none; }

/* price quote card */
.bot-msg:has(.bot-quote) { max-width: 94%; }
.bot-quote { display: grid; gap: 0.45rem; min-width: 15rem; }
.bq-route { display: grid; gap: 0.1rem; font-size: 0.84rem; }
.bq-route span { color: var(--muted); font-size: 0.7rem; }
.bq-best { display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 0.5rem; padding: 0.5rem 0.65rem; border-radius: 12px; background: linear-gradient(135deg, #eaf3ff, #f3fbff); border: 1px solid #cfe2ff; }
.bq-best span { font-size: 0.72rem; font-weight: 800; color: var(--blue); }
.bq-best b { justify-self: end; font-size: 1.1rem; color: var(--ink); }
.bq-best small { grid-column: 1 / -1; color: #475569; font-size: 0.72rem; }
.bq-best.fast { background: linear-gradient(135deg, #fff7e8, #fffbf3); border-color: #fde3b4; }
.bq-best.fast span { color: #c2410c; }
.bq-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.bq-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.5rem; padding: 0.35rem 0; border-top: 1px dashed #e3ebf6; font-size: 0.76rem; }
.bq-list li b { flex: 1 1 100%; font-size: 0.78rem; }
.bq-list li span { color: #334155; }
.bq-list li span + span::before { content: '·'; margin-right: 0.5rem; color: #cbd5e1; }
.bq-note { color: var(--muted); font-size: 0.68rem; }

/* service picker (cards inside the chat) */
.bot-msg:has(.bot-svcs) { max-width: 100%; width: 100%; }
.bot-svcs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; margin-top: 0.6rem; }
.bs-h { grid-column: 1 / -1; margin: 0.25rem 0 0; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.bot-svc {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 0.5rem;
  align-items: start;
  padding: 0.55rem 0.6rem;
  border: 1px solid #e3ebf6;
  border-radius: 12px;
  background: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s var(--ease);
}
.bot-svc:hover { border-color: #9cc3fb; box-shadow: 0 8px 18px -12px rgba(10, 80, 200, 0.45); transform: translateY(-1px); }
.bs-ic { grid-row: 1 / span 3; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 10px; background: #f1f6fd; font-size: 1.05rem; line-height: 1; }
.bs-t { font-size: 0.8rem; font-weight: 800; color: var(--ink); line-height: 1.25; }
.bs-s { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 0.1rem; font-size: 0.68rem; line-height: 1.35; color: var(--muted); }
.bs-tag { justify-self: start; margin-top: 0.3rem; padding: 0.08rem 0.45rem; border-radius: 99px; font-style: normal; font-size: 0.62rem; font-weight: 800; }
.bs-tag.is-instant { background: #e9f9ef; color: #15803d; }
.bs-tag.is-quote { background: #eaf3ff; color: var(--blue); }

@media (max-width: 360px) {
  .bot-svcs { grid-template-columns: 1fr; }
}

/* phones: the page behind the full-screen chat doesn't scroll */
@media (max-width: 560px) {
  body.bot-open { overflow: hidden; }
}
