#pchat-root, #pchat-root * { box-sizing: border-box; }
#pchat-root {
  --pc: #1f4e79;
  position: fixed; right: 20px; bottom: 20px; z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
/* Host-theme firewall. The widget renders inside the site's own DOM, so a
   theme that styles bare tags reaches straight into it. Astra
   (strongholdsafes.com.au) sets `button { padding: 14px 28px }`, which left the
   launcher's 28px icon rendering 4px wide, and put its Poppins/600 and a 26px
   line-height on every control and paragraph in the widget. Precision's theme
   is quieter, which is the only reason this went unnoticed until a second site.

   The :where() is load-bearing, not decoration: it holds these at plain
   #pchat-root specificity (1,0,0), which beats a theme's `button` and
   `input[type=...]` selectors but ties with every #pchat-* rule below, so
   source order alone decides and the rules below still win. Written as
   `#pchat-root button` instead it would be 1,0,1 and would outrank
   #pchat-input, #pchat-bubble and the rest - the same bug pointing the other
   way. Keep this block above them, and keep it to form controls and headings:
   widen it to divs or spans and it starts outranking the .pchat-* class rules
   that draw the messages. */
#pchat-root :where(button, input, textarea, select) {
  padding: 0; margin: 0; border-radius: 0; box-shadow: none;
  font-family: inherit; font-size: inherit; font-weight: 400; line-height: 1.4;
  letter-spacing: normal; text-transform: none; min-height: 0; min-width: 0;
}
#pchat-root :where(h1, h2, h3, h4, h5, h6, p) {
  font-family: inherit; font-weight: 400; line-height: 1.4;
  letter-spacing: normal; text-transform: none;
}
/* Touch devices have no hover: without this, iOS fires :hover on tap and the
   bubble stays stuck at 1.06 scale until the visitor taps elsewhere. */
@media (hover: none) and (pointer: coarse) {
  #pchat-bubble { transition: none; }
  #pchat-bubble:hover { transform: none; }
}
#pchat-bubble {
  width: 60px; height: 60px; border-radius: 50%; background: #2f80ed; color: #fff;
  border: none; cursor: pointer; box-shadow: none; filter: none; outline: none;
  -webkit-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent;
  display: flex; align-items: center; justify-content: center; transition: transform .15s;
}
#pchat-bubble:hover { transform: scale(1.06); }
#pchat-bubble svg { width: 28px; height: 28px; fill: #fff; }
#pchat-badge {
  position: absolute; top: -4px; right: -4px; background: #e53935; color: #fff;
  min-width: 20px; height: 20px; border-radius: 10px; font-size: 12px; font-weight: 700;
  display: none; align-items: center; justify-content: center; padding: 0 5px;
}
#pchat-greet {
  position: absolute; right: 4px; bottom: 76px; max-width: 240px;
  background: #2f80ed; color: #fff; border-radius: 16px; padding: 12px 34px 12px 16px;
  box-shadow: 0 10px 28px rgba(0,0,0,.22); font-size: 14.5px; font-weight: 600; font-style: italic; line-height: 1.3;
  white-space: nowrap; cursor: pointer;
  opacity: 0; transform: translateY(10px) scale(.94); transform-origin: bottom right;
  transition: opacity .28s ease, transform .28s ease; pointer-events: none;
}
#pchat-greet.in { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
#pchat-greet::after {
  content: ''; position: absolute; right: 20px; bottom: -6px; width: 14px; height: 14px;
  background: #2f80ed; transform: rotate(45deg); border-radius: 0 0 3px 0;
}
#pchat-greet-x {
  position: absolute; top: 3px; right: 7px; width: 20px; height: 20px; padding: 0;
  background: none; border: none; color: rgba(255,255,255,.8); font-size: 18px; line-height: 1; cursor: pointer;
}
#pchat-greet-x:hover { color: #fff; }
#pchat-root.pos-left #pchat-greet { right: auto; left: 4px; transform-origin: bottom left; }
#pchat-root.pos-left #pchat-greet::after { right: auto; left: 20px; }
#pchat-panel {
  position: absolute; right: 0; bottom: 74px; width: 370px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 120px); background: #fff; border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.28); display: none; flex-direction: column; overflow: hidden;
}
#pchat-root.open #pchat-panel { display: flex; }
#pchat-head { background: var(--pc); color: #fff; padding: 16px; }
#pchat-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
#pchat-head p { margin: 2px 0 0; font-size: 12px; opacity: .85; }
#pchat-close { position: absolute; top: 12px; right: 12px; background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; line-height: 1; }
#pchat-msgs { flex: 1; overflow-y: auto; padding: 14px; background: #f5f6f8; position: relative; }
#pchat-root.has-wm #pchat-msgs::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: var(--pc);
  -webkit-mask: var(--pc-wm) center 48% / 80% no-repeat; mask: var(--pc-wm) center 48% / 80% no-repeat;
  opacity: .09;
}
#pchat-msgs > * { position: relative; z-index: 1; }
.pchat-msg { margin-bottom: 10px; display: flex; }
.pchat-msg .b { max-width: 82%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.pchat-msg.v { justify-content: flex-end; }
.pchat-msg.v .b { background: var(--pc); color: #fff; border-bottom-right-radius: 4px; }
.pchat-msg.b0 .b, .pchat-msg.a .b { background: #fff; color: #1a1a1a; border: 1px solid #e3e6ea; border-bottom-left-radius: 4px; }
.pchat-msg.s { justify-content: center; }
.pchat-msg.s .b { background: #e8eaed; color: #555; font-size: 12px; border-radius: 10px; }
.pchat-msg .b a { color: inherit; text-decoration: underline; }
.pchat-msg.v .b a { color: #fff; }
/* Agent/bot avatar + message column (2.9.39) */
.pchat-msg.b0, .pchat-msg.a { align-items: flex-end; gap: 8px; flex-wrap: nowrap; }
.pchat-av { width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; background: #cdd6e0 center / cover no-repeat; box-shadow: 0 1px 3px rgba(0,0,0,.18); align-self: flex-end; }
.pchat-av.sp { visibility: hidden; box-shadow: none; }
.pchat-col { display: flex; flex-direction: column; min-width: 0; max-width: calc(100% - 44px); }
.pchat-col .b { max-width: 100%; }
/* On a narrow phone the 44px reserved beside the bubble costs the table a whole
   line of wrapping, so a column carrying a table takes it back and the bubble
   above keeps its own indent. */
@media (max-width: 420px) {
  .pchat-col.has-grid { max-width: 100%; }
  .pchat-col.has-grid .b { max-width: calc(100% - 44px); }
}
#pchat-typing { font-size: 12px; color: #888; padding: 0 14px 6px; height: 18px; }
#pchat-foot { border-top: 1px solid #e3e6ea; padding: 10px; background: #fff; }
#pchat-form { display: flex; gap: 8px; }
#pchat-input { flex: 1; border: 1px solid #cfd4da; border-radius: 20px; padding: 10px 14px; font-size: 14px; outline: none; resize: none; max-height: 90px; font-family: inherit; }
#pchat-input:focus { border-color: var(--pc); }
#pchat-send { background: var(--pc); border: none; color: #fff; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; flex: 0 0 auto; }
#pchat-send svg { width: 18px; height: 18px; fill: #fff; }
#pchat-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
#pchat-human { background: none; border: none; color: var(--pc); font-size: 12px; cursor: pointer; text-decoration: underline; padding: 0; }
#pchat-consent { font-size: 10px; color: #9aa0a6; margin: 0; }
#pchat-consent a { color: #9aa0a6; }
.pchat-dots span { display:inline-block; width:6px;height:6px;margin:0 1px;background:#bbb;border-radius:50%;animation:pcb 1s infinite; }
.pchat-dots span:nth-child(2){animation-delay:.2s}.pchat-dots span:nth-child(3){animation-delay:.4s}
@keyframes pcb{0%,60%,100%{opacity:.3}30%{opacity:1}}
@media (max-width:480px){ #pchat-panel{ width: calc(100vw - 24px); height: calc(100vh - 100px); } }
#pchat-root.prechat #pchat-foot { display: none; }
#pchat-prechat { padding: 4px 2px 8px; }
#pchat-prechat h4 { margin: 0 0 4px; font-size: 15px; color: #1a1a1a; }
#pchat-prechat p.i { font-size: 13px; color: #555; margin: 0 0 10px; }
#pchat-prechat input { width: 100%; box-sizing: border-box; margin-bottom: 8px; padding: 10px 12px; border: 1px solid #cfd4da; border-radius: 8px; font-size: 14px; font-family: inherit; }
#pchat-prechat input:focus { border-color: var(--pc); outline: none; }
#pchat-prechat button { width: 100%; background: var(--pc); color: #fff; border: none; border-radius: 8px; padding: 11px; font-size: 14px; font-weight: 600; cursor: pointer; }
#pchat-prechat button:disabled { opacity: .6; }
#pchat-prechat .err { color: #e53935; font-size: 12px; margin-bottom: 6px; display: none; }
#pchat-prechat .pc-note { font-size: 10px; color: #9aa0a6; margin-top: 8px; }
.pchat-msg { flex-wrap: wrap; }
.pchat-msg .who { width: 100%; font-size: 11px; font-weight: 600; color: #7a8290; margin: 0 0 3px 2px; letter-spacing: .01em; }
.pchat-msg.v .who { text-align: right; }

/* Bottom-left placement, for sites that already have a bubble bottom-right */
#pchat-root.pos-left { right: auto; left: 20px; }
#pchat-root.pos-left #pchat-panel { right: auto; left: 0; }
@media (max-width:480px){ #pchat-root.pos-left { left: 12px; } }

/* Attach button + file attachments */
#pchat-attach { background: none; border: none; color: #8a97a6; width: 34px; height: 40px; padding: 0; cursor: pointer; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
#pchat-attach:hover { color: var(--pc); }
#pchat-attach:disabled { opacity: .5; cursor: default; }
#pchat-attach svg { width: 20px; height: 20px; }
.pchat-att-img { display: inline-block; margin-top: 4px; }
.pchat-att-img img { max-width: 190px; max-height: 190px; border-radius: 10px; display: block; }
.pchat-att-file { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.16); text-decoration: none !important; max-width: 240px; }
.pchat-msg.b0 .pchat-att-file, .pchat-msg.a .pchat-att-file { background: #eef1f4; }
.pchat-att-file .ic { font-size: 18px; flex: 0 0 auto; }
.pchat-att-file .meta { display: flex; flex-direction: column; min-width: 0; }
.pchat-att-file .nm { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pchat-att-file .sz { font-size: 11px; opacity: .75; }

/* Product comparison table - drawn when Claudia puts forward 2+ safes.
   It sits beside the bubble, not inside it, so it can use the full column
   width (the bubble is capped at 82%). */
.pchat-gridwrap { margin: 6px 0 2px; border: 1px solid #e3e6ea; border-radius: 12px; overflow: hidden; background: #fff; }
.pchat-grid { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 11.5px; line-height: 1.35; }
.pchat-grid th { background: #f0f2f5; color: #77808c; font-weight: 600; text-align: left; padding: 6px 8px; font-size: 9.5px; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.pchat-grid td { padding: 7px 8px; border-top: 1px solid #edeff2; color: #1a1a1a; vertical-align: top; word-wrap: break-word; overflow-wrap: anywhere; }
.pchat-grid .nm { width: 46%; }
.pchat-grid td.nm a { color: var(--pc); text-decoration: none; font-weight: 600; }
.pchat-grid td.nm a:hover { text-decoration: underline; }
.pchat-grid .pr { width: 21%; }
.pchat-grid td.pr { font-weight: 600; white-space: nowrap; }
.pchat-grid .dm { width: 33%; }
.pchat-grid td.dm { color: #6b7482; }
.pchat-grid .oos { display: block; margin-top: 2px; font-size: 9.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: #b4232a; }

/* Same widths, tuned for a phone. These have to come AFTER the base rules
   above - equal specificity means source order decides, and a media query does
   not add any. Prices are short and a size is not: splitting "685 x 510 x
   380mm" over two lines reads worse than a name wrapping, so the size column
   takes the room back from the price. */
@media (max-width: 420px) {
  .pchat-grid { font-size: 11px; }
  .pchat-grid th { padding: 6px 6px; }
  .pchat-grid td { padding: 7px 6px; }
  .pchat-grid .nm { width: 41%; }
  .pchat-grid .pr { width: 19%; }
  .pchat-grid .dm { width: 40%; }
}
