#chat-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-safety-note {
  background: #eef4f1;
  color: var(--color-accent);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
}

#chat-messages {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#chat-main #chat-messages {
  min-height: 40vh;
}

.chat-bubble {
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  max-width: 85%;
  white-space: pre-wrap;
  line-height: 1.5;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--color-accent);
  color: white;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--color-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chat-bubble.status {
  align-self: flex-start;
  color: var(--color-muted);
  font-style: italic;
  background: none;
  box-shadow: none;
  padding: 0.25rem 1rem;
}

.chat-bubble.error {
  align-self: stretch;
  background: #f8d7da;
  color: #58151c;
}

.chat-schools {
  display: grid;
  gap: 0.5rem;
  align-self: stretch;
}

#chat-form {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  display: grid;
  gap: 0.5rem;
}

#chat-input {
  font: inherit;
  padding: 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  resize: vertical;
}

.chat-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.chat-actions button {
  font-size: 0.95rem;
  padding: 0.55rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  cursor: pointer;
}

#chat-send {
  background: var(--color-accent);
  color: white;
  border: none;
  font-weight: 600;
}

#chat-send:disabled,
#chat-reset:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#chat-reset {
  background: none;
}

/* Floating widget: same #chat-messages/#chat-form markup as the full
   /find-my-path page, just dropped into a fixed-position panel + a launcher
   button instead of the page's centered #chat-main column. */
#chat-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-accent);
  color: white;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-widget-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 5.75rem;
  width: min(360px, calc(100vw - 2.5rem));
  height: min(520px, calc(100vh - 8rem));
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999;
}

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

.chat-widget-header {
  background: var(--color-accent);
  color: white;
  padding: 0.7rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  flex-shrink: 0;
}

.chat-widget-header button {
  background: none;
  border: none;
  color: white;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.chat-widget-panel .chat-safety-note {
  margin: 0.6rem 0.75rem 0;
  padding: 0.5rem 0.7rem;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.chat-widget-panel #chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
}

.chat-widget-panel #chat-form {
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}
