.athena-chat-launcher {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #b78a35;
  border-radius: 999px;
  background: #071f49;
  color: #fff;
  padding: 12px 17px;
  box-shadow: 0 12px 30px rgba(7, 31, 73, .24);
  font: 600 14px/1.2 Georgia, "Times New Roman", serif;
  cursor: pointer;
  opacity: 1;
  transform: scale(1);
  transform-origin: bottom right;
  transition: opacity .16s ease, transform .16s ease;
}
.athena-chat-launcher[hidden] { display: none; }
.athena-chat-launcher:hover { background: #0d2d63; }
.athena-chat-launcher:focus-visible,
.athena-chat button:focus-visible,
.athena-chat textarea:focus-visible { outline: 3px solid #d7ae5b; outline-offset: 3px; }
.athena-chat-launcher svg { width: 21px; height: 21px; }

.athena-chat {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 1001;
  width: min(400px, calc(100vw - 36px));
  height: min(600px, calc(100dvh - 36px));
  max-width: calc(100vw - 36px);
  max-height: calc(100dvh - 36px);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: #fbfaf7;
  border: 1px solid rgba(183, 138, 53, .55);
  border-radius: 18px;
  box-shadow: 0 22px 60px rgba(7, 31, 73, .25);
  overflow: hidden;
  color: #13213a;
  font-family: Georgia, "Times New Roman", serif;
  opacity: 1;
  transform: scale(1) translateY(0);
  transform-origin: bottom right;
  transition: opacity .16s ease, transform .16s ease;
}
.athena-chat[hidden] { display: none; }
.athena-chat__header {
  position: relative;
  flex: 0 0 auto;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 10px 10px 13px;
  background: #071f49;
  color: #fff;
  border-bottom: 2px solid #b78a35;
}
.athena-chat__mark { display: grid; flex:0 0 auto; place-items: center; width: 34px; height: 34px; border: 1px solid #d7ae5b; border-radius: 50%; color: #d7ae5b; font-size: 15px; }
.athena-chat__identity { min-width: 0; flex: 1; }
.athena-chat__identity strong,
.athena-chat__identity span { display: block; }
.athena-chat__identity strong { font-size: 17px; }
.athena-chat__identity span { font-size: 12px; opacity: .86; }
.athena-chat__header button { flex:0 0 auto; border: 0; background: transparent; color: #fff; width: 30px; height: 30px; padding:0; border-radius: 8px; font-size: 19px; cursor: pointer; }
.athena-chat__header button:hover { background: rgba(255, 255, 255, .12); }
.athena-chat__messages { position:relative; z-index:1; flex: 1 1 auto; min-height: 0; overflow-x:hidden; overflow-y: auto; overscroll-behavior: contain; padding: 16px 14px 12px; scrollbar-gutter: stable; }
.athena-chat__message { position:static; display: flex; flex-direction: column; width:fit-content; max-width: 84%; margin: 0 0 14px; transform:none; }
.athena-chat__message--athena { align-items: flex-start; }
.athena-chat__message--customer { align-items: flex-end; margin-left: auto; }
.athena-chat__sender { margin: 0 7px 4px; color: #6c7280; font-size: 11px; }
.athena-chat__bubble { max-width:100%; white-space: pre-wrap; overflow-wrap: anywhere; word-break:break-word; padding: 10px 13px; border-radius: 15px; background: #fff; border: 1px solid rgba(7, 31, 73, .12); line-height: 1.45; font-size: 14px; }
.athena-chat__message--customer .athena-chat__bubble { background: #071f49; color: #fff; border-color: #071f49; border-bottom-right-radius: 4px; }
.athena-chat__message--athena .athena-chat__bubble { border-bottom-left-radius: 4px; }
.athena-chat__time { margin: 4px 7px 0; color: #808591; font-size: 10px; }
.athena-chat__footer { position:relative; z-index:2; flex: 0 0 auto; min-height:0; background: #fff; }
.athena-chat__typing,
.athena-chat__error { margin: 8px 14px 0; color: #6c7280; font-size: 12px; }
.athena-chat__error { padding: 9px 11px; border-radius: 9px; background: #fff3f0; color: #872c20; }
.athena-chat__error button { border: 0; background: none; color: #071f49; text-decoration: underline; cursor: pointer; }
.athena-chat__composer { display: flex; align-items: center; gap: 8px; margin:0; padding: 11px; background: #fff; border-top: 1px solid rgba(7, 31, 73, .12); }
.athena-chat__composer textarea { box-sizing:border-box; min-width:0; min-height: 42px; max-height: 112px; flex: 1 1 auto; resize: none; border: 1px solid rgba(7, 31, 73, .25); border-radius: 12px; padding: 10px 11px; color: #13213a; background: #fff; font: 14px/1.4 Georgia, "Times New Roman", serif; }
.athena-chat__send,
.athena-chat__end { border: 0; border-radius: 10px; background: #b78a35; color: #071f49; padding: 11px 13px; font-weight: 700; cursor: pointer; }
.athena-chat__send:disabled { opacity: .45; cursor: not-allowed; }
.athena-chat__header .athena-chat__end { position:static; width:auto; height:30px; border: 1px solid rgba(215,174,91,.7); color:#fff; padding: 4px 7px; font-size: 10px; line-height:1; box-shadow:none; }

@media (max-width: 600px) {
  .athena-chat-launcher span { display: none; }
  .athena-chat-launcher { padding: 14px; }
  .athena-chat { inset: 0; width: 100%; height: 100dvh; max-width: none; max-height:none; border: 0; border-radius: 0; }
  .athena-chat__header { padding-top: max(11px, env(safe-area-inset-top)); }
  .athena-chat__composer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .athena-chat,
  .athena-chat-launcher { transition: none; }
  .athena-chat * { scroll-behavior: auto !important; }
}
