:root {
  --navy: #1F497D;
  --red: #C00000;
  --bg: #FFFFFF;
  --soft: #F4F6FA;
  --rule: #D7DCE5;
  --muted: #555;
  --me: #E8F0FE;
  --them: #F4F6FA;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Calibri, "Segoe UI", -apple-system, sans-serif;
  color: #1a1a1a;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 2px solid var(--red);
  background: var(--navy);
  color: white;
  flex: 0 0 auto;
}
.brand { font-weight: 700; font-size: 18px; }
.muted { opacity: 0.7; font-weight: 400; }
.conn {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 10px;
  background: #888;
  color: white;
}
.conn.online { background: #2E7D32; }
.conn.degraded { background: #E6A000; }

main#log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px;
  background: var(--soft);
}

.msg {
  max-width: 80%;
  margin: 6px 0;
  padding: 8px 12px;
  border-radius: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.me   { background: var(--me);   margin-left: auto;  border-bottom-right-radius: 3px; }
.msg.them { background: var(--them); margin-right: auto; border-bottom-left-radius: 3px; border: 1px solid var(--rule); }
.msg .meta { font-size: 11px; color: var(--muted); margin-top: 4px; }

form#composer {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--rule);
  background: var(--bg);
  flex: 0 0 auto;
}
#prompt {
  flex: 1;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid var(--rule);
  border-radius: 18px;
  outline: none;
}
#prompt:focus { border-color: var(--navy); }
#send {
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  background: var(--navy);
  color: white;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
}
#send:disabled { background: #888; cursor: not-allowed; }
