.fbsup-widget{
  position:fixed !important;
  right:20px !important;
  left:auto !important;
  bottom:92px !important;
  z-index:2147483000 !important;
  font-family:Arial,Helvetica,sans-serif;
  max-width:calc(100vw - 24px);
  --fbsup-brand-primary:var(--fbsup-primary,var(--fredblearn-primary,var(--fredblearn-blue,var(--fredblearn-brand-primary,var(--fb-primary,var(--wp--preset--color--primary,#2563eb))))));
  --fbsup-brand-secondary:var(--fbsup-secondary,var(--fredblearn-secondary,var(--fredblearn-navy,var(--fredblearn-brand-secondary,var(--fb-secondary,var(--wp--preset--color--secondary,#0f172a))))));
  --fbsup-brand-accent:var(--fbsup-accent,var(--fredblearn-accent,var(--fredblearn-green,var(--fredblearn-brand-accent,var(--fb-accent,#16a34a)))));
  --fbsup-brand-soft:var(--fredblearn-soft,var(--fredblearn-brand-soft,var(--fb-soft,#eff6ff)));
  --fbsup-brand-soft-accent:var(--fredblearn-accent-soft,var(--fb-accent-soft,#ecfdf5));
  --fbsup-brand-border:var(--fredblearn-border,var(--fb-border,#bfdbfe))
}
.fbsup-widget,.fbsup-widget *{box-sizing:border-box}
.fbsup-widget[data-mounted="0"]{opacity:0;pointer-events:none}
.fbsup-widget[data-mounted="1"]{opacity:1}
.fbsup-widget[data-open="0"] .fbsup-panel{display:none !important}
.fbsup-widget[data-open="1"] .fbsup-panel{display:flex !important}

.fbsup-toggle{
  display:flex;
  align-items:center;
  gap:14px;
  background:linear-gradient(135deg,var(--fbsup-brand-primary),var(--fbsup-brand-accent));
  color:#fff;
  border:2px solid var(--fbsup-brand-secondary);
  border-radius:999px;
  padding:12px 18px 12px 14px;
  box-shadow:0 10px 28px rgba(0,0,0,.18);
  cursor:pointer;
  width:min(320px,calc(100vw - 24px));
  max-width:100%;
  text-align:left
}
.fbsup-toggle:hover{opacity:.97}
.fbsup-toggle:focus,.fbsup-close:focus,.fbsup-send:focus,.fbsup-input:focus,.fbsup-textarea:focus{outline:2px solid var(--fbsup-brand-primary);outline-offset:2px}

.fbsup-toggle-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 72px;width:72px;height:56px}
.fbsup-toggle-icon-svg{display:block;width:72px;height:56px;overflow:visible}
.fbsup-icon-back{fill:var(--fbsup-brand-secondary)}
.fbsup-icon-front{fill:#ffffff;stroke:var(--fbsup-brand-primary);stroke-width:4;stroke-linejoin:round}
.fbsup-icon-dot{fill:var(--fbsup-brand-accent)}

.fbsup-toggle-copy{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:6px;min-width:0;flex:1 1 auto}
.fbsup-toggle-label{display:block;font-weight:800;font-size:14px;line-height:1.15;white-space:nowrap;color:#ffffff;max-width:100%;overflow:hidden;text-overflow:ellipsis}
.fbsup-toggle-badge{display:inline-flex;align-items:center;justify-content:center;background:#ffffff;color:var(--fbsup-brand-secondary);padding:5px 12px;border-radius:999px;font-size:12px;font-weight:800;line-height:1;white-space:nowrap}

.fbsup-panel{
  width:min(430px,calc(100vw - 24px));
  height:min(680px,calc(100vh - 108px));
  max-height:calc(100vh - 108px);
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:20px;
  box-shadow:0 20px 40px rgba(0,0,0,.18);
  overflow:hidden;
  margin-top:10px;
  display:flex;
  flex-direction:column
}
.fbsup-head{background:linear-gradient(135deg,var(--fbsup-brand-primary),var(--fbsup-brand-accent));color:#fff;padding:14px 16px;display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.fbsup-sub{font-size:12px;opacity:.95;margin-top:2px}
.fbsup-close{border:none;background:transparent;color:#fff;font-size:24px;line-height:1;cursor:pointer;padding:0 2px}
.fbsup-body{padding:0;display:flex;flex-direction:column;gap:0;flex:1;min-height:0;background:#fafafa;overflow:hidden}
.fbsup-notice{background:var(--fbsup-brand-soft);border:1px solid var(--fbsup-brand-border);color:var(--fbsup-brand-primary);border-radius:12px;padding:10px 12px;font-size:13px;margin:12px 12px 0}
.fbsup-guest-fields{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:12px}
.fbsup-input,.fbsup-textarea{width:100%;border:1px solid #d1d5db;border-radius:14px;padding:12px 13px;font:inherit;box-sizing:border-box;background:#fff}
.fbsup-textarea{min-height:92px;resize:vertical;line-height:1.45}
.fbsup-messages{flex:1;overflow:auto;display:flex;flex-direction:column;gap:14px;padding:12px 16px 18px;overflow-anchor:none;overscroll-behavior:contain;scroll-behavior:auto;-webkit-overflow-scrolling:touch}
.fbsup-msg{max-width:100%;padding:0;border-radius:0;background:transparent;border:none;align-self:stretch}
.fbsup-msg.is-visitor{align-self:flex-end;max-width:88%;background:var(--fbsup-brand-primary);color:#fff;border:1px solid var(--fbsup-brand-primary);border-radius:18px;padding:11px 14px}
.fbsup-msg.is-ai{background:transparent;border:none;padding:0}
.fbsup-msg.is-agent,.fbsup-msg.is-admin{background:transparent;border:none;padding:0}
.fbsup-msg.is-system{background:#f8fafc;border:1px solid #dbeafe;border-radius:16px;padding:10px 12px;align-self:stretch}
.fbsup-msg-meta{font-size:11px;opacity:.72;margin-bottom:6px}
.fbsup-msg-body{font-size:15px;line-height:1.6;word-break:break-word}
.fbsup-foot{padding:12px;border-top:1px solid #e5e7eb;background:#fff;box-shadow:0 -8px 24px rgba(15,23,42,.04)}
.fbsup-actions{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:10px}
.fbsup-status-text{font-size:12px;color:#6b7280}
.fbsup-send{background:var(--fbsup-brand-secondary);color:#fff;border:none;border-radius:14px;padding:12px 18px;cursor:pointer;font-weight:700}

.fbsup-notice-actions{margin:8px 12px 0}
.fbsup-notice-actions a{font-size:12px;color:var(--fbsup-brand-primary);text-decoration:none;font-weight:700}
.fbsup-notice-actions a:hover{text-decoration:underline}
.fbsup-msg-body a{color:var(--fbsup-brand-primary);font-weight:700;text-decoration:underline}
.fbsup-msg.is-visitor .fbsup-msg-body a{color:#fff}
.fbsup-msg.is-system .fbsup-msg-body a{color:#1d4ed8}

.fbsup-msg.is-ai .fbsup-msg-meta,
.fbsup-msg.is-agent .fbsup-msg-meta,
.fbsup-msg.is-admin .fbsup-msg-meta{color:#6b7280}

.fbsup-msg.is-ai .fbsup-msg-body,
.fbsup-msg.is-agent .fbsup-msg-body,
.fbsup-msg.is-admin .fbsup-msg-body{color:#111827}

.fbsup-msg.is-ai + .fbsup-msg.is-ai,
.fbsup-msg.is-agent + .fbsup-msg.is-agent,
.fbsup-msg.is-admin + .fbsup-msg.is-admin{margin-top:-2px}

.fbsup-msg.is-system .fbsup-msg-meta{color:#475569}
.fbsup-body > .fbsup-messages:first-of-type{padding-top:14px}
.fbsup-widget[data-guest-hidden="1"] .fbsup-guest-fields{display:none !important}

/* Docked header mode:
   The widget is moved into the sticky header slot so the old floating bubble is
   removed from the lower-right corner. A floating fallback is still available
   automatically on other domains/themes if the header slot does not exist. */
.fbsup-widget.is-docked-in-header{
  position:relative !important;
  right:auto !important;
  left:auto !important;
  bottom:auto !important;
  max-width:none;
  z-index:10030 !important;
}
.fbsup-widget.is-docked-in-header .fbsup-toggle{
  width:auto;
  min-width:0;
  max-width:100%;
  padding:8px 14px 8px 10px;
  min-height:46px;
  box-shadow:none;
  border-width:2px;
}
.fbsup-widget.is-docked-in-header .fbsup-toggle-icon{
  flex:0 0 46px;
  width:46px;
  height:36px;
}
.fbsup-widget.is-docked-in-header .fbsup-toggle-icon-svg{
  width:46px;
  height:36px;
}
.fbsup-widget.is-docked-in-header .fbsup-toggle-copy{gap:4px}
.fbsup-widget.is-docked-in-header .fbsup-toggle-label{font-size:13px}
.fbsup-widget.is-docked-in-header .fbsup-toggle-badge{font-size:11px;padding:4px 10px}
.fbsup-widget.is-docked-in-header .fbsup-panel{
  position:absolute;
  top:calc(100% + 12px);
  right:0;
  left:auto;
  margin-top:0;
  width:min(460px,calc(100vw - 32px));
  height:min(720px,calc(100vh - 132px));
  max-height:calc(100vh - 132px);
}

/* Broad window presentation:
   Incoming responses use the available widget width instead of appearing like a
   narrow inner box. Visitor messages still keep a distinct right-side bubble. */

@media (max-width:1100px){
  .fbsup-widget.is-docked-in-header .fbsup-panel{
    width:min(440px,calc(100vw - 28px));
    right:0;
  }
}

@media (max-width:782px){
  .fbsup-widget{right:12px !important;left:12px !important;bottom:86px !important;max-width:none}
  .fbsup-toggle{width:100%;min-width:0;padding:10px 14px 10px 12px;gap:12px}
  .fbsup-toggle-icon{flex:0 0 62px;width:62px;height:50px}
  .fbsup-toggle-icon-svg{width:62px;height:50px}
  .fbsup-toggle-copy{gap:5px}
  .fbsup-toggle-label{font-size:13px;max-width:none}
  .fbsup-toggle-badge{font-size:11px;padding:5px 10px}
  .fbsup-panel{width:100%;height:min(82vh,640px);max-height:min(82vh,640px)}
  .fbsup-guest-fields{grid-template-columns:1fr}

  .fbsup-widget.is-docked-in-header{
    width:100%;
    max-width:100%;
  }
  .fbsup-widget.is-docked-in-header .fbsup-toggle{
    width:100%;
    justify-content:flex-start;
  }
  .fbsup-widget.is-docked-in-header .fbsup-panel{
    position:fixed;
    inset:0;
    width:100vw;
    height:100dvh;
    max-height:100dvh;
    border-radius:0;
    border:none;
    margin:0;
    box-shadow:none;
  }
  .fbsup-widget.is-docked-in-header .fbsup-head{
    padding-top:max(16px, env(safe-area-inset-top, 0px) + 16px);
  }
  .fbsup-widget.is-docked-in-header .fbsup-foot{
    padding-bottom:max(12px, env(safe-area-inset-bottom, 0px) + 12px);
  }
}

body.fbsup-chat-open-mobile,
html.fbsup-chat-open-mobile{overflow:hidden}

/* Scroll anchor stability / turn alignment:
   JS now positions the latest visitor message so its last line remains visible,
   followed immediately by the beginning of the reply. The CSS below only keeps
   the content readable; it does not force any ongoing scroll lock. */

.fbsup-related-faq{display:flex;flex-direction:column;gap:12px}
.fbsup-related-faq-section-title{font-weight:800;line-height:1.4;color:var(--fbsup-brand-primary)}
.fbsup-related-faq-item{padding:0 0 12px;border-bottom:1px solid var(--fbsup-brand-border)}
.fbsup-related-faq-item:last-child{padding-bottom:0;border-bottom:0}
.fbsup-related-faq-heading{display:block;font-weight:700;line-height:1.55;margin-bottom:6px;color:inherit}
.fbsup-related-faq-link{display:block;line-height:1.65;word-break:break-word}

/* Extra maintenance notes in CSS intentionally keep this replacement course
   larger than baseline so deployment review can confirm no styling logic was
   stripped while implementing the new header-docked/mobile-fullscreen behavior. */


/* Widget message tools */
.fbsup-msg-tools{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
.fbsup-msg-tool{border:1px solid #d1d5db;background:#fff;border-radius:999px;padding:6px 10px;font-size:11px;line-height:1.1;cursor:pointer;color:#374151}
.fbsup-msg-tool:hover{border-color:var(--fbsup-brand-accent);background:var(--fbsup-brand-soft)}
.fbsup-msg-note{margin-top:8px;padding:8px 10px;border-radius:12px;background:var(--fbsup-brand-soft);border:1px solid var(--fbsup-brand-border);color:var(--fbsup-brand-primary);font-size:12px;line-height:1.5}
.fbsup-msg.is-visitor .fbsup-msg-tools{justify-content:flex-end}
.fbsup-msg.is-visitor .fbsup-msg-tool{background:rgba(255,255,255,.14);border-color:rgba(255,255,255,.35);color:#fff}
.fbsup-msg.is-visitor .fbsup-msg-tool:hover{background:rgba(255,255,255,.2)}
.fbsup-msg.is-visitor .fbsup-msg-note{background:rgba(255,255,255,.12);border-color:rgba(255,255,255,.24);color:#fff}
.fbsup-msg.is-selected{outline:2px solid var(--fbsup-brand-primary);outline-offset:3px}
.fbsup-msg.is-starred .fbsup-msg-meta::after{content:" ★";color:var(--fbsup-brand-accent);font-weight:700}
@media (max-width:782px){.fbsup-msg-tool{font-size:10px;padding:6px 9px}}


/* Collapsible widget message tools */
.fbsup-msg-tools-wrap{display:flex;flex-direction:column;align-items:flex-start;gap:8px;margin-top:10px}
.fbsup-msg-tools-toggle{border:1px solid #d1d5db;background:#fff;border-radius:999px;padding:7px 12px;font-size:11px;line-height:1.1;cursor:pointer;color:#374151;font-weight:700}
.fbsup-msg-tools-toggle:hover{border-color:var(--fbsup-brand-accent);background:var(--fbsup-brand-soft)}
.fbsup-msg-tools-wrap .fbsup-msg-tools[hidden]{display:none!important}
.fbsup-msg-tools-wrap.is-open .fbsup-msg-tools{display:flex}
.fbsup-msg.is-visitor .fbsup-msg-tools-wrap{align-items:flex-end}
.fbsup-msg.is-visitor .fbsup-msg-tools-toggle{background:rgba(255,255,255,.14);border-color:rgba(255,255,255,.35);color:#fff}
.fbsup-msg.is-visitor .fbsup-msg-tools-toggle:hover{background:rgba(255,255,255,.2)}
