.pgmi-chat {
  --chat-blue: #153e7d;
  --chat-navy: #102651;
  --chat-gold: #eac25f;
  --chat-line: #d6e0eb;
  --chat-right: max(14px, env(safe-area-inset-right));
  --chat-bottom: max(14px, env(safe-area-inset-bottom));
  color: var(--chat-navy);
  font: 0.9375rem/1.5 system-ui, sans-serif;
}

.pgmi-chat [hidden] { display: none; }
.pgmi-chat button { cursor: pointer; font: inherit; }
.pgmi-chat :focus-visible { outline: 3px solid #a66e10; outline-offset: 2px; }

.pgmi-chat .pgmi-chat-launch {
  position: fixed;
  right: var(--chat-right);
  bottom: var(--chat-bottom);
  z-index: 18;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border: 1px solid var(--chat-gold);
  border-radius: 999px;
  background: var(--chat-blue);
  color: white;
  font-weight: 700;
  box-shadow: 0 4px 14px #1026513d;
}

.pgmi-chat-icon {
  position: relative;
  width: 17px;
  height: 13px;
  border: 2px solid var(--chat-gold);
  border-radius: 4px;
}
.pgmi-chat-icon::after {
  content: "";
  position: absolute;
  left: 2px;
  bottom: -4px;
  width: 4px;
  height: 4px;
  transform: rotate(-45deg);
  border-left: 2px solid var(--chat-gold);
  border-bottom: 2px solid var(--chat-gold);
  background: var(--chat-blue);
}

.pgmi-chat .pgmi-chat-panel {
  position: fixed;
  right: var(--chat-right);
  bottom: calc(var(--chat-bottom) + 58px);
  z-index: 19;
  width: min(360px, calc(100% - 2 * var(--chat-right)));
  height: min(510px, calc(100vh - var(--chat-bottom) - 148px));
  height: min(510px, calc(100dvh - var(--chat-bottom) - 148px));
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--chat-line);
  border-radius: 16px;
  background: white;
  box-shadow: 0 13px 38px #1026513d;
}
.pgmi-chat .pgmi-chat-panel[hidden] { display: none; }

.pgmi-chat-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 11px 8px 14px;
  background: var(--chat-blue);
  color: white;
  border-bottom: 3px solid var(--chat-gold);
}
.pgmi-chat-heading img { object-fit: cover; border-radius: 50%; background: white; }
.pgmi-chat-heading h2 { margin: 0; font-size: 1.16rem; color: white; }
.pgmi-chat .pgmi-chat-close {
  margin-left: auto;
  min-height: 44px;
  min-width: 44px;
  border: 1px solid #ffffff80;
  border-radius: 9px;
  background: transparent;
  color: white;
  font-size: 1.5rem;
}
.pgmi-chat-close:focus-visible { outline-color: var(--chat-gold); }

.pgmi-chat-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 13px 14px;
}
.pgmi-chat-body:focus-visible { outline-offset: -3px; }
.pgmi-chat-options { display: grid; gap: 7px; }
.pgmi-chat-options p { margin: 0 0 5px; }
.pgmi-chat-options button, .pgmi-chat-back {
  min-height: 44px;
  padding: 8px 10px;
  text-align: left;
  color: var(--chat-navy);
  border: 1px solid #bacbdd;
  border-radius: 8px;
  background: #f0f5fc;
}
.pgmi-chat-options button:hover, .pgmi-chat-back:hover { border-color: var(--chat-blue); }
.pgmi-chat-answer { border-left: 3px solid var(--chat-gold); padding-left: 10px; overflow-wrap: anywhere; }
.pgmi-chat-answer h3 { margin: 0 0 12px; font-size: 1.03rem; }
.pgmi-chat-answer p, .pgmi-chat-answer blockquote { margin: 0 0 10px; }
.pgmi-chat-answer a { display: block; text-decoration: underline; color: var(--chat-blue); margin-bottom: 8px; }
.pgmi-chat-back { margin-top: 12px; }
.pgmi-chat-privacy {
  flex-shrink: 0;
  margin: 0;
  padding: 9px 14px;
  border-top: 1px solid var(--chat-line);
  background: #f3f6fa;
  color: #43556a;
  font-size: 0.8rem;
}

@media (max-height: 430px) {
  .pgmi-chat .pgmi-chat-panel { height: calc(100dvh - var(--chat-bottom) - 100px); }
}
