:root {
  color-scheme: light;
  --background: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #edf1f4;
  --text: #19222c;
  --muted: #687482;
  --border: #d7dde3;
  --accent: #147c72;
  --accent-dark: #0f5f58;
  --danger: #a33d3d;
  --shadow: 0 18px 45px rgba(25, 34, 44, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  border-right: 1px solid var(--border);
  background: #fbfcfd;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.brand h1,
.brand p,
.panel h2,
.chat-header h2,
.chat-header p {
  margin: 0;
}

.brand h1 {
  font-size: 22px;
  line-height: 1.1;
}

.brand p,
.chat-header p,
.room small {
  color: var(--muted);
}

.panel {
  display: grid;
  gap: 10px;
}

.panel h2 {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
}

.room {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.room.active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.name-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.name-form input,
.composer input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.name-form input {
  min-height: 42px;
  padding: 0 10px;
}

.name-form button,
.composer button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.name-form button {
  min-width: 58px;
}

.name-form button:hover,
.composer button:hover {
  background: var(--accent-dark);
}

.chat {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.chat-header h2 {
  font-size: 22px;
}

.status-pill {
  min-width: 88px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.status-pill.online {
  background: #dff3ed;
  color: #11664f;
}

.status-pill.error {
  background: #f5dfdf;
  color: var(--danger);
}

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

.message,
.event {
  max-width: 760px;
}

.message {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.message.me {
  align-self: flex-end;
  border-color: #b8d9d3;
  background: #f4fffc;
}

.message-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.message-author {
  color: var(--text);
  font-weight: 700;
}

.message-body {
  overflow-wrap: anywhere;
  line-height: 1.45;
  white-space: pre-wrap;
}

.event {
  color: var(--muted);
  font-size: 13px;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.composer input {
  min-height: 48px;
  padding: 0 14px;
}

.composer button {
  min-height: 48px;
  font-weight: 700;
}

@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .sidebar {
    gap: 12px;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .brand h1 {
    font-size: 19px;
  }

  .panel {
    display: none;
  }

  .messages {
    padding: 14px;
  }

  .chat-header {
    padding: 14px;
  }

  .composer {
    grid-template-columns: minmax(0, 1fr) 78px;
    padding: 12px 14px 14px;
  }
}
