/* Shared responsive floating assistant for mobile and desktop. */
@media (min-width:0px) {
  .nsv-chat-launcher {
    position:fixed;
    z-index:990;
    right:16px;
    bottom:calc(16px + env(safe-area-inset-bottom,0px));
    display:grid;
    place-items:center;
    width:54px;
    height:54px;
    padding:0;
    border:1px solid rgba(255,255,255,.8);
    border-radius:18px;
    background:#ea580c;
    color:#fff;
    box-shadow:0 6px 22px rgba(124,45,18,.27);
    cursor:pointer;
    touch-action:manipulation;
    -webkit-tap-highlight-color:transparent;
  }
  .nsv-chat-launcher[hidden], .nsv-chat-panel[hidden],
  .nsv-chat-contacts[hidden] {display:none!important}
  .nsv-chat-unread {
    position:absolute;
    top:-7px;
    right:-7px;
    display:grid;
    place-items:center;
    min-width:22px;
    height:22px;
    box-sizing:border-box;
    padding:0 4px;
    border:2px solid #fff;
    border-radius:11px;
    background:#dc2626;
    color:#fff;
    font-family:inherit;
    font-size:11px;
    font-weight:800;
    line-height:1;
    font-variant-numeric:tabular-nums;
    box-shadow:0 2px 8px rgba(127,29,29,.3);
    pointer-events:none;
  }
  .nsv-chat-unread[hidden]{display:none!important}
  .nsv-chat-launcher:active {transform:scale(.96)}
  .nsv-chat-panel {
    position:fixed;
    z-index:991;
    right:12px;
    bottom:calc(12px + env(safe-area-inset-bottom,0px));
    width:min(370px,calc(100vw - 24px));
    height:min(472px,calc(100dvh - 24px - env(safe-area-inset-bottom,0px)));
    max-height:calc(100dvh - 24px - env(safe-area-inset-bottom,0px));
    box-sizing:border-box;
    display:flex;
    flex-direction:column;
    overflow:hidden;
    border:1px solid #dce3eb;
    border-radius:18px;
    color:#172338;
    background:#f8fafc;
    box-shadow:0 14px 42px rgba(3,14,32,.24);
    font-family:inherit;
    isolation:isolate;
  }
  .nsv-chat-panel:focus {outline:none}
  .nsv-chat-head {
    display:flex;
    align-items:center;
    gap:9px;
    flex:none;
    padding:10px 11px;
    min-height:54px;
    box-sizing:border-box;
    background:#162238;
    color:#fff;
    text-align:left;
  }
  .nsv-chat-identity {
    flex:1;
    display:flex;
    flex-direction:column;
    min-width:0;
    gap:1px;
    text-align:left;
  }
  .nsv-chat-identity h2 {
    padding:0;
    margin:0;
    color:#fff;
    font-size:13px;
    font-weight:800;
    letter-spacing:-.01em;
    line-height:1.35;
    white-space:nowrap;
  }
  .nsv-chat-identity span {
    color:#c6d1e0;
    font-size:10px;
    font-weight:500;
    line-height:1.3;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .nsv-chat-head-actions {display:flex;align-items:center;flex:none;gap:6px}
  .nsv-chat-human {
    display:grid;
    place-items:center;
    padding:6px 9px;
    min-height:35px;
    border:1px solid #ea580c;
    border-radius:9px;
    background:#ea580c;
    color:#fff;
    font-family:inherit;
    font-size:10px;
    font-weight:700;
    white-space:nowrap;
    cursor:pointer;
  }
  .nsv-chat-human.is-active,.nsv-chat-human:active{border-color:#fb923c;background:#c2410c}
  .nsv-chat-close {
    display:grid;
    place-items:center;
    flex:none;
    width:35px;
    height:35px;
    padding:0;
    border:1px solid rgba(255,255,255,.16);
    border-radius:9px;
    background:rgba(255,255,255,.06);
    color:#fff;
    font-family:inherit;
    font-size:22px;
    font-weight:400;
    line-height:1;
    cursor:pointer;
  }
  .nsv-chat-messages {
    display:flex;
    flex:1 1 auto;
    min-height:0;
    max-height:none;
    flex-direction:column;
    align-items:stretch;
    gap:10px;
    overflow-x:hidden;
    overflow-y:auto;
    padding:12px;
    background:#f8fafc;
    text-align:left;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:thin;
  }
  .nsv-chat-message {
    display:flex;
    align-self:flex-start;
    flex-direction:column;
    gap:6px;
    max-width:94%;
    flex:none;
    min-width:0;
  }
  .nsv-chat-message.is-user {align-self:flex-end;align-items:flex-end}
  .nsv-chat-bubble {
    padding:9px 11px;
    border:1px solid #e2e8f0;
    border-radius:13px 13px 13px 4px;
    background:#fff;
    color:#334155;
    font-size:13px;
    line-height:1.5;
    white-space:pre-wrap;
    overflow-wrap:anywhere;
  }
  .nsv-chat-message.is-user .nsv-chat-bubble {
    border-color:#fed7aa;
    border-radius:13px 13px 4px 13px;
    background:#fff2e7;
    color:#7c2d12;
  }
  .nsv-chat-actions,.nsv-chat-contact-links {display:flex;flex-wrap:wrap;gap:6px}
  .nsv-chat-link {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:32px;
    box-sizing:border-box;
    padding:6px 9px;
    border:1px solid #fed7aa;
    border-radius:10px;
    background:#fff7ed;
    color:#c2410c;
    font-size:11px;
    font-weight:700;
    line-height:1.3;
    text-align:center;
    text-decoration:none;
  }
  .nsv-chat-link:active {background:#ffedd5}
  .nsv-chat-contacts {
    flex:none;
    min-height:0;
    max-height:132px;
    box-sizing:border-box;
    overflow-y:auto;
    padding:10px 12px;
    border-top:1px solid #e2e8f0;
    background:#fff;
    overscroll-behavior:contain;
  }
  .nsv-chat-contact-title {
    color:#172338;
    font-size:12px;
    font-weight:800;
    line-height:1.4;
  }
  .nsv-chat-contact-note {
    margin:2px 0 9px;
    color:#64748b;
    font-size:11px;
    line-height:1.45;
  }
  .nsv-chat-composer {
    display:flex;
    align-items:flex-end;
    flex:none;
    gap:8px;
    padding:9px 11px 10px;
    border-top:1px solid #ecf0f5;
    background:#fff;
  }
  .nsv-chat-input {
    box-sizing:border-box;
    flex:1;
    min-width:0;
    min-height:44px;
    max-height:104px;
    padding:10px 12px;
    border:1px solid #d7e0eb;
    border-radius:11px;
    background:#f8fafc;
    color:#142033;
    font-family:inherit;
    font-size:16px;
    font-weight:400;
    line-height:1.4;
    resize:none;
    outline:none;
  }
  .nsv-chat-input::placeholder {color:#8592a5}
  .nsv-chat-input:focus {border-color:#ea580c;box-shadow:0 0 0 1px rgba(234,88,12,.09)}
  .nsv-chat-send {
    display:grid;
    place-items:center;
    flex:none;
    width:44px;
    height:44px;
    padding:0;
    border:0;
    border-radius:11px;
    background:#ea580c;
    color:#fff;
    cursor:pointer;
  }
  .nsv-chat-send:active {background:#c2410c}
  .nsv-chat-launcher:focus-visible,.nsv-chat-human:focus-visible,.nsv-chat-close:focus-visible,
  .nsv-chat-send:focus-visible,.nsv-chat-link:focus-visible {
    outline:2px solid #fb923c;
    outline-offset:2px;
  }
  body:has(.nsv-service-picker.nsv-picker-open) .nsv-chat-launcher {display:none!important}
}
@media (max-width:360px) {
  .nsv-chat-head{padding-inline:9px;gap:7px}
  .nsv-chat-head-actions{gap:4px}
  .nsv-chat-human{padding-inline:6px}
  .nsv-chat-identity h2{font-size:12px}
  .nsv-chat-human{padding-inline:6px;font-size:10px}
}
@media (max-width:767px) and (max-height:560px){
  .nsv-chat-contacts{max-height:98px}
}
/* Desktop: pinned to bottom-right of viewport during scrolling. */
@media (min-width:768px) {
  .nsv-chat-launcher{
    right:24px;bottom:24px;width:60px;height:60px;border-radius:19px;
  }
  .nsv-chat-panel{
    right:24px;bottom:24px;
    width:min(400px,calc(100vw - 48px));
    height:min(520px,calc(100dvh - 48px));
    max-height:calc(100dvh - 48px);
    border-radius:19px;
  }
  .nsv-chat-head{padding:12px 14px;min-height:62px;}
  .nsv-chat-identity h2{font-size:15px;}
  .nsv-chat-human{font-size:12px;min-height:38px;padding:7px 11px;}
  .nsv-chat-messages{padding:15px;}
  .nsv-chat-bubble{font-size:14px;}
  .nsv-chat-contact-note{font-size:12px;}
  .nsv-chat-link{font-size:12px;}
  .nsv-chat-launcher:hover{background:#c2410c;}
}
@media (min-width:768px) and (max-height:540px) {
  .nsv-chat-panel{
    top:12px;bottom:12px;
    height:calc(100dvh - 24px);
    max-height:calc(100dvh - 24px);
  }
  .nsv-chat-contacts{max-height:96px;}
}
@media(prefers-reduced-motion:reduce){
  .nsv-chat-launcher{transition:none;transform:none}
}
/* Mobile-only quick call: same frame as chat, stacked directly above it. */
@media (max-width:767px) {
  .nsv-call-launcher {
    position:fixed;
    z-index:990;
    right:16px;
    bottom:calc(82px + env(safe-area-inset-bottom,0px));
    display:grid;
    place-items:center;
    box-sizing:border-box;
    width:54px;
    height:54px;
    border:1px solid rgba(255,255,255,.8);
    border-radius:18px;
    background:#ea580c;
    color:#fff;
    text-decoration:none;
    box-shadow:0 6px 22px rgba(124,45,18,.27);
    cursor:pointer;
    -webkit-tap-highlight-color:transparent;
    touch-action:manipulation;
  }
  .nsv-call-launcher[hidden]{display:none!important}
  .nsv-call-launcher:active{transform:scale(.96)}
  .nsv-call-launcher:focus-visible{outline:2px solid #fb923c;outline-offset:2px}
  body:has(.nsv-service-picker.nsv-picker-open) .nsv-call-launcher{display:none!important}
}
@media (min-width:768px) {
  .nsv-call-launcher{display:none!important}
}

/* Human handoff is separate from contact details. */
.nsv-chat-contacts-button{
  display:grid;place-items:center;min-height:35px;padding:6px 9px;
  border:1px solid rgba(255,255,255,.35);border-radius:9px;
  background:rgba(255,255,255,.08);color:#fff;
  font-family:inherit;font-size:10px;font-weight:700;white-space:nowrap;
  cursor:pointer;touch-action:manipulation;
}
.nsv-chat-contacts-button:hover,.nsv-chat-contacts-button.is-active{
  background:rgba(255,255,255,.18);
}
.nsv-chat-human[aria-pressed="true"]{background:#0f866c;border-color:#0f866c}
.nsv-chat-human[aria-pressed="true"]:active{background:#086b58}
.nsv-chat-human:disabled{opacity:.65;cursor:wait}
/* Operator replies use the same message bubbles and contact-link pills as the AI assistant. */
.nsv-chat-contacts-button:focus-visible{
  outline:2px solid #fb923c;
  outline-offset:2px;
}
@media(min-width:768px){
  .nsv-chat-contacts-button{font-size:12px;min-height:38px;padding:7px 11px}
}
@media(max-width:375px){
  .nsv-chat-head{gap:5px;padding:8px}
  .nsv-chat-head-actions{gap:4px}
  .nsv-chat-human{font-size:9px;padding:5px 6px;min-height:32px}
  .nsv-chat-contacts-button{width:auto;min-width:0;min-height:36px;padding:6px 7px;font-size:10px;font-weight:650}
  .nsv-chat-contacts-button{font-family:inherit;white-space:nowrap}
  .nsv-chat-close{width:30px;height:36px}
}

