#pembridge-live-chat,#pembridge-live-chat *{box-sizing:border-box}
.pemchat{--navy:#002b43;--navy2:#073c56;--red:#ed1a29;--red2:#c91421;--line:#e3e7e9;--text:#263840;--muted:#737d82;position:fixed;right:20px;bottom:20px;z-index:999999;font-family:Arial,sans-serif}

/* Floating launcher */
#pembridge-live-chat .pemchat__launcher{position:relative;width:58px;height:58px;margin:0;padding:0;border:0!important;border-radius:50%!important;display:flex;align-items:center;justify-content:center;background:var(--navy2)!important;color:#fff!important;-webkit-text-fill-color:#fff!important;box-shadow:0 12px 30px rgba(0,43,67,.25),0 3px 8px rgba(0,0,0,.11);cursor:pointer;transition:transform .18s ease,opacity .18s ease,visibility .18s ease}
#pembridge-live-chat .pemchat__launcher:hover,#pembridge-live-chat .pemchat__launcher:focus{background:var(--navy2)!important;color:#fff!important;-webkit-text-fill-color:#fff!important;transform:translateY(-3px);outline:none}
.pemchat__launcher-icon{display:flex;align-items:center;justify-content:center;width:29px;height:29px}
.pemchat__launcher-icon svg{display:block;width:29px;height:29px;color:#fff}
.pemchat__launcher-status{position:absolute;right:1px;bottom:2px;width:13px;height:13px;border:3px solid #fff;border-radius:50%;background:#9aa3a7;box-shadow:0 2px 8px rgba(0,0,0,.16)}
.pemchat.is-online .pemchat__launcher-status{background:var(--red)}
.pemchat.is-open .pemchat__launcher{opacity:0;visibility:hidden;pointer-events:none;transform:scale(.92)}

/* Compact modern chat: roughly one-third of a desktop screen width. */
.pemchat__panel{position:fixed;right:20px;bottom:20px;width:clamp(285px,24vw,320px);height:min(445px,62dvh);min-height:375px;display:grid;grid-template-rows:auto minmax(0,1fr) auto;background:#fff;border:1px solid var(--line);border-radius:16px;box-shadow:0 20px 58px rgba(0,0,0,.20);overflow:hidden;transform:translateY(12px) scale(.985);transform-origin:bottom right;opacity:0;transition:transform .2s ease,opacity .2s ease}
.pemchat.is-open .pemchat__panel{transform:translateY(0) scale(1);opacity:1}
.pemchat__panel[hidden]{display:none!important}

.pemchat__header{min-height:58px;padding:10px 10px 9px 12px;background:var(--navy);color:#fff;display:flex;align-items:center;justify-content:space-between;gap:12px}
.pemchat__brandline{display:flex;align-items:center;gap:9px;min-width:0}
.pemchat__brand-avatar{width:30px;height:30px;flex:0 0 30px;border-radius:50%;background:#cbd0d3;box-shadow:inset 0 0 0 1px rgba(0,0,0,.04)}
.pemchat__header strong{display:block;max-width:185px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:600}
.pemchat__status{display:flex;gap:6px;align-items:center;margin-top:4px;font-size:11px;color:rgba(255,255,255,.76)}
.pemchat__status i{width:7px;height:7px;border-radius:50%;background:#9ba3a8}
.pemchat__status.is-online i{background:var(--red);box-shadow:0 0 0 3px rgba(237,26,41,.12)}
#pembridge-live-chat .pemchat__close{width:31px;height:31px;flex:0 0 31px;padding:0;border:0!important;border-radius:50%!important;background:transparent!important;color:#fff!important;-webkit-text-fill-color:#fff!important;font-size:24px;font-weight:300;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center}
#pembridge-live-chat .pemchat__close:hover,#pembridge-live-chat .pemchat__close:focus{background:rgba(255,255,255,.10)!important;color:#fff!important;-webkit-text-fill-color:#fff!important;outline:none}

.pemchat__body{min-height:0;overflow:auto;background:#f5f6f7;overscroll-behavior:contain}
.pemchat__start{min-height:100%;padding:15px 13px 13px;display:flex;flex-direction:column;justify-content:flex-start}
.pemchat__prechat{display:flex;align-items:center;gap:8px;margin-bottom:13px;padding-bottom:12px;border-bottom:1px solid #e5e8ea}
.pemchat__welcome-avatar{width:30px;height:30px;flex:0 0 30px;border-radius:50%;background:#cbd0d3}
.pemchat__prechat h3{margin:0 0 4px;color:var(--navy);font-size:15px;font-weight:400;line-height:1.25}
.pemchat__prechat p{margin:0;color:#687277;font-size:11px;line-height:1.4}
.pemchat__start label{display:block;margin:0 0 8px;color:var(--navy);font-size:10px;font-weight:600}
.pemchat__start input{width:100%;height:38px;margin-top:5px;padding:0 9px;border:1px solid #d5dade!important;border-radius:9px!important;background:#fff!important;font:inherit;color:var(--text)!important;-webkit-text-fill-color:var(--text)!important;outline:none;box-shadow:none!important}
.pemchat__start input:focus{border-color:var(--navy)!important;background:#fff!important}
#pembridge-live-chat .pemchat__start-btn{width:100%;min-height:39px;margin-top:2px;border:1px solid var(--red)!important;border-radius:9px!important;background:var(--red)!important;color:#fff!important;-webkit-text-fill-color:#fff!important;font-weight:600;cursor:pointer;box-shadow:none!important}
#pembridge-live-chat .pemchat__start-btn:hover,#pembridge-live-chat .pemchat__start-btn:focus{background:var(--red2)!important;border-color:var(--red2)!important;color:#fff!important;-webkit-text-fill-color:#fff!important}
.pemchat__start small{display:block;margin-top:8px;color:#7c868a;font-size:9px;line-height:1.45}
#pembridge-live-chat .pemchat__start small a{color:var(--navy)!important;-webkit-text-fill-color:var(--navy)!important;text-decoration:underline!important;text-underline-offset:2px}
#pembridge-live-chat .pemchat__start small a:hover{color:var(--red)!important;-webkit-text-fill-color:var(--red)!important}

.pemchat__conversation{min-height:100%;padding:11px 9px 10px}
.pemchat__messages{display:flex;flex-direction:column;gap:8px}
.pemchat__msg-row{display:flex;align-items:flex-end;gap:7px;max-width:88%;align-self:flex-start}
.pemchat__msg-row--visitor{align-self:flex-end;flex-direction:row-reverse}
.pemchat__msg-avatar{width:23px;height:23px;flex:0 0 23px;border-radius:50%;background:#c8ced2}
.pemchat__msg-content{min-width:0}
.pemchat__msg-meta{display:block;margin:0 0 4px 4px;color:#858e92;font-size:9px;line-height:1.2}
.pemchat__msg-row--visitor .pemchat__msg-meta{text-align:right;margin:0 4px 4px 0}
.pemchat__msg-bubble{padding:7px 9px;border:1px solid #e1e5e7;border-radius:15px 15px 15px 5px;background:#fff;color:var(--text);font-size:12px;line-height:1.42;word-break:break-word;box-shadow:0 1px 2px rgba(0,0,0,.02)}
.pemchat__msg-row--visitor .pemchat__msg-bubble{border-color:var(--navy);border-radius:15px 15px 5px 15px;background:var(--navy);color:#fff}

.pemchat__composer{padding:7px 8px calc(7px + env(safe-area-inset-bottom));background:#fff;border-top:1px solid var(--line);display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px;align-items:end}
.pemchat__composer[hidden]{display:none!important}
.pemchat__composer textarea{min-height:36px;max-height:78px;resize:none;border:1px solid #d7dcde!important;border-radius:11px!important;padding:7px 9px;font:inherit;line-height:1.35;outline:none;background:#f8f9f9!important;color:var(--text)!important;-webkit-text-fill-color:var(--text)!important;box-shadow:none!important}
.pemchat__composer textarea:focus{border-color:var(--navy)!important;background:#fff!important}
#pembridge-live-chat .pemchat__composer button{height:36px;min-width:52px;border:1px solid var(--red)!important;border-radius:9px!important;background:var(--red)!important;color:#fff!important;-webkit-text-fill-color:#fff!important;padding:0 10px;cursor:pointer;box-shadow:none!important;font-size:11px;font-weight:600}
#pembridge-live-chat .pemchat__composer button:hover,#pembridge-live-chat .pemchat__composer button:focus{background:var(--red2)!important;border-color:var(--red2)!important;color:#fff!important;-webkit-text-fill-color:#fff!important}

/* Stop Elementor/global accent colours leaking into the widget. */
#pembridge-live-chat{--e-global-color-primary:#002b43!important;--e-global-color-secondary:#002b43!important;--e-global-color-accent:#ed1a29!important;--e-global-color-text:#263840!important}
#pembridge-live-chat a{color:#002b43!important;-webkit-text-fill-color:#002b43!important}
#pembridge-live-chat a:hover{color:#ed1a29!important;-webkit-text-fill-color:#ed1a29!important}

@media(max-width:520px){
  .pemchat{right:12px;bottom:12px}
  #pembridge-live-chat .pemchat__launcher{width:56px;height:56px}
  .pemchat__launcher-icon,.pemchat__launcher-icon svg{width:28px;height:28px}
  .pemchat__panel{left:auto;right:10px;bottom:10px;width:min(88vw,320px);height:min(445px,calc(100dvh - 86px));min-height:375px;border-radius:16px;transform-origin:bottom center}
  .pemchat__header{min-height:58px;padding:10px 9px 9px 11px}
  .pemchat__brand-avatar{width:29px;height:29px;flex-basis:29px}
  .pemchat__start{padding:14px 12px}
  .pemchat__conversation{padding:11px 8px}
  .pemchat__msg-row{max-width:92%}
}

/* v1.0.7 compact chat + profile icon */
.pemchat__brand-avatar,
.pemchat__welcome-avatar,
.pemchat__msg-avatar--agent{
  background:#B8BEC4;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
.pemchat__brand-avatar img,
.pemchat__welcome-avatar img{
  display:block;
  width:19px;
  height:19px;
  object-fit:contain;
}
.pemchat__msg-avatar--agent img{
  display:block;
  width:15px;
  height:15px;
  object-fit:contain;
}
#pembridge-live-chat .pemchat__message-link{
  color:#002b43!important;
  -webkit-text-fill-color:#002b43!important;
  text-decoration:underline!important;
  text-underline-offset:2px;
  font-weight:600;
}
#pembridge-live-chat .pemchat__message-link:hover{
  color:#ed1a29!important;
  -webkit-text-fill-color:#ed1a29!important;
}

/* v1.0.8 — prevent mobile browsers zooming the page when a chat field receives focus. */
#pembridge-live-chat .pemchat__start input,
#pembridge-live-chat .pemchat__composer textarea {
  font-family: Arial, sans-serif !important;
  font-size: 16px !important;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Keep the compact field dimensions even though the focus-safe text size is 16px. */
#pembridge-live-chat .pemchat__start input {
  line-height: 1.2 !important;
}
#pembridge-live-chat .pemchat__composer textarea {
  line-height: 1.25 !important;
}

/* v1.0.9 — typing indicator and post-chat rating */
.pemchat__typing{display:flex;align-items:center;gap:7px;margin:8px 0 2px 30px;color:#727d82;font-size:10px;line-height:1.3}
.pemchat__typing[hidden]{display:none!important}
.pemchat__typing-dots{display:inline-flex;align-items:center;gap:3px}
.pemchat__typing-dots i{display:block;width:4px;height:4px;border-radius:50%;background:#9ba4a8;animation:pemchatTyping 1.05s infinite ease-in-out}
.pemchat__typing-dots i:nth-child(2){animation-delay:.14s}
.pemchat__typing-dots i:nth-child(3){animation-delay:.28s}
@keyframes pemchatTyping{0%,60%,100%{transform:translateY(0);opacity:.5}30%{transform:translateY(-3px);opacity:1}}
.pemchat__rating{margin:12px 0 2px;padding:10px;border:1px solid #e1e5e7;border-radius:12px;background:#fff;text-align:center}
.pemchat__rating[hidden]{display:none!important}
.pemchat__rating p{margin:0 0 8px;color:#34454d;font-size:11px;font-weight:600;line-height:1.35}
.pemchat__rating-actions{display:flex;justify-content:center;gap:8px}
.pemchat__rating-actions[hidden]{display:none!important}
#pembridge-live-chat .pemchat__rating-actions button{width:36px;height:32px;padding:0;border:1px solid #d8dddf!important;border-radius:9px!important;background:#f8f9f9!important;color:#263840!important;-webkit-text-fill-color:#263840!important;cursor:pointer;font-size:16px;line-height:1}
#pembridge-live-chat .pemchat__rating-actions button:hover,#pembridge-live-chat .pemchat__rating-actions button:focus{border-color:#002b43!important;background:#fff!important;color:#002b43!important;-webkit-text-fill-color:#002b43!important}
.pemchat__rating-thanks{display:block;margin:2px 0 0;color:#657075;font-size:10px;line-height:1.35}
.pemchat__rating-thanks[hidden]{display:none!important}


/* v1.0.11 — launcher keeps the darker hover colour at rest; hover only lifts it slightly. */
#pembridge-live-chat .pemchat__launcher,
#pembridge-live-chat .pemchat__launcher:hover,
#pembridge-live-chat .pemchat__launcher:focus {
  background:#073c56!important;
}


/* v1.0.12 — larger, cleaner visitor chat. White header, no navy top bar. */
#pembridge-live-chat .pemchat__panel{
  right:20px;
  bottom:20px;
  width:min(430px,calc(100vw - 40px));
  height:min(680px,calc(100dvh - 40px));
  min-height:520px;
  grid-template-rows:auto minmax(0,1fr) auto;
  background:#fff;
  border:1px solid #e5e8ea;
  border-radius:18px;
  box-shadow:0 24px 70px rgba(0,0,0,.22);
}
#pembridge-live-chat .pemchat__header{
  min-height:72px;
  padding:14px 15px 13px 16px;
  background:#fff!important;
  color:#263840!important;
  border-bottom:1px solid #eceeef;
}
#pembridge-live-chat .pemchat__brand-avatar{
  width:38px;
  height:38px;
  flex-basis:38px;
}
#pembridge-live-chat .pemchat__brand-avatar img{width:21px;height:21px}
#pembridge-live-chat .pemchat__header strong{
  max-width:260px;
  color:#263840!important;
  -webkit-text-fill-color:#263840!important;
  font-size:15px;
  font-weight:600;
}
#pembridge-live-chat .pemchat__status{
  margin-top:3px;
  color:#7b858a!important;
  font-size:11px;
}
#pembridge-live-chat .pemchat__close{
  width:36px;
  height:36px;
  flex-basis:36px;
  border-radius:50%!important;
  background:transparent!important;
  color:#263840!important;
  -webkit-text-fill-color:#263840!important;
  font-size:29px;
}
#pembridge-live-chat .pemchat__close:hover,
#pembridge-live-chat .pemchat__close:focus{
  background:#f2f3f4!important;
  color:#263840!important;
  -webkit-text-fill-color:#263840!important;
}
#pembridge-live-chat .pemchat__body{background:#fff}
#pembridge-live-chat .pemchat__start{
  padding:22px 18px 18px;
}
#pembridge-live-chat .pemchat__prechat{
  margin-bottom:20px;
  padding-bottom:18px;
  border-bottom:1px solid #eceeef;
}
#pembridge-live-chat .pemchat__welcome-avatar{
  width:38px;
  height:38px;
  flex-basis:38px;
}
#pembridge-live-chat .pemchat__prechat h3{font-size:17px}
#pembridge-live-chat .pemchat__prechat p{font-size:13px}
#pembridge-live-chat .pemchat__start label{font-size:12px;margin-bottom:13px}
#pembridge-live-chat .pemchat__start input{height:46px;border-radius:10px!important;padding:0 12px}
#pembridge-live-chat .pemchat__start-btn{min-height:46px!important;border-radius:10px!important}
#pembridge-live-chat .pemchat__start small{font-size:11px;margin-top:12px}
#pembridge-live-chat .pemchat__conversation{padding:20px 16px 14px;background:#fff}
#pembridge-live-chat .pemchat__messages{gap:12px}
#pembridge-live-chat .pemchat__msg-row{max-width:86%;gap:8px}
#pembridge-live-chat .pemchat__msg-avatar{width:28px;height:28px;flex-basis:28px}
#pembridge-live-chat .pemchat__msg-bubble{
  padding:10px 12px;
  border:0;
  border-radius:14px 14px 14px 5px;
  background:#f3f4f5;
  color:#263840;
  font-size:14px;
  line-height:1.48;
  box-shadow:none;
}
#pembridge-live-chat .pemchat__msg-row--visitor .pemchat__msg-bubble{
  border:0;
  border-radius:14px 14px 5px 14px;
  background:#eef0f2;
  color:#263840;
}
#pembridge-live-chat .pemchat__msg-meta{font-size:10px;color:#8a9397}
#pembridge-live-chat .pemchat__composer{
  padding:11px 12px calc(11px + env(safe-area-inset-bottom));
  border-top:1px solid #e7eaec;
  background:#fff;
  gap:8px;
}
#pembridge-live-chat .pemchat__composer textarea{
  min-height:44px;
  max-height:110px;
  padding:10px 12px;
  border-radius:11px!important;
  background:#fff!important;
}
#pembridge-live-chat .pemchat__composer button{
  height:44px;
  min-width:64px;
  border-radius:10px!important;
}

/* On phones the chat opens almost full-screen, like a standalone messenger. */
@media(max-width:520px){
  #pembridge-live-chat .pemchat__panel{
    left:8px;
    right:8px;
    bottom:8px;
    width:auto;
    height:calc(100dvh - 16px);
    min-height:0;
    max-height:none;
    border-radius:18px;
    transform-origin:bottom center;
  }
  #pembridge-live-chat .pemchat__header{
    min-height:74px;
    padding:14px 14px 13px 16px;
  }
  #pembridge-live-chat .pemchat__conversation{padding:20px 14px 14px}
  #pembridge-live-chat .pemchat__msg-row{max-width:88%}
  #pembridge-live-chat .pemchat__start{padding:22px 16px 18px}
}

/* Larger but still contained on laptops/desktops. */
@media(min-width:900px){
  #pembridge-live-chat .pemchat__panel{
    width:min(460px,calc(100vw - 48px));
    height:min(720px,calc(100dvh - 48px));
    right:24px;
    bottom:24px;
  }
}


/* v1.0.13 — visitor chat is a true mobile overlay.
   When a logged-in WordPress user tests the site, the WP admin toolbar is
   hidden only while the visitor chat is open so it cannot sit above the chat. */
html.pemchat-modal-open-html{
  margin-top:0!important;
}
body.pemchat-modal-open{
  overflow:hidden!important;
  overscroll-behavior:none;
}
body.pemchat-modal-open #wpadminbar{
  display:none!important;
}

/* Keep the chat above WordPress/Elementor overlays and admin UI. */
#pembridge-live-chat,
#pembridge-live-chat .pemchat__panel{
  z-index:2147483647!important;
}

/* Phone/tablet: messenger-style full viewport. */
@media(max-width:782px){
  #pembridge-live-chat .pemchat__panel{
    position:fixed!important;
    inset:0!important;
    width:100vw!important;
    height:100dvh!important;
    min-height:0!important;
    max-height:none!important;
    margin:0!important;
    border:0!important;
    border-radius:0!important;
    box-shadow:none!important;
    transform-origin:bottom center;
  }

  #pembridge-live-chat .pemchat__header{
    padding-top:max(14px,env(safe-area-inset-top));
  }

  #pembridge-live-chat .pemchat__composer{
    padding-bottom:max(11px,env(safe-area-inset-bottom));
  }
}
