.sf-chat-backdrop{
  position:fixed;
  inset:0;
  z-index:10070;
  display:none;
  background:rgba(15,23,42,.28);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
}
.sf-chat-panel{
  position:fixed;
  right:calc(var(--sf-app-gap-right,0px) + 18px);
  bottom:calc(var(--sf-app-gap-bottom,0px) + 18px);
  z-index:10080;
  box-sizing:border-box;
  width:min(390px,calc(100vw - var(--sf-app-gap-right,0px) - 36px));
  max-width:calc(100vw - var(--sf-app-gap-right,0px) - 36px);
  height:min(600px,calc(100svh - var(--sf-app-gap-bottom,0px) - 104px));
  max-height:calc(100svh - var(--sf-app-gap-bottom,0px) - 104px);
  display:none;
  grid-template-rows:auto minmax(0,1fr) auto;
  overflow:hidden;
  border:1px solid rgba(15,23,42,.14);
  border-radius:18px;
  background:#fff;
  box-shadow:0 28px 70px rgba(15,23,42,.24);
}
.sf-chat-panel.open{display:grid;}
.sf-chat-head{
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 14px 12px;
  border-bottom:1px solid #e5e7eb;
  background:linear-gradient(180deg,#fff,#f8fafc);
}
.sf-chat-title{display:flex;align-items:center;gap:10px;min-width:0;max-width:100%;}
.sf-chat-mark{
  width:36px;
  height:36px;
  display:grid;
  place-items:center;
  flex:0 0 auto;
  border-radius:11px;
  background:#111827;
  color:#fff;
  font-weight:900;
  font-size:.82rem;
}
.sf-chat-title strong{display:block;color:#111827;font-size:.95rem;line-height:1.1;}
.sf-chat-title small{display:block;color:#64748b;font-size:.72rem;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.sf-chat-head-actions{display:flex;gap:6px;flex:0 0 auto;}
.sf-chat-icon-btn{
  width:34px;
  height:34px;
  border:1px solid #e2e8f0;
  border-radius:10px;
  background:#fff;
  color:#334155;
  cursor:pointer;
  font-weight:900;
}
.sf-chat-icon-btn:hover{background:#f1f5f9;}
.sf-chat-icon-btn.active{background:#fff7cc;border-color:#fde68a;color:#92400e;}
.sf-chat-messages{
  min-height:0;
  min-width:0;
  overflow:auto;
  padding:14px;
  background:#f8fafc;
}
.sf-chat-empty,
.sf-chat-state{
  height:100%;
  width:100%;
  max-width:100%;
  min-width:0;
  box-sizing:border-box;
  padding:0 10px;
  min-height:210px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  text-align:center;
  color:#64748b;
  font-size:.84rem;
  line-height:1.45;
}
.sf-chat-empty strong,
.sf-chat-state strong{max-width:100%;color:#0f172a;font-size:.96rem;white-space:normal;overflow-wrap:anywhere;}
.sf-chat-empty span,
.sf-chat-state span{max-width:28ch;white-space:normal;overflow-wrap:anywhere;}
.sf-chat-day{
  display:flex;
  justify-content:center;
  margin:6px 0 12px;
}
.sf-chat-day span{
  border:1px solid #e2e8f0;
  border-radius:999px;
  background:#fff;
  color:#64748b;
  font-size:.68rem;
  font-weight:800;
  padding:4px 8px;
}
.sf-chat-msg{
  display:flex;
  gap:8px;
  margin:0 0 10px;
  align-items:flex-end;
}
.sf-chat-msg.mine{justify-content:flex-end;}
.sf-chat-avatar{
  width:28px;
  height:28px;
  flex:0 0 auto;
  display:grid;
  place-items:center;
  border-radius:50%;
  background:#e0f2fe;
  color:#075985;
  font-size:.68rem;
  font-weight:900;
}
.sf-chat-msg.mine .sf-chat-avatar{display:none;}
.sf-chat-bubble{
  max-width:min(78%,310px);
  padding:9px 10px;
  border:1px solid #e2e8f0;
  border-radius:14px 14px 14px 5px;
  background:#fff;
  color:#0f172a;
  box-shadow:0 1px 0 rgba(255,255,255,.9) inset;
}
.sf-chat-msg.mine .sf-chat-bubble{
  border-color:#111827;
  border-radius:14px 14px 5px 14px;
  background:#111827;
  color:#fff;
}
.sf-chat-meta{
  display:flex;
  gap:6px;
  align-items:center;
  margin-bottom:4px;
  color:#64748b;
  font-size:.66rem;
  font-weight:800;
}
.sf-chat-msg.mine .sf-chat-meta{color:rgba(255,255,255,.66);}
.sf-chat-msg.pulse .sf-chat-bubble{outline:3px solid rgba(37,99,235,.25);outline-offset:3px;}
.sf-chat-text{
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  font-size:.84rem;
  line-height:1.42;
}
.sf-chat-link{
  border:0;
  border-radius:999px;
  background:#e8f1ff;
  color:#0756b8;
  font:inherit;
  font-weight:900;
  padding:1px 7px;
  cursor:pointer;
  vertical-align:baseline;
}
.sf-chat-msg.mine .sf-chat-link{
  background:rgba(255,255,255,.16);
  color:#fff;
}
.sf-chat-link:hover{text-decoration:underline;}
.sf-chat-quote{
  width:100%;
  border:0;
  border-left:3px solid #60a5fa;
  border-radius:8px;
  background:#f1f5f9;
  color:#334155;
  display:grid;
  gap:2px;
  margin:0 0 7px;
  padding:6px 8px;
  text-align:left;
  cursor:pointer;
}
.sf-chat-msg.mine .sf-chat-quote{background:rgba(255,255,255,.12);border-left-color:#bfdbfe;color:#fff;}
.sf-chat-quote span{font-size:.68rem;font-weight:950;}
.sf-chat-quote small{font-size:.68rem;line-height:1.2;opacity:.82;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.sf-chat-msg-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:7px;}
.sf-chat-msg-actions button{
  border:0;
  background:transparent;
  color:#64748b;
  font:inherit;
  font-size:.68rem;
  font-weight:850;
  cursor:pointer;
  padding:0;
  text-decoration:underline;
  text-underline-offset:2px;
}
.sf-chat-msg.mine .sf-chat-msg-actions button{color:rgba(255,255,255,.68);}
.sf-chat-msg-actions button:hover,
.sf-chat-msg.mine .sf-chat-msg-actions button:hover{color:#2563eb;}
.sf-chat-msg.mine .sf-chat-msg-actions button:hover{color:#fff;}
.sf-chat-msg-actions button.active{color:#f59e0b;text-decoration:none;}
.sf-chat-msg-actions button.liked{
  color:#dc2626;
  text-decoration:none;
  font-weight:950;
}
.sf-chat-msg-actions button.danger{color:#dc2626;}
.sf-chat-msg.mine .sf-chat-msg-actions button.danger{color:#fecaca;}
.sf-chat-likes{
  display:block;
  width:fit-content;
  max-width:100%;
  margin-top:6px;
  border:0;
  background:transparent;
  color:#64748b;
  font-size:.66rem;
  font-weight:850;
  cursor:pointer;
  padding:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.sf-chat-msg.mine .sf-chat-likes{color:rgba(255,255,255,.72);}
.sf-chat-msg.deleted .sf-chat-bubble{
  border-color:#e2e8f0;
  background:#fff;
  color:#64748b;
}
.sf-chat-msg.mine.deleted .sf-chat-bubble{
  border-color:#cbd5e1;
  background:#f8fafc;
  color:#64748b;
}
.sf-chat-msg.mine.deleted .sf-chat-meta{color:#64748b;}
.sf-chat-deleted-text{
  color:#64748b;
  font-style:italic;
}
.sf-chat-compose{
  position:relative;
  min-width:0;
  padding:10px;
  border-top:1px solid #e5e7eb;
  background:#fff;
}
.sf-chat-reply-preview{
  display:none;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin:0 0 8px;
  padding:8px 10px;
  border-left:3px solid #2563eb;
  border-radius:10px;
  background:#eff6ff;
}
.sf-chat-reply-preview.show{display:flex;}
.sf-chat-reply-preview div{min-width:0;display:grid;gap:2px;}
.sf-chat-reply-preview span{color:#2563eb;font-size:.62rem;font-weight:950;text-transform:uppercase;letter-spacing:.08em;}
.sf-chat-reply-preview strong{color:#0f172a;font-size:.76rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.sf-chat-reply-preview small{color:#475569;font-size:.72rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.sf-chat-reply-preview button{
  width:28px;
  height:28px;
  border:1px solid #bfdbfe;
  border-radius:9px;
  background:#fff;
  color:#1d4ed8;
  font-weight:950;
  cursor:pointer;
}
.sf-chat-quick{
  min-width:0;
  max-width:100%;
  display:flex;
  gap:6px;
  overflow-x:auto;
  padding-bottom:8px;
  scrollbar-width:none;
}
.sf-chat-quick::-webkit-scrollbar{display:none;}
.sf-chat-chip{
  flex:0 0 auto;
  border:1px solid #dbe4ef;
  border-radius:999px;
  background:#f8fafc;
  color:#334155;
  padding:5px 9px;
  font-size:.7rem;
  font-weight:850;
  cursor:pointer;
}
.sf-chat-chip:hover{background:#eef5ff;border-color:#bdd7ff;color:#0756b8;}
.sf-chat-form{min-width:0;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:end;}
.sf-chat-input{
  min-width:0;
  width:100%;
  box-sizing:border-box;
  min-height:42px;
  max-height:112px;
  resize:none;
  border:1px solid #dbe4ef;
  border-radius:13px;
  padding:10px 11px;
  outline:none;
  color:#111827;
  background:#f8fafc;
  font-size:.84rem;
  line-height:1.35;
}
.sf-chat-input:focus{border-color:#7bb0ff;background:#fff;box-shadow:0 0 0 3px rgba(27,111,232,.12);}
.sf-chat-send{
  flex:0 0 auto;
  min-width:74px;
  height:42px;
  border:0;
  border-radius:13px;
  background:#111827;
  color:#fff;
  font-size:.78rem;
  font-weight:900;
  cursor:pointer;
}
.sf-chat-send:disabled{opacity:.45;cursor:not-allowed;}
.sf-chat-suggest{
  position:absolute;
  left:10px;
  right:10px;
  bottom:66px;
  display:none;
  overflow:hidden;
  border:1px solid #dbe4ef;
  border-radius:14px;
  background:#fff;
  box-shadow:0 16px 34px rgba(15,23,42,.16);
}
.sf-chat-suggest.open{display:block;}
.sf-chat-suggest button{
  width:100%;
  border:0;
  border-bottom:1px solid #eef2f7;
  background:#fff;
  padding:10px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  cursor:pointer;
  text-align:left;
}
.sf-chat-suggest button:hover{background:#f8fafc;}
.sf-chat-suggest strong{display:block;color:#0f172a;font-size:.78rem;}
.sf-chat-suggest span{color:#64748b;font-size:.68rem;font-weight:800;text-transform:uppercase;}
.sf-chat-nav-badge{
  min-width:17px;
  height:17px;
  display:none;
  place-items:center;
  margin-left:2px;
  border-radius:999px;
  background:#dc2626;
  color:#fff;
  font-size:.62rem;
  font-weight:900;
  line-height:1;
}
.sf-chat-nav-badge.show{display:grid;}
.sf-chat-mention-badge{
  display:none;
  margin-left:2px;
  color:#dc2626;
  font-size:.82rem;
  font-weight:950;
  line-height:1;
}
.sf-chat-mention-badge.show{display:inline-grid;}
body.sf-chat-open .sf-chat-backdrop{display:none;}

@media(max-width:599px){
  #nav-chat-btn .sf-chat-nav-badge.show{
    position:absolute !important;
    top:-5px !important;
    right:-5px !important;
    z-index:3 !important;
    display:grid !important;
    pointer-events:none !important;
    margin-left:0 !important;
    box-shadow:0 0 0 2px #fff;
  }
  #nav-chat-btn .sf-chat-mention-badge.show{
    position:absolute !important;
    top:-8px !important;
    right:11px !important;
    z-index:4 !important;
    display:grid !important;
    pointer-events:none !important;
    margin-left:0 !important;
    text-shadow:0 1px 0 #fff;
  }
}

@media(max-width:900px){
  body.sf-chat-open{
    width:100% !important;
    max-width:100% !important;
    overflow:hidden !important;
  }
  body.sf-chat-open #sf-mobile-nav{display:none !important;}
  body.sf-chat-open .sf-chat-backdrop{display:block !important;}
  .sf-chat-panel{
    top:max(8px,env(safe-area-inset-top,0px)) !important;
    right:8px !important;
    bottom:max(8px,env(safe-area-inset-bottom,0px)) !important;
    left:8px !important;
    width:calc(100vw - 16px) !important;
    width:calc(100dvw - 16px) !important;
    max-width:calc(100vw - 16px) !important;
    max-width:calc(100dvw - 16px) !important;
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    margin:0 !important;
    transform:none !important;
    border-radius:20px !important;
  }
  .sf-chat-head{padding:12px;}
  .sf-chat-messages{padding:12px;}
  .sf-chat-bubble{max-width:84%;}
  .sf-chat-send{min-width:68px;}
  .sf-chat-suggest{bottom:64px;}
}
