/* Floating chatbot: button + coming-soon fallback panel + live FAQ assistant panel. */
.op-chat{
 position:fixed;
 right:24px;
 bottom:48px;
 z-index:16;
 display:flex;
 flex-direction:column;
 align-items:flex-end;
 gap:10px;
 pointer-events:none;
 transition:opacity .18s cubic-bezier(.22,1,.36,1),visibility .18s;
}
.op-chat.is-obscured,
body:has(dialog[open]) .op-chat,
body:has(#mobile-drawer.is-open) .op-chat,
body:has(#mobile-drawer:not([hidden])) .op-chat{
 opacity:0!important;
 visibility:hidden!important;
 pointer-events:none!important;
}
.op-chat-btn{
 pointer-events:auto;
 width:46px;
 height:46px;
 border-radius:50%;
 border:1px solid var(--ink);
 background:var(--ink);
 color:var(--paper);
 display:grid;
 place-items:center;
 padding:0;
 box-shadow:0 8px 24px rgb(0 0 0 / .16);
 transition:background-color .18s,border-color .18s,transform .18s,box-shadow .18s;
}
:root[data-theme=dark] .op-chat-btn{
 background:var(--surface,#202428);
 color:var(--ink);
 border-color:var(--line);
 box-shadow:0 8px 24px rgb(0 0 0 / .4);
}
.op-chat-btn:hover,
.op-chat.is-open .op-chat-btn{
 background:var(--red);
 border-color:var(--red);
 color:#fff;
}
:root[data-theme=dark] .op-chat-btn:hover,
:root[data-theme=dark] .op-chat.is-open .op-chat-btn{
 background:var(--red);
 border-color:var(--red);
 color:#141618;
}
.op-chat-btn svg{
 width:20px;
 height:20px;
 fill:none;
 stroke:currentColor;
 stroke-width:1.6;
}
.op-chat-panel{
 pointer-events:auto;
 width:min(320px,calc(100vw - 32px));
 background:var(--paper);
 color:var(--ink);
 border:1px solid var(--line);
 padding:18px 20px 20px;
 box-shadow:0 16px 40px rgb(0 0 0 / .16);
 display:flex;
 flex-direction:column;
 gap:10px;
}
.op-chat-panel.is-live{
 width:min(360px,calc(100vw - 32px));
 max-height:min(540px,calc(100dvh - 120px));
 padding:14px 16px 14px;
 gap:0;
}
:root[data-theme=dark] .op-chat-panel{
 background:var(--surface,#202428);
 box-shadow:0 16px 44px rgb(0 0 0 / .48);
}
@media(prefers-reduced-motion:no-preference){
 .op-chat-panel:not([hidden]){
  animation:op-chat-panel-in .2s cubic-bezier(.22,1,.36,1);
 }
}
@keyframes op-chat-panel-in{
 from{opacity:0;transform:translateY(8px) scale(.98)}
 to{opacity:1;transform:none}
}
.op-chat-panel-head{
 display:flex;
 align-items:center;
 justify-content:space-between;
 gap:10px;
 flex-shrink:0;
}
.op-chat-panel.is-live .op-chat-panel-head{
 padding-bottom:10px;
 border-bottom:1px solid var(--line);
}
.op-chat-badge{
 display:inline-flex;
 align-items:center;
 gap:8px;
 font-size:10px;
 font-weight:600;
 letter-spacing:.12em;
 text-transform:uppercase;
 color:var(--muted,#686c69);
}
.op-chat-badge svg{
 width:15px;
 height:15px;
 fill:none;
 stroke:var(--red);
 stroke-width:1.7;
 flex:none;
}
.op-chat-close{
 width:32px;
 height:32px;
 border:1px solid var(--line);
 border-radius:50%;
 display:grid;
 place-items:center;
 padding:0;
 color:var(--ink);
 background:transparent;
 flex:none;
}
.op-chat-close:hover{
 border-color:var(--ink);
}
.op-chat-close svg{
 width:14px;
 height:14px;
 fill:none;
 stroke:currentColor;
 stroke-width:1.6;
}

/* Coming-soon fallback view */
.op-chat-fallback{
 display:flex;
 flex-direction:column;
 gap:10px;
}
.op-chat-fallback[hidden]{
 display:none!important;
}
.op-chat-title{
 margin:2px 0 0;
 font-size:19px;
 font-weight:600;
 letter-spacing:-.025em;
 line-height:1.2;
}
.op-chat-copy{
 margin:0;
 font-size:13px;
 line-height:1.6;
 color:var(--muted,#686c69);
}
.op-chat-fallback-actions{
 display:flex;
 flex-direction:column;
 gap:8px;
 margin-top:4px;
}
.op-chat-cta{
 margin:0;
 width:100%;
 min-height:42px;
 padding:10px 16px;
 font-size:12px;
}
.op-chat-secondary{
 display:inline-flex;
 align-items:center;
 justify-content:center;
 width:100%;
 min-height:38px;
 padding:8px 14px;
 border:1px solid var(--line);
 background:transparent;
 color:var(--ink);
 font-size:12px;
 font-weight:500;
 text-decoration:none;
 transition:border-color .15s,color .15s;
}
.op-chat-secondary:hover{
 border-color:var(--ink);
 color:var(--ink);
}

/* Live FAQ chat view */
.op-chat-live{
 display:flex;
 flex-direction:column;
 min-height:0;
 flex:1 1 auto;
 gap:10px;
 padding-top:10px;
}
.op-chat-live[hidden]{
 display:none!important;
}
.op-chat-messages{
 flex:1 1 auto;
 min-height:140px;
 max-height:280px;
 overflow-y:auto;
 overscroll-behavior:contain;
 display:flex;
 flex-direction:column;
 gap:10px;
 padding-right:2px;
}
.op-chat-msg{
 display:flex;
 flex-direction:column;
 gap:6px;
 max-width:92%;
 min-width:0;
}
.op-chat-msg-bot{
 align-self:flex-start;
}
.op-chat-msg-user{
 align-self:flex-end;
 align-items:flex-end;
}
.op-chat-bubble{
 padding:10px 12px;
 font-size:13px;
 line-height:1.55;
 border:1px solid var(--line);
 background:var(--surface,#eae8e1);
 color:var(--ink);
 overflow-wrap:anywhere;
}
:root[data-theme=dark] .op-chat-bubble{
 background:var(--paper,#141618);
}
.op-chat-msg-user .op-chat-bubble{
 background:var(--ink);
 border-color:var(--ink);
 color:var(--paper);
}
:root[data-theme=dark] .op-chat-msg-user .op-chat-bubble{
 background:#eeeee9;
 border-color:#eeeee9;
 color:#141618;
}
.op-chat-bubble a{
 color:inherit;
 font-weight:600;
 text-decoration:underline;
 text-underline-offset:2px;
}
.op-chat-bubble a:hover{
 color:var(--red);
}
.op-chat-sources{
 display:flex;
 flex-direction:column;
 gap:4px;
 padding-left:2px;
}
.op-chat-sources-label{
 font-size:10px;
 font-weight:600;
 letter-spacing:.08em;
 text-transform:uppercase;
 color:var(--muted,#686c69);
}
.op-chat-sources-links{
 display:flex;
 flex-wrap:wrap;
 gap:5px;
}
.op-chat-source-link{
 display:inline-flex;
 align-items:center;
 padding:3px 8px;
 border:1px solid var(--line);
 background:var(--paper);
 color:var(--muted,#686c69);
 font-size:11px;
 line-height:1.35;
 text-decoration:none;
 transition:border-color .15s,color .15s;
}
.op-chat-source-link:hover{
 border-color:var(--ink);
 color:var(--ink);
}
.op-chat-handoff{
 display:flex;
 flex-wrap:wrap;
 gap:6px;
 margin-top:2px;
}
.op-chat-handoff-btn{
 display:inline-flex;
 align-items:center;
 justify-content:center;
 min-height:34px;
 padding:6px 12px;
 font-size:11px;
 font-weight:500;
 text-decoration:none;
 border:1px solid var(--ink);
}
.op-chat-handoff-btn.is-secondary{
 background:transparent;
 border-color:var(--line);
 color:var(--ink);
}
.op-chat-handoff-btn.is-secondary:hover{
 border-color:var(--ink);
}
.op-chat-msg-system{
 align-self:stretch;
 max-width:100%;
 padding:8px 10px;
 border:1px solid var(--line);
 border-left:3px solid var(--red);
 background:var(--paper);
 color:var(--red);
 font-size:12px;
 line-height:1.45;
}
:root[data-theme=dark] .op-chat-msg-system{
 color:#ff9ca9;
}

/* Typing indicator */
.op-chat-dots{
 display:inline-flex;
 align-items:center;
 gap:4px;
 height:14px;
}
.op-chat-dots i{
 width:5px;
 height:5px;
 border-radius:50%;
 background:var(--muted,#686c69);
 display:inline-block;
 animation:op-chat-dot 1.1s infinite ease-in-out;
}
.op-chat-dots i:nth-child(2){
 animation-delay:.16s;
}
.op-chat-dots i:nth-child(3){
 animation-delay:.32s;
}
@keyframes op-chat-dot{
 0%,80%,100%{opacity:.35;transform:translateY(0)}
 40%{opacity:1;transform:translateY(-2px)}
}

/* Suggestion chips */
.op-chat-suggestions{
 display:flex;
 flex-wrap:wrap;
 gap:6px;
 flex-shrink:0;
}
.op-chat-suggestions[hidden]{
 display:none!important;
}
.op-chat-chip{
 padding:6px 10px;
 border:1px solid var(--line);
 background:var(--paper);
 color:var(--ink);
 font:inherit;
 font-size:11px;
 font-weight:500;
 line-height:1.3;
 text-align:left;
 cursor:pointer;
 transition:border-color .15s,background-color .15s;
}
.op-chat-chip:hover{
 border-color:var(--ink);
 background:var(--surface,#eae8e1);
}
:root[data-theme=dark] .op-chat-chip:hover{
 background:#292d32;
}

/* Input form */
.op-chat-form{
 display:grid;
 grid-template-columns:minmax(0,1fr) 38px;
 gap:6px;
 flex-shrink:0;
 padding-top:4px;
}
.op-chat-input{
 width:100%;
 min-width:0;
 min-height:38px;
 padding:8px 10px;
 border:1px solid var(--line);
 border-radius:0;
 background:var(--paper);
 color:var(--ink);
 font:inherit;
 font-size:13px;
 line-height:1.35;
}
.op-chat-input:focus{
 outline:none;
 border-color:var(--ink);
}
.op-chat-send{
 width:38px;
 height:38px;
 border:1px solid var(--ink);
 background:var(--ink);
 color:var(--paper);
 display:grid;
 place-items:center;
 padding:0;
 cursor:pointer;
 transition:background-color .15s,border-color .15s;
}
:root[data-theme=dark] .op-chat-send{
 background:#eeeee9;
 border-color:#eeeee9;
 color:#141618;
}
.op-chat-send:hover:not(:disabled){
 background:var(--red);
 border-color:var(--red);
 color:#fff;
}
:root[data-theme=dark] .op-chat-send:hover:not(:disabled){
 background:var(--red);
 border-color:var(--red);
 color:#141618;
}
.op-chat-send:disabled{
 opacity:.45;
 cursor:default;
}
.op-chat-send svg{
 width:16px;
 height:16px;
 fill:none;
 stroke:currentColor;
 stroke-width:1.6;
}
.op-chat-foot{
 margin:0;
 font-size:11px;
 line-height:1.45;
 color:var(--muted,#686c69);
 flex-shrink:0;
}
.op-chat-foot a{
 color:var(--ink);
 text-decoration:underline;
 text-underline-offset:2px;
}
.op-chat-foot a:hover{
 color:var(--red);
}
.sr-only{
 position:absolute!important;
 width:1px!important;
 height:1px!important;
 padding:0!important;
 margin:-1px!important;
 overflow:hidden!important;
 clip:rect(0,0,0,0)!important;
 white-space:nowrap!important;
 border:0!important;
}

/* Keep form submit buttons and 3D studio controls clear of the floating chat launcher. */
@media(min-width:761px){
 body[data-page="studio"] .editor{
  padding-bottom:76px!important;
 }
 .contact-page{
  padding-bottom:84px;
 }
}
@media(max-height:700px) and (min-width:761px) and (not ((pointer:coarse) and (max-height:500px) and (max-width:1000px))){
 .op-chat{
  bottom:42px;
 }
}
@media(max-width:760px),(pointer:coarse) and (max-height:500px) and (max-width:1000px){
 .op-chat{
  right:calc(16px + env(safe-area-inset-right,0px));
  bottom:calc(78px + env(safe-area-inset-bottom,0px));
 }
 .op-chat-btn{
  width:46px;
  height:46px;
 }
 .op-chat-panel,
 .op-chat-panel.is-live{
  width:min(340px,calc(100vw - 32px - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px)));
  max-height:calc(100dvh - 150px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));
 }
 .op-chat-messages{
  max-height:220px;
 }
 .op-chat-input{
  font-size:16px;
 }
 body[data-page="studio"] #phone-customize{
  right:76px;
  width:calc(100% - 96px);
 }
 body[data-page="studio"][data-studio-screen="edit"] .editor{
  padding-bottom:92px!important;
 }
 body[data-page="home"] .store-copy .button{
  right:78px;
  width:calc(100% - 102px);
 }
 .contact-page{
  padding-bottom:88px;
 }
}
@media(max-height:500px) and (max-width:1000px){
 .op-chat{
  bottom:calc(62px + env(safe-area-inset-bottom,0px));
 }
}
@media(prefers-reduced-motion:reduce){
 .op-chat,.op-chat-btn,.op-chat-panel,.op-chat-dots i{
  animation:none!important;
  transition:none!important;
 }
}
