* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #111827;
  border-bottom: 1px solid #1f2937;
}
h1 { font-size: 18px; margin: 0; }
#status { font-size: 14px; color: #9ca3af; }

#messages {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.message {
  max-width: 75ch;
  padding: 8px 12px;
  border-radius: 10px;
  background: #1f2937;
  border: 1px solid #374151;
  line-height: 1.35;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.message .meta { font-size: 12px; color: #93c5fd; margin-bottom: 4px; }
.message.self { background: #0b5; border-color: #0a4; align-self: flex-end; }
.system { color: #9ca3af; font-style: italic; padding: 6px; }

form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 8px;
  background: #111827;
  border-top: 1px solid #1f2937;
}
#input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #374151;
  background: #0b1020;
  color: #e2e8f0;
}
#input:focus { outline: 2px solid #2563eb; }
button {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #2563eb;
  background: #2563eb;
  color: white;
  cursor: pointer;
}
button:hover { filter: brightness(1.05); }

/* Modal styling for settings */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal-content {
  width: 100%;
  max-width: 420px;
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 16px;
}
.modal .field { display:flex; flex-direction:column; gap:6px; margin-bottom:10px; }
.modal label { font-size: 14px; color:#9ca3af; }
.modal input { padding:10px 12px; border-radius:8px; border:1px solid #374151; background:#0b1020; color:#e2e8f0; }
.modal .actions { display:flex; gap:8px; justify-content:flex-end; }
.modal .error { color:#fca5a5; min-height:18px; }
.modal .success { color:#86efac; min-height:18px; }
