:root{
  --vi-chat-primary:#0b3a6e;
  --vi-chat-primary-dark:#06264a;
  --vi-chat-accent:#f58220;
  --vi-chat-accent-dark:#e06b0a;
  --vi-chat-bg:#f4f6fb;
  --vi-chat-text:#1b2430;
  --vi-chat-muted:#6b7686;
  --vi-chat-wa:#25d366;
  --vi-chat-call:#1c7ed6;
  --vi-chat-radius:22px;
}
.vi-chat-root,.vi-chat-root *{box-sizing:border-box;font-family:"Inter","Segoe UI",Roboto,Arial,sans-serif}
.vi-chat-root button,.vi-chat-root input,.vi-chat-root select,.vi-chat-root textarea{font-family:inherit}
.vi-chat-root :focus-visible{outline:2px solid var(--vi-chat-accent);outline-offset:2px}

/* ---------- Right-wall dock (desktop) ---------- */
.vi-chat-dock{position:fixed;right:5px;top:50%;transform:translateY(-50%);z-index:99990;display:flex;flex-direction:column;gap:10px;padding:8px;border-radius:30px;background:rgba(255,255,255,.82);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);box-shadow:0 10px 30px rgba(6,38,74,.18),0 0 0 1px rgba(11,58,110,.06)}
.vi-chat-dock a,.vi-chat-dock button{position:relative;display:flex;align-items:center;justify-content:center;width:46px;height:46px;border:0;cursor:pointer;color:#fff;text-decoration:none;border-radius:50%;transition:transform .2s,box-shadow .2s}
.vi-chat-dock a:hover,.vi-chat-dock button:hover{transform:scale(1.08);box-shadow:0 6px 16px rgba(0,0,0,.25)}
.vi-chat-dock svg{width:22px;height:22px;fill:currentColor}
.vi-chat-dock-call{background:linear-gradient(145deg,#3b97ea,var(--vi-chat-call))}
.vi-chat-dock-wa{background:linear-gradient(145deg,#3ee684,#1fb957)}
.vi-chat-dock-bot{background:linear-gradient(145deg,var(--vi-chat-primary),var(--vi-chat-primary-dark))}
.vi-chat-dock-bot::after{content:"";position:absolute;top:1px;right:1px;width:12px;height:12px;border-radius:50%;background:var(--vi-chat-accent);border:2px solid #fff}
.vi-chat-dock [data-tip]::before{content:attr(data-tip);position:absolute;right:calc(100% + 12px);top:50%;transform:translateY(-50%) translateX(6px);background:var(--vi-chat-primary-dark);color:#fff;font-size:12px;font-weight:600;padding:6px 10px;border-radius:8px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s}
.vi-chat-dock [data-tip]:hover::before{opacity:1;transform:translateY(-50%)}

/* ---------- Panel: compact floating card ---------- */
.vi-chat-panel{position:fixed;right:84px;bottom:24px;width:384px;height:min(600px,calc(100vh - 48px));max-width:calc(100vw - 100px);background:#fff;z-index:99999;display:flex;flex-direction:column;overflow:hidden;overflow:clip;border-radius:var(--vi-chat-radius);box-shadow:0 24px 70px rgba(6,38,74,.30),0 0 0 1px rgba(11,58,110,.08);opacity:0;transform:translateY(18px) scale(.96);transform-origin:bottom right;visibility:hidden;pointer-events:none;transition:opacity .25s ease,transform .3s cubic-bezier(.2,.8,.2,1),visibility .3s}
.vi-chat-panel.vi-chat-open{opacity:1;transform:none;visibility:visible;pointer-events:auto}

.vi-chat-header{position:relative;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px 16px;background:linear-gradient(135deg,var(--vi-chat-primary) 0%,var(--vi-chat-primary-dark) 100%);color:#fff;overflow:hidden}
.vi-chat-header::after{content:"";position:absolute;right:-40px;top:-60px;width:160px;height:160px;border-radius:50%;pointer-events:none}
.vi-chat-brand{display:flex;align-items:center;gap:11px;min-width:0;position:relative;z-index:1}
.vi-chat-logo-wrap{background:#fff;border-radius:12px;padding:5px 9px;display:flex;align-items:center;box-shadow:0 2px 8px rgba(0,0,0,.2);flex:none}
.vi-chat-logo{height:30px;max-width:130px;object-fit:contain;display:block}
.vi-chat-title{min-width:0;line-height:1.25}
.vi-chat-title b{display:block;font-size:14px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.vi-chat-title span{display:flex;align-items:center;gap:6px;font-size:12px;color:rgba(255,255,255,.8)}
.vi-chat-title i{width:8px;height:8px;border-radius:50%;background:#4cd964;box-shadow:0 0 0 3px rgba(76,217,100,.25)}
.vi-chat-header-actions{display:flex;gap:6px;position:relative;z-index:1}
.vi-chat-icon-btn{width:32px;height:32px;border-radius:50%;border:0;background:rgba(255,255,255,.14);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .2s}
.vi-chat-icon-btn:hover{background:rgba(255,255,255,.28)}
.vi-chat-icon-btn svg{width:17px;height:17px;fill:currentColor}

.vi-chat-body{flex:1;min-height:0;overflow-y:auto;padding:16px 14px 6px;background:var(--vi-chat-bg);scroll-behavior:smooth;overscroll-behavior:contain}
.vi-chat-body::-webkit-scrollbar{width:6px}
.vi-chat-body::-webkit-scrollbar-thumb{background:#c9d3e0;border-radius:6px}
.vi-chat-msg{display:flex;margin-bottom:10px}
.vi-chat-msg-bot{justify-content:flex-start}
.vi-chat-msg-user{justify-content:flex-end}
.vi-chat-bubble{max-width:86%;padding:10px 14px;font-size:14px;line-height:1.55;color:var(--vi-chat-text);word-wrap:break-word}
.vi-chat-msg-bot .vi-chat-bubble{background:#fff;border-radius:6px 18px 18px 18px;box-shadow:0 1px 2px rgba(11,58,110,.06),0 4px 14px rgba(11,58,110,.06)}
.vi-chat-msg-user .vi-chat-bubble{background:linear-gradient(135deg,var(--vi-chat-primary),#134f94);color:#fff;border-radius:18px 6px 18px 18px;box-shadow:0 4px 12px rgba(11,58,110,.25)}
.vi-chat-bubble a{color:var(--vi-chat-primary);font-weight:600}
.vi-chat-bubble p{margin:0 0 6px}
.vi-chat-bubble p:last-child{margin:0}

.vi-chat-chips{display:flex;flex-wrap:wrap;gap:7px;margin:2px 0 14px}
.vi-chat-chip{border:1px solid rgba(11,58,110,.22);background:#fff;color:var(--vi-chat-primary);padding:8px 14px;border-radius:999px;font-size:13px;font-weight:600;cursor:pointer;transition:all .2s;text-decoration:none;display:inline-block}
.vi-chat-chip:hover{background:var(--vi-chat-primary);border-color:var(--vi-chat-primary);color:#fff;transform:translateY(-1px)}
.vi-chat-chip-accent{background:#00994a;border-color:transparent;color:#fff;box-shadow:0 4px 12px rgba(245,130,32,.35)}
.vi-chat-chip-accent:hover{background:linear-gradient(135deg,var(--vi-chat-accent),var(--vi-chat-accent-dark));border-color:transparent}

.vi-chat-list{list-style:none;margin:8px 0 0;padding:0;max-height:210px;overflow-y:auto}
.vi-chat-list li{border-top:1px solid #edf0f4}
.vi-chat-list a{display:block;padding:8px 2px;text-decoration:none;font-weight:600;font-size:13.5px}
.vi-chat-list a::before{content:"\203A";color:var(--vi-chat-accent);font-weight:700;margin-right:8px}
.vi-chat-list a:hover{color:var(--vi-chat-accent-dark)}

.vi-chat-typing{display:inline-flex;gap:4px;padding:4px 2px}
.vi-chat-typing span{width:7px;height:7px;border-radius:50%;background:#9aa8ba;animation:vi-chat-blink 1.2s infinite}
.vi-chat-typing span:nth-child(2){animation-delay:.2s}
.vi-chat-typing span:nth-child(3){animation-delay:.4s}
@keyframes vi-chat-blink{0%,80%,100%{opacity:.25}40%{opacity:1}}

/* ---------- Enquiry form ---------- */
.vi-chat-form{background:#fff;border-radius:16px;padding:16px;margin-bottom:14px;box-shadow:0 1px 2px rgba(11,58,110,.06),0 8px 22px rgba(11,58,110,.10)}
.vi-chat-form h4{margin:0 0 2px;font-size:16px;color:var(--vi-chat-primary)}
.vi-chat-form p{margin:0 0 12px;font-size:12.5px;color:var(--vi-chat-muted)}
.vi-chat-field{margin-bottom:10px}
.vi-chat-field label{display:block;font-size:12px;font-weight:600;color:#3a4756;margin-bottom:4px}
.vi-chat-field input,.vi-chat-field select,.vi-chat-field textarea{width:100%;padding:10px 12px;border:1px solid #d4dce8;border-radius:10px;font-size:14px;color:var(--vi-chat-text);background:#f9fbfd;outline:none;transition:border-color .2s,box-shadow .2s,background .2s}
.vi-chat-field textarea{resize:vertical;min-height:64px}
.vi-chat-field input:focus,.vi-chat-field select:focus,.vi-chat-field textarea:focus{border-color:var(--vi-chat-primary);background:#fff;box-shadow:0 0 0 3px rgba(11,58,110,.12)}
.vi-chat-field.vi-chat-invalid input,.vi-chat-field.vi-chat-invalid select{border-color:#d63939}
.vi-chat-error{display:none;color:#d63939;font-size:11.5px;margin-top:3px}
.vi-chat-invalid .vi-chat-error{display:block}
.vi-chat-hp{position:absolute;left:-9999px;opacity:0;height:0;width:0}
.vi-chat-submit{width:100%;padding:12px;border:0;border-radius:12px;color:#fff;font-size:15px;font-weight:700;cursor:pointer;transition:transform .2s,box-shadow .2s}
.vi-chat-submit:hover{transform:translateY(-1px);box-shadow:0 8px 20px rgba(245,130,32,.45)}
.vi-chat-submit:disabled{opacity:.6;cursor:wait;transform:none}
.vi-chat-formmsg{margin-top:8px;font-size:13px;display:none}
.vi-chat-formmsg.vi-chat-ok{display:block;color:#1a7f3c}
.vi-chat-formmsg.vi-chat-fail{display:block;color:#d63939}

/* ---------- Input bar ---------- */
.vi-chat-footer{background:#fff;border-top:1px solid #e8edf4;padding:10px 12px 12px}
.vi-chat-inputbar{display:flex;gap:8px;align-items:center;background:var(--vi-chat-bg);border:1px solid #e1e7ef;border-radius:999px;padding:4px 4px 4px 16px;transition:border-color .2s,box-shadow .2s}
.vi-chat-inputbar:focus-within{border-color:var(--vi-chat-primary);box-shadow:0 0 0 3px rgba(11,58,110,.10);background:#fff}
.vi-chat-inputbar input{flex:1;border:0;background:transparent;padding:8px 0;font-size:14px;outline:none;min-width:0;color:var(--vi-chat-text)}
.vi-chat-send{width:38px;height:38px;border-radius:50%;border:0;color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;flex:none;transition:transform .2s}
.vi-chat-send:hover{transform:scale(1.07)}
.vi-chat-send svg{width:18px;height:18px;fill:currentColor}
.vi-chat-action-row{display:flex;gap:8px;margin-top:9px}
.vi-chat-action-row a{flex:1;text-align:center;padding:8px 6px;border-radius:10px;font-size:13px;font-weight:600;text-decoration:none;display:flex;align-items:center;justify-content:center;gap:6px;border:1px solid transparent;transition:background .2s}
.vi-chat-action-row svg{width:16px;height:16px;fill:currentColor}
.vi-chat-action-call{color:var(--vi-chat-call);background:rgba(28,126,214,.09)}
.vi-chat-action-call:hover{background:rgba(28,126,214,.18)}
.vi-chat-action-wa{color:#18a04a;background:rgba(37,211,102,.12)}
.vi-chat-action-wa:hover{background:rgba(37,211,102,.22)}

/* ---------- Short desktop screens ---------- */
@media (max-height:640px) and (min-width:769px){
  .vi-chat-action-row{display:none}
}

/* ---------- Mobile bottom navbar ---------- */
.vi-chat-nav{display:none}
@media (max-width:768px){
  .vi-chat-dock{display:none}
  body{padding-bottom:64px}
  .vi-chat-nav{display:grid;grid-template-columns:repeat(4,1fr);position:fixed;left:0;right:0;bottom:0;height:64px;background:#fff;border-top:3px solid var(--vi-chat-accent);z-index:100000;box-shadow:0 -3px 12px rgba(0,0,0,.15);padding-bottom:env(safe-area-inset-bottom)}
  .vi-chat-nav a,.vi-chat-nav button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;border:0;background:none;color:var(--vi-chat-primary);font-size:11.5px;font-weight:600;text-decoration:none;cursor:pointer;padding:0;min-width:0}
  .vi-chat-nav svg{width:24px;height:24px;fill:currentColor}
  .vi-chat-nav .vi-chat-nav-bot{color:var(--vi-chat-accent)}
  .vi-chat-nav .vi-chat-nav-wa{color:#1da851}
  .vi-chat-nav .vi-chat-nav-call{color:var(--vi-chat-call)}
  .vi-chat-panel{right:0;left:0;top:0;bottom:64px;width:100%;height:auto;max-width:100%;border-radius:0;box-shadow:none;transform:translateY(24px)}
  .vi-chat-action-row{display:none}
}
@media (prefers-reduced-motion:reduce){.vi-chat-panel,.vi-chat-dock a,.vi-chat-dock button,.vi-chat-chip{transition:none}.vi-chat-typing span{animation:none}.vi-chat-body{scroll-behavior:auto}}




@media (max-width: 768px) {
  .vi-chat-footer-spacer {
    height: calc(66px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    pointer-events: none;
  }
}


/* =========================================
   VI CHAT - MOBILE FOOTER OVERLAP FIX
========================================= */

@media (max-width: 768px) {

  /* Reserve space for the fixed bottom navigation */
  body {
    padding-bottom: 0 !important;
  }

  /* Keep the navbar fixed at the bottom */
  .vi-chat-root .vi-chat-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding: 0 0 env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
    z-index: 100000;
  }

  /* Add enough scrolling space after the footer */
  body > footer,
  footer {
    margin-bottom: 0;
  }

  /* Reserve space at the end of the page content */
  body {
    scroll-padding-bottom:
      calc(76px + env(safe-area-inset-bottom, 0px));
  }

  /* Prevent the chat panel from overlapping the navbar */
  .vi-chat-root .vi-chat-panel {
    top: 0;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    height: auto;
  }
}
