.chat {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 32;
  font-family: var(--body);
}
html.on-home .hero-tools .chat {
  position: relative;
  right: auto;
  top: auto;
  bottom: auto;
}
.chat-launch {
  appearance: none;
  border: 1px solid rgba(247, 244, 238, 0.72);
  background: rgba(0, 0, 0, 0.25);
  color: #f7f4ee;
  padding: 10px 14px;
  font-family: var(--ui);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 10px;
  cursor: pointer;
  backdrop-filter: blur(12px);
}
.chat-launch[aria-expanded="true"] {
  background: rgba(0, 0, 0, 0.25);
  color: #f7f4ee;
  border-color: rgba(247, 244, 238, 0.92);
}
@media (min-width: 981px) {
  html.on-home .hero-tools .chat-panel {
    top: calc(100% + 8px);
    right: 0;
    bottom: auto;
  }
}
.chat-panel {
  position: absolute;
  right: 0;
  bottom: 54px;
  width: min(380px, calc(100vw - 32px));
  height: min(520px, calc(100vh - 140px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #090909;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.chat-panel[hidden] { display: none !important; }
.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
}
.chat-head strong {
  display: block;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
}
.chat-head button {
  appearance: none;
  border: 0;
  background: none;
  color: var(--mute);
  font-family: var(--ui);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 10px;
  cursor: pointer;
}
.chat-log {
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-msg {
  max-width: 92%;
  padding: 10px 12px;
  line-height: 1.45;
  font-size: 14px;
}
.chat-msg > div:first-child {
  white-space: pre-line;
}
.chat-msg.desk {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}
.chat-msg.user {
  align-self: flex-end;
  background: rgba(198, 163, 106, 0.14);
  border: 1px solid rgba(198, 163, 106, 0.35);
}
.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.chat-actions button,
.chat-actions a {
  appearance: none;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent-2);
  padding: 7px 9px;
  font-family: var(--ui);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}
.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}
.chat-form input {
  background: #0c0c0e;
  border: 1px solid var(--line);
  color: var(--paper);
  padding: 12px;
  outline: none;
}
.chat-form input:focus { border-color: var(--accent); }
.chat-form .btn { padding: 12px 14px; }
.chat-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
@media (max-width: 980px) {
  .chat { right: 12px; bottom: 16px; }
  html.on-home .hero-tools .chat {
    position: relative;
    right: auto;
    top: auto;
    bottom: auto;
  }
  .chat-panel,
  html.on-home .chat-panel {
    position: fixed;
    inset: 0;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: none;
    z-index: 40;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .chat-launch {
    padding: 8px 10px;
    font-size: 9px;
  }
  .chat-launch[aria-expanded="true"] { display: none; }
  .chat-form input { font-size: 16px; }
}
