body {
  font-family: sans-serif;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #faf8f3;
}
header {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: padding 0.3s;
}
header img {
  height: 52px;
  transition: height 0.3s;
}
#top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.2rem;
}
.status-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.5rem;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px #bbb;
}
.status-dot.online { background: #30b67d; }
.status-dot.offline { background: #db3933; }
.header-link {
  font-size: 1.08rem;
  color: #86660a;
  text-decoration: none;
  margin-left: 0.7rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.header-link:hover { opacity: 1; color: #6b4e16; }

#chatWindow {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.bubble {
  position: relative;
  max-width: 75%;
  padding: 0.75rem 1rem;
  line-height: 1.4;
  word-wrap: break-word;
}
.assistant-bubble {
  align-self: flex-start;
  background: #C7B563;
  color: #333;
  border-radius: 0 18px 18px 18px;
  margin-left: 3rem;
}
.assistant-bubble::before {
  content: "";
  position: absolute;
  top: 0;
  left: -48px;
  width: 40px;
  height: 40px;
  background-image: url('https://brewer-sam.co.za/brewer-sam-192.png');
  background-size: cover;
  border-radius: 50%;
}
.typing .dot {
  display: inline-block;
  font-size: 1.2rem;
  margin: 0 1px;
  animation: blink 1.4s infinite;
  opacity: 0;
}
.typing .dot:nth-child(1) { animation-delay: 0s; }
.typing .dot:nth-child(2) { animation-delay: 0.2s; }
.typing .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0; }
  40% { opacity: 1; }
}
.copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  color: #666;
}
.copy-btn:hover { color: #333; }
.user-bubble {
  align-self: flex-end;
  background: #720d21;
  color: #faf8f3;
  border-radius: 18px 18px 4px 18px;
}
#inputArea {
  display: flex;
  padding: 0.5rem;
  border-top: 1px solid #ddd;
  background: #fff;
}
#userInput {
  flex: 1;
  padding: 0.5rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 5px;
  resize: none;
  overflow: hidden;
  height: auto;
}
#sendBtn, #clearBtn {
  padding: 0 1rem;
  margin-left: 0.5rem;
  border: none;
  background: #6b4e16;
  color: #fff;
  border-radius: 5px;
  cursor: pointer;
}
#clearBtn {
  background: #db3933;
  margin-left: 0.3rem;
}
#sendBtn:disabled {
  background: #aaa;
  cursor: not-allowed;
}
@media (max-width: 600px) {
  body { height: auto; }
  #chatWindow { flex: none; overflow-y: visible; }
  #inputArea { position: static; }
}
.settings-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(30,22,4,0.25);
  z-index: 80;
}

.settings-panel {
  position: fixed;
  top: 0; right: 0; width: 320px; max-width: 98vw;
  height: 100vh;
  background: #fffceb;
  box-shadow: -2px 0 24px #5e501560;
  z-index: 99;
  padding: 2rem 1.4rem 1rem 1.4rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s;
  border-top-left-radius: 16px;
  border-bottom-left-radius: 16px;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.3rem;
  font-size: 1.2rem;
  font-weight: bold;
}

#closeSettings {
  background: none;
  border: none;
  font-size: 1.7rem;
  color: #916b07;
  cursor: pointer;
  margin-left: 1rem;
}

#settingsForm label {
  display: block;
  margin-bottom: 1.1rem;
  color: #593d08;
}

#settingsForm select, #settingsForm input[type="text"] {
  display: block;
  width: 98%;
  margin-top: 0.25rem;
  padding: 0.4rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fff;
  font-size: 1rem;
}

#settingsForm button[type="submit"] {
  width: 100%;
  margin-top: 0.7rem;
  background: #6b4e16;
  color: #fff;
  border-radius: 6px;
  border: none;
  padding: 0.8rem;
  font-size: 1.08rem;
  cursor: pointer;
  transition: background 0.15s;
}

#settingsForm button[type="submit"]:hover {
  background: #91702d;
}
