:root {
  --bg: #0e1320;
  --panel: #171b2c;
  --muted: #9aa0bd;
  --text: #e7eaff;
  --accent: #4c82ff;
  --accent-2: #78a6ff;
  --border: #22263b;
  --danger: #ff5c7a;
}

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

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: #121629; border-bottom: 1px solid var(--border); padding: 10px 14px;
}
.profile { display: flex; align-items: center; gap: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.identity .username { font-weight: 700; }
.identity .description { color: var(--muted); font-size: 12px; }

/* Layout */
.layout { display: grid; grid-template-columns: 280px 1fr; height: calc(100vh - 58px); }
.sidebar {
  background: var(--panel); border-right: 1px solid var(--border); padding: 12px; overflow-y: auto;
}
.brand .logo { width: 32px; height: 32px; margin-bottom: 8px; }
.section { margin: 10px 0; }
.section-title { color: var(--muted); font-size: 12px; text-transform: uppercase; margin-bottom: 6px; }
.channel-list { list-style: none; margin: 0; padding: 0; }
.channel-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.channel-list li:hover { background: #1b2033; }
.channel-list li.active { background: #21263e; border: 1px solid #2b3150; }
.channel {
  display: flex; align-items: center; gap: 8px; overflow: hidden;
}
.channel .icon {
  width: 22px; height: 22px; border-radius: 50%; background: #0f1326; border: 1px solid var(--border);
  background-size: cover; background-position: center;
}
.unread-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}

/* Chat panel */
.chat { display: flex; flex-direction: column; }
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px; border-bottom: 1px solid var(--border);
}
.room-icon {
  display: inline-block; width: 18px; height: 18px; border-radius: 50%;
  background: #0f1326; border: 1px solid var(--border); margin-right: 8px;
  background-size: cover; background-position: center;
}
.typing { color: var(--muted); font-size: 12px; padding: 0 12px 6px; min-height: 18px; }
.messages { flex: 1; overflow-y: auto; padding: 12px; }
.msg { margin: 8px 0; }
.msg .name { color: var(--accent); font-weight: 600; margin-right: 8px; }
.msg .time { color: var(--muted); font-size: 12px; margin-left: 8px; }
.msg.admin .name::after { content: " 🔹"; color: var(--accent-2); }

.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
input[type="text"] {
  flex: 1; padding: 10px; border-radius: 8px; border: 1px solid #2a2f4d; background: #0f1220; color: var(--text);
}
.btn { padding: 8px 12px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; }
.btn.primary { background: var(--accent); color: white; }
.btn.secondary { background: #1b2033; color: var(--text); border-color: #2b3150; }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--border); }

/* Modals */
.modal { border: none; border-radius: 12px; padding: 16px; background: #121629; color: var(--text); }
.modal::backdrop { background: rgba(0,0,0,0.5); }
.modal h3 { margin-top: 0; }
.modal label { display: block; margin: 8px 0; font-size: 14px; }
.modal .row { display: flex; gap: 8px; margin-top: 8px; }
.hint { color: var(--muted); font-size: 12px; }

.create-row { margin-top: 8px; }
