* { box-sizing: border-box; }

:root {
  color: #e2e8f0;
  background: #0f172a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.12), transparent 32rem),
    #0f172a;
}

.chat-shell {
  width: min(760px, calc(100% - 32px));
  height: calc(100vh - 32px);
  min-height: 420px;
  margin: 16px auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid #334155;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.96);
  box-shadow: 0 24px 70px rgba(2, 6, 23, 0.45);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #334155;
}

.chat-header h1, .chat-header p { margin: 0; }
.chat-header h1 { font-size: 1.35rem; }
.eyebrow { color: #38bdf8; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.16em; }

.connection { display: flex; align-items: center; gap: 8px; color: #94a3b8; font-size: 0.85rem; }
.connection-dot { width: 9px; height: 9px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 12px currentColor; }
.connection-dot.connected { background: #22c55e; }
.connection-dot.error { background: #ef4444; }

.messages {
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-state { margin: auto; color: #64748b; text-align: center; }
.message { max-width: 82%; align-self: flex-start; }
.message.own { align-self: flex-end; }
.message-meta { margin: 0 4px 5px; color: #94a3b8; font-size: 0.75rem; }
.message.own .message-meta { text-align: right; }
.message-bubble { margin: 0; padding: 10px 13px; border-radius: 14px 14px 14px 4px; background: #1e293b; line-height: 1.45; overflow-wrap: anywhere; }
.message.own .message-bubble { border-radius: 14px 14px 4px 14px; background: #0369a1; }
.system-message { align-self: center; color: #fca5a5; font-size: 0.82rem; text-align: center; }

.composer {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid #334155;
  background: #111827;
}

.composer label { display: flex; flex-direction: column; gap: 5px; color: #94a3b8; font-size: 0.75rem; }
.composer input {
  width: 100%;
  height: 42px;
  border: 1px solid #475569;
  border-radius: 9px;
  outline: none;
  background: #0f172a;
  color: #f8fafc;
  padding: 0 11px;
}
.composer input:focus { border-color: #38bdf8; box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12); }
.composer button {
  align-self: end;
  height: 42px;
  border: 0;
  border-radius: 9px;
  padding: 0 18px;
  background: #0284c7;
  color: white;
  font-weight: 700;
  cursor: pointer;
}
.composer button:disabled { cursor: not-allowed; opacity: 0.55; }

@media (max-width: 620px) {
  .chat-shell { width: 100%; height: 100vh; margin: 0; border: 0; border-radius: 0; }
  .composer { grid-template-columns: 1fr auto; }
  .composer label:first-child { grid-column: 1 / -1; }
}
