.public-chat {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

.public-chat__launcher {
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.1rem;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgb(5 150 105 / 28%);
}

.public-chat__launcher:hover {
  background: var(--color-primary-hover);
}

.public-chat__panel {
  display: none;
  width: min(22rem, calc(100vw - 2rem));
  max-height: min(32rem, calc(100vh - 6rem));
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgb(15 23 42 / 14%);
  overflow: hidden;
}

.public-chat__panel--open {
  display: flex;
}

.public-chat__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, #ecfdf5 0%, var(--color-surface) 100%);
}

.public-chat__eyebrow {
  margin: 0 0 0.15rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
}

.public-chat__title {
  margin: 0;
  font-size: 1rem;
  color: var(--color-navy);
}

.public-chat__close {
  border: 0;
  background: transparent;
  color: var(--color-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  min-width: 2.25rem;
  min-height: 2.25rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  border-radius: 8px;
}

.public-chat__close:hover {
  background: rgb(15 23 42 / 6%);
  color: var(--color-text);
}

.public-chat__messages {
  flex: 1 1 auto;
  min-height: 10rem;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.public-chat__message {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.public-chat__message--assistant {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.public-chat__message--user {
  align-self: flex-end;
  max-width: 88%;
  background: var(--color-primary);
  color: #fff;
}

.public-chat__message-text a {
  color: inherit;
  text-decoration: underline;
}

.public-chat__message--assistant .public-chat__message-text a {
  color: var(--color-primary);
}

.public-chat__sources {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.public-chat__sources a {
  font-size: 0.6875rem;
  color: var(--color-muted);
  text-decoration: none;
  word-break: break-all;
}

.public-chat__typing {
  margin: 0;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.public-chat__starters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1rem 0.75rem;
}

.public-chat__starter {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.6875rem;
  cursor: pointer;
}

.public-chat__form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--color-border);
}

.public-chat__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-size: 0.8125rem;
}

.public-chat__form .btn {
  flex: 0 0 auto;
  font-size: 0.8125rem;
  padding: 0.55rem 0.85rem;
}

@media (max-width: 768px) {
  .public-chat {
    right: 0.75rem;
    bottom: 0.75rem;
  }
}
