:root {
  --bg: #0f1115;
  --panel: #171a21;
  --line: #262a33;
  --text: #e6e6e6;
  --muted: #8b919c;
  --me: #2b4a7a;
  --aimro: #22262f;
  --accent: #6aa0ff;
  --danger: #ff7b7b;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f7; --panel: #ffffff; --line: #e1e4ea; --text: #1b1f27; --muted: #6a7180;
    --me: #d8e6ff; --aimro: #eef0f4; --accent: #2f6fe0;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column;
}
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .sub { color: var(--muted); font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); display: inline-block; }
.dot.on { background: #4cd27a; }
.who { color: var(--muted); font-size: 13px; display: flex; gap: 10px; align-items: center; }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

main { flex: 1; display: flex; flex-direction: column; min-height: 0; max-width: 860px; width: 100%; margin: 0 auto; padding: 0 16px; }
.panel { margin: 40px auto; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.panel h1 { margin: 0 0 8px; font-size: 20px; }
.panel p { color: var(--muted); }
.error { color: var(--danger) !important; }
#dev-login { display: flex; gap: 8px; margin-top: 12px; }
#dev-login input { flex: 1; }

#chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#messages { flex: 1; overflow-y: auto; padding: 16px 0; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 78%; padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--me); border-bottom-right-radius: 4px; }
.msg.aimro { align-self: flex-start; background: var(--aimro); border-bottom-left-radius: 4px; }
.msg .meta { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.msg.pending .meta::after { content: " · čaká na Aimra"; }
.day { align-self: center; color: var(--muted); font-size: 12px; margin: 8px 0 2px; }

.typing { color: var(--muted); font-size: 13px; padding: 4px 0 8px; }
.typing span { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

#composer { display: flex; gap: 8px; padding: 8px 0 4px; border-top: 1px solid var(--line); }
textarea, input {
  width: 100%; resize: none; background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit;
}
textarea:focus, input:focus { outline: 2px solid var(--accent); border-color: transparent; }
#send, #dev-login button {
  background: var(--accent); color: white; border: 0; border-radius: 10px; padding: 0 16px; font-size: 18px; cursor: pointer;
}
#send:disabled { opacity: .5; cursor: default; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 10px; }
