
/* ---------- THEME TOKENS ---------- */
:root,
[data-theme="light"] {
  --bg: #f5f7fb;
  --bg-elev: #ffffff;
  --bg-soft: #f0f2f7;
  --bg-hover: #eaeef5;
  --border: #e3e7ee;
  --border-strong: #d1d6df;
  --text: #1a1f2e;
  --text-muted: #6b7280;
  --text-soft: #4b5563;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --danger: #dc2626;
  --success: #16a34a;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 12px rgba(15,23,42,.06);
  --shadow-lg: 0 10px 30px rgba(15,23,42,.12);
  --bubble-mine-bg: #4f46e5;
  --bubble-mine-fg: #ffffff;
  --bubble-other-bg: #ffffff;
  --bubble-other-fg: #1a1f2e;
  --bubble-other-border: #e3e7ee;
}
[data-theme="dark"] {
  --bg: #0f1115;
  --bg-elev: #1a1d24;
  --bg-soft: #15181f;
  --bg-hover: #232733;
  --border: #2a2f3a;
  --border-strong: #3a4150;
  --text: #e6e8ee;
  --text-muted: #8b93a6;
  --text-soft: #b6bdcd;
  --primary: #818cf8;
  --primary-hover: #a5afff;
  --primary-soft: #1e2236;
  --danger: #f87171;
  --success: #4ade80;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.5);
  --bubble-mine-bg: #4f46e5;
  --bubble-mine-fg: #ffffff;
  --bubble-other-bg: #232733;
  --bubble-other-fg: #e6e8ee;
  --bubble-other-border: #2a2f3a;
}

/* ---------- BASE ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.block { display: block; width: 100%; }
.block-label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; color: var(--text-soft); }

/* ---------- FLASH ---------- */
.flash {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  padding: 10px 18px; border-radius: 8px; z-index: 9999;
  box-shadow: var(--shadow-lg);
  font-size: 14px; font-weight: 500;
  animation: flashIn .2s ease-out, flashOut .3s ease-in 4s forwards;
}
.flash-success { background: var(--success); color: #fff; }
.flash-error   { background: var(--danger);  color: #fff; }
@keyframes flashIn { from { opacity:0; transform: translate(-50%, -8px); } to { opacity:1; transform: translate(-50%, 0);} }
@keyframes flashOut { to { opacity:0; } }

/* ---------- AUTH ---------- */
.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--bg); position: relative;
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--bg-elev);
  border-radius: 16px; padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-logo {
  width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 12px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white; font-weight: 800; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.auth-card h1 { font-size: 22px; margin: 0 0 4px; }
.auth-form label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--text-soft); }
.auth-form input {
  display: block; width: 100%; margin-top: 6px; padding: 11px 14px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); font-size: 15px;
}
.auth-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.auth-form input:disabled { color: var(--text-muted); }
.auth-foot { text-align: center; margin: 20px 0 0; font-size: 13px; }
.alert-inline { padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.alert-inline.error { background: rgba(220,38,38,.1); color: var(--danger); border: 1px solid rgba(220,38,38,.25); }
.theme-toggle-floating {
  position: absolute; top: 20px; right: 20px;
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-elev); color: var(--text); cursor: pointer; font-size: 18px;
}

/* ---------- BUTTONS ---------- */
.btn-primary {
  padding: 11px 18px; border-radius: 10px; border: none;
  background: var(--primary); color: white; font-weight: 600; font-size: 15px;
  cursor: pointer; transition: background .15s;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary.block { width: 100%; }
.btn-secondary {
  padding: 9px 14px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--bg-elev); color: var(--text); font-weight: 500; font-size: 14px;
  cursor: pointer; transition: background .15s;
}
.btn-secondary:hover { background: var(--bg-hover); }
.btn-secondary.block { width: 100%; margin-bottom: 6px; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 14px; padding: 0; }
.btn-link.danger { color: var(--danger); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: none;
  background: transparent; color: var(--text); cursor: pointer; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--bg-hover); }

/* ---------- APP SHELL ---------- */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: 320px; min-width: 320px; height: 100%;
  background: var(--bg-elev); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.sidebar-head {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 9px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--text-muted); margin-top: -2px; }
.head-actions { display: flex; gap: 4px; position: relative; }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 240px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 6px;
  display: none; z-index: 100;
}
.dropdown-menu.open { display: block; }
.dropdown-head { display: flex; gap: 10px; padding: 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dropdown-item {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 6px;
  background: transparent; border: none; color: var(--text); cursor: pointer;
  font-size: 14px; text-decoration: none;
}
.dropdown-item:hover { background: var(--bg-hover); text-decoration: none; }

.sidebar-actions { padding: 12px 12px 6px; }

.conv-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.conv-item {
  display: flex; gap: 10px; padding: 9px 10px; border-radius: 9px;
  cursor: pointer; transition: background .12s;
}
.conv-item:hover { background: var(--bg-hover); }
.conv-item.active { background: var(--primary-soft); }
.conv-avatar {
  width: 38px; height: 38px; border-radius: 9px;
  color: white; font-weight: 700; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.conv-meta { flex: 1; min-width: 0; }
.conv-title-row { display: flex; justify-content: space-between; align-items: baseline; }
.conv-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-preview { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv-badge {
  background: var(--primary); color: white; font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 10px; min-width: 20px; text-align: center;
}
.empty-hint { text-align: center; color: var(--text-muted); font-size: 13px; padding: 30px 12px; line-height: 1.6; }

/* ---------- CHAT PANE ---------- */
.chat-pane {
  flex: 1; display: flex; flex-direction: column;
  background: var(--bg); min-width: 0; height: 100%;
}
.chat-head {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  background: var(--bg-elev); display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.chat-head-title { font-weight: 700; font-size: 16px; }
.chat-head-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px 24px;
  display: flex; flex-direction: column; gap: 10px;
}
.msg-row { display: flex; gap: 10px; max-width: 80%; }
.msg-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
  width: 34px; height: 34px; border-radius: 9px;
  color: white; font-weight: 700; flex-shrink: 0; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.msg-bubble {
  background: var(--bubble-other-bg); color: var(--bubble-other-fg);
  border: 1px solid var(--bubble-other-border);
  padding: 9px 13px; border-radius: 14px; max-width: 100%;
  box-shadow: 0 1px 1px rgba(0,0,0,.03);
}
.msg-row.mine .msg-bubble {
  background: var(--bubble-mine-bg); color: var(--bubble-mine-fg);
  border-color: transparent;
}
.msg-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.msg-row.mine .msg-meta { text-align: right; }
.msg-body { font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.msg-body .mention { background: rgba(99,102,241,.18); color: var(--primary); padding: 1px 5px; border-radius: 4px; font-weight: 600; }
.msg-row.mine .msg-body .mention { background: rgba(255,255,255,.22); color: white; }
.msg-edited { font-size: 11px; opacity: .7; margin-left: 4px; }

.msg-attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.attach-image { max-width: 320px; max-height: 240px; border-radius: 8px; cursor: pointer; display: block; }
.attach-file {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px;
  background: rgba(0,0,0,.06); color: inherit; text-decoration: none;
  font-size: 13px;
}
.msg-row.mine .attach-file { background: rgba(255,255,255,.15); color: white; }
.attach-file:hover { text-decoration: none; opacity: .9; }
.attach-icon {
  width: 32px; height: 32px; border-radius: 6px;
  background: rgba(0,0,0,.1); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
}
.msg-row.mine .attach-icon { background: rgba(255,255,255,.2); }
.attach-meta { font-size: 11px; opacity: .75; }

.chat-composer {
  border-top: 1px solid var(--border); background: var(--bg-elev);
  padding: 12px 16px; flex-shrink: 0;
}
.composer-attachments {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px;
}
.composer-attachments:empty { display: none; }
.composer-attach-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px 5px 10px; border-radius: 6px;
  background: var(--bg-hover); font-size: 12px;
}
.composer-attach-chip .x {
  cursor: pointer; padding: 0 4px; border-radius: 4px;
}
.composer-attach-chip .x:hover { background: rgba(0,0,0,.1); }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer-row textarea {
  flex: 1; resize: none; min-height: 42px; max-height: 200px;
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--bg-soft); color: var(--text); font: inherit; font-size: 14.5px;
}
.composer-row textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.empty-state {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px; text-align: center;
}
.empty-logo {
  width: 80px; height: 80px; border-radius: 20px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white; font-weight: 800; font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
}

.avatar {
  width: 28px; height: 28px; border-radius: 7px; color: white;
  font-weight: 700; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- MEMBERS PANEL ---------- */
.members-bar {
  padding: 10px 20px; border-bottom: 1px solid var(--border);
  background: var(--bg-soft); font-size: 12px; color: var(--text-muted);
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
.member-chip { display: inline-flex; align-items: center; gap: 6px; }
.presence-dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; }
.presence-dot.online { background: #22c55e; }

/* ---------- MODAL ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 24px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  width: 100%; max-width: 480px; max-height: 80vh; display: flex; flex-direction: column;
  background: var(--bg-elev); border-radius: 14px; box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-body input[type="search"], .modal-body input[type="text"] {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--bg-soft); color: var(--text);
  font-size: 14px; margin-bottom: 12px;
}
.user-list { max-height: 320px; overflow-y: auto; }
.user-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.user-item:hover { background: var(--bg-hover); }
.user-item-check { cursor: default; }
.user-item-check input { margin-right: 4px; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }

/* ---------- ADMIN ---------- */
.admin-shell { max-width: 1100px; margin: 0 auto; padding: 24px; }
.admin-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.admin-head h1 { margin: 0; font-size: 22px; }
.back-link { color: var(--text-muted); font-size: 14px; }
.admin-section { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; }
.admin-section h2 { font-size: 15px; margin: 0 0 12px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .04em; }
.admin-inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin-inline-form input[type="text"], .admin-inline-form input[type="email"] {
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg-soft); color: var(--text); font-size: 14px;
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.badge { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge.ok { background: rgba(22,163,74,.15); color: var(--success); }
.badge.muted { background: var(--bg-hover); color: var(--text-muted); }

/* ---------- SCROLLBAR ---------- */
.conv-list::-webkit-scrollbar, .chat-messages::-webkit-scrollbar, .user-list::-webkit-scrollbar { width: 8px; }
.conv-list::-webkit-scrollbar-thumb, .chat-messages::-webkit-scrollbar-thumb, .user-list::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 4px;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 720px) {
  .sidebar { width: 100%; min-width: 0; position: absolute; z-index: 50; }
  .app-shell.show-chat .sidebar { display: none; }
  .app-shell.show-chat .chat-pane { display: flex; }
}


/* ---------- RICH COMPOSER (contenteditable) ---------- */
.composer-row .composer-input {
  flex: 1;
  min-height: 42px;
  max-height: 200px;
  overflow-y: auto;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  line-height: 1.4;
  outline: none;
  word-break: break-word;
}
.composer-row .composer-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.composer-row .composer-input:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
  display: block;
}
.composer-row .composer-input p { margin: 0 0 4px; }
.composer-row .composer-input p:last-child { margin-bottom: 0; }
.composer-row .composer-input ul,
.composer-row .composer-input ol { margin: 4px 0 4px 20px; padding: 0; }
.composer-row .composer-input a { color: var(--primary); }
.composer-row .composer-input img { max-width: 100%; border-radius: 6px; }

/* ---------- RICH MESSAGE BODY ---------- */
.msg-body > :first-child { margin-top: 0 !important; }
.msg-body > :last-child  { margin-bottom: 0 !important; }
.msg-body p { margin: 0 0 6px; }
.msg-body h1, .msg-body h2, .msg-body h3,
.msg-body h4, .msg-body h5, .msg-body h6 {
  margin: 6px 0 4px;
  font-weight: 700;
  line-height: 1.25;
}
.msg-body h1 { font-size: 1.25em; }
.msg-body h2 { font-size: 1.18em; }
.msg-body h3 { font-size: 1.10em; }
.msg-body h4,
.msg-body h5,
.msg-body h6 { font-size: 1em; }
.msg-body ul, .msg-body ol { margin: 4px 0 4px 20px; padding: 0; }
.msg-body li { margin: 2px 0; }
.msg-body code {
  background: rgba(0,0,0,.08);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.msg-body pre {
  background: rgba(0,0,0,.08);
  padding: 10px 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 6px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  white-space: pre;
}
.msg-body pre code { background: transparent; padding: 0; }
.msg-body blockquote {
  border-left: 3px solid var(--border-strong);
  padding: 2px 12px;
  margin: 6px 0;
  color: var(--text-muted);
}
.msg-body a { color: var(--primary); text-decoration: underline; }
.msg-row.mine .msg-body a { color: #fff; text-decoration: underline; }
.msg-row.mine .msg-body code,
.msg-row.mine .msg-body pre { background: rgba(255,255,255,.18); }
.msg-row.mine .msg-body blockquote { border-left-color: rgba(255,255,255,.45); color: rgba(255,255,255,.85); }

/* ---------- SIDEBAR UNREAD ---------- */
.conv-title-row { gap: 6px; }
.conv-item .conv-title { display: inline-flex; align-items: center; gap: 6px; }
.conv-item .conv-title .conv-badge {
  background: var(--primary); color: white; font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: 10px; min-width: 20px; text-align: center;
  line-height: 1.4;
}
.conv-item.has-unread .conv-title { font-weight: 700; }
.conv-item.has-unread .conv-preview { color: var(--text); font-weight: 500; }

/* ---------- SIDEBAR USER SEARCH ---------- */
.user-search-wrap { position: relative; }
.user-search-wrap input[type="search"] {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  outline: none;
  -webkit-appearance: none;
}
.user-search-wrap input[type="search"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.user-search-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  max-height: 360px; overflow-y: auto;
  z-index: 80;
  padding: 4px;
}
.user-search-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
}
.user-search-item:hover { background: var(--bg-hover); }
.user-search-empty { padding: 14px; color: var(--text-muted); font-size: 13px; text-align: center; }

/* ---------- NAVRAIL ---------- */
.app-shell { /* sidebar layout stays the same; navrail prepends */ }
.navrail {
  width: 60px;
  flex-shrink: 0;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}
.navrail-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}
.navrail-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  text-decoration: none;
  transition: background .12s ease, color .12s ease;
}
.navrail-btn:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.navrail-btn.active { color: var(--text); background: var(--primary-soft); }
.navrail-btn svg {
  width: 20px; height: 20px;
  stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.navrail-badge {
  position: absolute;
  top: 4px; right: 4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  min-width: 16px;
  text-align: center;
  line-height: 1.3;
}
@media (max-width: 720px) {
  .navrail { width: 52px; }
  .navrail-btn { width: 36px; height: 36px; }
}


/* ---------- MESSAGE ACTION BUTTONS ---------- */
.msg-col { display: flex; flex-direction: column; min-width: 0; }
.msg-bubble-wrap { display: flex; align-items: flex-end; gap: 6px; max-width: 100%; }
.msg-row.mine .msg-bubble-wrap { flex-direction: row-reverse; }
.msg-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .12s, transform .12s;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  box-shadow: var(--shadow);
  align-self: center;
}
.msg-bubble-wrap:hover .msg-actions { opacity: 1; transform: translateY(0); }
.msg-action {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: 999px;
  color: var(--text-soft); cursor: pointer;
}
.msg-action:hover { background: var(--bg-hover); color: var(--text); }
.msg-action.danger:hover { color: var(--danger); }

/* ---------- REPLY QUOTE (inside bubble) ---------- */
.msg-quote {
  background: rgba(0,0,0,.05);
  border-left: 3px solid var(--primary);
  padding: 6px 10px;
  margin-bottom: 6px;
  border-radius: 6px;
  cursor: pointer;
  max-width: 100%;
}
.msg-row.mine .msg-quote {
  background: rgba(255,255,255,.18);
  border-left-color: rgba(255,255,255,.6);
}
.msg-quote:hover { filter: brightness(0.95); }
.msg-quote-name { font-weight: 700; font-size: 12px; color: var(--primary); margin-bottom: 2px; }
.msg-row.mine .msg-quote-name { color: white; }
.msg-quote-body { font-size: 13px; opacity: 0.85; max-height: 3.4em; overflow: hidden; word-break: break-word; }

/* Highlight when jumping to a referenced message */
.msg-flash .msg-bubble { animation: msgFlash 1.4s ease; }
@keyframes msgFlash {
  0%   { box-shadow: 0 0 0 0 var(--primary); }
  20%  { box-shadow: 0 0 0 4px var(--primary-soft); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------- REPLY PREVIEW (above composer) ---------- */
.reply-preview {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 8px 16px;
}
.reply-preview-inner {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: 6px 10px;
}
.reply-preview-meta { font-size: 12px; color: var(--text-soft); display: flex; align-items: center; gap: 4px; }
.reply-preview-body { flex: 1; font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-preview-x {
  border: none; background: transparent; cursor: pointer;
  color: var(--text-muted); font-size: 18px; line-height: 1;
  width: 24px; height: 24px; border-radius: 6px;
}
.reply-preview-x:hover { background: var(--bg-hover); color: var(--text); }

/* ---------- FORWARD MODAL ---------- */
.forward-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.forward-item:hover { background: var(--bg-hover); }
.forward-item input { margin: 0; }
.forward-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ---------- NOTES VIEW ---------- */
.notes-shell { display: flex; flex-direction: column; height: 100%; }
.notes-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  background: var(--bg-elev); flex-shrink: 0;
}
.notes-body { flex: 1; display: flex; min-height: 0; }
.notes-list {
  width: 280px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 8px;
}
.note-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background .12s;
}
.note-item:hover { background: var(--bg-hover); }
.note-item.active { background: var(--primary-soft); }
.note-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; word-break: break-word; }
.note-preview { line-height: 1.4; max-height: 2.8em; overflow: hidden; word-break: break-word; }
.note-time { margin-top: 4px; font-size: 11px; }

.notes-editor {
  flex: 1;
  display: flex; flex-direction: column;
  padding: 16px 20px;
  background: var(--bg);
  overflow-y: auto;
  min-height: 0;
}
.note-editor-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
#noteTitle {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  outline: none;
}
#noteTitle:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.note-body {
  flex: 1;
  min-height: 250px;
  margin-bottom: 12px;
  background: var(--bg-elev) !important;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  padding: 14px 16px;
  overflow-y: auto;
}
.note-body:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.note-actions {
  display: flex; gap: 8px; align-items: center;
  padding-top: 8px;
}
.btn-secondary.danger {
  border-color: rgba(220,38,38,.3); color: var(--danger);
}
.btn-secondary.danger:hover { background: rgba(220,38,38,.08); }

/* ---------- BRAND IMAGE (theme-swap) ---------- */
.brand-image { display: inline-flex; align-items: center; }
.brand-image img { height: 32px; width: auto; max-width: 100%; display: block; }
.brand-image-lg img { height: 56px; }
.brand-image .brand-light, .brand-image .brand-dark { display: none; }
[data-theme="light"] .brand-image .brand-light { display: block; }
[data-theme="dark"]  .brand-image .brand-dark  { display: block; }
.auth-brand .brand-image { justify-content: center; margin-bottom: 12px; display: flex; }
.empty-state .brand-image { margin-bottom: 14px; }

/* ---------- MODAL POLISH (blur + center + close) ---------- */
.modal-backdrop {
  background: rgba(15, 23, 42, 0.45) !important;
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  animation: modalFadeIn 0.18s ease-out;
}
[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.55) !important;
}
.modal-backdrop .modal {
  animation: modalPopIn 0.22s cubic-bezier(.2,.9,.3,1.1);
  border: 1px solid var(--border);
}
@keyframes modalFadeIn {
  from { opacity: 0; backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0); }
  to   { opacity: 1; }
}
@keyframes modalPopIn {
  from { transform: translateY(8px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1);      opacity: 1; }
}
/* Make the X close button look like a clickable button regardless of context */
.modal-head .icon-btn { font-size: 22px; line-height: 1; cursor: pointer; }
.modal-head .icon-btn:hover { background: var(--bg-hover); }


/* ---------- MSG AVATAR (img variant for profile pictures) ---------- */
img.msg-avatar {
  object-fit: cover;
  background: var(--bg-soft);
}

/* ---------- PROFILE VIEW ---------- */
.profile-shell { display: flex; flex-direction: column; height: 100%; }
.profile-body {
  flex: 1; overflow-y: auto;
  padding: 24px 32px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}
.profile-section {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.profile-section h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.profile-section label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 12px;
}
.profile-section input[type="text"],
.profile-section input[type="email"],
.profile-section input[type="password"] {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.profile-section input[type="text"]:focus,
.profile-section input[type="email"]:focus,
.profile-section input[type="password"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.profile-section input[type="color"] {
  width: 60px; height: 36px;
  margin-top: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-soft);
  cursor: pointer;
}
.profile-pic-row { display: flex; align-items: center; gap: 18px; }
.profile-pic-preview {
  width: 96px; height: 96px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-soft);
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.profile-pic-preview img { width: 100%; height: 100%; object-fit: cover; }
.profile-pic-preview .avatar-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 36px;
  font-weight: 700;
}
.profile-pic-actions p.muted { margin: 8px 0 0; }

.profile-actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.profile-msg { font-size: 13px; }
.profile-msg.ok  { color: var(--success); }
.profile-msg.err { color: var(--danger); }

/* ---------- REMINDERS VIEW ---------- */
.reminders-shell { display: flex; flex-direction: column; height: 100%; }
.reminders-body {
  flex: 1; overflow-y: auto;
  padding: 16px 20px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}
.reminders-form {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.reminders-form input[type="text"],
.reminders-form input[type="datetime-local"],
.reminders-form textarea {
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.reminders-form input:focus,
.reminders-form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.reminders-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.reminder-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  transition: background .12s;
}
.reminder-item:hover { background: var(--bg-hover); }
.reminder-item.completed { opacity: 0.55; }
.reminder-item.completed .reminder-title { text-decoration: line-through; }
.reminder-item.overdue { border-color: var(--danger); }
.reminder-check {
  margin-top: 3px;
  width: 18px; height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}
.reminder-meta { flex: 1; min-width: 0; }
.reminder-title { font-weight: 600; font-size: 14px; word-break: break-word; }
.reminder-body { margin-top: 3px; }
.reminder-time { margin-top: 6px; color: var(--text-muted); }
.overdue-tag {
  display: inline-block;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-right: 4px;
}
.reminder-del {
  width: 28px; height: 28px;
  color: var(--text-muted);
}
.reminder-del:hover { color: var(--danger); }

/* ---------- REMINDER TOAST ---------- */
.reminder-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 14px 18px 14px 16px;
  min-width: 260px;
  max-width: 360px;
  animation: toastIn 0.3s ease-out;
  position: relative;
}
.reminder-toast.out { animation: toastOut 0.3s ease-in forwards; }
.reminder-toast-head {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
}
.reminder-toast-title { font-weight: 700; font-size: 15px; padding-right: 18px; }
.reminder-toast-body { margin-top: 4px; color: var(--text-soft); }
.reminder-toast-x {
  position: absolute;
  top: 6px; right: 8px;
  border: none; background: transparent;
  color: var(--text-muted);
  font-size: 18px; cursor: pointer;
  width: 22px; height: 22px;
  border-radius: 6px;
}
.reminder-toast-x:hover { background: var(--bg-hover); color: var(--text); }
@keyframes toastIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
  to { transform: translateX(20px); opacity: 0; }
}


/* ---------- GROUP SETTINGS MODAL ---------- */
.modal-wide { max-width: 560px; }
#groupSettingsBody h4 {
  font-size: 13px;
  margin: 0 0 10px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: .04em;
}
#groupSettingsBody h4 + .members-list { margin-bottom: 18px; }

.members-list {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 18px;
}
.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  transition: background .12s;
}
.member-row:hover { background: var(--bg-hover); }
.member-info { flex: 1; min-width: 0; }
.member-info .strong { word-break: break-word; }

.avatar.avatar-md {
  width: 36px; height: 36px;
  font-size: 14px;
  border-radius: 9px;
}
img.avatar { object-fit: cover; }

.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .05em;
  vertical-align: middle;
  margin-left: 4px;
}
.badge.admin {
  background: rgba(99,102,241,.18);
  color: var(--primary);
}
.badge.muted {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.group-add-section { margin-top: 6px; }
.group-add-section input[type="search"] {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  outline: none;
  margin-bottom: 8px;
  -webkit-appearance: none;
}
.group-add-section input[type="search"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
#groupAddResults { max-height: 220px; overflow-y: auto; }
#groupAddResults .user-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
#groupAddResults .user-item:hover { background: var(--bg-hover); }

.group-actions-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.btn-link.danger { color: var(--danger); padding: 4px 8px; border-radius: 6px; }
.btn-link.danger:hover { background: rgba(220,38,38,.08); }


/* ---------- CONVERSATION 3-DOT MENU ---------- */
.conv-item {
  position: relative;
  align-items: center;
}
.conv-menu-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  flex-shrink: 0;
  transition: opacity .15s, background .12s, color .12s;
}
.conv-item:hover .conv-menu-btn,
.conv-item.active .conv-menu-btn {
  opacity: 1;
}
.conv-menu-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.conv-menu-btn:focus { opacity: 1; outline: none; }

.conv-item.pinned {
  background: linear-gradient(to right, var(--primary-soft), transparent 60%);
}
.conv-item.pinned.active {
  background: var(--primary-soft);
}
.pin-icon {
  font-size: 11px;
  margin-right: 2px;
  opacity: .75;
}

.conv-menu {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 180px;
  z-index: 1000;
  animation: convMenuIn .12s ease-out;
}
.conv-menu .dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 13.5px;
  font-family: inherit;
}
.conv-menu .dropdown-item:hover { background: var(--bg-hover); }
.conv-menu .dropdown-item.danger { color: var(--danger); }
.conv-menu .dropdown-item.danger:hover { background: rgba(220,38,38,.08); }

@keyframes convMenuIn {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ---------- REPORTS VIEW ---------- */
.reports-shell { display: flex; flex-direction: column; height: 100%; }
.reports-body { flex: 1; display: flex; min-height: 0; }

.reports-list {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 8px;
}
.report-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background .12s;
}
.report-item:hover { background: var(--bg-hover); }
.report-item.active { background: var(--primary-soft); }
.report-item-title { font-weight: 600; font-size: 14px; word-break: break-word; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.report-item-time { margin-top: 4px; font-size: 11px; }

.report-status {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.report-status.draft { background: var(--bg-hover); color: var(--text-muted); }
.report-status.sent  { background: rgba(22,163,74,.18); color: var(--success); }

.reports-editor {
  flex: 1;
  display: flex; flex-direction: column;
  padding: 16px 20px;
  overflow: hidden;
  min-width: 0;
}
.report-editor-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
#reportTitle {
  flex: 1;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  outline: none;
}
#reportTitle:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.report-save-indicator {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 10px;
  background: var(--bg-soft);
  border-radius: 999px;
  white-space: nowrap;
}

.report-table-wrap {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
  padding: 0 0 8px;
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 1000px;
}
.report-table thead th {
  background: #a7c8eb;
  color: #1a1f2e;
  font-weight: 700;
  text-align: left;
  padding: 10px 8px;
  border: 1px solid #d1d6df;
  position: sticky;
  top: 0;
  z-index: 1;
}
[data-theme="dark"] .report-table thead th { background: #2a3a5a; color: #e6e8ee; border-color: #3a4150; }
.report-table tbody td {
  padding: 0;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  vertical-align: top;
}
.report-table td.col-sno {
  text-align: center;
  font-weight: 600;
  width: 50px;
  padding: 8px;
  color: var(--text-muted);
  background: var(--bg-soft);
}
.report-table td.col-x {
  width: 32px;
  padding: 4px;
  text-align: center;
  background: var(--bg-soft);
}
.report-table td input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 9px 10px;
  font: inherit;
  font-size: 13px;
  outline: none;
  min-height: 36px;
}
.report-table td input:focus {
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 2px var(--primary);
}
.report-table .col-date input { width: 130px; }
.report-table .col-status input::placeholder { color: var(--text-muted); font-size: 12px; }

.row-del {
  width: 22px; height: 22px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  border-radius: 4px;
  cursor: pointer;
}
.row-del:hover { background: rgba(220,38,38,.1); color: var(--danger); }

.report-actions {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.report-email-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px;
  color: var(--text-soft);
}
.report-email-label input[type="email"] {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 13px;
  outline: none;
  min-width: 240px;
}
.report-email-label input[type="email"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ---------- LOGIN BACKGROUND ---------- */
.auth-shell {
  background-image: url("/assets/login-bg.png");
  background-repeat: no-repeat;
  background-position: center 80%;
  background-size: cover;
}
@media (max-width: 600px) {
  .auth-shell { background-position: center bottom; background-size: 90vw auto; }
}
[data-theme="dark"] .auth-shell {
  background-image: linear-gradient(rgba(15,17,21,0.6), rgba(15,17,21,0.6)),
                    url("/assets/login-bg.png");
  background-blend-mode: normal;
}


/* ---------- MENTION AUTOCOMPLETE DROPDOWN ---------- */
.mention-dropdown {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 260px;
  max-width: 340px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 1500;
}
.mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.mention-item.selected,
.mention-item:hover { background: var(--bg-hover); }
.mention-item.selected { background: var(--primary-soft); }
.mention-avatar {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
img.mention-avatar { object-fit: cover; }
.mention-meta { min-width: 0; }
.mention-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mention-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ---------- DRAG-AND-DROP OVERLAY ---------- */
.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(79, 70, 229, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  pointer-events: none;  /* let drag events fall through to document */
  animation: dropOverlayFade .15s ease-out;
}
.drop-overlay[hidden] { display: none; }
.drop-overlay-inner {
  background: var(--bg-elev);
  color: var(--text);
  border: 3px dashed var(--primary);
  border-radius: 20px;
  padding: 40px 64px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 80%;
}
.drop-overlay svg {
  color: var(--primary);
  margin-bottom: 14px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.drop-overlay h3 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
}
.drop-overlay p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}
@keyframes dropOverlayFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
