.project-chat {
  position: fixed;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  right: max(24px, env(safe-area-inset-right, 0px));
  z-index: 26;
  font: 400 14px/1.45 system-ui;
  color: #142f43;
}
.project-chat button { cursor: pointer; font: inherit; }
.project-chat a { color: #142f43; text-underline-offset: 3px; }
.project-chat button:focus-visible, .project-chat a:focus-visible, .project-chat input:focus-visible, .project-chat-log:focus-visible {
  outline: 2px solid #216777;
  outline-offset: 2px;
}
.project-chat .project-chat-open {
  padding: 0;
  overflow: hidden;
  background: #f5f5f5;
}

.project-chat-open img {
  display: block;
  width: 40px;
  height: auto;
}
.project-chat-panel[hidden] { display: none; }
.project-chat-panel {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  width: min(360px, calc(100vw - 40px));
  max-height: max(140px, calc(100dvh - 156px - env(safe-area-inset-bottom, 0px)));
  display: flex;
  flex-direction: column;
  overflow: auto;
  overscroll-behavior: contain;
  background: #fbfdfd;
  border: 1px solid #b5d9dd;
  border-radius: 18px;
  box-shadow: 0 14px 44px #142f4335;
}
.project-chat-panel header, .project-chat-panel footer, .project-chat-panel form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
}
.project-chat-panel header { background: #142f43; color: white; }
.project-chat-panel h2 { margin: 0; font: 700 16px/1.35 system-ui; }
.project-chat .project-chat-close { color: white; background: transparent; border: 0; min-width: 36px; min-height: 36px; font-size: 24px; line-height: 1; }
.project-chat-log { min-height: 60px; height: 208px; overflow-y: auto; padding: 12px 14px; }
.project-chat-log p {
  width: fit-content;
  max-width: 96%;
  margin: 0 0 8px;
  padding: 8px 11px;
  background: #eaf2f3;
  border-radius: 10px;
  overflow-wrap: anywhere;
}
.project-chat-log .project-chat-question { margin-left: auto; background: #142f43; color: white; }
.project-chat-log a { display: block; margin-top: 5px; text-decoration: underline; font-weight: 700; }
.project-chat-topics { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 14px 5px; }
.project-chat-topics button { border-radius: 100px; border: 1px solid #b5d9dd; background: #edf6f7; color: inherit; padding: 5px 9px; }
.project-chat-panel form { margin: 0; }
.project-chat-panel input { flex: 1; min-width: 0; border-radius: 8px; border: 1px solid #a1b9be; padding: 8px; color: inherit; background: white; font: inherit; font-size: 16px; }
.project-chat-panel form button { border-radius: 8px; border: 0; padding: 9px 12px; background: #142f43; color: white; }
.project-chat-panel footer { border-top: 1px solid #b5d9dd; }
.project-chat-panel footer a { text-decoration: underline; font-weight: 600; }

@media (max-width: 600px) {
  .project-chat { right: max(12px, env(safe-area-inset-right, 0px)); bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

.project-chat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.project-chat-actions {
  display: flex;
  gap: 12px;
}

.project-chat .project-chat-open,
.project-chat .project-chat-register,
.project-chat .project-chat-tour {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 50px;
  height: 50px;
  border: 3px solid #c7e8e9;
  border-radius: 50%;

  color: white;
  box-shadow: 0 0 0 1px #439396, 0 4px 14px #142f4330;
}

.project-chat .project-chat-register {
  background: #484848;
}

.project-chat .project-chat-tour {
  background: #147984;
}

.project-chat .project-chat-register:hover,
.project-chat .project-chat-tour:hover {
  background: #206777;
}

.project-chat-panel {
  max-height: max(140px, calc(100dvh - 156px - env(safe-area-inset-bottom, 0px)));
}
