.chat-widget {
  position: fixed;
  z-index: 30;
  right: 22px;
  bottom: 22px;
  font-family: var(--body);
}

.chat-launcher {
  min-height: 54px;
  padding: 0 17px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--brick);
  color: var(--white);
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  transition: transform .18s ease, background-color .18s ease;
}

.chat-launcher:hover {
  transform: translateY(-2px);
  background: var(--brick-dark);
}

.chat-launcher:focus-visible,
.chat-close:focus-visible,
.chat-send:focus-visible,
.chat-suggestions button:focus-visible,
.chat-input:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

.chat-launcher-mark {
  color: #ffe1a3;
  font-size: 20px;
  line-height: 1;
}

.chat-launcher-status {
  margin-left: 2px;
  padding: 4px 6px;
  border: 1px solid #ffffff70;
  color: #fff2d2;
  font-size: 8px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.chat-panel {
  position: absolute;
  right: 0;
  bottom: 69px;
  width: min(390px, calc(100vw - 32px));
  max-height: min(650px, calc(100dvh - 110px));
  display: grid;
  grid-template-rows: auto auto minmax(110px, 1fr) auto auto auto;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: var(--paper);
  box-shadow: 8px 8px 0 #24201b30;
}

.chat-panel[hidden] { display: none !important; }

.chat-header {
  min-height: 78px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--ink);
  color: var(--paper);
}

.chat-header-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.chat-avatar {
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  background: var(--orange);
  color: var(--ink);
  font-family: var(--display);
  font-size: 20px;
  transform: rotate(-5deg);
}

.chat-header-copy { min-width: 0; }
.chat-header-copy p {
  margin: 0 0 3px;
  color: #f3ca7d;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .15em;
}
.chat-header-copy h2 {
  margin: 0;
  color: var(--white);
  font-family: var(--display);
  font-size: 21px;
  line-height: 1;
  letter-spacing: -.02em;
  text-transform: uppercase;
}
.chat-status {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #cfc6b8;
  font-size: 9px;
}
.chat-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9abb72;
}

.chat-close {
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #ffffff45;
  background: transparent;
  color: var(--white);
  cursor: pointer;
  font-size: 23px;
  line-height: 1;
}
.chat-close:hover { background: #ffffff18; }

.chat-disclaimer {
  margin: 0;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #f1e6d3;
  color: #665d51;
  font-size: 10px;
  line-height: 1.55;
}

.chat-messages {
  min-height: 110px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border: 1px solid #ded2bf;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.chat-bubble-assistant {
  align-self: flex-start;
  background: var(--white);
}
.chat-bubble-user {
  align-self: flex-end;
  border-color: var(--brick);
  background: var(--brick);
  color: var(--white);
}
.chat-thinking {
  align-self: flex-start;
  color: var(--muted);
  font-size: 10px;
  font-style: italic;
}
.chat-thinking[hidden],
.chat-suggestions[hidden] { display: none !important; }

.chat-suggestions {
  padding: 0 12px 10px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
}
.chat-suggestions button {
  min-height: 31px;
  flex: 0 0 auto;
  padding: 0 9px;
  border: 1px solid #cfc1ad;
  border-radius: 99px;
  background: transparent;
  color: #5e574e;
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}
.chat-suggestions button:hover {
  border-color: var(--brick);
  color: var(--brick);
}

.chat-form {
  margin: 0 12px;
  padding: 8px;
  display: flex;
  align-items: flex-end;
  gap: 7px;
  border: 1px solid #cfc1ad;
  background: var(--white);
}
.chat-input {
  width: 100%;
  min-height: 37px;
  max-height: 100px;
  padding: 8px 7px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  line-height: 1.45;
}
.chat-input::placeholder { color: #8a8276; }
.chat-send {
  width: 37px;
  height: 37px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  background: var(--brick);
  color: var(--white);
  cursor: pointer;
  font-size: 17px;
  font-weight: 900;
}
.chat-send:hover { background: var(--brick-dark); }
.chat-send:disabled { opacity: .55; cursor: wait; }

.chat-footnote {
  margin: 0;
  padding: 8px 13px 10px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}
.chat-footnote a {
  color: var(--brick-dark);
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .chat-widget { right: 12px; bottom: 12px; }
  .chat-launcher { min-height: 50px; padding-inline: 14px; }
  .chat-panel {
    width: min(390px, calc(100vw - 24px));
    max-height: calc(100dvh - 92px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-launcher { transition: none; }
}
