/* Talks24 styles */
:root {
  --rail-bg:        #4b53bc;
  --rail-bg-hover:  #5a62d1;
  --sidebar-bg:     #f5f5f5;
  --sidebar-border: #e1e1e1;
  --chat-bg:        #ffffff;
  --primary:        #5B5FC7;
  --primary-dark:   #444791;
  --primary-soft:   #eef0fa;
  --text:           #242424;
  --text-muted:     #616161;
  --bubble-mine:    #e3e7f7;
  --bubble-theirs:  #f3f3f3;
  --composer-bg:    #ffffff;
  --composer-surface: #f7f7f8;
  --composer-border: #d7d7d7;
  --danger:         #d13438;
  --success:        #13a10e;
  --warn:           #f7b731;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--chat-bg);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

.has-pwa-install-banner .app {
  height: calc(100vh - 72px);
}

.pwa-install-banner {
  position: relative;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  margin: 10px 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

.pwa-install-copy {
  font-size: 14px;
  font-weight: 600;
}

.pwa-install-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pwa-install-actions button,
.pwa-update-toast button {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 8px;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.pwa-install-actions button:disabled,
.pwa-update-toast button:disabled {
  cursor: progress;
  opacity: .7;
}

.pwa-install-primary,
.pwa-update-toast button {
  background: #0b57d0;
  border-color: #0b57d0;
}

.pwa-install-dismiss {
  background: #1f1f1f;
}

.pwa-update-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

@media (max-width: 700px) {
  .pwa-install-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .pwa-install-actions {
    justify-content: flex-end;
  }
}

/* ---------- Auth pages ---------- */
.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; overflow: auto;
  background: linear-gradient(135deg, #5B5FC7 0%, #7B83EB 60%, #9CA1F0 100%);
}
.auth-card {
  width: min(420px, 92vw);
  background: #fff; border-radius: 12px;
  padding: 36px 32px; box-shadow: var(--shadow-md);
}
.auth-logo { display: flex; align-items: center; gap: 10px; }
.auth-logo h1 { font-size: 22px; margin: 0; color: var(--primary); }
.auth-title { font-size: 22px; margin: 18px 0 4px; color: var(--text); }
.auth-sub { color: var(--text-muted); margin: 6px 0 22px; }
.auth-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-bottom: 18px;
}
.auth-switch-link {
  text-align: center; text-decoration: none; color: var(--text);
  border: 1px solid #d1d1d1; border-radius: 8px; padding: 9px 12px;
  font-size: 13px; font-weight: 600; background: #fff;
}
.auth-switch-link.active {
  border-color: var(--primary); background: var(--primary-soft); color: var(--primary);
}
.auth-card form label {
  display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 14px;
}
.auth-card input {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px;
  border: 1px solid #d1d1d1; border-radius: 6px; font-size: 14px; background: #fff;
}
.auth-card input:focus { border-color: var(--primary); outline: 2px solid var(--primary-soft); }
.auth-error {
  background: #fde7e9; color: var(--danger);
  padding: 10px 12px; border-radius: 6px; margin-bottom: 16px; font-size: 13px;
}
.auth-success {
  background: #e8f5e9; color: #1b5e20;
  padding: 10px 12px; border-radius: 6px; margin-bottom: 16px; font-size: 13px;
}
.auth-link { text-align: center; margin-top: 18px; font-size: 13px; }
.auth-link a { color: var(--primary); text-decoration: none; font-weight: 600; }
.auth-hint { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* ---------- Buttons ---------- */
.btn-primary {
  width: 100%; padding: 11px; background: var(--primary); color: #fff;
  border: none; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 14px;
  transition: background .15s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  padding: 9px 16px; background: #fff; color: var(--text);
  border: 1px solid #d1d1d1; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.btn-secondary:hover { background: #f5f5f5; }
.btn-danger {
  padding: 9px 16px; background: #fff; color: var(--danger);
  border: 1px solid #f1b6b8; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.btn-danger:hover { background: #fde7e9; }
.icon-btn {
  background: transparent; border: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 18px;
}
.icon-btn:hover { background: rgba(0,0,0,.06); color: var(--text); }

/* ---------- App layout ---------- */
.app {
  display: grid;
  grid-template-columns: 68px 280px 1fr;
  height: 100vh;
  min-height: 0;
}

/* Far-left rail */
.rail {
  background: var(--rail-bg); display: flex; flex-direction: column;
  align-items: center; padding: 8px 0; gap: 4px;
}
.rail-logo {
  width: 56px;
  height: 48px;
  padding: 7px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-presence-logo {
  position: relative;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.app-logo-tile {
  width: 26px;
  height: 26px;
  border-radius: 3px;
  background: #6264a7;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  box-shadow: inset -5px 0 0 rgba(70, 71, 117, .55);
}
.app-logo-status {
  position: absolute;
  right: -10px;
  top: -7px;
  display: inline-flex;
  align-items: center;
  gap: 1px;
}
.app-logo-status-dot {
  width: 7px;
  height: 7px;
  border: 1px solid var(--rail-bg);
  border-radius: 50%;
  background: #8b8dff;
}
.rail-spacer { flex: 1; }
.rail-btn {
  width: 56px; padding: 10px 4px; background: transparent; border: none;
  color: rgba(255,255,255,.85); cursor: pointer; border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; text-decoration: none; transition: background .15s;
}
.rail-btn:hover { background: var(--rail-bg-hover); color: #fff; }
.rail-btn.active { background: var(--rail-bg-hover); color: #fff; font-weight: 600; }

/* Sidebar */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column; overflow: hidden; min-height: 0;
}
.sidebar-header { padding: 16px 16px; border-bottom: 1px solid var(--sidebar-border); }
.me { display: flex; align-items: center; gap: 12px; }
.workspace-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--primary-dark); font-weight: 700; margin-bottom: 2px;
}
.me-name { font-weight: 600; font-size: 14px; }
.me-status-line { font-size: 12px; color: var(--text-muted); }
.me-status { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.sidebar-search { padding: 10px 12px; border-bottom: 1px solid var(--sidebar-border); }
.sidebar-search input {
  width: 100%; padding: 7px 12px; border: 1px solid transparent;
  background: #fff; border-radius: 4px; font-size: 13px;
}
.sidebar-search input:focus { border-color: var(--primary); outline: none; }
.sidebar-scroll {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding-bottom: 14px;
}
.sidebar-section { padding: 12px 0 4px; }
.sidebar-section[hidden] { display: none; }
.sidebar-section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 16px; font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
}
.sidebar-list { list-style: none; margin: 4px 0; padding: 0; }
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 16px; cursor: pointer; font-size: 14px;
  border-left: 3px solid transparent; transition: background .12s;
}
.sidebar-item:hover { background: rgba(0,0,0,.05); }
.sidebar-item.active {
  background: var(--primary-soft);
  border-left-color: var(--primary); font-weight: 600; color: var(--primary-dark);
}
.sidebar-item .hash { color: var(--text-muted); width: 16px; text-align: center; }
.group-item .hash { color: var(--primary); font-size: 12px; }
.sidebar-item-copy { flex: 1; min-width: 0; }
.sidebar-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-item-meta {
  display: block; font-size: 11px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.favorite-item .sidebar-item-name {
  font-weight: 600;
}
.sidebar-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.sidebar-name-row .sidebar-item-name {
  min-width: 0;
}
.dm-presence-chip {
  max-width: 96px;
  flex: 0 1 auto;
  min-width: 0;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.45;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dm-presence-chip.online {
  color: #0b6a08;
  background: #e8f5e9;
}
.dm-presence-chip.inactive {
  color: #6f4b00;
  background: #fff4ce;
}
.dm-presence-chip.unavailable {
  color: #5f6368;
  background: #eef0f3;
}
.dm-presence-chip.in-call {
  color: #fff;
  background: var(--danger);
}
.sidebar-empty {
  padding: 7px 16px;
  color: var(--text-muted);
  font-size: 12px;
}

/* Avatars */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  color: #fff; font-weight: 600; font-size: 13px; flex-shrink: 0;
  overflow: hidden;
}
.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar-lg { width: 44px; height: 44px; font-size: 14px; }
.avatar-xl { width: 76px; height: 76px; font-size: 22px; }
.avatar-presence {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

/* Presence badge */
.presence-badge {
  --presence-size: 16px;
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: var(--presence-size);
  height: var(--presence-size);
  border: 2px solid var(--sidebar-bg);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.16);
}
.avatar-sm + .presence-badge {
  --presence-size: 14px;
}
.avatar-lg + .presence-badge {
  --presence-size: 17px;
}
.app-logo-status .presence-badge {
  --presence-size: 15px;
  position: relative;
  right: auto;
  bottom: auto;
  border-color: var(--rail-bg);
  box-shadow: 0 1px 2px rgba(0,0,0,.22);
}
.presence-active {
  background: var(--success);
}
.presence-active::before {
  content: "";
  width: 45%;
  height: 27%;
  margin-top: -1px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}
.presence-inactive {
  background: var(--warn);
  color: #5c3d00;
}
.presence-inactive::before {
  content: "";
  width: 62%;
  height: 62%;
  border: 1.6px solid currentColor;
  border-radius: 50%;
}
.presence-inactive::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 27%;
  width: 24%;
  height: 32%;
  border-left: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
}
.presence-unavailable {
  background: #8a8f98;
}
.presence-unavailable::before,
.presence-unavailable::after {
  content: "";
  position: absolute;
  width: 57%;
  height: 2px;
  border-radius: 999px;
  background: #fff;
}
.presence-unavailable::before {
  transform: rotate(45deg);
}
.presence-unavailable::after {
  transform: rotate(-45deg);
}
.presence-in-call,
.presence-ringing {
  background: var(--danger);
}
.presence-in-call::before,
.presence-ringing::before {
  content: "";
  width: 46%;
  height: 46%;
  border: 2px solid #fff;
  border-radius: 50%;
}
.presence-ringing::after {
  content: "";
  position: absolute;
  width: 72%;
  height: 72%;
  border: 1.4px solid rgba(255,255,255,.9);
  border-radius: 50%;
}
.sidebar-item.active .presence-badge,
.sidebar-item:hover .presence-badge {
  border-color: #eef0ff;
}
.employee-avatar .presence-badge {
  border-color: #fff;
}
.unread-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* ---------- Chat area ---------- */
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-header {
  position: relative;
  padding: 14px 24px; border-bottom: 1px solid var(--sidebar-border);
  display: flex; align-items: center; justify-content: space-between;
}
.chat-header h2 { margin: 0; font-size: 18px; font-weight: 600; }
.chat-header h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-title-status {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.45;
  font-weight: 700;
}
.chat-title-status.online { color: #0b6a08; background: #e8f5e9; }
.chat-title-status.inactive { color: #6f4b00; background: #fff4ce; }
.chat-title-status.unavailable { color: #5f6368; background: #eef0f3; }
.chat-title-status.in-call { color: #fff; background: var(--danger); }
.chat-subtitle { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }
.pinned-message-banner {
  display: flex; align-items: center; gap: 8px;
  min-height: 42px; padding: 0 24px;
  border-bottom: 1px solid var(--sidebar-border);
  background: #242424; color: #f4f4f4;
}
.pinned-message-main {
  flex: 1; min-width: 0; border: 0; background: transparent; color: inherit;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0; font: inherit; cursor: pointer; text-align: left;
}
.pinned-message-main svg {
  flex: 0 0 auto; color: #e6e6e6;
}
.pinned-message-main strong {
  flex: 0 0 auto; font-size: 13px;
}
.pinned-message-main span {
  min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  color: #e6e6e6; font-size: 13px; font-weight: 600;
}
.pinned-message-more {
  width: 30px; height: 30px; border: 0; border-radius: 4px;
  background: transparent; color: #e6e6e6; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.pinned-message-main:hover,
.pinned-message-more:hover {
  background: rgba(255,255,255,.08);
}
.header-actions {
  display: flex; align-items: center; gap: 10px;
}
.teams-toolbar-wrap {
  display: flex; align-items: center; gap: 10px;
}
.teams-toolbar {
  display: inline-flex; align-items: center; gap: 2px;
  background: #232226; color: #f5f5f7;
  border-radius: 12px; padding: 4px 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.teams-toolbar-btn {
  width: 34px; height: 34px; border: 0; border-radius: 8px;
  background: transparent; color: inherit; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.teams-toolbar-btn:hover {
  background: rgba(255,255,255,.08);
}
.teams-toolbar-btn-danger {
  color: #ffb3b5;
}
.teams-toolbar-btn-danger:hover {
  background: rgba(209,52,56,.22);
  color: #fff;
}
.favorite-chat-btn.is-favorite {
  color: #ffd166;
}
.favorite-chat-btn.is-favorite svg {
  fill: currentColor;
}
.teams-toolbar-btn-sm {
  width: 24px;
}
.teams-toolbar-divider {
  width: 1px; height: 22px; background: rgba(255,255,255,.15);
  margin: 0 4px;
}
.toolbar-chip {
  display: inline-flex; align-items: center; padding: 8px 12px;
  border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark);
  font-size: 12px; font-weight: 600;
}

.messages {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 16px 24px;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--chat-bg);
}
.chat-date-divider,
.chat-read-divider {
  width: min(640px, 78%);
  align-self: center;
  display: grid; grid-template-columns: minmax(80px, 1fr) auto minmax(80px, 1fr);
  align-items: center; gap: 14px;
  margin: 18px 0 14px;
  color: var(--text-muted); font-size: 12px; font-weight: 600;
}
.chat-date-divider {
  position: sticky; top: 0; z-index: 12;
  pointer-events: none;
}
.chat-date-divider::before,
.chat-date-divider::after,
.chat-read-divider::before,
.chat-read-divider::after {
  content: ""; height: 1px; background: #dde2f3;
}
.chat-date-divider span,
.chat-read-divider span {
  min-width: 0; padding: 4px 10px; border-radius: 999px;
  background: var(--chat-bg); white-space: nowrap;
}
.chat-read-divider {
  color: #6d78ff; margin-top: 22px;
}
.chat-read-divider::before,
.chat-read-divider::after {
  background: #9ca1f0;
}
.conversation-search {
  display: none; gap: 10px; align-items: center;
  margin-bottom: 14px; padding: 12px 14px;
  border-radius: 14px; background: #f6f8ff; border: 1px solid #dde2f3;
}
.conversation-search.visible {
  display: flex;
}
.conversation-search input {
  flex: 1; border: 1px solid #d1d1d1; border-radius: 10px;
  padding: 10px 12px; font: inherit; background: #fff;
}
.conversation-search input:focus { outline: none; border-color: var(--primary); }
.empty {
  margin: auto; text-align: center; color: var(--text-muted); max-width: 360px;
}
.empty-inline {
  padding: 12px; color: var(--text-muted); font-size: 13px;
}
.empty h3 { color: var(--text); margin: 14px 0 6px; }
.hub-empty {
  margin: auto; max-width: 720px; text-align: center;
}
.hub-badge {
  display: inline-flex; padding: 7px 12px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-dark);
  font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
}
.hub-empty h3 {
  font-size: 30px; line-height: 1.2; margin: 18px 0 10px;
}
.hub-empty p {
  color: var(--text-muted); font-size: 15px; margin: 0 auto; max-width: 540px;
}
.hub-stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px; margin-top: 28px;
}
.stat-card {
  border: 1px solid #dde2f3; background: linear-gradient(180deg, #fff 0%, #f6f8ff 100%);
  border-radius: 16px; padding: 18px 16px;
}
.stat-card strong {
  display: block; font-size: 28px; color: var(--primary-dark); line-height: 1;
}
.stat-card span {
  display: block; margin-top: 6px; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
}

.msg-row {
  position: relative; display: flex; gap: 10px; width: 100%;
  min-width: 100%; align-self: stretch;
  padding: 2px 0; align-items: flex-start;
}
.msg-row.mine {
  justify-content: flex-end;
  flex-direction: row;
}
.msg-row.theirs {
  justify-content: flex-start;
  flex-direction: row;
}
.msg-row .avatar { margin-top: 22px; }
.msg-stack {
  position: relative; min-width: 0; max-width: min(640px, 76%);
  display: flex; flex-direction: column;
}
.msg-row.mine .msg-stack {
  align-items: flex-end;
}
.msg-row.theirs .msg-stack {
  align-items: flex-start;
}
.msg-meta {
  min-height: 20px; font-size: 12px; color: var(--text-muted);
  display: flex; gap: 7px; align-items: center; padding: 0 4px 3px;
}
.msg-row.mine .msg-meta {
  justify-content: flex-end;
}
.msg-row.theirs .msg-meta {
  justify-content: flex-start;
}
.msg-meta strong { color: var(--text); font-weight: 600; font-size: 13px; }
.msg-bubble-wrap {
  position: relative; display: flex; align-items: flex-end; gap: 6px;
}
.msg-row.mine .msg-bubble-wrap {
  flex-direction: row;
}
.msg-row.theirs .msg-bubble-wrap {
  flex-direction: row;
}
.msg-bubble {
  position: relative; max-width: 100%;
  padding: 9px 12px; border-radius: 6px;
  box-shadow: 0 1px 1px rgba(0,0,0,.05);
}
.msg-row.mine .msg-bubble {
  background: var(--bubble-mine); color: var(--text);
}
.msg-row.theirs .msg-bubble {
  background: var(--bubble-theirs); color: var(--text);
}
.msg-bubble-media {
  padding: 0; background: transparent !important;
  box-shadow: none;
}
.msg-text { word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; padding: 0; }
.msg-text a {
  color: inherit;
  text-decoration: underline;
  font-weight: 600;
}
.msg-text blockquote {
  margin: 4px 0;
  padding-left: 9px;
  border-left: 3px solid currentColor;
  opacity: .86;
}
.msg-text code {
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0,0,0,.08);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: .92em;
}
.msg-list-line {
  display: inline-block;
  padding-left: 2px;
}
.msg-text + .msg-text { margin-top: 2px; }
.msg-forwarded {
  margin-bottom: 4px; font-size: 11px; color: var(--text-muted);
}
.msg-quote {
  width: 100%; margin: 0 0 7px; padding: 7px 9px;
  display: flex; flex-direction: column; gap: 2px;
  border: 1px solid #d6d6d6; border-left: 3px solid var(--primary);
  border-radius: 5px; background: #fff; color: inherit;
  font: inherit; text-align: left; cursor: pointer;
}
.msg-row.theirs .msg-quote {
  border-color: #d6d6d6; border-left-color: var(--primary);
}
.msg-quote strong {
  font-size: 12px; line-height: 1.2;
}
.msg-quote span {
  font-size: 12px; line-height: 1.25; opacity: .9;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.msg-reactions {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px;
}
.msg-reactions button {
  position: relative;
  min-height: 24px; padding: 2px 7px; border: 1px solid #d6d6d6;
  border-radius: 999px; background: #fff; color: inherit;
  cursor: pointer; font: inherit; font-size: 12px;
}
.msg-reactions button.active {
  border-color: #6d78ff; box-shadow: 0 0 0 1px rgba(109,120,255,.18);
}
.reaction-tooltip {
  position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 45;
  display: none; transform: translateX(-50%);
  min-width: max-content; max-width: 220px; padding: 7px 10px;
  border-radius: 4px; background: #242424; color: #f5f5f5;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  font-size: 12px; font-weight: 500; line-height: 1.25; text-align: center;
  white-space: normal; pointer-events: none;
}
.reaction-tooltip::after {
  content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: #242424;
}
.msg-reactions button:hover .reaction-tooltip,
.msg-reactions button:focus-visible .reaction-tooltip {
  display: block;
}
.msg-deleted {
  color: inherit;
  font-style: italic;
  opacity: .9;
}
.msg-deleted button {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 0 0 0 6px;
}
.msg-row.deleted .msg-bubble {
  outline: 1px solid rgba(109,120,255,.35);
}
.message-flash .msg-bubble {
  outline: 2px solid #7d83ff;
}
.msg-read-state {
  position: relative;
  width: 18px; height: 18px; flex: 0 0 18px;
  color: #6d78ff; display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 2px; padding: 0; border: 0; background: transparent; cursor: pointer;
}
.msg-read-state.sent {
  border: 1px solid #6d78ff; border-radius: 50%;
}
.msg-read-state.seen svg {
  stroke-width: 1.8;
}
.msg-read-state:focus-visible {
  outline: 2px solid rgba(109,120,255,.35);
  outline-offset: 2px;
  border-radius: 50%;
}
.read-receipt-popover {
  position: fixed; z-index: 20010;
  min-width: 160px; max-width: 260px; padding: 7px 10px;
  border-radius: 4px; background: #242424; color: #f5f5f5;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  font-size: 12px; font-weight: 500; line-height: 1.3; text-align: center;
  white-space: normal; pointer-events: none;
}
.read-receipt-popover::after {
  content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: #242424;
}
.read-receipt-list {
  display: grid; gap: 6px; margin-top: 6px;
}
.read-receipt-list div {
  padding: 8px 10px; border: 1px solid #e2e6f5; border-radius: 6px;
  color: var(--text); background: #f8f9ff; font-weight: 600;
}
.message-hover-bar {
  position: absolute; left: 2px; top: -36px; z-index: 20;
  display: none; align-items: center; gap: 2px;
  padding: 5px 8px; border-radius: 6px; background: #242424; color: #f5f5f5;
  box-shadow: 0 8px 24px rgba(0,0,0,.24);
  max-width: calc(100vw - 380px);
}
.msg-row.mine .message-hover-bar {
  left: auto; right: 2px;
}
.msg-row.actions-visible .message-hover-bar,
.msg-row.actions-locked .message-hover-bar {
  display: inline-flex;
}
.message-hover-bar button {
  width: 30px; height: 28px; border: 0; border-radius: 5px;
  background: transparent; color: inherit; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  font: inherit;
}
.message-hover-bar .message-reply-btn {
  width: auto;
  min-width: 70px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
}
.message-hover-bar button:hover {
  background: rgba(255,255,255,.1);
}
.message-context-menu {
  position: absolute; left: 0; top: 4px; z-index: 30;
  width: 220px; padding: 6px 0; border-radius: 4px;
  background: #242424; color: #f3f2f1;
  box-shadow: 0 10px 28px rgba(0,0,0,.34);
}
.msg-row.mine .message-context-menu {
  left: auto; right: 0;
}
.message-context-menu[hidden] {
  display: none;
}
.message-context-menu button {
  width: 100%; min-height: 40px; border: 0; background: transparent; color: inherit;
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  font: inherit; text-align: left; cursor: pointer;
}
.message-context-menu button:hover {
  background: rgba(255,255,255,.08);
}
.message-context-menu button.danger {
  color: #ffb8bd;
}
.message-context-menu hr {
  height: 1px; border: 0; background: rgba(255,255,255,.14); margin: 5px 0;
}

.attachment {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--primary-soft);
  border: 1px solid #d8ddf2; border-radius: 6px; margin-top: 4px;
  text-decoration: none; color: var(--primary-dark); font-size: 13px; max-width: 320px;
}
.attachment:hover { background: #e1e5f5; }
.attachment img { max-width: 320px; max-height: 240px; border-radius: 6px; display: block; }
.attachment-image {
  padding: 0; border: 0; background: transparent; cursor: pointer;
  max-width: min(405px, 54vw); overflow: hidden;
}
.attachment-image:hover { background: transparent; }
.attachment-image img {
  width: auto; max-width: min(405px, 54vw); max-height: 230px;
  border-radius: 6px; border: 1px solid rgba(0,0,0,.16);
  background: #f5f5f5;
}

.msg-row.mine .attachment {
  background: #fff;
  border-color: #d8ddf2;
  color: var(--primary-dark);
}
.msg-row.mine .attachment-image {
  background: transparent; border-color: transparent;
}

.call-options-menu {
  position: absolute; right: 24px; top: 58px; z-index: 80;
  width: 170px; padding: 6px; border-radius: 8px;
  background: #242424; color: #f5f5f5;
  box-shadow: 0 10px 28px rgba(0,0,0,.25);
}
.call-options-menu button {
  width: 100%; min-height: 38px; border: 0; border-radius: 6px;
  background: transparent; color: inherit; font: inherit; cursor: pointer;
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
}
.call-options-menu button:hover {
  background: rgba(255,255,255,.08);
}
.call-panel {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.48);
}
.call-card {
  width: min(420px, 92vw); border-radius: 12px;
  background: #1f1f1f; color: #fff; padding: 18px;
  box-shadow: 0 18px 48px rgba(0,0,0,.35);
}
.call-card-top {
  display: flex; justify-content: space-between; gap: 16px; align-items: flex-start;
}
.call-card h3 {
  margin: 0; font-size: 20px;
}
.call-preview {
  min-height: 210px; margin: 18px 0; border-radius: 10px;
  background: #111; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; color: #d6d6d6;
  overflow: hidden; text-align: center; padding: 18px;
}
.call-preview video {
  width: 100%; height: 100%; min-height: 210px; object-fit: cover;
}
.call-avatar {
  width: 82px; height: 82px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #343452; color: #9da4ff;
}
.call-actions {
  display: flex; justify-content: flex-end; gap: 10px;
}
.call-actions .btn-primary,
.call-actions .btn-secondary {
  width: auto; display: inline-flex; align-items: center; gap: 8px;
}
.incoming-call-panel {
  position: fixed; right: 18px; top: 82px; z-index: 1300;
}
.incoming-call-card {
  min-width: 320px; display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 12px; background: #1f1f1f; color: #fff;
  box-shadow: 0 14px 40px rgba(0,0,0,.32);
}
.incoming-call-copy {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
}
.incoming-call-copy span {
  color: #d6d6d6; font-size: 12px;
}
.incoming-accept,
.incoming-decline {
  width: 38px; height: 38px; border: 0; border-radius: 50%;
  color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.incoming-accept { background: #13a10e; }
.incoming-decline { background: #d13438; }

/* Composer */
.composer { border-top: 1px solid var(--sidebar-border); padding: 12px 24px 16px; background: var(--composer-bg); }
.composer-editor {
  border: 1px solid var(--composer-border);
  border-radius: 6px;
  background: var(--composer-surface);
  color: var(--text);
  overflow: visible;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.composer-format-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 38px;
  padding: 5px 10px 0;
  border-bottom: 1px solid #e5e5e5;
}
.composer-format-toolbar[hidden] {
  display: none;
}
.composer-format-toolbar button {
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.composer-format-toolbar button:hover {
  background: #ececec;
}
.composer-toolbar-divider {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: #d1d1d1;
}
.toolbar-underline {
  text-decoration: underline;
}
.toolbar-strike {
  text-decoration: line-through;
}
.reply-preview {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 8px; padding: 8px 10px;
  border: 1px solid #d8ddf2; border-left: 3px solid var(--primary);
  border-radius: 6px; background: #f6f8ff;
}
.reply-preview div {
  min-width: 0; display: flex; flex-direction: column; gap: 2px;
}
.reply-preview strong {
  color: var(--primary-dark); font-size: 12px;
}
.reply-preview span {
  color: var(--text-muted); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.reply-preview button {
  width: 28px; height: 28px; border: 0; border-radius: 4px;
  background: transparent; color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.reply-preview button:hover {
  background: rgba(0,0,0,.06); color: var(--text);
}
.composer-row {
  position: relative;
  display: flex; align-items: center; gap: 6px;
  border: 0; border-radius: 0; padding: 7px 10px;
  background: var(--composer-surface); transition: border-color .15s;
}
.composer-editor:focus-within { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.composer textarea {
  flex: 1; border: none; outline: none; resize: none;
  min-height: 36px; max-height: 180px;
  padding: 7px 6px; font: inherit; line-height: 22px; background: transparent; color: var(--text);
}
.rich-composer-wrap {
  flex: 1;
  min-width: 0;
}
.message-rich-editor {
  min-height: 36px;
  max-height: 180px;
  overflow-y: auto;
  border: 0;
  box-shadow: none;
  background: var(--composer-surface);
  color: var(--text);
  padding: 7px 6px;
  line-height: 22px;
  outline: none;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.composer-editor.format-open .message-rich-editor {
  min-height: 88px;
}
.message-rich-editor:empty::before {
  content: attr(data-placeholder);
  color: #5f5f5f;
  pointer-events: none;
}
.message-rich-editor > :first-child {
  margin-top: 0;
}
.message-rich-editor > :last-child {
  margin-bottom: 0;
}
.message-rich-editor a {
  color: var(--primary-dark);
}
.composer-editor.format-open .composer-row {
  align-items: flex-end;
  padding-top: 8px;
}
.composer-editor.format-open .composer textarea {
  min-height: 88px;
}
.composer textarea::placeholder {
  color: #5f5f5f;
}
.composer-editor .icon-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  color: #424242;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.composer-editor .icon-btn:hover {
  background: #ececec;
  color: var(--text);
}
.mention-suggest-panel {
  position: absolute;
  left: 50px;
  bottom: calc(100% + 8px);
  z-index: 120;
  width: min(360px, calc(100vw - 96px));
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #d1d1d1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(0,0,0,.18);
}
.mention-suggest-panel[hidden] {
  display: none;
}
.mention-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.mention-option:hover,
.mention-option.active {
  background: var(--primary-soft);
}
.mention-option-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.mention-option-copy strong,
.mention-option-copy span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.mention-option-copy strong {
  font-size: 13px;
}
.mention-option-copy span {
  color: var(--text-muted);
  font-size: 11px;
}
.composer-tool-btn {
  width: 34px; height: 34px; flex: 0 0 34px;
  border: 0; border-radius: 6px; background: transparent; color: #424242;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.composer-tool-btn:hover,
.composer-tool-btn.active {
  background: #ececec; color: var(--primary-dark);
}
.composer-format-toggle {
  position: relative;
  font-weight: 600;
  letter-spacing: 0;
}
.format-letter {
  font-size: 18px;
  line-height: 1;
}
.format-pen {
  position: absolute;
  right: 7px;
  bottom: 8px;
  width: 11px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-45deg);
}
.format-pen::after {
  content: "";
  position: absolute;
  right: -3px;
  top: -2px;
  width: 0;
  height: 0;
  border-left: 4px solid currentColor;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
}
.emoji-picker-panel {
  position: absolute; right: 48px; bottom: calc(100% + 10px); z-index: 100;
  width: min(396px, calc(100vw - 48px)); height: 420px;
  border-radius: 6px; background: #242424; color: #f3f2f1;
  box-shadow: 0 14px 38px rgba(0,0,0,.32);
  --background: #242424;
  --border-color: rgba(255,255,255,.12);
  --button-hover-background: rgba(255,255,255,.1);
  --button-active-background: rgba(139,136,255,.22);
  --category-emoji-padding: 6px;
  --emoji-padding: 8px;
  --indicator-color: #8b88ff;
  --input-border-color: rgba(255,255,255,.14);
  --input-font-color: #f3f2f1;
  --input-placeholder-color: rgba(255,255,255,.62);
  --outline-color: #8b88ff;
  --text-color: #f3f2f1;
}
.emoji-picker-panel[hidden] {
  display: none;
}
.btn-send {
  background: var(--primary); border: none; color: #fff;
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-send:hover { background: var(--primary-dark); }
.btn-send:disabled { background: #c7c7c7; cursor: not-allowed; }
.composer-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.attach-image-draft-panel {
  width: 100%; min-height: 180px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 16px 18px; border: 1px solid #5b5fc7; border-radius: 4px;
  background: #f7f7f8;
}
.attach-image-draft {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  max-width: min(420px, 48vw); max-height: 220px;
}
.attach-image-draft img {
  max-width: min(420px, 48vw); max-height: 220px;
  object-fit: contain; border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.attach-image-draft .remove-attach-btn {
  position: absolute; top: 6px; right: 6px;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,.68); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.attach-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: min(260px, 100%);
  padding: 4px 10px; background: var(--primary-soft);
  border-radius: 14px; font-size: 12px; color: var(--primary-dark);
}
.attach-chip-image {
  padding: 4px 8px 4px 4px;
  border-radius: 8px;
}
.attach-chip img {
  width: 42px; height: 32px; object-fit: cover;
  border-radius: 5px; border: 1px solid rgba(75,83,188,.18);
  background: #fff; flex: 0 0 auto;
}
.attach-chip span {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.attach-chip button {
  background: transparent; border: none; color: var(--primary-dark);
  cursor: pointer; font-size: 14px; line-height: 1; padding: 0; flex-shrink: 0;
}

.image-viewer {
  position: fixed; inset: 0; z-index: 30000;
  background: rgba(32,32,32,.92); color: #fff;
  display: flex; flex-direction: column;
}
.image-viewer-top {
  height: 76px; flex: 0 0 76px; display: flex; align-items: center; gap: 14px;
  padding: 0 28px; background: #1b1b1b;
}
.image-viewer-close,
.image-viewer-download {
  width: 38px; height: 38px; border: 0; border-radius: 4px;
  background: transparent; color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.image-viewer-close:hover,
.image-viewer-download:hover { background: rgba(255,255,255,.1); }
.image-viewer-meta {
  min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px;
}
.image-viewer-meta strong { font-size: 16px; }
.image-viewer-meta span { color: #d1d1d1; font-size: 13px; }
.image-viewer-stage {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 42px 56px;
}
.image-viewer.is-zoomed .image-viewer-stage {
  align-items: flex-start;
  padding: 0;
}
.image-viewer-canvas {
  position: relative; max-width: min(1024px, calc(100vw - 160px)); max-height: min(620px, calc(100vh - 180px));
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden; cursor: zoom-in;
}
.image-viewer-canvas.is-zoomed {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  align-items: flex-start;
  cursor: grab;
}
.image-viewer-canvas.is-dragging { cursor: grabbing; }
.image-viewer-stage img {
  max-width: min(1024px, calc(100vw - 160px)); max-height: min(620px, calc(100vh - 180px));
  object-fit: contain; box-shadow: 0 4px 18px rgba(0,0,0,.32);
  transform-origin: center center; transition: transform .16s ease;
  user-select: none; -webkit-user-drag: none; pointer-events: none;
}
.image-viewer-canvas.is-zoomed img {
  transform-origin: top center;
}
.image-viewer-canvas.is-dragging img { transition: none; }
.image-viewer-zoom-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; background: rgba(0,0,0,.18);
  opacity: 0; pointer-events: none; transition: opacity .12s ease;
}
.image-viewer-canvas:hover .image-viewer-zoom-hint { opacity: 1; }
.image-viewer-canvas.is-zoomed .image-viewer-zoom-hint { display: none; }
.image-viewer-zoom-hint svg {
  width: 58px; height: 58px; padding: 12px; border-radius: 50%;
  background: rgba(0,0,0,.55);
}

@media (max-width: 760px) {
  .image-viewer-top {
    height: 68px; flex-basis: 68px; padding: 0 16px;
  }
  .image-viewer-stage {
    padding: 24px 16px;
  }
  .image-viewer-canvas,
  .image-viewer-stage img {
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 132px);
  }
}

/* Modal */
.modal {
  position: fixed; inset: 0; background: rgba(17, 18, 24, .46);
  display: flex; align-items: center; justify-content: center; z-index: 20000;
  padding: 24px;
}
.modal[hidden] { display: none; }
.modal-card {
  background: #fff; border-radius: 12px; padding: 24px;
  width: min(420px, 92vw);
  border: 1px solid #dde2f3;
  box-shadow: 0 20px 60px rgba(24, 25, 38, .22);
}
.modal-card-wide { width: min(760px, 94vw); }
.modal-card h3 { margin: 0 0 18px; }
.swal2-form-popup {
  max-height: min(86vh, 760px);
  overflow-y: auto;
  text-align: left;
}
.swal2-popup.modal-card-wide,
.swal2-form-popup.modal-card-wide {
  width: min(760px, 94vw);
}
.swal2-form-popup .swal2-title {
  margin-bottom: 18px;
}
.user-import-tools {
  display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 18px;
}
.user-import-tools .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  width: auto; text-decoration: none;
}
.profile-upload-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 18px;
}
.profile-upload-control {
  position: relative;
  width: 82px;
  height: 82px;
  margin: 0;
  cursor: pointer;
}
.profile-upload-preview {
  border: 3px solid #d8f0ff;
  box-shadow: 0 1px 6px rgba(75,83,188,.18);
}
.profile-upload-add {
  position: absolute;
  right: 1px;
  bottom: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}
.profile-upload-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.profile-upload-copy strong {
  color: var(--text);
  font-size: 14px;
}
.profile-upload-copy span {
  color: var(--text-muted);
  font-size: 12px;
}
.profile-upload-copy .btn-secondary {
  width: max-content;
  padding: 6px 10px;
  font-size: 12px;
}
.modal-card label {
  display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 14px;
}
.modal-card .profile-upload-control {
  display: inline-flex;
  margin-bottom: 0;
}
.modal-card input,
.modal-card select {
  display: block; width: 100%; margin-top: 4px; padding: 9px 12px;
  border: 1px solid #d1d1d1; border-radius: 6px; font-size: 14px;
}
.form-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px;
}
.form-note {
  margin: 4px 0 0; color: var(--text-muted); font-size: 12px;
}
.member-picker { margin-top: 8px; }
.member-picker-label {
  font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px;
}
.member-search-input {
  margin: 0 0 10px;
}
.member-checklist {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px; max-height: 260px; overflow-y: auto;
  border: 1px solid #dfe3f3; border-radius: 12px; padding: 12px; background: #f9fbff;
}
.member-option {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px; background: #fff;
  border: 1px solid #eceff9; margin: 0;
}
.member-option input { width: auto; margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.modal-actions .btn-primary,
.modal-actions .btn-secondary { width: auto; }
.forward-targets {
  max-height: 340px; overflow-y: auto; display: flex; flex-direction: column;
  gap: 6px; margin: 14px 0;
}
.forward-targets button {
  width: 100%; border: 1px solid #e2e5f5; border-radius: 7px;
  background: #fff; padding: 10px 12px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 2px; font: inherit;
}
.forward-targets button:hover {
  background: var(--primary-soft); border-color: #cfd5f5;
}
.forward-targets span {
  color: var(--text-muted); font-size: 12px;
}

.directory-stack {
  display: flex; flex-direction: column; gap: 22px; width: 100%; padding-bottom: 32px;
}
.section-title-row {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.section-title {
  margin: 0; font-size: 22px;
}
.surface-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px; width: 100%;
}
.surface-card,
.file-row,
.employee-row {
  background: #fff; border: 1px solid #dde2f3; border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.surface-card {
  padding: 18px;
}
.surface-card-top,
.file-row {
  display: flex; gap: 14px; justify-content: space-between;
}
.surface-kicker {
  font-size: 11px; font-weight: 700; color: var(--primary-dark);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px;
}
.surface-card h3,
.file-copy h3 {
  margin: 0; font-size: 18px;
}
.surface-card p,
.file-copy p {
  color: var(--text-muted); margin: 12px 0;
}
.surface-meta,
.surface-actions {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.surface-meta {
  color: var(--text-muted); font-size: 12px;
}
.stat-pill {
  background: #eef2ff; color: var(--primary-dark);
  border-radius: 999px; padding: 7px 10px; font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.toolbar-chip-button {
  border: 0;
  cursor: pointer;
}
.toolbar-chip-button:hover {
  background: #dfe5ff;
}
.surface-list {
  width: 100%; display: flex; flex-direction: column; gap: 14px;
}
.people-groups {
  display: flex; flex-direction: column; gap: 16px;
}
.people-section {
  display: flex; flex-direction: column; gap: 8px;
}
.people-section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px;
}
.people-section-head h4 {
  margin: 0; font-size: 15px; font-weight: 700;
}
.people-section-head span {
  color: var(--text-muted); font-size: 12px; font-weight: 700;
}
.compact-list {
  gap: 8px;
}
.file-row,
.employee-row {
  align-items: center; padding: 16px 18px;
}
.compact-list .employee-row {
  min-height: 64px; padding: 10px 14px; border-radius: 8px;
}
.employee-row {
  display: flex; gap: 14px; justify-content: space-between;
}
.employee-row-clickable {
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.employee-row-clickable:hover {
  transform: translateY(-1px);
  border-color: #c6d0f5;
  box-shadow: 0 6px 18px rgba(68, 71, 145, .08);
}
.file-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary-dark);
}
.file-copy {
  flex: 1; min-width: 0;
}
.employee-copy {
  flex: 1; min-width: 0;
}
.employee-copy h3 { margin: 0; font-size: 18px; }
.compact-list .employee-copy h3 { font-size: 15px; }
.employee-copy p { margin: 8px 0 0; color: var(--text-muted); }
.compact-list .employee-copy p { margin-top: 3px; font-size: 12px; }
.compact-list .employee-copy p + p { display: none; }
.file-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  color: var(--text-muted); font-size: 12px;
}
.employee-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
}
.compact-list .employee-meta {
  flex-direction: row; align-items: center; gap: 8px;
}

.swal2-container {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 18, 24, .46);
  animation: swal2-fade-in .12s ease-out;
}
.swal2-container.swal2-closing {
  animation: swal2-fade-out .12s ease-in forwards;
}
.swal2-popup {
  width: min(420px, 92vw);
  padding: 24px;
  border: 1px solid #dde2f3;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(24, 25, 38, .22);
  color: var(--text);
  text-align: left;
}
.swal2-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  font-size: 22px;
  font-weight: 800;
}
.swal2-icon-info,
.swal2-icon-question {
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.swal2-icon-success {
  background: #e7f6e7;
  color: var(--success);
}
.swal2-icon-warning {
  background: #fff4ce;
  color: #8a5a00;
}
.swal2-icon-error {
  background: #fde7e9;
  color: var(--danger);
}
.swal2-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}
.swal2-html-container {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-line;
}
.swal2-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}
.swal2-confirm,
.swal2-cancel {
  min-width: 88px;
  padding: 10px 16px;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.swal2-confirm {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
}
.swal2-confirm:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.swal2-cancel {
  border: 1px solid #d1d1d1;
  background: #fff;
  color: var(--text);
}
.swal2-cancel:hover {
  background: #f5f5f5;
}
@keyframes swal2-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes swal2-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Mobile */
@media (max-width: 768px) {
  .app { grid-template-columns: 56px 1fr; }
  .sidebar { display: none; }
  .app.show-sidebar .sidebar { display: flex; position: fixed; left: 56px; top: 0; bottom: 0; width: 280px; z-index: 5; }
  .rail-btn span { display: none; }
  .chat-header { padding: 14px 16px; }
  .header-actions,
  .teams-toolbar-wrap {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .messages { padding: 14px 16px; }
  .msg-stack { max-width: min(100%, 84vw); }
  .message-hover-bar { top: -34px; max-width: calc(100vw - 34px); }
  .call-options-menu { right: 12px; top: 86px; }
  .composer { padding: 12px 16px 16px; }
  .hub-stats { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .member-checklist { grid-template-columns: 1fr; }
  .surface-grid { grid-template-columns: 1fr; }
  .file-row,
  .surface-card-top,
  .employee-row {
    flex-direction: column;
  }
  .file-meta,
  .employee-meta {
    align-items: flex-start;
  }
  .mention-suggest-panel {
    left: 0;
    right: 0;
    width: auto;
  }
}

/* Scrollbar polish */
.messages::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.sidebar-scroll::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.sidebar-scroll::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 4px; }
.messages::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover,
.sidebar-scroll::-webkit-scrollbar-thumb:hover { background: #b0b0b0; }
