/* Cre8web Chat Platform — Cre8webs yellow/black brand */
:root {
  --brand-yellow: #ffd400;
  --brand-yellow-hover: #e6bf00;
  --brand-black: #0a0a0a;
  --brand-dark: #141414;
  --brand-dark-2: #1c1c1c;
  --rail-bg: #0a0a0a;
  --sidebar-bg: #141414;
  --sidebar-hover: #1f1f1f;
  --sidebar-active: #ffd400;
  --sidebar-active-text: #0a0a0a;
  --sidebar-text: #ffffff;
  --sidebar-muted: rgba(255, 255, 255, 0.65);
  --main-bg: #ffffff;
  --main-text: #1a1a1a;
  --main-muted: #5c5c5c;
  --border: #e5e5e5;
  --accent: #ffd400;
  --accent-hover: #e6bf00;
  --accent-text: #0a0a0a;
  --danger: #e01e5a;
  --success: #2bac76;
  --badge: #ffd400;
  --badge-text: #0a0a0a;
  --composer-bg: #fafafa;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  --font: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --rail-width: 72px;
  --sidebar-width: 280px;
  --header-height: 52px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 15px;
  color: var(--main-text);
}

.hidden { display: none !important; }

/* ========== AUTH ========== */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(145deg, #0a0a0a 0%, #1a1a1a 45%, #2a2200 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-container {
  width: 100%;
  max-width: 420px;
}

.auth-brand {
  text-align: center;
  color: #fff;
  margin-bottom: 32px;
}

.auth-logo {
  max-width: 280px;
  width: 100%;
  height: auto;
  margin: 0 auto 12px;
  display: block;
}

.auth-tagline {
  font-size: 11px;
  letter-spacing: 0.35em;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 8px;
  font-weight: 700;
}

.auth-brand p { opacity: 0.85; margin-top: 8px; color: #fff; }

.auth-card {
  background: #fff;
  border-radius: 8px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.auth-card h2 {
  font-size: 22px;
  margin-bottom: 24px;
  font-weight: 900;
}

.auth-card label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  margin-top: 16px;
}

.auth-card label:first-of-type { margin-top: 0; }

.auth-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 15px;
  font-family: inherit;
}

.auth-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.btn-primary {
  width: 100%;
  margin-top: 24px;
  padding: 12px;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  padding: 10px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.btn-secondary:hover { background: #f8f8f8; }

.btn-sm { padding: 8px 12px; font-size: 13px; display: inline-block; cursor: pointer; }

.btn-danger-outline {
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--main-muted);
}

.auth-switch a { color: var(--brand-yellow); font-weight: 700; text-decoration: none; }
.auth-demo { margin-top: 16px; font-size: 12px; color: var(--main-muted); text-align: center; }
.auth-demo code { background: #f0f0f0; padding: 2px 6px; border-radius: 3px; }

/* ========== APP SHELL ========== */
.app-page { height: 100vh; overflow: hidden; }

.app-shell {
  display: flex;
  height: 100vh;
  background: var(--main-bg);
}

/* Rail */
.rail {
  width: var(--rail-width);
  min-width: var(--rail-width);
  background: var(--rail-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  z-index: 20;
}

.rail-workspace {
  width: 56px;
  height: 56px;
  background: transparent;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  cursor: pointer;
  overflow: hidden;
}

.rail-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding-right: 8px;
}

.sidebar-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  flex-shrink: 0;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.rail-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rail-btn svg { width: 22px; height: 22px; }

.rail-btn:hover,
.rail-btn.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
}

.rail-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--badge);
  color: var(--badge-text);
  font-size: 11px;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rail-add { margin-top: 8px; }

.rail-bottom { margin-top: auto; }

.rail-avatar {
  position: relative;
  width: 36px;
  height: 36px;
  border: none;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #ccc;
}

.rail-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.status-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--rail-bg);
}

.status-dot.online { background: var(--success); }
.status-dot.away { background: #ecb22e; }
.status-dot.offline { background: #9e9e9e; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 15;
}

.sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  min-height: auto;
}

.workspace-name {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: inherit;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-name svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  align-self: flex-start;
  padding-top: 4px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: inherit;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); }

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
}

.sidebar-search svg { width: 16px; height: 16px; opacity: 0.7; flex-shrink: 0; }

.sidebar-search input {
  flex: 1;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
}

.sidebar-search input::placeholder { color: rgba(255, 255, 255, 0.6); }
.sidebar-search input:focus { outline: none; }

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 16px;
}

.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 3px; }

.sidebar-section { margin-bottom: 8px; }

.sidebar-link {
  display: block;
  padding: 4px 20px;
  color: var(--sidebar-muted);
  text-decoration: none;
  font-size: 14px;
}

.sidebar-link:hover { color: #fff; }

.section-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 4px 12px 4px 8px;
  background: none;
  border: none;
  color: var(--sidebar-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.section-toggle svg { width: 12px; height: 12px; transition: transform 0.15s; }
.collapsible:not(.open) .section-toggle svg { transform: rotate(-90deg); }
.collapsible:not(.open) .channel-list,
.collapsible:not(.open) .sidebar-add { display: none; }

.channel-list { list-style: none; }

.channel-list a,
.channel-list button.channel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 28px 4px 24px;
  color: var(--sidebar-muted);
  text-decoration: none;
  font-size: 15px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  position: relative;
}

.channel-list a:hover,
.channel-list button.channel-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.channel-list a.active,
.channel-list button.channel-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
  font-weight: 700;
}

.channel-unread {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--badge);
  color: var(--badge-text);
  font-size: 12px;
  font-weight: 700;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dm-list .channel-item .dm-avatar {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: cover;
}

.sidebar-add {
  display: block;
  width: 100%;
  padding: 4px 24px;
  background: none;
  border: none;
  color: var(--sidebar-muted);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.sidebar-add:hover { color: #fff; }

/* Main chat */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--main-bg);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  min-height: var(--header-height);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mobile-menu {
  display: none;
  border: none;
  background: none;
  cursor: pointer;
  padding: 4px;
}

.channel-title {
  font-size: 18px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-dropdown {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--main-muted);
  padding: 2px;
}

.channel-dropdown svg { width: 16px; height: 16px; }

.member-avatars {
  display: flex;
  margin-left: 8px;
}

.member-avatars img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 2px solid #fff;
  margin-left: -6px;
  object-fit: cover;
}

.member-avatars img:first-child { margin-left: 0; }

.member-count.dm-presence {
  font-size: 13px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--main-surface, #f4f4f5);
}

.member-count.dm-presence.presence-online {
  color: var(--success, #2bac76);
}

.member-count.dm-presence.presence-offline {
  color: var(--main-muted, #888);
}

.member-count {
  font-size: 13px;
  color: var(--main-muted);
  margin-left: 4px;
}

.chat-header-right { display: flex; gap: 4px; }

.header-action {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--main-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-action svg { width: 20px; height: 20px; }
.header-action:hover { background: #f0f0f0; color: var(--main-text); }

.chat-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-tab {
  padding: 10px 12px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 700;
  color: var(--main-muted);
  cursor: pointer;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.chat-tab.active {
  color: var(--main-text);
  border-bottom-color: var(--accent);
}

.chat-tab-add {
  margin-left: auto;
  border: none;
  background: none;
  font-size: 18px;
  color: var(--main-muted);
  cursor: pointer;
  padding: 8px;
}

/* Messages */
.messages-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
}

.messages-wrap::-webkit-scrollbar { width: 8px; }
.messages-wrap::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

.messages {
  max-width: 900px;
  padding: 0 20px;
}

.msg-group {
  display: flex;
  gap: 12px;
  padding: 8px 8px 8px 0;
  margin-bottom: 4px;
}

.msg-group:hover { background: #f8f8f8; border-radius: 4px; }

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.msg-body { flex: 1; min-width: 0; }

.msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.msg-author { font-weight: 900; font-size: 15px; }
.msg-time { font-size: 12px; color: var(--main-muted); }

.msg-text {
  line-height: 1.46;
  word-break: break-word;
  white-space: pre-wrap;
}

.msg-attachment {
  margin-top: 8px;
  max-width: 400px;
}

.msg-attachment img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.msg-attachment video {
  max-width: 100%;
  border-radius: 8px;
}

.msg-file {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #f8f8f8;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--main-text);
  margin-top: 8px;
}

.msg-file svg { width: 32px; height: 32px; color: var(--danger); }

.msg-reactions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.reaction-btn:hover { border-color: var(--accent); background: #f0f7fc; }

.msg-thread {
  margin-top: 6px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  padding: 0;
}

.msg-thread:hover { text-decoration: underline; }

.msg-actions {
  opacity: 0;
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.msg-group:hover .msg-actions { opacity: 1; }

.msg-action-btn {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

.date-divider {
  text-align: center;
  margin: 24px 0 16px;
  position: relative;
}

.date-divider span {
  background: #fff;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--main-muted);
  position: relative;
  z-index: 1;
}

.date-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--border);
}

/* Composer */
.composer-wrap {
  padding: 0 20px 20px;
  flex-shrink: 0;
  position: relative;
}

.composer-emoji-anchor {
  position: relative;
  height: 0;
  z-index: 50;
}

.composer-emoji-anchor emoji-picker {
  position: absolute;
  bottom: 8px;
  left: 0;
  --num-columns: 8;
  --emoji-size: 1.35rem;
  --emoji-padding: 0.35rem;
  max-height: 380px;
  box-shadow: var(--shadow);
  border-radius: 8px;
}

.composer-emoji-anchor emoji-picker.hidden {
  display: none !important;
}

#emojiBtn {
  font-size: 20px;
  line-height: 1;
}

.composer-toolbar {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}

.toolbar-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--main-muted);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar-btn svg { width: 18px; height: 18px; }
.toolbar-btn:hover { background: #eee; color: var(--main-text); }

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--composer-bg);
}

.composer-input-wrap { flex: 1; }

.composer textarea {
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.46;
  max-height: 200px;
}

.composer textarea:focus { outline: none; }

.attachment-preview {
  margin-bottom: 8px;
  padding: 8px;
  background: #fff;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
}

.attachment-preview .attach-preview-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 28px 6px 6px;
  background: var(--main-surface, #f8f8f8);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-width: 100%;
}

.attachment-preview .attach-file-label {
  font-size: 12px;
  font-weight: 600;
  word-break: break-all;
}

.attachment-preview .attach-preview-item .remove-attach {
  position: absolute;
  top: 2px;
  right: 4px;
  margin-left: 0;
}

.attachment-preview img,
.attachment-preview video {
  max-height: 80px;
  border-radius: 4px;
}

.attachment-preview .remove-attach {
  margin-left: auto;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--main-muted);
}

.send-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.send-btn svg { width: 18px; height: 18px; }
.send-btn:hover { background: var(--accent-hover); }

/* Right panel */
.right-panel {
  width: 320px;
  min-width: 320px;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: #fff;
}

.right-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.right-panel-header h3 { font-size: 16px; font-weight: 900; }

.right-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.member-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.member-list-item img {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
}

.member-list-item .name { font-weight: 700; }
.member-list-item .role { font-size: 12px; color: var(--main-muted); }

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 8px;
  z-index: 101;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 22px; font-weight: 900; }

.modal-close {
  border: none;
  background: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--main-muted);
  line-height: 1;
}

.modal-body {
  padding: 20px 24px 24px;
}

.modal-body label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin: 16px 0 6px;
}

.modal-body label:first-child { margin-top: 0; }

.modal-body input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.modal-body textarea,
.modal-body select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 15px;
  font-family: inherit;
}

.modal-body .field-hint {
  font-size: 12px;
  color: var(--main-muted);
  margin: -2px 0 8px;
  line-height: 1.45;
}

.modal-body input:focus,
.modal-body textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.input-prefix {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.input-prefix span {
  padding: 10px 12px;
  background: #f8f8f8;
  color: var(--main-muted);
  font-weight: 700;
}

.input-prefix input {
  border: none;
  flex: 1;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-weight: 400 !important;
  cursor: pointer;
}

.checkbox-label input { width: auto; }

.member-picker {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--main-surface, #f8f8f9);
}

.member-picker-inner {
  display: flex;
  flex-direction: column;
}

.member-picker-section {
  padding: 12px 14px;
}

.member-picker-section + .member-picker-section {
  border-top: 1px solid var(--border);
}

.member-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--main-muted);
  margin: 0 0 10px;
}

.member-chip input[type="hidden"] {
  display: none !important;
}

.member-chip-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-you {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--main-muted);
  padding: 0 4px;
}

.member-add-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  margin: 0 0 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.member-add-btn:last-child {
  margin-bottom: 0;
}

.member-add-btn:hover {
  border-color: var(--accent, #f7c600);
  background: rgba(247, 198, 0, 0.08);
}

.member-add-btn img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.member-add-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-add-plus {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent, #f7c600);
  color: #1d1c1d;
}

.member-add-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 200px;
  overflow-y: auto;
}

.modal-footer .btn-danger-outline {
  margin-right: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.profile-modal .profile-avatar-edit {
  text-align: center;
  margin-bottom: 24px;
}

.profile-avatar-preview {
  width: 100%;
  max-width: 280px;
  min-height: 160px;
  max-height: 280px;
  margin: 0 auto 12px;
  border-radius: 12px;
  overflow: hidden;
  background: #f0f1f3;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.profile-avatar-preview img {
  max-width: 100%;
  max-height: 264px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.profile-photo-hint {
  font-size: 12px;
  color: var(--main-muted);
  margin-top: 8px;
  line-height: 1.4;
}

.profile-modal hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.profile-modal h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.people-list {
  list-style: none;
  margin-top: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.people-list li button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  border-radius: 4px;
}

.people-list li button:hover { background: #f0f0f0; }

.people-list img {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
}

.search-results { margin-top: 16px; }

.search-result-item {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.search-result-item:hover { background: #f8f8f8; }

.search-result-item .type {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--main-muted);
  font-weight: 700;
}

.search-result-item .title { font-weight: 700; margin-top: 4px; }
.search-result-item .snippet { font-size: 13px; color: var(--main-muted); margin-top: 4px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  background: #1d1c1d;
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
  z-index: 200;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: var(--rail-width);
    top: 0;
    bottom: 0;
    z-index: 25;
    transform: translateX(calc(-100% - var(--rail-width)));
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .main {
    flex: 1;
    min-width: 0;
  }

  .chat-header {
    padding: 10px 12px;
    gap: 8px;
  }

  .chat-header-left {
    min-width: 0;
    flex: 1;
  }

  .right-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 30;
    box-shadow: var(--shadow);
    width: min(100vw, 320px);
  }
}

@media (max-width: 600px) {
  .sidebar {
    left: var(--rail-width);
    width: min(280px, calc(100vw - var(--rail-width)));
  }

  .member-avatars { display: none; }

  .header-user-chevron { display: none; }
}

/* ——— Cre8web extras ——— */
.demo-accounts {
  list-style: none;
  font-size: 12px;
  color: var(--main-muted);
  margin-top: 8px;
  line-height: 1.8;
}

.auth-note {
  text-align: center;
  font-size: 12px;
  color: var(--main-muted);
  margin-top: 16px;
}

.sidebar-brand .workspace-name {
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  display: block;
  line-height: 1.15;
  max-width: 100%;
  white-space: normal;
  letter-spacing: -0.02em;
}

.sidebar-header .workspace-name {
  background: none;
  border: none;
  padding: 0;
  cursor: default;
  overflow: visible;
  text-overflow: unset;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  color: var(--sidebar-muted);
  font-size: 13px;
  font-weight: 700;
}

.section-head .section-toggle {
  padding: 0;
  width: auto;
}

.section-add {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--sidebar-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
}

.section-add:hover { color: #fff; }

.channel-item {
  position: relative;
}

.channel-item .item-label { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; }

.item-menu {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 14px;
  opacity: 0;
}

.channel-item:hover .item-menu { opacity: 1; }
.channel-item.active .item-menu { opacity: 1; color: #fff; }

.empty-hint, .empty-chat {
  padding: 8px 24px;
  color: var(--sidebar-muted);
  font-size: 13px;
  list-style: none;
}

.sidebar-hint {
  padding: 4px 24px 12px;
  font-size: 11px;
  color: var(--sidebar-muted);
  font-style: italic;
}

.section-head small {
  font-weight: 400;
  opacity: 0.8;
}

.empty-chat { color: var(--main-muted); padding: 24px 20px; }

.sidebar-search-wrap {
  position: relative;
  margin: 8px 12px 4px;
}

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
}

.sidebar-search-wrap .sidebar-search {
  margin: 0;
}

.search-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow-y: auto;
  z-index: 50;
}

.search-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  border-bottom: 1px solid var(--border);
}

.search-item:hover { background: #f4f4f4; }

.search-item .search-type {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--main-muted);
  font-weight: 700;
}

.search-item strong { display: block; margin-top: 2px; }
.search-item small { display: block; color: var(--main-muted); font-size: 12px; margin-top: 4px; }

.search-empty { padding: 12px; color: var(--main-muted); font-size: 13px; }

.mention {
  background: rgba(255, 212, 0, 0.35);
  color: #7a5f00;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

.msg-link {
  color: #9a7500;
  text-decoration: underline;
  word-break: break-all;
}

.msg-link:hover {
  color: var(--brand-black);
  background: rgba(255, 212, 0, 0.25);
}

.attach-file-btn {
  width: auto !important;
  padding: 6px 12px !important;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--main-text) !important;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.attach-file-btn:hover {
  border-color: var(--accent);
  background: rgba(255, 212, 0, 0.15) !important;
}

.attach-file-btn svg {
  width: 18px;
  height: 18px;
}

.attachment-preview .uploading {
  color: var(--main-muted);
  font-size: 13px;
}

.admin-sidebar-link:hover {
  background: var(--brand-yellow) !important;
  color: var(--accent-text) !important;
}

/* Slide notifications */
.notify-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  pointer-events: none;
}

.notify-card {
  pointer-events: auto;
  background: #fff;
  border-left: 4px solid var(--brand-yellow);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.notify-card.show {
  transform: translateX(0);
  opacity: 1;
}

.notify-card strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.notify-where {
  font-size: 11px;
  color: var(--main-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.notify-card p {
  margin-top: 6px;
  font-size: 13px;
  color: var(--main-text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Desktop (Chrome / Windows) notification controls */
.notify-bell-btn {
  position: relative;
}

.notify-bell-btn.enabled {
  color: var(--accent-text);
  background: var(--brand-yellow);
}

.notify-bell-btn.enabled:hover {
  background: var(--brand-yellow-hover);
}

.notify-bell-btn.blocked {
  opacity: 0.55;
}

.notify-bell-btn::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  display: none;
}

.notify-bell-btn:not(.enabled):not(.blocked)::after {
  display: block;
}

.desktop-notify-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 10px 12px;
  background: #fffbe6;
  border: 1px solid var(--brand-yellow);
  border-radius: 8px;
  font-size: 13px;
  color: var(--main-text);
}

.desktop-notify-banner span {
  flex: 1;
  line-height: 1.35;
}

.desktop-notify-banner .banner-dismiss {
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--main-muted);
  padding: 0 4px;
}

.notify-enable-btn {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  padding: 12px 20px;
  background: var(--brand-yellow);
  color: var(--accent-text);
  border: none;
  border-radius: 24px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-family: inherit;
}

.notify-enable-btn:hover {
  background: var(--brand-yellow-hover);
}

.mention-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.mention-item:hover,
.mention-item.active { background: rgba(255, 212, 0, 0.2); }

.mention-item img {
  width: 28px;
  height: 28px;
  border-radius: 4px;
}

.mention-hint {
  margin-left: auto;
  font-size: 12px;
  color: var(--main-muted);
}

.mention-hint kbd {
  background: #eee;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
}

.composer-input-wrap { position: relative; }

.role-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.role-badge.admin { background: var(--brand-yellow); color: var(--accent-text); }
.role-badge.creator { background: #fff8e6; color: #8a6d00; }
.role-badge.member { background: #eee; color: #444; }
.role-badge.sm { font-size: 10px; padding: 2px 6px; }

.admin-sidebar-link {
  display: block;
  margin: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.admin-sidebar-link:hover { background: rgba(255,255,255,0.2); }

.rail-nav a.rail-btn {
  text-decoration: none;
  color: rgba(255,255,255,0.7);
}

.panel-desc { color: var(--main-muted); margin-bottom: 16px; }
.panel-sub { font-size: 12px; text-transform: uppercase; color: var(--main-muted); margin-bottom: 8px; }

.modal-footer .btn-danger-outline { margin-right: auto; }

/* Admin page */
.admin-page {
  min-height: 100vh;
  background: #f4f4f4;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.admin-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-header-logo {
  height: 36px;
  object-fit: contain;
}

.admin-header-left h1 { font-size: 20px; font-weight: 900; }

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.admin-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.admin-card {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.admin-card h2 { font-size: 18px; margin-bottom: 16px; }

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.admin-card-header h2 { margin: 0; }

.admin-form {
  background: #f8f8f8;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}

.form-row label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }

.form-row input,
.form-row select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
}

.form-actions { display: flex; gap: 8px; justify-content: flex-end; }

.admin-table-wrap { overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--main-muted);
  font-weight: 700;
}

.table-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-user img {
  width: 32px;
  height: 32px;
  border-radius: 4px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
  padding: 4px 8px;
}

.btn-link.danger { color: var(--danger); }

.status-online { color: var(--success); font-weight: 700; }

.form-hint {
  font-size: 13px;
  color: var(--main-muted);
  margin: 12px 0;
  line-height: 1.5;
}

/* Admin access lists use css/admin.css (.admin-check-grid) */

@media (max-width: 700px) {
  .form-row { grid-template-columns: 1fr; }
}
