:root {
  --ha-chat-bg: #0f172a;
  --ha-chat-card: #111827;
  --ha-chat-text: #f8fafc;
  --ha-chat-muted: #94a3b8;
  --ha-chat-accent: #d4af37;
  --ha-chat-user: #2563eb;
  --ha-chat-bot: #1f2937;
}

#ha-chat-button {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99999;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #d4af37, #f8d978);
  color: #111827;
  font-weight: 700;
  box-shadow: 0 18px 45px rgba(0,0,0,.35);
  cursor: pointer;
}

#ha-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 84px;
  width: min(380px, calc(100vw - 28px));
  height: min(620px, calc(100vh - 114px));
  z-index: 99999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  background: var(--ha-chat-bg);
  color: var(--ha-chat-text);
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.1);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#ha-chat-panel.open { display: flex; }

.ha-chat-header {
  padding: 16px;
  background: rgba(255,255,255,.04);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.ha-chat-title { font-weight: 800; font-size: 16px; }
.ha-chat-subtitle { color: var(--ha-chat-muted); font-size: 13px; margin-top: 3px; }

#ha-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ha-message {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 16px;
  line-height: 1.42;
  font-size: 14px;
  white-space: pre-wrap;
}

.ha-message.user {
  align-self: flex-end;
  background: var(--ha-chat-user);
  color: white;
  border-bottom-right-radius: 5px;
}

.ha-message.bot {
  align-self: flex-start;
  background: var(--ha-chat-bot);
  border-bottom-left-radius: 5px;
}

.ha-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
}

#ha-chat-input {
  flex: 1;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  padding: 11px 13px;
  background: #020617;
  color: white;
  outline: none;
}

#ha-chat-send {
  border: 0;
  border-radius: 999px;
  padding: 0 15px;
  background: var(--ha-chat-accent);
  color: #111827;
  font-weight: 800;
  cursor: pointer;
}

.ha-source-note {
  color: var(--ha-chat-muted);
  font-size: 11px;
  margin-top: 6px;
}
