#altagwa-chat-root {
  --atg-navy: #123c3a;
  --atg-teal: #1d625d;
  --atg-gold: #ba8b45;
  --atg-cream: #f7f3ea;
  --atg-ink: #172321;
  --atg-muted: #64706d;
  position: fixed;
  z-index: 999998;
  inset-inline-end: 22px;
  bottom: 22px;
  font-family: inherit;
  color: var(--atg-ink);
}
#altagwa-chat-root,
#altagwa-chat-root * { box-sizing: border-box; }
#altagwa-chat-root [hidden] { display: none !important; }

.altagwa-chat-launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 9px 17px 9px 10px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--atg-navy), var(--atg-teal));
  box-shadow: 0 12px 32px rgba(18, 60, 58, .28);
  cursor: pointer;
  font-weight: 700;
}

[dir="rtl"] .altagwa-chat-launcher { padding: 9px 10px 9px 17px; }
.altagwa-chat-launcher:hover { transform: translateY(-1px); }
#altagwa-chat-root.is-open .altagwa-chat-launcher { display: none; }
.altagwa-chat-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--atg-navy);
  background: var(--atg-gold);
  font-size: 20px;
}
.altagwa-chat-dot { width: 9px; height: 9px; border-radius: 50%; background: #55d88a; box-shadow: 0 0 0 3px rgba(85,216,138,.2); }

.altagwa-chat-panel {
  position: absolute;
  inset-inline-end: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 92px));
  max-height: calc(100vh - 92px);
  overflow: hidden;
  border: 1px solid rgba(18,60,58,.14);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(13, 39, 38, .24);
  isolation: isolate;
}
.altagwa-chat-header {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
  min-height: 58px;
  padding: 8px 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--atg-navy), var(--atg-teal));
}
.altagwa-chat-header > div:nth-child(2) { display: flex; flex-direction: column; flex: 1; }
.altagwa-chat-header span { font-size: 12px; opacity: .8; }
.altagwa-chat-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: var(--atg-navy); background: var(--atg-gold); font-weight: 900; }
.altagwa-chat-close { border: 0; color: #fff; background: transparent; font-size: 28px; line-height: 1; cursor: pointer; }
.altagwa-chat-preview { flex: 0 0 auto; padding: 6px 10px; color: #6b4a17; background: #fff3cf; text-align: center; font-size: 11px; font-weight: 700; }
.altagwa-chat-consent { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 22px 20px; }
.altagwa-chat-consent p { margin-top: 0; line-height: 1.65; }
.altagwa-chat-consent label { display: flex; gap: 9px; align-items: flex-start; margin: 18px 0 8px; line-height: 1.45; }
.altagwa-chat-consent input { margin-top: 4px; }
.altagwa-chat-consent a { color: var(--atg-teal); font-size: 13px; }
.altagwa-start-chat { display: block; width: 100%; margin-top: 20px; padding: 12px 16px; border: 0; border-radius: 12px; color: #fff; background: var(--atg-teal); font-weight: 800; cursor: pointer; }
.altagwa-start-chat:disabled { opacity: .45; cursor: not-allowed; }
.altagwa-honeypot { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }
.altagwa-chat-live { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: #fbfcfb; }
.altagwa-chat-preview + .altagwa-chat-live { min-height: 0; }
.altagwa-chat-messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 14px 12px 8px; }
.altagwa-message { display: flex; margin: 0 0 10px; }
.altagwa-message > div { max-width: 82%; padding: 9px 12px; border-radius: 15px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.48; font-size: 13.5px; text-align: start; unicode-bidi: plaintext; }
.altagwa-message > div > p { margin: 7px 0 0; }
.altagwa-message > div > p:first-child { margin-top: 0; }
.altagwa-message > div[dir="ltr"] { direction: ltr; text-align: left; }
.altagwa-message > div[dir="rtl"] { direction: rtl; text-align: right; }
.altagwa-message img, .altagwa-message video { display: block; width: min(260px, 100%); max-height: 260px; border-radius: 11px; object-fit: contain; background: #0e1716; }
.altagwa-message audio { display: block; width: min(260px, 100%); }
.altagwa-message details { margin-top: 8px; font-size: 12px; }
.altagwa-message details summary { cursor: pointer; font-weight: 700; }
.altagwa-message.is-customer { justify-content: flex-end; }
.altagwa-message.is-customer > div { color: #fff; background: var(--atg-teal); border-end-end-radius: 4px; }
.altagwa-message.is-bot > div { background: var(--atg-cream); border-end-start-radius: 4px; }
.altagwa-message.is-admin > div { color: #fff; background: var(--atg-navy); border-end-start-radius: 4px; }
.altagwa-quick-actions { flex: 0 0 auto; display: flex; gap: 7px; overflow-x: auto; scrollbar-width: thin; padding: 0 12px 8px; }
.altagwa-quick-actions button { flex: 0 0 auto; padding: 8px 11px; border: 1px solid rgba(29,98,93,.25); border-radius: 999px; color: var(--atg-teal); background: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
.altagwa-quick-actions button.is-primary { color: #fff; background: var(--atg-teal); }
.altagwa-chat-safe { flex: 0 0 auto; padding: 5px 12px; color: var(--atg-muted); background: #fff; font-size: 10.5px; }
.altagwa-media-tools { flex: 0 0 auto; display: flex; gap: 6px; padding: 6px 10px 0; border-top: 1px solid #eef2f1; background: #fff; }
.altagwa-media-tools button { display: grid; place-items: center; width: 35px; height: 33px; padding: 0; border: 1px solid #d9e1df; border-radius: 10px; color: var(--atg-teal); background: #f7faf9; font-size: 16px; cursor: pointer; }
.altagwa-media-tools button:hover { border-color: var(--atg-teal); background: #eef6f4; }
.altagwa-media-tools button.is-recording { color: #fff; border-color: #b52f2f; background: #c23a3a; animation: altagwa-recording-pulse 1s infinite alternate; }
.altagwa-media-tools button:disabled { opacity: .45; cursor: not-allowed; }
@keyframes altagwa-recording-pulse { from { box-shadow: 0 0 0 0 rgba(194,58,58,.2); } to { box-shadow: 0 0 0 7px rgba(194,58,58,0); } }
.altagwa-chat-form { position: relative; z-index: 2; flex: 0 0 auto; display: flex; align-items: flex-end; gap: 7px; width: 100%; padding: 8px 10px max(9px, env(safe-area-inset-bottom)); border-top: 1px solid #e7ecea; background: #fff; }
.altagwa-chat-form textarea { flex: 1 1 auto; min-width: 0; min-height: 39px; max-height: 86px; overflow-y: auto; resize: none; padding: 8px 10px; border: 1px solid #d9e1df; border-radius: 11px; font: inherit; font-size: 13px; }
.altagwa-chat-form button { flex: 0 0 auto; min-width: 60px; min-height: 39px; padding: 8px 12px; border: 0; border-radius: 11px; color: #fff; background: var(--atg-teal); font-weight: 800; cursor: pointer; }
.altagwa-chat-status { flex: 0 0 auto; min-height: 0; padding: 0 12px; color: var(--atg-muted); font-size: 10.5px; }
.altagwa-chat-status.is-error { min-height: 22px; padding-bottom: 7px; color: #a52626; }

@media (max-width: 600px) {
  #altagwa-chat-root { inset-inline-end: 10px; bottom: 10px; }
  .altagwa-chat-launcher-text { display: none; }
  .altagwa-chat-launcher { min-width: 56px; padding: 10px; justify-content: center; }
  .altagwa-chat-dot { position: absolute; top: 1px; inset-inline-end: 2px; }
  .altagwa-chat-panel { position: fixed; inset: 8px; width: auto; height: auto; max-height: none; border-radius: 18px; }
  .admin-bar .altagwa-chat-panel { top: 54px; }
}

@supports (height: 100dvh) {
  .altagwa-chat-panel { height: min(560px, calc(100dvh - 92px)); max-height: calc(100dvh - 92px); }
  @media (max-width: 600px) {
    .altagwa-chat-panel { height: auto; max-height: none; }
  }
}

@media (max-height: 650px) and (min-width: 601px) {
  #altagwa-chat-root { bottom: 10px; }
  .altagwa-chat-panel { height: calc(100vh - 66px); max-height: calc(100vh - 66px); }
  .admin-bar .altagwa-chat-panel { height: calc(100vh - 82px); max-height: calc(100vh - 82px); }
  .altagwa-chat-header { min-height: 52px; padding-block: 6px; }
  .altagwa-chat-safe { display: none; }
}
