:root {
  --bg: #0f1221;
  --card: #1a1e33;
  --accent: #6c8cff;
  --text: #e7e9f2;
  --muted: #9aa0bd;
  --user: #2a3d6b;
  --agent: #273150;
  --error: #ff6b6b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.app__title {
  font-size: 20px;
  letter-spacing: 0.5px;
  color: var(--accent);
}

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.hidden { display: none !important; }

.form { display: flex; flex-direction: column; gap: 10px; }
.form__label { font-size: 13px; color: var(--muted); }
.form__input, .chat__input, .invite__input {
  background: #11152a;
  border: 1px solid #2c3254;
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 15px;
}
.form__input:focus, .chat__input:focus { outline: 1px solid var(--accent); }

.btn {
  background: var(--accent);
  color: #0b0e1c;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--small { padding: 8px 12px; font-size: 13px; }
.btn--secondary { background: transparent; color: var(--muted); border: 1px solid #39406a; }

.chat__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.chat__me { font-weight: 600; }
.chat__other { color: var(--muted); margin-left: 10px; font-size: 13px; }

.invite {
  background: #11152a;
  border: 1px dashed #39406a;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}
.invite__label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 8px; }
.invite__row { display: flex; gap: 8px; }
.invite__input { flex: 1; }

.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 240px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 6px 2px;
  margin-bottom: 14px;
}

.bubble {
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.35;
}
.bubble__author { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.bubble--user { align-self: flex-end; background: var(--user); }
.bubble--other { align-self: flex-start; background: #24463f; }
.bubble--agent { align-self: flex-start; background: var(--agent); }
.bubble--error { align-self: flex-start; background: #3a2030; color: var(--error); }
.bubble--pending { opacity: 0.6; font-style: italic; }

.chat__form { display: flex; gap: 8px; }
.chat__input { flex: 1; }

.error { color: var(--error); font-size: 13px; margin-top: 10px; }
