* {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

html,
body {
  height: 100%
}

body {
  font-family: 'Nunito', sans-serif
}

:root {
  --bg: #0f1117;
  --sidebar: #161b26;
  --main: #1a2030;
  --panel: #1e2535;
  --border: #ffffff0f;
  --accent: #3b82f6;
  --accent2: #60a5fa;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f59e0b;
  --text: #e2e8f0;
  --sub: #64748b;
  --muted: #334155;
  --bubble-me: #1d4ed8;
  --bubble-them: #243044;
  --font: 'Nunito', sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

html,
body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font)
}

#app {
  display: flex;
  height: 100vh
}

#shell {
  display: flex;
  flex: 1;
  min-width: 0;
  height: 100%
}

#nav {
  width: 72px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px
}

.nav-btn {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--muted);
  border: none;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  text-decoration: none
}

.nav-btn.active {
  background: var(--accent);
  color: #fff
}

#screen-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  height: 100%
}

#overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  transition: opacity .4s
}

#overlay.hidden {
  opacity: 0;
  pointer-events: none
}

/* ── QR LOGIN ── */
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  max-width: 360px;
  width: 100%
}

.login-card h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px
}

.login-card p {
  color: var(--sub);
  font-size: 13px;
  margin-bottom: 24px
}

#qr-wrap {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  display: inline-block;
  margin-bottom: 16px;
  min-width: 220px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center
}

#qr-img {
  width: 200px;
  height: 200px;
  display: none
}

.qr-skeleton {
  width: 200px;
  height: 200px;
  background: linear-gradient(90deg, #e2e8f020 25%, #e2e8f040 50%, #e2e8f020 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px
}

@keyframes shimmer {
  0% {
    background-position: 200% 0
  }

  100% {
    background-position: -200% 0
  }
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--muted);
  color: var(--text)
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.5s infinite
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: .3
  }
}

.status-pill.scanned .dot {
  background: var(--green)
}

.status-pill.error .dot {
  background: var(--red);
  animation: none
}

#btn-refresh {
  margin-top: 16px;
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s
}

#btn-refresh:hover {
  background: #2563eb;
  transform: translateY(-1px)
}

/* ── SIDEBAR ── */
#sidebar {
  width: 300px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px
}

.sidebar-actions {
  margin-left: auto;
  display: flex;
  gap: 6px
}

.mini-btn {
  background: var(--muted);
  border: none;
  color: var(--text);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none
}

.mini-btn:hover {
  background: var(--accent)33
}

.avatar-sm {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--muted);
  object-fit: cover;
  flex-shrink: 0;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sub)
}

.sidebar-name {
  font-weight: 700;
  font-size: 15px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border)
}

.tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--sub);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .2s
}

.tab.active {
  color: var(--accent2);
  border-color: var(--accent)
}

.search-wrap {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border)
}

.search-wrap input {
  width: 100%;
  padding: 8px 12px;
  background: var(--muted);
  border: none;
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none
}

.search-wrap input::placeholder {
  color: var(--sub)
}

#thread-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0
}

#thread-list::-webkit-scrollbar {
  width: 4px
}

#thread-list::-webkit-scrollbar-track {
  background: transparent
}

#thread-list::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: 4px
}

.thread-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .15s;
  border-radius: 10px;
  margin: 2px 8px
}

.thread-item:hover {
  background: var(--muted)
}

.thread-item.active {
  background: var(--accent)22
}

.thread-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  position: relative
}

.thread-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

.group-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--accent);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--sidebar);
  font-size: 7px;
  display: flex;
  align-items: center;
  justify-content: center
}

.thread-info {
  flex: 1;
  min-width: 0
}

.thread-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.thread-preview {
  font-size: 12px;
  color: var(--sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px
}

.unread-badge {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  flex-shrink: 0
}

/* ── MAIN CHAT ── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--main);
  min-width: 0
}

#chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--sidebar)
}

#chat-header .h-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  overflow: hidden
}

#chat-header .h-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

#chat-header .h-name {
  font-size: 16px;
  font-weight: 700
}

#chat-header .h-sub {
  font-size: 12px;
  color: var(--sub)
}

.header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--muted);
  border: none;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  font-size: 16px
}

.icon-btn:hover {
  background: var(--accent)33
}

/* ── MESSAGES ── */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px
}

#messages::-webkit-scrollbar {
  width: 4px
}

#messages::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: 4px
}

.msg-row {
  display: flex;
  gap: 10px;
  max-width: 75%;
  animation: fadeUp .2s ease
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

.msg-row.me {
  align-self: flex-end;
  flex-direction: row-reverse
}

.msg-row.them {
  align-self: flex-start
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  align-self: flex-end
}

.msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

.msg-body {
  display: flex;
  flex-direction: column;
  gap: 3px
}

.msg-name {
  font-size: 11px;
  color: var(--sub);
  padding: 0 6px
}

.msg-row.me .msg-name {
  text-align: right
}

.bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  max-width: 100%
}

.me .bubble {
  background: var(--bubble-me);
  border-bottom-right-radius: 4px
}

.them .bubble {
  background: var(--bubble-them);
  border-bottom-left-radius: 4px
}

.bubble img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  display: block;
  margin-top: 4px;
  cursor: pointer
}

.media-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  max-width: 260px
}

.media-card img {
  width: 100%;
  display: block
}

.media-card .caption {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text)
}

.link-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  max-width: 280px
}

.link-card img {
  width: 100%;
  display: block
}

.link-card .body {
  padding: 8px 10px
}

.link-card .title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px
}

.link-card .desc {
  font-size: 12px;
  color: var(--sub)
}

.link-card .url {
  font-size: 11px;
  color: var(--accent2)
}

.msg-time {
  font-size: 10px;
  color: var(--sub);
  padding: 0 6px;
  font-family: var(--mono)
}

.msg-row.me .msg-time {
  text-align: right
}

.day-divider {
  text-align: center;
  font-size: 12px;
  color: var(--sub);
  padding: 8px;
  position: relative
}

.day-divider::before,
.day-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 60px);
  height: 1px;
  background: var(--border)
}

.day-divider::before {
  left: 0
}

.day-divider::after {
  right: 0
}

/* ── INPUT ── */
#input-area {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--sidebar)
}

.input-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px
}

.tool-btn {
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--muted);
  border: none;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: background .2s;
  display: flex;
  align-items: center;
  gap: 5px
}

.tool-btn:hover {
  background: var(--accent)33;
  color: var(--accent2)
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end
}

#msg-input {
  flex: 1;
  background: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  color: var(--main);
  font-family: var(--font);
  font-size: 14px;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  outline: none;
  line-height: 1.5;
  transition: border-color .2s
}

#msg-input:focus {
  border-color: var(--accent)55
}

#msg-input::placeholder {
  color: var(--sub)
}

#btn-send {
  width: 38px;
  height: 38px;
  border-radius: 25px;
  background: var(--accent);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: all .2s
}

#btn-send:hover {
  background: #2563eb;
  transform: scale(1.05)
}

#btn-send:disabled {
  background: var(--muted);
  opacity: .5;
  cursor: not-allowed;
  transform: none
}

/* ── EMPTY STATE ── */
#empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--sub)
}

#empty-state .icon {
  font-size: 56px;
  opacity: .3
}

#empty-state p {
  font-size: 15px
}

/* ── FILE PREVIEW ── */
#file-preview {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--muted);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 13px
}

#file-preview .fname {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

#file-preview .cancel-file {
  cursor: pointer;
  color: var(--red);
  font-size: 18px;
  line-height: 1
}

#file-input {
  display: none
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 13px;
  z-index: 999;
  animation: slideIn .3s ease;
  max-width: 300px
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

.toast.success {
  border-color: var(--green)55
}

.toast.error {
  border-color: var(--red)55
}

/* ── LOADING ── */
#loading-threads {
  text-align: center;
  padding: 20px;
  color: var(--sub);
  font-size: 13px
}

body {
  background: #f6f8fb;
  color: #0f172a;
  overflow: hidden
}

#shell {
  display: flex;
  height: 100vh
}

#nav {
  width: 72px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px
}

.nav-btn {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: #f1f5f9;
  border: none;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 16px
}

.nav-btn.active {
  background: #1d4ed8;
  color: #fff
}

#content {
  flex: 1;
  padding: 18px;
  overflow: auto
}

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 2px #00000008
}

.panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 2px #00000008
}

body {
  background: #f6f8fb;
  color: #0f172a;
  overflow: hidden
}

#shell {
  display: flex;
  height: 100vh
}

#nav {
  width: 72px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px
}

.nav-btn {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: #f1f5f9;
  border: none;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 16px
}

.nav-btn.active {
  background: #1d4ed8;
  color: #fff
}

#content {
  flex: 1;
  overflow: auto
}

.topbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center
}

.breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  color: #64748b;
  font-size: 13px
}

.breadcrumb .pill {
  background: #f1f5f9;
  border-radius: 999px;
  padding: 6px 10px;
  color: #0f172a;
  border: 1px solid #e2e8f0
}

.tabs {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: #64748b
}

.tabs .active {
  color: #1d4ed8;
  font-weight: 700
}

.container {
  padding: 18px
}

.grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px
}

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 2px #00000008
}

.card h3 {
  font-size: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb
}

.card-body {
  padding: 12px 14px
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px
}

.row label {
  font-size: 12px;
  color: #64748b;
  min-width: 110px
}

.row input,
.row textarea,
.row select {
  flex: 1;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  font-size: 12px
}

.row textarea {
  min-height: 180px;
  resize: vertical
}

.actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px
}

.primary {
  background: #1d4ed8;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer
}

.ghost {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer
}

.chat {
  display: flex;
  flex-direction: column;
  height: 100%
}

.chat-body {
  flex: 1;
  padding: 12px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px
}

.msg {
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4
}

.msg.me {
  align-self: flex-end;
  background: #1d4ed8;
  color: #fff
}

.msg.bot {
  align-self: flex-start;
  background: #f1f5f9;
  color: #0f172a
}

.chat-input {
  border-top: 1px solid #e5e7eb;
  padding: 10px;
  display: flex;
  gap: 8px
}

.chat-input input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px
}

.note {
  font-size: 12px;
  color: #64748b
}


/* ── CHAT LIGHT THEME ── */
body.chat-page {
  background: #f6f8fb;
  color: #0f172a
}

.chat-page {
  --text: #0f172a;
  --sub: #64748b;
  --muted: #e2e8f0;
  --panel: #ffffff;
  --sidebar: #ffffff;
  --main: #ffffff;
  --border: #e5e7eb;
  --bubble-me: #1d4ed8;
  --bubble-them: #f1f5f9
}

.chat-page #nav {
  background: #fff;
  border-right: 1px solid #e5e7eb
}

.chat-page .nav-btn {
  background: #f1f5f9;
  color: #0f172a
}

.chat-page .nav-btn.active {
  background: #1d4ed8;
  color: #fff
}

.chat-page #screen-wrap {
  width: 100%
}

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

.chat-page .left-panel {
  min-width: 320px
}

.chat-page .center-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e5e7eb;
  height: 100%;
  overflow: hidden
}

.chat-page .right-panel {
  min-width: 280px
}

.chat-page #main {
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden
}

.chat-page #chat-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden
}

.chat-page #messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto
}

.chat-page #chat-header {
  min-height: 64px
}

.chat-page #sidebar {
  background: #fff;
  border-right: 1px solid #e5e7eb
}

.chat-page .user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px
}

.chat-page .user-name {
  font-weight: 700;
  font-size: 13px;
  color: #0f172a
}

.chat-page .bot-select {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px
}

.chat-page .bot-pill {
  background: #e8f0ff;
  color: #1d4ed8;
  border: 1px solid #c7d7ff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700
}

.chat-page .bot-meta {
  padding: 0 12px 10px;
  font-size: 11px;
  color: #64748b
}

.chat-page .search-wrap {
  padding: 0 12px 10px;
  border-bottom: 1px solid #e5e7eb
}

.chat-page .search-wrap input {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #0f172a
}

.chat-page .tab-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb
}

.chat-page .tab-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #f1f5f9;
  border: none;
  cursor: pointer
}

.chat-page .tab-icon.active {
  background: #1d4ed8;
  color: #fff
}

.chat-page .tab-bar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb
}

.chat-page .tab {
  color: #64748b
}

.chat-page .tab.active {
  color: #1d4ed8;
  border-color: #1d4ed8
}

.chat-page #thread-list {
  background: #fff;
  flex: 1;
  overflow-y: auto
}

.chat-page .thread-item {
  background: #fff;
  border: 1px solid #eef2f7
}

.chat-page .thread-item:hover {
  background: #f8fafc
}

.chat-page .thread-item.active {
  background: #e8f0ff;
  border-color: #c7d7ff
}

.chat-page .thread-preview {
  color: #64748b
}

.chat-page .unread-badge {
  background: #ef4444
}

.chat-page #main {
  background: #fff
}

.chat-page #chat-header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb
}

.chat-page #chat-header {
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 2
}

.chat-page #messages {
  padding: 16px 20px
}

.chat-page #messages {
  background: #fff
}

.chat-page .bubble {
  background: #f1f5f9;
  color: #0f172a
}

.chat-page .me .bubble {
  background: #1d4ed8;
  color: #fff
}

.chat-page .msg-time {
  color: #94a3b8
}

.chat-page #input-area {
  background: #fff;
  border-top: 1px solid #e5e7eb
}

.chat-page #msg-input {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #0f172a
}

.chat-page #btn-send {
  background: #1d4ed8
}

.chat-page .tool-btn {
  background: #f1f5f9;
  color: #0f172a
}

.chat-page .right-panel {
  background: #fff;
  border-left: 1px solid #e5e7eb;
  padding: 14px
}

.chat-page .panel-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 12px
}

.chat-page .panel-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px
}

.chat-page .panel-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px
}

.chat-page .panel-name {
  font-weight: 700
}

.chat-page .panel-sub {
  color: #64748b;
  font-size: 12px
}

.chat-page .panel-actions {
  display: flex;
  flex-direction: column;
  gap: 8px
}

.chat-page .panel-action {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  color: #0f172a;
  background: #f8fafc
}

.chat-page #overlay {
  background: #f6f8fb
}

.chat-page .login-card {
  background: #fff;
  border: 1px solid #e5e7eb
}

.chat-page .status-pill {
  background: #f1f5f9;
  color: #0f172a
}

/* ── NEW LAYOUT (future_group_chat style) ── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

html,
body {
  height: 100%;
  overflow: hidden
}

body {
  font-family: 'Be Vietnam Pro', 'Nunito', sans-serif;
  background: #f0f2f5;
  color: #050505;
  font-size: 14px
}

/* Overlay / QR Login */
#overlay {
  position: fixed;
  inset: 0;
  background: #f0f2f5;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center
}

.qr-card {
  background: #fff;
  border: 1px solid #e4e6eb;
  border-radius: 20px;
  padding: 36px 40px;
  text-align: center;
  max-width: 360px;
  width: 100%
}

.qr-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 24px
}

.qr-logo-text {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.3px
}

.qr-logo-text span {
  color: #0866ff
}

.qr-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #050505
}

.qr-desc {
  color: #65676b;
  font-size: 13px;
  margin-bottom: 20px
}

.qr-wrap {
  background: #fff;
  border: 1px solid #e4e6eb;
  border-radius: 12px;
  padding: 12px;
  display: inline-block;
  margin-bottom: 16px
}

.qr-skeleton {
  width: 200px;
  height: 200px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite
}

@keyframes shimmer {
  0% {
    background-position: 200% 0
  }

  100% {
    background-position: -200% 0
  }
}

#qr-img {
  width: 200px;
  height: 200px;
  display: none
}

.qr-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  background: #f0f2f5;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px
}

.qr-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0866ff;
  animation: pulse 1.5s infinite
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: .3
  }
}

.qr-status.scanned .qr-dot {
  background: #22c55e
}

.qr-refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 auto;
  padding: 10px 24px;
  background: #0866ff;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer
}

.qr-refresh:hover {
  background: #0757d6
}

/* App body */
#app,
#app {
  height: 100vh;
  display: flex;
  flex-direction: column
}

.app-body {
  flex: 1;
  display: flex;
  overflow: hidden
}

/* Top header */
.top-header {
  height: 48px;
  background: #fff;
  border-bottom: 1px solid #e4e6eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 20
}

.top-header-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 13px;
  color: #050505;
  text-decoration: none
}

.workgpt-text {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #1a1a2e
}

.top-header-spacer {
  flex: 1
}

.top-header-actions {
  display: flex;
  align-items: center;
  gap: 6px
}

.top-header-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #65676b;
  position: relative
}

.top-header-icon:hover {
  background: #f2f2f2
}

.top-header-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #e41e26;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 4px;
  min-width: 16px;
  text-align: center
}

.top-robot-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px
}

.header-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  background: linear-gradient(135deg, #e41e26, #c0392b)
}

.header-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

/* Left nav */
.left-nav {
  width: 56px;
  background: #fff;
  border-right: 1px solid #e4e6eb;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 6px;
  flex-shrink: 0;
  z-index: 10
}

.nav-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
  color: #65676b;
  position: relative
}

.nav-icon:hover {
  background: #f2f2f2
}

.nav-icon.active {
  background: #e7f0ff;
  color: #0866ff
}

.nav-icon svg {
  width: 20px;
  height: 20px
}

/* Sidebar */
.sidebar {
  width: 320px;
  background: #fff;
  border-right: 1px solid #e4e6eb;
  display: flex;
  flex-direction: column;
  flex-shrink: 0
}

.sidebar-header {
  padding: 12px 12px 8px;
  border-bottom: 1px solid #e4e6eb
}

.user-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.my-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #e41e26, #c0392b);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px
}

.my-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

.my-name {
  font-weight: 700;
  font-size: 13px;
  color: #050505
}

.bot-selector {
  display: flex;
  align-items: center;
  background: #0866ff;
  color: #fff;
  border-radius: 20px;
  padding: 5px 10px 5px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: fit-content;
  gap: 8px;
  margin-bottom: 8px
}

.bot-selector-close {
  width: 16px;
  height: 16px;
  background: rgba(255, 255, 255, .3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer
}

.search-bar {
  display: flex;
  align-items: center;
  background: #f0f2f5;
  border-radius: 20px;
  padding: 6px 12px;
  gap: 8px;
  width: 100%;
}

.search-bar input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 13px;
  color: #050505;
  font-family: inherit
}

.search-bar input::placeholder {
  color: #65676b
}

.search-bar svg {
  color: #65676b;
  width: 16px;
  height: 16px;
  flex-shrink: 0
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  padding: 6px 12px;
  gap: 4px;
  border-bottom: 1px solid #e4e6eb;
  justify-content: center
}

.filter-tab {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  flex: 1 0 0;
  align-items: center;
  justify-content: center;
  color: #65676b;
  transition: background .15s
}

.filter-tab:hover {
  background: #f2f2f2
}

.filter-tab.active {
  background: #e7f0ff;
  color: #0866ff
}

.filter-tab svg {
  width: 18px;
  height: 18px
}

/* Conversation list */
.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0
}

.conv-list::-webkit-scrollbar {
  width: 4px
}

.conv-list::-webkit-scrollbar-track {
  background: transparent
}

.conv-list::-webkit-scrollbar-thumb {
  background: #e4e6eb;
  border-radius: 4px
}

#loading-threads {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 0;
  color: #65676b;
  font-size: 13px
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid #e4e6eb;
  border-top-color: #0866ff;
  border-radius: 50%;
  animation: spin .8s linear infinite
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

/* Chat area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f0f2f5;
  min-width: 0
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #65676b
}

.chat-empty svg {
  width: 56px;
  height: 56px;
  opacity: .3
}

.chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0
}

.chat-header {
  background: #fff;
  border-bottom: 1px solid #e4e6eb;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0
}

.chat-header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  background: linear-gradient(135deg, #e41e26, #c0392b)
}

.chat-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

.chat-header-info {
  flex: 1
}

.chat-header-name {
  font-weight: 700;
  font-size: 15px;
  color: #050505
}

.chat-header-sub {
  font-size: 12px;
  color: #65676b;
  display: flex;
  align-items: center;
  gap: 8px
}

.choose-tag-btn {
  background: #e7f0ff;
  color: #0866ff;
  border: none;
  border-radius: 16px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: inherit
}

/* Messages */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px
}

.messages-area::-webkit-scrollbar {
  width: 4px
}

.messages-area::-webkit-scrollbar-thumb {
  background: #e4e6eb;
  border-radius: 4px
}

.date-divider {
  text-align: center;
  font-size: 12px;
  color: #65676b;
  background: rgba(255, 255, 255, .8);
  padding: 4px 14px;
  border-radius: 12px;
  width: fit-content;
  margin: 0 auto
}

.msg-loading {
  display: flex;
  justify-content: center;
  padding: 20px
}

.message-group {
  display: flex;
  gap: 10px;
  align-items: flex-end
}

.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #e41e26, #c0392b)
}

.msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

.msg-content {
  max-width: 75%
}

.msg-sender {
  font-size: 12px;
  font-weight: 600;
  color: #0866ff;
  margin-bottom: 4px;
  padding-left: 4px
}

.msg-bubble {
  background: #fff;
  border-radius: 16px 16px 16px 4px;
  padding: 8px 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08)
}

.msg-text {
  font-size: 13.5px;
  color: #050505;
  line-height: 1.5;
  margin-top: 6px;
  word-break: break-all;
}

.msg-time {
  font-size: 11px;
  color: #65676b;
  margin-top: 4px;
  padding-left: 4px
}

.msg-image {
  border-radius: 12px;
  overflow: hidden;
  width: 220px;
  height: 200px
}

/* Input area */
.chat-input-area {
  background: #fff;
  border-top: 1px solid #e4e6eb;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0
}

.input-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: pointer;
  color: #0866ff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s
}

.input-icon-btn:hover {
  background: #f2f2f2
}

.input-icon-btn svg {
  width: 22px;
  height: 22px
}

.chat-input {
  flex: 1;
  background: #f0f2f5;
  border: none;
  border-radius: 20px;
  padding: 9px 16px;
  outline: none;
  font-size: 14px;
  color: #050505;
  font-family: inherit
}

.chat-input::placeholder {
  color: #65676b
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 4px
}

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #0866ff;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s
}

.send-btn:hover {
  background: #0757d6
}

.send-btn svg {
  width: 18px;
  height: 18px
}

.file-preview {
  display: none;
  align-items: center;
  gap: 8px;
  background: #f0f2f5;
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 13px;
  flex: 1
}

.file-preview-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.file-preview-cancel {
  cursor: pointer;
  color: #e41e26;
  font-size: 18px;
  line-height: 1
}

/* Right info panel */
.info-panel {
  width: 280px;
  background: #fff;
  border-left: 1px solid #e4e6eb;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto
}

.info-panel::-webkit-scrollbar {
  width: 4px
}

.info-panel::-webkit-scrollbar-thumb {
  background: #e4e6eb;
  border-radius: 4px
}

.info-title {
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  color: #050505;
  border-bottom: 1px solid #e4e6eb
}

.info-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 12px;
  gap: 8px;
  border-bottom: 1px solid #e4e6eb
}

.info-main-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #c0392b, #922b21);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  font-weight: 700
}

.info-main-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

.info-name {
  font-size: 15px;
  font-weight: 700;
  color: #050505;
  display: flex;
  align-items: center;
  gap: 6px
}

.info-members {
  font-size: 12px;
  color: #65676b
}

.info-actions-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 12px 16px;
  border-bottom: 1px solid #e4e6eb
}

.info-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer
}

.info-action-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3e4042;
  transition: background .15s
}

.info-action-icon:hover {
  background: #e4e6eb
}

.info-action-icon.active {
  background: #e7f0ff;
  color: #0866ff
}

.info-action-icon svg {
  width: 18px;
  height: 18px
}

.info-action span {
  font-size: 10.5px;
  color: #65676b;
  text-align: center;
  max-width: 70px
}

.info-row {
  display: flex;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid #e4e6eb;
  cursor: pointer;
  transition: background .15s;
  gap: 12px
}

.info-row:hover {
  background: #f2f2f2
}

.info-row-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3e4042;
  flex-shrink: 0
}

.info-row-icon svg {
  width: 18px;
  height: 18px
}

.info-row-content {
  flex: 1
}

.info-row-title {
  font-size: 13px;
  font-weight: 600;
  color: #050505
}

.info-row-sub {
  font-size: 11px;
  color: #65676b;
  margin-top: 1px
}

.info-row-arrow {
  color: #65676b
}

.info-row-action {
  color: #0866ff;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s
}

.info-row-action:hover {
  background: #e7f0ff
}

/* Thread items */
.conv-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 10px;
  cursor: pointer;
  transition: background .15s;
  border-radius: 8px;
  margin: 1px 6px
}

.conv-item:hover {
  background: #f2f2f2
}

.conv-item.active {
  background: #e7f0ff
}

.conv-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff
}

.conv-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff
}

.avatar-red {
  background: linear-gradient(135deg, #e41e26, #c0392b)
}

.avatar-blue {
  background: linear-gradient(135deg, #0866ff, #0052cc)
}

.avatar-green {
  background: linear-gradient(135deg, #28a745, #20863a)
}

.avatar-orange {
  background: linear-gradient(135deg, #e07d00, #c56a00)
}

.tag-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  border-radius: 4px;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 3px;
  color: #fff;
  border: 1.5px solid #fff
}

.tag-dt {
  background: #e07d00
}

.tag-cn {
  background: #6c5ce7
}

.tag-cc {
  background: #e74c3c
}

.conv-info {
  flex: 1;
  min-width: 0
}

.conv-name {
  font-weight: 600;
  font-size: 13px;
  color: #050505;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.conv-preview {
  font-size: 12px;
  color: #65676b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px
}

.conv-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0
}

.conv-time {
  font-size: 11px;
  color: #65676b
}

.unread-badge {
  background: #e41e26;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center
}

/* Tags on avatar in list */
.avatar-tag-DT::after {
  content: 'ĐT';
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: #e07d00;
  color: #fff;
  font-size: 7px;
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 3px;
  border: 1.5px solid #fff
}

/* Avatar colors for conv list */
.c0 {
  background: linear-gradient(135deg, #e41e26, #c0392b)
}

.c1 {
  background: linear-gradient(135deg, #e07d00, #c56a00)
}

.c2 {
  background: linear-gradient(135deg, #0866ff, #0052cc)
}

.c3 {
  background: linear-gradient(135deg, #28a745, #20863a)
}

.c4 {
  background: linear-gradient(135deg, #6c5ce7, #4834d4)
}

.c5 {
  background: linear-gradient(135deg, #e74c3c, #c0392b)
}

.c6 {
  linear-gradient(135deg, #20863a, #14532d)
}

/* ── USER DROPDOWN ── */
.user-menu-wrap { position: relative; }

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 220px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
  z-index: 999;
  overflow: hidden;
  animation: fadeUp .15s ease;
}

.user-dropdown-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.user-dropdown-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.user-dropdown-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-dropdown-info { min-width: 0; }

.user-dropdown-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown-label {
  font-size: 11px;
  color: var(--sub);
  margin-top: 2px;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background .15s;
}

.user-dropdown-item:hover { background: var(--border); }

.user-dropdown-item.danger { color: var(--red); }

.user-dropdown-item svg { flex-shrink: 0; opacity: .8; }

/* ── ACCOUNT SWITCHER (left nav) ── */
.account-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.account-avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--muted);
  border: 2px solid transparent;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  transition: border-color .2s, transform .15s;
  flex-shrink: 0;
}
.account-avatar-btn:hover    { transform: scale(1.08); }
.account-avatar-btn.active   { border-color: var(--accent); }
.account-avatar-btn img      { width: 100%; height: 100%; object-fit: cover; }

.account-add-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px dashed var(--sub);
  background: transparent;
  color: var(--sub);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .2s, color .2s;
  line-height: 1;
}
.account-add-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── BOT CONFIG PANEL ── */
.bot-config-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f0f2f5;
  min-width: 0;
  overflow: hidden;
}

.bot-topbar {
  background: #fff;
  border-bottom: 1px solid #e4e6eb;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.bot-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #64748b;
}

.bot-breadcrumb strong { color: #050505; }

.bot-breadcrumb-icon {
  width: 22px;
  height: 22px;
  background: #e7f0ff;
  color: #0866ff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bot-bc-sep { color: #cbd5e1; }

.bot-tabs {
  display: flex;
  gap: 4px;
}

.bot-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: #64748b;
  cursor: pointer;
  font-weight: 500;
  transition: background .15s;
}

.bot-tab:hover { background: #f1f5f9; }

.bot-tab.active {
  color: #0866ff;
  font-weight: 700;
  border-bottom: 2px solid #0866ff;
  border-radius: 0;
}

.bot-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
  padding: 16px;
  overflow: auto;
  align-items: start;
}

.bot-body::-webkit-scrollbar { width: 4px; }
.bot-body::-webkit-scrollbar-thumb { background: #e4e6eb; border-radius: 4px; }

.bot-left { display: flex; flex-direction: column; gap: 16px; }

.bot-card {
  background: #fff;
  border: 1px solid #e4e6eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.bot-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #050505;
  padding: 12px 16px;
  border-bottom: 1px solid #e4e6eb;
}

.bot-card-desc {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 12px;
}

.bot-card-body {
  padding: 14px 16px;
}

.bot-card-body--table { padding: 0; }

.bot-textarea {
  width: 100%;
  min-height: 200px;
  resize: vertical;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  color: #050505;
  outline: none;
  background: #f8fafc;
  line-height: 1.6;
}

.bot-textarea:focus { border-color: #0866ff; }

.bot-char-count {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
  text-align: right;
}

.bot-card-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.bot-btn-primary {
  background: #0866ff;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
}

.bot-btn-primary:hover { background: #0757d6; }
.bot-btn-primary:disabled { background: #93c5fd; cursor: not-allowed; }

.bot-field {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.bot-field label {
  font-size: 12px;
  color: #64748b;
  min-width: 120px;
  flex-shrink: 0;
}

.bot-field input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  color: #050505;
  background: #f8fafc;
  outline: none;
}

.bot-field input:focus { border-color: #0866ff; }

/* Doc table */
.bot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.bot-table th {
  background: #f8fafc;
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  border-bottom: 1px solid #e4e6eb;
}

.bot-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #050505;
}

.bot-table tr:last-child td { border-bottom: none; }
.bot-table tr:hover td { background: #f8fafc; }

.bot-doc-link {
  color: #0866ff;
  text-decoration: none;
  font-size: 12px;
}

.bot-doc-link:hover { text-decoration: underline; }

.bot-doc-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.bot-doc-type--sheets { background: #dcfce7; color: #166534; }
.bot-doc-type--docs   { background: #dbeafe; color: #1e40af; }
.bot-doc-type--file   { background: #f1f5f9; color: #475569; }

.bot-doc-del {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
}

.bot-doc-del:hover { color: #ef4444; background: #fee2e2; }

.bot-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid #e4e6eb;
  font-size: 12px;
  color: #64748b;
  gap: 12px;
}

.bot-table-info { display: flex; align-items: center; gap: 4px; }

.bot-pagination {
  display: flex;
  gap: 3px;
}

.bot-pagination button {
  width: 28px;
  height: 28px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  color: #374151;
}

.bot-pagination button:hover:not(:disabled) { background: #e7f0ff; border-color: #0866ff; color: #0866ff; }
.bot-pagination button:disabled { opacity: .4; cursor: not-allowed; }
.bot-pagination button.active { background: #0866ff; color: #fff; border-color: #0866ff; }

/* Bot chat panel */
.bot-right { position: sticky; top: 0; }

.bot-chat-panel {
  background: #fff;
  border: 1px solid #e4e6eb;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  height: 560px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.bot-chat-header {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #050505;
  border-bottom: 1px solid #e4e6eb;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bot-chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
}

.bot-chat-empty-icon {
  width: 72px;
  height: 72px;
  background: #e7f0ff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bot-chat-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: #050505;
}

.bot-chat-empty-sub {
  font-size: 13px;
  color: #64748b;
  text-align: center;
}

.bot-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bot-chat-messages::-webkit-scrollbar { width: 4px; }
.bot-chat-messages::-webkit-scrollbar-thumb { background: #e4e6eb; border-radius: 4px; }

.bot-chat-msg { display: flex; }
.bot-chat-msg--user { justify-content: flex-end; }
.bot-chat-msg--bot  { justify-content: flex-start; }

.bot-chat-bubble {
  max-width: 80%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.bot-chat-msg--user .bot-chat-bubble {
  background: #0866ff;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bot-chat-msg--bot .bot-chat-bubble {
  background: #f1f5f9;
  color: #050505;
  border-bottom-left-radius: 4px;
}

.bot-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}

.bot-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: botTyping 1.2s infinite;
}

.bot-typing span:nth-child(2) { animation-delay: .2s; }
.bot-typing span:nth-child(3) { animation-delay: .4s; }

@keyframes botTyping {
  0%, 80%, 100% { transform: scale(1); opacity: .5; }
  40% { transform: scale(1.3); opacity: 1; }
}

.bot-chat-input-area {
  border-top: 1px solid #e4e6eb;
  padding: 10px 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.bot-chat-input {
  flex: 1;
  background: #f0f2f5;
  border: none;
  border-radius: 16px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  color: #050505;
  outline: none;
  resize: none;
  min-height: 36px;
  max-height: 100px;
  line-height: 1.5;
}

.bot-chat-input::placeholder { color: #94a3b8; }

.bot-chat-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #0866ff;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}

.bot-chat-send:hover { background: #0757d6; }
.bot-chat-send:disabled { background: #93c5fd; cursor: not-allowed; }

.bot-chat-send svg { width: 15px; height: 15px; }

.bot-chat-hint {
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  padding: 4px 12px 8px;
  flex-shrink: 0;
}
