:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #edf0f8;
  background: #111420;
  --panel: #181d2d;
  --raised: #20263a;
  --border: #353d56;
  --muted: #acb6cc;
  --accent: #b0befe;
  --warning: #f5b49d;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); }
button, textarea, input, select { font: inherit; }
button, textarea, input, select {
  color: inherit;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 6px;
}
button, input, select { padding: .55rem .75rem; }
textarea { padding: .65rem .75rem; min-height: 5rem; resize: vertical; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button:hover:not(:disabled) { border-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button.primary { background: var(--accent); color: #151932; border-color: var(--accent); font-weight: 650; }
button.ghost { background: none; border-color: transparent; color: var(--muted); }
button.danger { color: var(--warning); }
.bar {
  border-bottom: 1px solid var(--border);
  background: #151927;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.65rem;
  padding: .65rem clamp(1rem, 3vw, 2.25rem);
}
.brand { color: inherit; font-weight: 500; text-decoration: none; }
.brand strong { color: var(--accent); font-weight: 650; }
.account, .actions, .compose-options { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; }
.account { font-size: .85rem; color: var(--muted); justify-content: flex-end; }
.panel {
  width: min(100% - 2rem, 33rem);
  margin: clamp(2rem, 10vh, 7rem) auto 1rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}
h1, h2, p { margin: 0; }
.panel h1 { font-size: clamp(1.35rem, 4vw, 1.8rem); }
.panel p { color: var(--muted); line-height: 1.45; }
.stack { display: grid; gap: 1rem; }
.field { display: grid; gap: .4rem; font-size: .9rem; }
.field :is(textarea, input, select) { width: 100%; }
.status { max-width: 72rem; margin: 1rem auto; padding: 0 1rem; color: var(--warning); }
.status:empty, [hidden] { display: none !important; }
.layout {
  display: grid;
  grid-template-columns: minmax(12rem, 17rem) minmax(0, 1fr);
  min-height: calc(100dvh - 3.65rem);
}
.rooms { background: var(--panel); border-right: 1px solid var(--border); padding: 1.2rem; }
.rooms h2 { font-size: .85rem; color: var(--muted); margin: 0 0 .8rem; }
.rooms nav { display: grid; gap: .35rem; }
.rooms nav button { text-align: left; background: transparent; overflow-wrap: anywhere; }
.rooms nav button[aria-current="true"] { color: var(--accent); background: var(--raised); border-color: var(--accent); }
.conversation { width: min(100%, 70rem); padding: clamp(1rem, 3vw, 2.25rem); }
.conversation h1 { font-size: 1.45rem; overflow-wrap: anywhere; }
.members { color: var(--muted); font-size: .85rem; margin: .3rem 0 1rem; overflow-wrap: anywhere; }
.messages { list-style: none; margin: 0 0 1.25rem; padding: 0; border-top: 1px solid var(--border); }
.message { border-bottom: 1px solid var(--border); padding: .8rem 0; display: grid; gap: .42rem; }
.message-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem; }
.message-head time, .message-head span, .message small { color: var(--muted); font-size: .82rem; }
.message p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.message .actions button { padding: .3rem .5rem; font-size: .82rem; }
.composer { padding: 1rem; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); }
.compose-options { justify-content: space-between; }
.compose-options :is(input, select) { max-width: 100%; }
.compose-options .field { min-width: 7.5rem; }
.message-status { color: var(--muted); margin: .25rem 0 1rem; line-height: 1.45; }

@media (max-width: 650px) {
  .layout { grid-template-columns: 1fr; }
  .rooms { border-right: 0; border-bottom: 1px solid var(--border); padding: .75rem 1rem; }
  .rooms nav { display: flex; flex-wrap: wrap; }
  .rooms h2 { margin-bottom: .45rem; }
  .account button { padding: .35rem; }
}
