* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f0f2f5; color: #1a1a1a; min-height: 100vh; }

/* ─── Login Overlay ─────────────────────────── */
#loginOverlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; flex-direction: column; z-index: 1000;
}
#loginOverlay.hidden { display: none; }
.has-token #loginOverlay { display: none; }
#loginForm {
  background: #fff; padding: 32px; border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2); width: 340px;
}
#loginForm h2 { margin-bottom: 20px; font-size: 20px; text-align: center; color: #1e3a5f; }
#loginForm input {
  width: 100%; padding: 10px 12px; margin-bottom: 12px;
  border: 1px solid #d0d5dd; border-radius: 8px; font-size: 14px;
}
#loginForm input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
#loginForm button {
  width: 100%; padding: 10px; background: #2563eb; color: #fff;
  border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
}
#loginForm button:hover { background: #1d4ed8; }
#loginError { color: #dc2626; font-size: 13px; margin-bottom: 8px; display: none; }

/* Login tabs for dual auth (admin vs twin) */
#loginTabs {
  display: flex; gap: 0; margin-bottom: 0; width: 340px;
  border-radius: 12px 12px 0 0; overflow: hidden;
}
.login-tab {
  flex: 1; padding: 10px; border: none; background: #e2e8f0; color: #475569;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.login-tab.active { background: #fff; color: #1e3a5f; }
.login-tab:hover:not(.active) { background: #cbd5e1; }
#loginTabs + #loginForm { border-radius: 0 0 12px 12px; }

#twinFields button { margin-top: 4px; }
#twinFields button:disabled { opacity: .6; cursor: not-allowed; }
#twinStep2 input { letter-spacing: 6px; text-align: center; font-size: 20px; font-weight: 700; }

/* Confirmation message styling in boss chat */
.msg-confirmation {
  border-left: 3px solid #f59e0b; background: #fffbeb; padding: 8px 12px;
  border-radius: 6px; margin: 4px 0;
}
.msg-confirmation .confirm-actions { margin-top: 8px; display: flex; gap: 8px; }
.msg-confirmation .confirm-actions button {
  padding: 4px 14px; border-radius: 6px; border: none; font-size: 12px;
  font-weight: 600; cursor: pointer;
}
.confirm-actions .btn-confirm { background: #10b981; color: #fff; }
.confirm-actions .btn-confirm:hover { background: #059669; }
.confirm-actions .btn-reject { background: #ef4444; color: #fff; }
.confirm-actions .btn-reject:hover { background: #dc2626; }

/* ─── Toolbar ───────────────────────────────── */
#toolbar {
  background: #1e293b; color: #fff; padding: 10px 20px;
  display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 100;
}
#toolbar h1 { font-size: 16px; font-weight: 600; margin-right: auto; }
#toolbar button {
  padding: 6px 14px; border-radius: 6px; border: none;
  font-size: 13px; font-weight: 500; cursor: pointer;
}
#addPanelBtn { background: #2563eb; color: #fff; }
#addPanelBtn:hover { background: #1d4ed8; }
#logoutBtn { background: #475569; color: #fff; }
#logoutBtn:hover { background: #64748b; }
#connectionBadge {
  width: 10px; height: 10px; border-radius: 50%;
  background: #ef4444; display: inline-block; margin-left: 4px;
}
#connectionBadge.connected { background: #22c55e; }
#connectionBadge.connecting { background: #eab308; }

/* ─── Company Switcher (God) ─────────────── */
#currentCompanyBadge {
  padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600;
  background: #7c3aed; color: #fff; white-space: nowrap;
}
#companySwitcher { margin-left: 8px; }
#companySelect {
  padding: 5px 10px; border-radius: 6px; border: 1px solid #475569;
  background: #334155; color: #fff; font-size: 13px; cursor: pointer;
  max-width: 250px;
}
#companySelect:focus { outline: none; border-color: #2563eb; }

/* ─── Add-Panel Dialog ──────────────────────── */
#addDialog {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
#addDialog.hidden { display: none; }
.dialog-body {
  background: #fff; padding: 24px; border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2); width: 380px;
}
.dialog-body h3 { margin-bottom: 16px; font-size: 16px; }
.dialog-body label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: #475569; }
.dialog-body select, .dialog-body input {
  width: 100%; padding: 8px 10px; margin-bottom: 12px;
  border: 1px solid #d0d5dd; border-radius: 6px; font-size: 13px;
}
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }
.dialog-actions button {
  padding: 6px 16px; border-radius: 6px; border: none;
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.dialog-actions .btn-primary { background: #2563eb; color: #fff; }
.dialog-actions .btn-cancel { background: #e2e8f0; color: #1e293b; }

/* ─── Panels Grid ───────────────────────────── */
#panelsContainer {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px; padding: 16px;
}

/* ─── Panel Card ────────────────────────────── */
.panel {
  background: #fff; border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
  display: flex; flex-direction: column;
  max-height: 600px; overflow: hidden;
}
.panel.panel-wide {
  grid-column: 1 / -1;
  max-height: 800px;
}
.panel-header {
  background: #2563eb; color: #fff; padding: 8px 12px;
  display: flex; align-items: center; gap: 8px;
  border-radius: 10px 10px 0 0; flex-shrink: 0;
}
.panel-header .panel-title { font-size: 13px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-header .panel-type { font-size: 11px; opacity: .7; }
.panel-close {
  background: none; border: none; color: #fff; font-size: 16px;
  cursor: pointer; padding: 0 4px; opacity: .7; line-height: 1;
}
.panel-close:hover { opacity: 1; }
.panel-body { flex: 1; overflow-y: auto; padding: 0; min-height: 0; }

/* Panel header color variants */
.panel-header.header-purple { background: #7c3aed; }
.panel-header.header-emerald { background: #059669; }
.panel-header.header-amber { background: #d97706; }
.panel-header.header-rose { background: #e11d48; }
.panel-header.header-slate { background: #475569; }
.panel-header.header-cyan { background: #0891b2; }

/* ─── Conversation List (Employee Watcher) ─── */
.conv-list { list-style: none; }
.conv-item {
  padding: 8px 12px; border-bottom: 1px solid #f0f2f5; cursor: pointer;
  font-size: 13px; display: flex; justify-content: space-between; align-items: center;
}
.conv-item:hover { background: #f8fafc; }
.conv-item.active { background: #eff6ff; }
.conv-status {
  font-size: 11px; padding: 2px 6px; border-radius: 4px;
  background: #e2e8f0; color: #475569;
}
.conv-status.active { background: #dcfce7; color: #166534; }
.conv-status.escalated { background: #fef9c3; color: #854d0e; }
.conv-status.resolved { background: #e0e7ff; color: #3730a3; }
.conv-inline-messages {
  padding: 8px 12px; border-bottom: 1px solid #e2e8f0;
  background: #fafbfc; max-height: 300px; overflow-y: auto;
}

/* ─── Messages (Conversation Viewer / Chat) ── */
.messages {
  padding: 12px; display: flex; flex-direction: column; gap: 6px;
}
.msg {
  max-width: 85%; padding: 8px 12px; border-radius: 12px;
  font-size: 13px; line-height: 1.4; word-wrap: break-word;
}
.msg.user {
  align-self: flex-end; background: #2563eb; color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.assistant {
  align-self: flex-start; background: #e5e7eb; color: #1a1a1a;
  border-bottom-left-radius: 4px;
}
.msg.system {
  align-self: center; background: #fef3c7; color: #92400e;
  font-size: 12px; font-style: italic;
}
.msg.status {
  align-self: center; background: #eff6ff; color: #1e40af;
  font-size: 12px; font-style: italic; border: 1px dashed #93c5fd;
  animation: statusPulse 2s ease-in-out infinite;
}
@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.msg-time { font-size: 10px; opacity: .6; margin-top: 2px; }

/* ─── Chat Input (modern Telegram-style) ──────── */
.chat-input {
  display: flex; gap: 6px; padding: 8px 10px;
  border-top: 1px solid #e2e8f0; flex-shrink: 0;
  align-items: flex-end; background: #f8fafc;
}
.chat-input textarea {
  flex: 1; padding: 8px 12px; border: 1.5px solid #d0d5dd;
  border-radius: 18px; font-size: 13px; font-family: inherit;
  resize: none; min-height: 36px; max-height: 200px;
  line-height: 1.5; overflow-y: auto;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff; min-width: 0;
}
.chat-input textarea:focus {
  outline: none; border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.chat-input textarea::placeholder { color: #94a3b8; }
.chat-input .chat-send-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: #2563eb; color: #fff; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s, transform 0.1s;
  font-size: 16px;
}
.chat-input .chat-send-btn:hover { background: #1d4ed8; transform: scale(1.05); }
.chat-input .chat-send-btn:active { transform: scale(0.95); }
.chat-input .chat-send-btn:disabled { background: #60a5fa; cursor: not-allowed; transform: none; opacity: 0.7; }
/* Legacy input fallback */
.chat-input input {
  flex: 1; padding: 8px 10px; border: 1px solid #d0d5dd;
  border-radius: 8px; font-size: 13px;
}
.chat-input button:not(.chat-send-btn) {
  padding: 8px 14px; background: #2563eb; color: #fff;
  border: none; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer;
}
.chat-input button:not(.chat-send-btn):hover { background: #1d4ed8; }
.chat-input button:not(.chat-send-btn):disabled { background: #93c5fd; cursor: not-allowed; }

/* ─── Fleet Dashboard ──────────────────────── */
.fleet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px; padding: 12px;
}
.fleet-card {
  border: 1px solid #e2e8f0; border-radius: 10px; padding: 14px;
  cursor: pointer; transition: all 0.15s;
  background: #fff; position: relative;
}
.fleet-card:hover { border-color: #2563eb; box-shadow: 0 2px 8px rgba(37,99,235,.15); transform: translateY(-1px); }
.fleet-card-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.fleet-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.fleet-card-name { font-size: 14px; font-weight: 600; color: #1e293b; }
.fleet-card-template { font-size: 11px; color: #64748b; }
.fleet-card-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  margin-top: 8px;
}
.fleet-stat {
  background: #f8fafc; border-radius: 6px; padding: 6px 8px;
  font-size: 11px;
}
.fleet-stat-label { color: #94a3b8; display: block; margin-bottom: 2px; }
.fleet-stat-value { color: #1e293b; font-weight: 600; font-size: 13px; }
.fleet-status-badge {
  position: absolute; top: 10px; right: 10px;
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.fleet-status-badge.active { background: #dcfce7; color: #166534; }
.fleet-status-badge.paused { background: #fef9c3; color: #854d0e; }
.fleet-status-badge.retired { background: #fee2e2; color: #991b1b; }
.fleet-status-badge.initializing { background: #e0e7ff; color: #3730a3; }
.fleet-actions {
  display: flex; gap: 6px; margin-top: 10px; padding-top: 8px;
  border-top: 1px solid #f0f2f5;
}
.fleet-actions button {
  flex: 1; padding: 4px 8px; border: 1px solid #e2e8f0;
  border-radius: 4px; background: #fff; font-size: 11px;
  cursor: pointer; color: #475569;
}
.fleet-actions button:hover { background: #f1f5f9; }
.fleet-actions button.btn-danger { color: #dc2626; border-color: #fecaca; }
.fleet-actions button.btn-danger:hover { background: #fef2f2; }
.fleet-actions button.btn-success { color: #16a34a; border-color: #bbf7d0; }
.fleet-actions button.btn-success:hover { background: #f0fdf4; }

/* Fleet toolbar */
.fleet-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0; background: #f8fafc;
  flex-wrap: wrap;
}
.fleet-toolbar .fleet-count {
  font-size: 12px; color: #64748b; margin-right: auto;
}
.fleet-toolbar button {
  padding: 4px 10px; border: 1px solid #e2e8f0; border-radius: 4px;
  background: #fff; font-size: 11px; cursor: pointer; color: #475569;
}
.fleet-toolbar button:hover { background: #f1f5f9; }
.fleet-toolbar button.active { background: #2563eb; color: #fff; border-color: #2563eb; }

/* ─── Employee Detail Panel ─────────────────── */
.detail-section {
  padding: 12px; border-bottom: 1px solid #f0f2f5;
}
.detail-section:last-child { border-bottom: none; }
.detail-section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: #94a3b8; margin-bottom: 8px;
}
.detail-header {
  display: flex; align-items: center; gap: 12px; padding: 16px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #fff;
}
.detail-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: #fff;
  border: 3px solid rgba(255,255,255,0.3);
}
.detail-name { font-size: 18px; font-weight: 700; }
.detail-meta { font-size: 12px; opacity: 0.7; margin-top: 2px; }
.detail-stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.detail-stat-card {
  text-align: center; padding: 10px 6px; background: #f8fafc;
  border-radius: 8px; border: 1px solid #e2e8f0;
}
.detail-stat-card .value { font-size: 20px; font-weight: 700; color: #1e293b; }
.detail-stat-card .label { font-size: 10px; color: #94a3b8; margin-top: 2px; }
.detail-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.detail-actions button {
  padding: 6px 12px; border-radius: 6px; border: 1px solid #e2e8f0;
  background: #fff; font-size: 12px; cursor: pointer; font-weight: 500;
}
.detail-actions button:hover { background: #f1f5f9; }
.detail-actions button.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.detail-actions button.primary:hover { background: #1d4ed8; }
.detail-actions button.danger { color: #dc2626; border-color: #fecaca; }

/* Autonomy gauge */
.autonomy-gauge {
  display: flex; align-items: center; gap: 8px; padding: 8px;
  background: #f8fafc; border-radius: 8px; border: 1px solid #e2e8f0;
}
.autonomy-bar {
  flex: 1; height: 8px; background: #e2e8f0; border-radius: 4px;
  overflow: hidden;
}
.autonomy-fill {
  height: 100%; border-radius: 4px; transition: width 0.3s;
}
.autonomy-label {
  font-size: 12px; font-weight: 600; min-width: 80px; text-align: right;
}

/* ─── Ouroboros Hub ──────────────────────────── */
.ouro-tabs {
  display: flex; gap: 0; border-bottom: 2px solid #e2e8f0;
  padding: 0 12px; background: #fafbfc;
}
.ouro-tab {
  padding: 8px 14px; font-size: 12px; font-weight: 500;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; color: #64748b;
  background: none; border-top: none; border-left: none; border-right: none;
}
.ouro-tab:hover { color: #1e293b; }
.ouro-tab.active { color: #7c3aed; border-bottom-color: #7c3aed; font-weight: 600; }
.ouro-content { padding: 12px; }
.ouro-content.hidden { display: none; }

.dna-fact {
  padding: 10px; border: 1px solid #e2e8f0; border-radius: 8px;
  margin-bottom: 8px; font-size: 12px;
}
.dna-fact-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px;
}
.dna-fact-trigger { font-weight: 600; color: #7c3aed; }
.dna-fact-confidence {
  font-size: 11px; padding: 1px 6px; border-radius: 10px;
  background: #f3e8ff; color: #7c3aed;
}
.dna-fact-text { color: #475569; line-height: 1.4; }
.dna-fact-meta { font-size: 10px; color: #94a3b8; margin-top: 4px; }
.dna-fact-actions { display: flex; gap: 6px; margin-top: 6px; }
.dna-fact-actions button {
  padding: 3px 10px; border-radius: 4px; border: 1px solid #e2e8f0;
  background: #fff; font-size: 11px; cursor: pointer;
}
.dna-fact-actions .btn-approve { color: #16a34a; border-color: #bbf7d0; }
.dna-fact-actions .btn-reject { color: #dc2626; border-color: #fecaca; }

.timeline-event {
  display: flex; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid #f5f5f5; font-size: 12px;
}
.timeline-dot {
  width: 8px; height: 8px; border-radius: 50%; margin-top: 4px;
  flex-shrink: 0;
}
.timeline-event-type { font-weight: 600; color: #1e293b; }
.timeline-event-time { color: #94a3b8; font-size: 11px; }

/* Self-model display */
.self-model-box {
  background: #faf5ff; border: 1px solid #e9d5ff; border-radius: 8px;
  padding: 12px; font-size: 12px; line-height: 1.6;
  white-space: pre-wrap; color: #581c87;
}

/* Block chain display */
.block-card {
  display: flex; align-items: center; gap: 8px;
  padding: 8px; background: #f8fafc; border-radius: 6px;
  border: 1px solid #e2e8f0; margin-bottom: 6px; font-size: 11px;
}
.block-hash { font-family: monospace; color: #7c3aed; font-size: 10px; }
.block-date { font-weight: 600; color: #1e293b; min-width: 80px; }
.block-count { color: #64748b; }

/* ─── Training Panel ────────────────────────── */
.training-stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  padding: 12px;
}
.training-stat {
  text-align: center; padding: 12px 8px;
  background: #f8fafc; border-radius: 8px; border: 1px solid #e2e8f0;
}
.training-stat .big-value { font-size: 24px; font-weight: 700; }
.training-stat .label { font-size: 10px; color: #94a3b8; text-transform: uppercase; }
.maturity-badge {
  display: inline-block; padding: 3px 10px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.maturity-badge.apprentice { background: #fef9c3; color: #854d0e; }
.maturity-badge.specialist { background: #dbeafe; color: #1e40af; }
.maturity-badge.expert { background: #dcfce7; color: #166534; }
.maturity-badge.master { background: #f3e8ff; color: #7c3aed; }

.draft-card {
  border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px;
  margin-bottom: 8px;
}
.draft-header { font-size: 12px; color: #64748b; margin-bottom: 6px; }
.draft-content {
  font-size: 13px; background: #f8fafc; padding: 8px;
  border-radius: 4px; margin-bottom: 8px; line-height: 1.5;
}
.draft-actions { display: flex; gap: 6px; }
.draft-actions button {
  padding: 4px 12px; border-radius: 4px; border: 1px solid #e2e8f0;
  background: #fff; font-size: 11px; cursor: pointer;
}
.draft-actions .btn-approve { color: #16a34a; border-color: #bbf7d0; }
.draft-actions .btn-reject { color: #dc2626; border-color: #fecaca; }
.draft-actions .btn-edit { color: #2563eb; border-color: #bfdbfe; }

.rule-item {
  padding: 8px 12px; border-bottom: 1px solid #f0f2f5;
  font-size: 12px;
}
.rule-item:last-child { border-bottom: none; }
.rule-trigger { font-weight: 600; color: #1e40af; margin-bottom: 2px; }
.rule-response { color: #475569; }
.rule-meta { font-size: 10px; color: #94a3b8; margin-top: 2px; }

/* ─── Group Chats Panel ─────────────────────── */
.gc-list { list-style: none; }
.gc-item {
  padding: 10px 12px; border-bottom: 1px solid #f0f2f5;
  cursor: pointer; display: flex; align-items: center; gap: 10px;
}
.gc-item:hover { background: #f8fafc; }
.gc-item.active { background: #eff6ff; }
.gc-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: #e0e7ff; color: #3730a3; display: flex;
  align-items: center; justify-content: center; font-size: 14px;
  flex-shrink: 0;
}
.gc-info { flex: 1; min-width: 0; }
.gc-name { font-size: 13px; font-weight: 600; color: #1e293b; }
.gc-members { font-size: 11px; color: #94a3b8; }
.gc-messages {
  padding: 12px; max-height: 300px; overflow-y: auto;
  background: #fafbfc; border-bottom: 1px solid #e2e8f0;
}
.gc-msg {
  margin-bottom: 8px; font-size: 12px;
}
.gc-msg-sender { font-weight: 600; color: #1e40af; }
.gc-msg-time { font-size: 10px; color: #94a3b8; }
.gc-msg-content { color: #1e293b; margin-top: 2px; line-height: 1.4; }
.gc-msg.directive {
  background: #fef3c7; border: 1px solid #fbbf24;
  border-radius: 6px; padding: 8px;
}
.gc-msg.directive .gc-msg-sender { color: #92400e; }
.gc-input-row {
  display: flex; gap: 6px; padding: 8px 12px;
  border-top: 1px solid #e2e8f0;
}
.gc-input-row input {
  flex: 1; padding: 6px 10px; border: 1px solid #d0d5dd;
  border-radius: 6px; font-size: 12px;
}
.gc-input-row button {
  padding: 6px 12px; border-radius: 6px; border: none;
  font-size: 12px; font-weight: 500; cursor: pointer;
}
.gc-input-row .btn-message { background: #2563eb; color: #fff; }
.gc-input-row .btn-directive { background: #d97706; color: #fff; }

/* ─── Cost & Routing Panel ──────────────────── */
.cost-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  padding: 12px;
}
.cost-card {
  text-align: center; padding: 14px 8px; background: #f8fafc;
  border-radius: 8px; border: 1px solid #e2e8f0;
}
.cost-card .big-value { font-size: 22px; font-weight: 700; }
.cost-card .label { font-size: 10px; color: #94a3b8; margin-top: 2px; }
.cost-card.highlight { background: #f0fdf4; border-color: #bbf7d0; }
.cost-card.highlight .big-value { color: #16a34a; }
.cost-bar {
  display: flex; height: 24px; border-radius: 6px; overflow: hidden;
  margin: 0 12px 12px;
}
.cost-bar-segment {
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; color: #fff;
  min-width: 20px;
}
.cost-legend {
  display: flex; gap: 12px; padding: 0 12px 12px;
  font-size: 11px; color: #64748b;
}
.cost-legend-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 4px;
}

/* ─── Utility ───────────────────────────────── */
.loading { text-align: center; padding: 20px; color: #94a3b8; font-size: 13px; }
.empty { text-align: center; padding: 20px; color: #94a3b8; font-size: 13px; font-style: italic; }
.panel-body::-webkit-scrollbar { width: 5px; }
.panel-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.conv-inline-messages::-webkit-scrollbar { width: 4px; }
.conv-inline-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

/* Common buttons */
.btn-sm {
  padding: 4px 10px; border-radius: 4px; border: 1px solid #e2e8f0;
  background: #fff; font-size: 11px; cursor: pointer; color: #475569;
}
.btn-sm:hover { background: #f1f5f9; }
.btn-sm:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-sm.primary:hover { background: #1d4ed8; }

/* Info row */
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 12px; border-bottom: 1px solid #f5f5f5;
}
.info-row:last-child { border-bottom: none; }
.info-row .label { color: #94a3b8; }
.info-row .value { color: #1e293b; font-weight: 500; }

/* ─── Boss Chat Panel (v2 — redesigned) ───── */

/* Wrapper: sidebar + main chat area */
.bc-wrapper {
  display: flex; flex: 1; min-height: 0; overflow: hidden;
  position: relative;
}

/* Left sidebar timeline — hidden on desktop (v23: replaced by minimap) */
.bc-sidebar {
  width: 200px; min-width: 160px; max-width: 260px;
  border-right: 1px solid #e2e8f0; background: #f8fafc;
  display: none; flex-direction: column; overflow: hidden;
  flex-shrink: 0;
}
.bc-sidebar-header {
  padding: 10px 12px; border-bottom: 1px solid #e2e8f0;
  font-size: 11px; font-weight: 600; color: #475569;
  text-transform: uppercase; letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 6px;
}
.bc-sidebar-header::before {
  content: ''; width: 3px; height: 14px;
  background: #2563eb; border-radius: 2px;
}
.bc-timeline {
  flex: 1; overflow-y: auto; padding: 8px 0;
}
.bc-timeline::-webkit-scrollbar { width: 3px; }
.bc-timeline::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.bc-tl-entry {
  display: flex; gap: 8px; padding: 5px 10px;
  cursor: pointer; font-size: 10px; line-height: 1.35;
  transition: background 0.15s; position: relative;
}
.bc-tl-entry:hover { background: #e2e8f0; }
.bc-tl-entry:focus { outline: 2px solid #2563eb; outline-offset: -2px; }
.bc-tl-entry.active { background: #dbeafe; border-right: 2px solid #2563eb; }

/* Timeline vertical line */
.bc-tl-entry::before {
  content: ''; position: absolute; left: 13px; top: 18px;
  bottom: -5px; width: 1px; background: #e2e8f0;
}
.bc-tl-entry:last-child::before { display: none; }

.bc-tl-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0; margin-top: 3px; z-index: 1;
  border: 2px solid #cbd5e1; background: #fff;
}
.bc-tl-entry.tl-boss .bc-tl-dot { border-color: #1e293b; background: #1e293b; }
.bc-tl-entry.tl-employee .bc-tl-dot { border-color: #22c55e; background: #22c55e; }
.bc-tl-entry.tl-system .bc-tl-dot { border-color: #f59e0b; background: #f59e0b; }
.bc-tl-entry.tl-goal .bc-tl-dot { border-color: #2563eb; background: #2563eb; }
.bc-tl-entry.tl-goal { margin-top: 6px; padding-top: 8px; border-top: 1px solid #e2e8f0; }
.bc-tl-entry.tl-goal:first-child { margin-top: 0; padding-top: 5px; border-top: none; }
.bc-tl-entry.tl-progress .bc-tl-dot {
  border-color: #8b5cf6; background: #8b5cf6;
  animation: tl-pulse 2s infinite;
}
@keyframes tl-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139,92,246,0.3); }
  50% { box-shadow: 0 0 0 4px rgba(139,92,246,0); }
}

.bc-tl-text {
  flex: 1; color: #475569;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.bc-tl-time {
  font-size: 9px; color: #64748b; white-space: nowrap; margin-top: 1px;
}

/* Sidebar toggle for mobile */
.bc-sidebar-toggle {
  display: none; position: absolute; left: 8px; top: 8px; z-index: 10;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px;
  padding: 4px 8px; font-size: 14px; cursor: pointer; transition: all 0.15s;
}
.bc-sidebar-toggle:hover { background: #e2e8f0; border-color: #2563eb; }
.bc-sidebar-toggle:focus { outline: 2px solid #2563eb; outline-offset: 2px; }

/* Main chat column */
.bc-main {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
}

/* Search bar */
.bc-search-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-bottom: 1px solid #e2e8f0;
  background: #fafbfc; flex-wrap: wrap;
}
.bc-search-input {
  flex: 1; padding: 5px 8px 5px 26px; border: 1px solid #d0d5dd;
  border-radius: 6px; font-size: 12px; background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}
.bc-search-input:focus {
  outline: none; border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}
.bc-search-wrap {
  position: relative; flex: 1;
}
.bc-search-wrap::before {
  content: '\1F50D'; position: absolute; left: 8px; top: 50%;
  transform: translateY(-50%); font-size: 11px; pointer-events: none;
  opacity: 0.5;
}
.bc-search-count {
  font-size: 10px; color: #64748b; white-space: nowrap; font-weight: 500;
}
.bc-search-nav {
  display: none; gap: 2px;
}
.bc-search-nav.active { display: flex; }
.bc-search-nav button {
  background: none; border: 1px solid #d0d5dd; border-radius: 4px;
  padding: 5px 10px; font-size: 10px; cursor: pointer; color: #475569;
  line-height: 1; min-width: 32px; min-height: 28px;
}
.bc-search-nav button:hover { background: #e2e8f0; }
.bc-search-nav button:focus { outline: 2px solid #2563eb; outline-offset: 1px; }
.bc-search-highlight { background: #fef08a; border-radius: 2px; }
.bc-search-highlight.current { background: #fb923c; color: #fff; }

/* Messages container */
.bc-messages {
  padding: 12px 14px 12px 42px; display: flex; flex-direction: column; gap: 8px;
  overflow-y: auto; flex: 1; min-height: 0;
  scroll-behavior: smooth; position: relative;
}
.bc-messages::-webkit-scrollbar { width: 6px; }
.bc-messages::-webkit-scrollbar-track { background: #f8fafc; }
.bc-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #93c5fd, #a5b4fc);
  border-radius: 3px;
}
.bc-messages::-webkit-scrollbar-thumb:hover { background: #60a5fa; }
/* Integrated audit-trail timeline */
.bc-messages::before {
  content: '';
  position: absolute; left: 19px; top: 0; bottom: 0;
  width: 2px; pointer-events: none; z-index: 0;
  background: linear-gradient(180deg,
    rgba(37,99,235,0.25) 0%,
    rgba(37,99,235,0.12) 40%,
    rgba(37,99,235,0.12) 60%,
    rgba(74,222,128,0.20) 100%);
}
/* Timeline dot for employee messages */
.bc-msg-employee { position: relative; }
.bc-msg-employee::after {
  content: '';
  position: absolute; left: -16px; top: 18px;
  width: 6px; height: 6px; border-radius: 50%;
  background: #22c55e; opacity: 0.5;
  box-shadow: 0 0 0 1px rgba(34,197,94,0.15);
}
/* Boss messages: no left marker (right-aligned) */

/* Date separator with timeline marker */
.bc-date-sep {
  align-self: center; font-size: 11px; color: #64748b; font-weight: 500;
  background: #e2e8f0; padding: 3px 14px; border-radius: 10px;
  margin: 12px 0 6px; position: relative;
}

/* Message row: avatar + bubble */
.bc-msg {
  display: flex; gap: 10px; max-width: 92%; font-size: 13px; line-height: 1.5;
  position: relative; scroll-margin-top: 12px;
}
/* Only animate new messages, not history load */
.bc-msg.bc-animate {
  animation: bc-msg-enter 0.25s ease-out;
}
@keyframes bc-msg-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.bc-msg-boss {
  align-self: flex-end; flex-direction: row-reverse; max-width: 88%;
}
.bc-msg-employee {
  align-self: flex-start;
}
.bc-msg-system {
  align-self: center; max-width: 90%;
}

/* Avatar */
.bc-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
  letter-spacing: -0.5px;
}
.bc-msg-boss .bc-avatar {
  background: linear-gradient(135deg, #1e293b, #334155); color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.bc-msg-employee .bc-avatar {
  background: rgba(34,197,94,0.12); color: #16a34a;
  border: 1px solid rgba(34,197,94,0.2);
}

/* Bubble */
.bc-bubble {
  flex: 1; min-width: 0;
}
.bc-sender-row {
  display: flex; align-items: center; gap: 6px; margin-bottom: 3px;
  flex-wrap: wrap;
}
.bc-sender-name {
  font-size: 11px; font-weight: 600; color: #475569;
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bc-msg-boss .bc-sender-name { color: #1e293b; font-weight: 700; }
.bc-sender-time {
  font-size: 10px; color: #64748b;
}
.bc-exec-time {
  font-size: 9px; color: #8b5cf6; background: rgba(139,92,246,0.08);
  padding: 1px 6px; border-radius: 8px; white-space: nowrap;
}

.bc-bubble-body {
  padding: 8px 12px; word-wrap: break-word;
}
.bc-msg-boss .bc-bubble-body {
  background: #1e293b; color: #fff;
  border-radius: 14px 14px 4px 14px;
}
.bc-msg-employee .bc-bubble-body {
  background: #f0fdf4; color: #1e293b;
  border-radius: 14px 14px 14px 4px;
  border: 1px solid #bbf7d0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.bc-msg-system .bc-bubble-body {
  background: #fef3c7; color: #92400e;
  padding: 6px 12px; border-radius: 8px; font-size: 11px; font-style: italic;
}

/* Thinking indicator */
.bc-thinking {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; color: #7c3aed; margin-bottom: 4px;
  padding: 3px 8px; background: rgba(139,92,246,0.08);
  border-radius: 6px; border: 1px solid rgba(139,92,246,0.15);
  font-style: italic;
}
.bc-thinking::before { content: '\1F9E0'; font-size: 12px; }
.bc-thinking-text {
  max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Message content (markdown) */
.bc-msg-content { word-wrap: break-word; overflow-wrap: break-word; word-break: break-word; }

/* ─── Markdown Content Styles ──────────── */
.bc-msg-content .bc-md-h3 {
  font-size: 14px; font-weight: 600; margin: 12px 0 6px 0; color: #1e293b;
  border-bottom: 1px solid #e2e8f0; padding-bottom: 4px;
}
.bc-msg-content .bc-md-h4 {
  font-size: 13px; font-weight: 600; margin: 10px 0 4px 0; color: #334155;
}
.bc-msg-content .bc-md-p { margin: 0 0 8px 0; }
.bc-msg-content .bc-md-p:last-child { margin-bottom: 0; }
.bc-msg-content .bc-md-ul, .bc-msg-content .bc-md-ol {
  margin: 4px 0 8px 0; padding-left: 20px;
}
.bc-msg-content .bc-md-li, .bc-msg-content .bc-md-oli {
  margin: 2px 0; line-height: 1.5;
}
.bc-msg-content .bc-md-hr {
  border: none; border-top: 1px solid #e2e8f0; margin: 8px 0;
}
.bc-msg-content .bc-md-code {
  background: #f1f5f9; padding: 1px 4px; border-radius: 3px;
  font-family: monospace; font-size: 12px;
}
.bc-msg-content .bc-md-pre {
  background: #f1f5f9; padding: 8px 10px; border-radius: 6px;
  font-family: monospace; font-size: 11px; line-height: 1.5;
  overflow-x: auto; white-space: pre-wrap; margin: 6px 0;
}
.bc-msg-boss .bc-md-h3 { color: #e2e8f0; border-bottom-color: #475569; }
.bc-msg-boss .bc-md-h4 { color: #cbd5e1; }
.bc-msg-boss .bc-md-code { background: rgba(255,255,255,0.1); color: #e2e8f0; }
.bc-msg-boss .bc-md-pre { background: rgba(255,255,255,0.08); color: #e2e8f0; }
.bc-msg-boss .bc-md-hr { border-top-color: #475569; }

/* Regenerate button */
.bc-regen-btn {
  display: none;
  margin-top: 6px;
  padding: 4px 12px;
  border: none;
  border-radius: 6px;
  font-size: 11px;
  color: #94a3b8;
  background: rgba(0,0,0,0.04);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.bc-regen-btn:hover { background: rgba(0,0,0,0.08); color: #64748b; }
.bc-msg-employee:last-child .bc-regen-btn { display: inline-block; }
.mob-detail-content .bc-regen-btn { background: rgba(255,255,255,0.05); color: #64748b; }
.mob-detail-content .bc-regen-btn:hover { background: rgba(255,255,255,0.1); }

/* Links in markdown */
.bc-md-link {
  color: #3b82f6;
  text-decoration: none;
  border-bottom: 1px solid rgba(59,130,246,0.3);
  transition: border-color 0.15s, color 0.15s;
  word-break: break-all;
}
.bc-md-link:hover { color: #2563eb; border-bottom-color: #2563eb; }
.bc-md-link-bare {
  font-size: 0.9em;
  color: #60a5fa;
  display: inline-block;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.bc-msg-boss .bc-md-link { color: #93c5fd; border-bottom-color: rgba(147,197,253,0.3); }
.bc-msg-boss .bc-md-link:hover { color: #bfdbfe; }
/* Mobile dark mode links */
.mob-detail-content .bc-md-link { color: #60a5fa; border-bottom-color: rgba(96,165,250,0.3); }

/* Chips & metadata */
.bc-msg-chips { display: flex; gap: 4px; margin-top: 6px; }
.bc-chip {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  background: rgba(255,255,255,0.2); color: inherit;
  font-weight: 500;
}
.bc-msg-boss .bc-chip { background: rgba(255,255,255,0.2); font-weight: 600; }
.bc-msg-employee .bc-chip { background: #dcfce7; color: #166534; }
.bc-msg-emotion {
  font-size: 10px; opacity: 0.7; margin-top: 2px; font-style: italic;
}
.bc-msg-time { font-size: 10px; opacity: 0.5; margin-top: 2px; }

/* Self-assessment */
.bc-self-assess {
  margin-top: 6px; padding: 8px; background: #f1f5f9;
  border-radius: 6px; font-size: 11px; border: 1px solid #e2e8f0;
  line-height: 1.5;
}
.bc-self-assess.hidden { display: none; }
.bc-assess-toggle {
  display: inline-block; font-size: 10px; color: #2563eb;
  cursor: pointer; margin-top: 4px;
}
.bc-assess-toggle:hover { text-decoration: underline; }

/* Asana link rendering */
.bc-asana-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 6px; font-size: 11px;
  background: rgba(244,148,116,0.1); color: #e8604c;
  text-decoration: none; border: 1px solid rgba(244,148,116,0.2);
  transition: background 0.15s; font-weight: 500;
}
.bc-asana-link:hover { background: rgba(244,148,116,0.2); }
.bc-asana-link::before { content: '\1F4CB'; }

/* ─── File Attachments ───────────────────── */
.bc-file-attachments {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px;
}
.bc-file-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 500;
  background: #dbeafe; color: #1e40af; text-decoration: none;
  border: 1px solid #93c5fd; transition: background 0.15s;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bc-file-link:hover { background: #bfdbfe; }
.bc-msg-employee .bc-file-link { background: #dcfce7; color: #166534; border-color: #86efac; }
.bc-msg-employee .bc-file-link:hover { background: #bbf7d0; }

/* ─── File Upload (Boss Chat) ─────────── */
.chat-attach-btn {
  background: none; border: none; font-size: 18px; cursor: pointer;
  padding: 2px 4px; opacity: 0.6; transition: opacity 0.15s;
  flex-shrink: 0;
}
.chat-attach-btn:hover { opacity: 1; }

.bc-file-preview {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 6px 12px; background: #f8fafc; border-top: 1px solid #e2e8f0;
}
.bc-file-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 4px; font-size: 11px;
  background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd;
}
.bc-file-remove { cursor: pointer; margin-left: 4px; font-size: 10px; opacity: 0.6; }
.bc-file-remove:hover { opacity: 1; color: #dc2626; }

/* ─── Task Progress Indicator (enhanced) ─── */
.bc-task-progress {
  align-self: stretch; background: linear-gradient(135deg, #eff6ff, #f0f9ff);
  border: 1px solid #bfdbfe; border-left: 4px solid #2563eb;
  border-radius: 8px; padding: 10px 14px; margin: 8px 0;
  font-size: 12px; color: #1e40af; display: flex; flex-direction: column; gap: 6px;
}
.bc-progress-header {
  display: flex; align-items: center; gap: 8px;
}
.bc-progress-icon { font-size: 18px; flex-shrink: 0; animation: bc-icon-bounce 1.5s ease-in-out infinite; }
.bc-progress-text { flex: 1; font-weight: 500; font-size: 13px; }
.bc-progress-phase { font-size: 10px; opacity: 0.7; white-space: nowrap; }
.bc-progress-bar {
  height: 4px; background: #dbeafe; border-radius: 2px; overflow: hidden;
}
.bc-progress-fill {
  height: 100%; background: #2563eb; border-radius: 2px;
  transition: width 0.5s ease; will-change: width;
}
.bc-progress-details {
  display: flex; gap: 12px; font-size: 10px; color: #6b7280;
}
.bc-progress-details span { display: flex; align-items: center; gap: 3px; }
.bc-progress-goal-name {
  font-size: 11px; color: #64748b; font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
@keyframes bc-icon-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* ─── Resize handle ──────────────────────── */
.bc-resize-handle {
  position: absolute; bottom: 0; right: 0;
  width: 16px; height: 16px; cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, #cbd5e1 50%, transparent 60%,
              #cbd5e1 70%, transparent 80%);
  opacity: 0.4; transition: opacity 0.15s;
}
.bc-resize-handle:hover { opacity: 0.8; }
.panel.bc-resizing { user-select: none; }
.panel.bc-resizable {
  resize: both; overflow: hidden;
  min-height: 300px; min-width: 400px; height: 700px;
  max-width: calc(100vw - 48px);
  z-index: 2; position: relative;
  transition: box-shadow 0.2s;
}
.panel.bc-resizable:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
/* Boss chat panel-body must flex-contain, not scroll */
.panel.bc-resizable > .panel-body {
  overflow: hidden; display: flex; flex-direction: column;
}

/* ─── Goals Dashboard ─────────────────────── */
.goals-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0; background: #f8fafc;
}
.goals-filter, .goals-sort {
  padding: 6px 8px; border: 1px solid #d0d5dd; border-radius: 6px;
  font-size: 12px; background: #fff;
}
.goals-count { font-size: 11px; color: #64748b; margin-left: auto; }
.goals-list {
  padding: 8px 12px; overflow-y: auto; flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.goals-empty {
  text-align: center; color: #94a3b8; padding: 24px; font-size: 13px;
}
.goal-card {
  border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px;
  background: #fff; cursor: pointer; transition: all 0.15s;
  border-left: 4px solid #e2e8f0;
}
.goal-card:hover { border-color: #2563eb; box-shadow: 0 2px 8px rgba(37,99,235,.08); }
.goal-header {
  display: flex; align-items: flex-start; gap: 8px;
}
.goal-icon { flex-shrink: 0; font-size: 14px; margin-top: 1px; }
.goal-desc {
  flex: 1; font-size: 13px; font-weight: 500; color: #1e293b;
  line-height: 1.4;
}
.goal-progress {
  margin-top: 6px; display: flex; align-items: center; gap: 8px;
}
.goal-progress .bc-progress-bar { flex: 1; }
.goal-phase { font-size: 11px; color: #64748b; white-space: nowrap; }
.goal-status-row {
  display: flex; align-items: center; gap: 8px; margin-top: 4px;
  font-size: 11px; color: #64748b;
}
.goal-status-label {
  padding: 1px 8px; border-radius: 8px; font-size: 10px; font-weight: 500;
  background: #f1f5f9; color: #475569;
}
.goal-time { font-size: 10px; color: #94a3b8; }
.goal-detail { padding: 8px 0 0 26px; }
.goal-detail.hidden { display: none; }
.goal-phases { margin-bottom: 6px; }
.goal-phase-row {
  display: flex; align-items: center; gap: 6px; padding: 2px 0;
  font-size: 12px; color: #475569;
}
.goal-phase-icon { font-size: 12px; }
.goal-phase-name { flex: 1; }
.goal-stats {
  font-size: 11px; color: #64748b; margin-bottom: 6px;
  display: flex; gap: 4px; flex-wrap: wrap;
}
.goal-actions { display: flex; gap: 6px; }
.goal-actions .btn-sm {
  padding: 4px 12px; border-radius: 6px; border: 1px solid #e2e8f0;
  background: #fff; font-size: 11px; cursor: pointer; color: #475569;
}
.goal-actions .btn-sm:hover { background: #f1f5f9; border-color: #2563eb; color: #1e40af; }
.bc-goal-created { background: #ecfdf5 !important; color: #065f46 !important; border: 1px solid #a7f3d0; }

/* ─── Goal Dividers (Boss Chat) ────────────── */
.bc-goal-divider {
  display: flex; align-items: center; gap: 8px;
  margin: 16px 0 8px; padding: 0; position: relative;
}
.bc-goal-divider::before {
  content: '';
  position: absolute; left: -28px; top: 50%; transform: translateY(-50%);
  width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.2), 0 0 6px rgba(37,99,235,0.15);
  z-index: 1;
  transition: box-shadow 0.2s;
}
.bc-goal-divider:hover::before {
  box-shadow: 0 0 0 3px rgba(37,99,235,0.3), 0 0 10px rgba(37,99,235,0.25);
}
/* Last goal divider pulses to show it's active */
.bc-goal-divider:last-of-type::before {
  animation: goal-pulse 2.5s infinite;
}
@keyframes goal-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(37,99,235,0.2), 0 0 6px rgba(37,99,235,0.15); }
  50% { box-shadow: 0 0 0 3px rgba(37,99,235,0.35), 0 0 12px rgba(37,99,235,0.2); }
}
.bc-goal-divider-line {
  flex: 1; height: 1px; background: linear-gradient(to right, rgba(147,197,253,0.4), transparent);
}
.bc-goal-divider-label {
  font-size: 11px; color: #1e40af;
  background: linear-gradient(135deg, #dbeafe, #e0f2fe);
  padding: 5px 14px; border-radius: 8px;
  max-width: 85%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600; border: 1px solid rgba(147,197,253,0.5);
  cursor: pointer; transition: all 0.15s;
  box-shadow: 0 1px 3px rgba(37,99,235,0.08);
  letter-spacing: -0.1px;
}
.bc-goal-divider-label:hover {
  background: linear-gradient(135deg, #bfdbfe, #dbeafe);
  border-color: #93c5fd;
  box-shadow: 0 2px 6px rgba(37,99,235,0.12);
  transform: translateX(2px);
}

/* ─── Activity Feed (Boss Chat) ────────────── */
/* ─── Plan Confirmation Buttons ─── */
.bc-confirm-plan {
  align-self: stretch;
  border-left: 3px solid #eab308;
  padding: 14px 18px;
  margin: 8px 0;
  background: linear-gradient(135deg, #fefce8, #fef9c3);
  border-radius: 0 12px 12px 0;
  box-shadow: 0 2px 8px rgba(234,179,8,0.15);
}
.bc-confirm-text {
  font-size: 13px;
  color: #713f12;
  margin-bottom: 12px;
  line-height: 1.4;
}
.bc-confirm-actions {
  display: flex;
  gap: 10px;
}
.bc-confirm-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
}
.bc-confirm-btn:active { transform: scale(0.97); }
.bc-confirm-approve {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  box-shadow: 0 2px 8px rgba(34,197,94,0.3);
  flex: 1;
}
.bc-confirm-approve:hover { box-shadow: 0 4px 12px rgba(34,197,94,0.4); }
.bc-confirm-reject {
  background: rgba(0,0,0,0.06);
  color: #64748b;
}
.bc-confirm-reject:hover { background: rgba(0,0,0,0.1); }
.bc-confirm-sending {
  color: #16a34a;
  font-size: 13px;
  font-weight: 500;
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.bc-activity-feed {
  align-self: stretch; border-left: 3px solid #2563eb;
  padding: 10px 14px; margin: 8px 0; background: linear-gradient(135deg, #f8fafc, #eff6ff);
  border-radius: 0 10px 10px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  position: relative;
}
.bc-activity-feed::before {
  content: '';
  position: absolute; left: -26px; top: 14px;
  width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(139,92,246,0.2);
  z-index: 1;
}
.bc-activity-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  font-size: 12px; font-weight: 600; color: #1e40af;
}
.bc-activity-header .bc-progress-bar { flex: 1; }
.bc-activity-title { white-space: nowrap; }
.bc-activity-entry {
  display: flex; gap: 8px; padding: 4px 0;
  font-size: 12px; line-height: 1.4;
  border-bottom: 1px solid rgba(226,232,240,0.5);
}
.bc-activity-entry:last-child { font-weight: 500; border-bottom: none; }
.bc-act-icon { flex-shrink: 0; width: 20px; text-align: center; }
.bc-act-text { flex: 1; color: #334155; }
.bc-act-time { flex-shrink: 0; color: #94a3b8; font-size: 11px; }

/* Execution time badge in activity */
.bc-act-duration {
  font-size: 9px; color: #8b5cf6; background: rgba(139,92,246,0.08);
  padding: 1px 6px; border-radius: 8px; white-space: nowrap;
  margin-left: 4px;
}

/* ─── Scroll-to-bottom FAB ────────────────── */
.bc-scroll-fab {
  position: absolute; bottom: 60px; right: 12px;
  width: 28px; height: 28px; border-radius: 50%;
  background: #2563eb; color: #fff; border: none;
  cursor: pointer; font-size: 12px; z-index: 50;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 1px 6px rgba(37,99,235,0.25);
  transition: transform 0.2s, opacity 0.2s;
  opacity: 0.7;
}
.bc-scroll-fab:hover { transform: scale(1.1); opacity: 1; }
.bc-scroll-fab.visible { display: flex; }

/* ─── Delegation Approval Buttons ─────────── */
.bc-delegation-actions {
  display: flex; gap: 8px; margin-top: 8px;
}
.bc-deleg-btn {
  padding: 6px 16px; border-radius: 8px; font-size: 12px;
  font-weight: 500; cursor: pointer; border: none;
  transition: all 0.15s;
}
.bc-deleg-approve {
  background: #22c55e; color: #fff;
}
.bc-deleg-approve:hover { background: #16a34a; }
.bc-deleg-reject {
  background: #f1f5f9; color: #dc2626; border: 1px solid #fecaca;
}
.bc-deleg-reject:hover { background: #fef2f2; }

/* ─── Timeline goal filter ────────────────── */
.bc-tl-goal-filter {
  display: flex; gap: 4px; padding: 6px 12px;
  border-bottom: 1px solid #e2e8f0; flex-wrap: wrap;
}
.bc-tl-goal-btn {
  padding: 2px 8px; border-radius: 10px; font-size: 10px;
  background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0;
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
  max-width: 120px; overflow: hidden; text-overflow: ellipsis;
}
.bc-tl-goal-btn:hover { border-color: #2563eb; color: #1e40af; }
.bc-tl-goal-btn.active { background: #dbeafe; border-color: #2563eb; color: #1e40af; font-weight: 500; }

/* ─── Sidebar stats ──────────────────────── */
.bc-sidebar-stats {
  padding: 8px 12px; border-top: 1px solid #e2e8f0;
  font-size: 10px; color: #94a3b8;
  display: flex; gap: 8px; justify-content: center;
}
.bc-sidebar-stat { display: flex; align-items: center; gap: 3px; }

/* ─── Minimap strip (v23: replaces sidebar on desktop) ─── */
.bc-content-area {
  display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden;
}
.bc-minimap {
  display: none; /* v24: replaced by integrated audit-trail timeline */
}
.bc-minimap-track {
  position: absolute; top: 0; left: 0; right: 0;
  min-height: 100%;
}
.bc-minimap-marker {
  position: absolute; left: 50%; transform: translateX(-50%);
  cursor: pointer; transition: opacity 0.15s;
  z-index: 1;
}
.bc-minimap-marker:hover { opacity: 1 !important; }
.bc-minimap-marker.mm-goal {
  width: 10px; height: 10px; border-radius: 50%;
  background: #2563eb; opacity: 0.8;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
}
.bc-minimap-marker.mm-boss {
  width: 6px; height: 3px; border-radius: 1px;
  background: #1e293b; opacity: 0.5;
}
.bc-minimap-marker.mm-date {
  width: 18px; height: 1px;
  background: #94a3b8; opacity: 0.4;
}
.bc-minimap-viewport {
  position: absolute; left: 1px; right: 1px;
  background: rgba(37,99,235,0.08);
  border: 1px solid rgba(37,99,235,0.25);
  border-radius: 2px; pointer-events: none;
  transition: top 0.1s ease-out, height 0.1s ease-out;
  z-index: 0;
}
.bc-minimap-tooltip {
  position: fixed; padding: 4px 8px; border-radius: 4px;
  background: #1e293b; color: #fff; font-size: 10px;
  white-space: nowrap; pointer-events: none; z-index: 100;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis;
}

/* ─── Sticky current-goal indicator ────────── */
.bc-current-goal {
  position: sticky; top: 0; z-index: 5;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-bottom: 1px solid rgba(147,197,253,0.4);
  padding: 4px 12px 4px 32px; margin: 0 -14px 6px -42px;
  font-size: 10px; color: #1e40af; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  backdrop-filter: blur(8px);
  opacity: 0; transition: opacity 0.2s;
}
.bc-current-goal.visible { opacity: 1; }
.bc-current-goal::before {
  content: '';
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 8px; height: 8px; border-radius: 50%;
  background: #2563eb;
}

/* ─── Goal-jump dropdown ─────────────────── */
.bc-goal-jump {
  font-size: 11px; padding: 4px 8px; border: 1px solid #93c5fd;
  border-radius: 8px; max-width: 180px;
  background: linear-gradient(135deg, #eff6ff, #fff);
  color: #1e40af; cursor: pointer; flex-shrink: 0;
  font-weight: 500;
}
.bc-goal-jump:focus { outline: none; border-color: #2563eb; }
.bc-goal-jump:empty { display: none; }

/* ─── Semantic search toggle ─────────────── */
/* Search mode toggle group */
.bc-search-mode-group {
  display: flex; gap: 0; flex-shrink: 0;
  border: 1px solid #d0d5dd; border-radius: 8px;
  overflow: hidden;
}
.bc-search-mode {
  font-size: 11px; padding: 4px 10px;
  border: none; background: #fff; color: #64748b;
  cursor: pointer; white-space: nowrap;
  transition: all 0.15s; font-weight: 500;
}
.bc-search-mode:first-child { border-right: 1px solid #d0d5dd; }
.bc-search-mode:hover { color: #2563eb; background: #f8fafc; }
.bc-search-mode.active {
  background: linear-gradient(135deg, #eff6ff, #dbeafe); color: #1e40af;
  font-weight: 600;
}
.bc-search-semantic-badge {
  font-size: 9px; padding: 1px 5px; border-radius: 8px;
  background: #dbeafe; color: #2563eb; margin-left: 4px;
  font-weight: 600; vertical-align: middle;
}
/* Message count pill */
.bc-msg-count {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  background: #f1f5f9; color: #64748b; flex-shrink: 0;
  font-weight: 500;
}

/* ─── Typing indicator ──────────────────── */
.bc-typing-indicator {
  display: flex; gap: 4px; padding: 10px 14px;
  align-self: flex-start;
}
.bc-typing-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #94a3b8; animation: bc-typing 1.4s infinite;
  will-change: transform, opacity;
}
.bc-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.bc-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bc-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ─── Show more / truncation ─────────────── */
.bc-msg-truncated {
  max-height: 150px; overflow: hidden; position: relative;
}
.bc-show-more {
  text-align: center; padding: 4px 8px; cursor: pointer;
  font-size: 11px; color: #1d4ed8; font-weight: 500;
  background: linear-gradient(transparent, #f0fdf4 50%);
  position: relative; margin-top: -24px; padding-top: 24px;
}
.bc-show-more:hover { text-decoration: underline; }
.bc-msg-boss .bc-show-more {
  background: linear-gradient(transparent, #1e293b 50%);
  color: #93c5fd;
}
.bc-msg-system .bc-show-more {
  background: linear-gradient(transparent, #fef3c7 50%);
  color: #92400e;
}
.bc-show-more.expanded {
  margin-top: 0; padding-top: 4px; background: none;
}

/* ─── Message hover actions ──────────────── */
.bc-msg:hover .bc-msg-actions,
.bc-msg:focus-within .bc-msg-actions { opacity: 1; }
.bc-msg-actions {
  position: absolute; top: -8px; right: 8px;
  display: flex; gap: 2px; opacity: 0;
  transition: opacity 0.15s;
}
.bc-msg-action-btn {
  width: 24px; height: 24px; border-radius: 4px;
  background: #fff; border: 1px solid #e2e8f0;
  cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.bc-msg-action-btn:hover { background: #f1f5f9; }
.bc-msg-action-btn:focus { outline: 2px solid #2563eb; outline-offset: 1px; }

/* ─── Empty state ────────────────────────── */
.bc-empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 40px 20px; gap: 12px;
  color: #94a3b8; flex: 1;
}
.bc-empty-icon { font-size: 48px; opacity: 0.4; }
.bc-empty-title { font-size: 14px; font-weight: 500; color: #64748b; }
.bc-empty-hint { font-size: 12px; max-width: 300px; text-align: center; line-height: 1.5; }

/* ─── Phase transition marker ────────────── */
.bc-phase-marker {
  align-self: center; display: flex; align-items: center; gap: 8px;
  margin: 12px 0; padding: 6px 16px; border-radius: 20px;
  background: linear-gradient(135deg, #dbeafe, #ede9fe);
  border: 1px solid #c7d2fe; font-size: 11px; font-weight: 500;
  color: #4338ca;
}
.bc-phase-marker::before { content: '\u25B6'; font-size: 8px; }

/* ─── Unread indicator ───────────────────── */
.bc-unread-badge {
  position: absolute; top: -4px; right: -4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444; border: 2px solid #fff;
}

/* ─── Employee Cards Panel ─────────────────── */
.cards-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0; background: #f8fafc;
  flex-wrap: wrap;
}
.cards-search {
  flex: 1; min-width: 120px; padding: 6px 10px; border: 1px solid #d0d5dd;
  border-radius: 6px; font-size: 12px;
}
.cards-sort {
  padding: 6px 8px; border: 1px solid #d0d5dd; border-radius: 6px;
  font-size: 12px; background: #fff;
}
.cards-count { font-size: 11px; color: #64748b; }
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px; padding: 12px;
}
.cards-pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 8px 12px; border-top: 1px solid #e2e8f0;
}
.cards-page-info { font-size: 11px; color: #64748b; }

.ec-card {
  border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px;
  cursor: pointer; transition: all 0.15s; background: #fff;
  position: relative;
}
.ec-card:hover { border-color: #0891b2; box-shadow: 0 2px 8px rgba(8,145,178,.12); transform: translateY(-1px); }
.ec-flags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.ec-flag {
  font-size: 10px; padding: 2px 8px; border-radius: 8px; font-weight: 500;
}
.ec-flag-warning { background: #fef9c3; color: #854d0e; }
.ec-flag-critical { background: #fee2e2; color: #991b1b; }
.ec-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ec-info { flex: 1; min-width: 0; }
.ec-name { font-size: 14px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec-role { font-size: 11px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec-template { font-size: 10px; color: #94a3b8; font-style: italic; }
.ec-mission {
  font-size: 11px; color: #475569; line-height: 1.4; margin-bottom: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.ec-status-row { display: flex; gap: 4px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.ec-status {
  font-size: 9px; padding: 1px 6px; border-radius: 8px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.ec-status-active { background: #dcfce7; color: #166534; }
.ec-status-paused { background: #fef9c3; color: #854d0e; }
.ec-status-draft { background: #e2e8f0; color: #475569; }
.ec-status-retired { background: #fee2e2; color: #991b1b; }
.ec-channel {
  font-size: 9px; padding: 1px 6px; border-radius: 8px;
  background: #e0e7ff; color: #3730a3; text-transform: uppercase;
}
.ec-boss-badge {
  font-size: 9px; padding: 1px 6px; border-radius: 8px;
  background: #fef3c7; color: #92400e; font-weight: 500;
}
.ec-maturity {
  font-size: 10px; font-weight: 600; padding: 2px 8px;
  border-radius: 10px; border: 1px solid; flex-shrink: 0;
}
.ec-quality-row {
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
}
.ec-qlabel { font-size: 10px; color: #94a3b8; min-width: 42px; }
.ec-qtrack {
  flex: 1; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden;
}
.ec-qfill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.ec-qval { font-size: 11px; font-weight: 600; color: #1e293b; min-width: 36px; text-align: right; }
.ec-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  margin-bottom: 8px;
}
.ec-stat {
  text-align: center; padding: 4px; background: #f8fafc;
  border-radius: 4px;
}
.ec-stat-val { display: block; font-size: 14px; font-weight: 700; color: #1e293b; }
.ec-stat-label { display: block; font-size: 9px; color: #94a3b8; text-transform: uppercase; }
.ec-last-activity {
  font-size: 10px; color: #64748b; margin-bottom: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ec-actions {
  display: flex; gap: 4px; padding-top: 8px; border-top: 1px solid #f0f2f5;
}
.ec-actions button {
  flex: 1; padding: 4px 6px; border: 1px solid #e2e8f0;
  border-radius: 4px; background: #fff; font-size: 10px;
  cursor: pointer; color: #475569;
}
.ec-actions button:hover { background: #f1f5f9; }

/* ─── Execution Clouds Panel ──────────────── */
.cloud-summary {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0; background: #f8fafc;
  font-size: 12px; color: #475569; flex-wrap: wrap;
}
.cloud-summary .cloud-count { font-weight: 600; color: #1e293b; }
.cloud-list { padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.cloud-card {
  border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px;
  border-left: 4px solid #94a3b8; transition: border-color 0.2s;
}
.cloud-card.status-executing { border-left-color: #22c55e; }
.cloud-card.status-completed { border-left-color: #2563eb; }
.cloud-card.status-failed { border-left-color: #ef4444; }
.cloud-card.status-planning { border-left-color: #eab308; }
.cloud-card-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.cloud-status-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.cloud-status-dot.executing { background: #22c55e; animation: cloud-pulse 1.5s ease-in-out infinite; }
.cloud-status-dot.completed { background: #2563eb; }
.cloud-status-dot.failed { background: #ef4444; }
.cloud-status-dot.planning { background: #eab308; }
@keyframes cloud-pulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.4; }
}
.cloud-goal-id { font-family: monospace; font-size: 11px; color: #7c3aed; font-weight: 600; }
.cloud-goal-desc {
  flex: 1; font-size: 12px; color: #1e293b; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cloud-exec-status {
  font-size: 10px; padding: 2px 8px; border-radius: 8px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.cloud-exec-status.executing { background: #dcfce7; color: #166534; }
.cloud-exec-status.completed { background: #dbeafe; color: #1e40af; }
.cloud-exec-status.failed { background: #fee2e2; color: #991b1b; }
.cloud-exec-status.planning { background: #fef9c3; color: #854d0e; }
.cloud-progress {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 11px; color: #475569;
}
.cloud-progress-bar {
  flex: 0 0 100px; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden;
}
.cloud-progress-fill {
  height: 100%; border-radius: 3px; background: #2563eb; transition: width 0.5s;
}
.cloud-progress-fill.executing { background: #22c55e; }
.cloud-actions-breakdown {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px;
  font-size: 11px; color: #475569;
}
.cloud-ctx {
  font-family: monospace; font-size: 11px; color: #64748b;
  margin-bottom: 6px; line-height: 1.6;
}
.cloud-ctx-val { color: #059669; font-weight: 600; }
.cloud-aggregates {
  display: flex; gap: 10px; font-size: 11px; color: #64748b; margin-bottom: 8px; flex-wrap: wrap;
}
.cloud-aggregates span { display: flex; align-items: center; gap: 3px; }
.cloud-btns {
  display: flex; gap: 4px; flex-wrap: wrap; padding-top: 6px;
  border-top: 1px solid #f0f2f5;
}
.cloud-btns button {
  padding: 3px 10px; border-radius: 4px; border: 1px solid #e2e8f0;
  background: #fff; font-size: 10px; cursor: pointer; color: #475569;
}
.cloud-btns button:hover { background: #f1f5f9; }
.cloud-btns button.active { background: #eff6ff; border-color: #93c5fd; color: #1e40af; }
.cloud-btns button.btn-danger { color: #dc2626; border-color: #fecaca; }
.cloud-btns button.btn-danger:hover { background: #fef2f2; }
.cloud-btns button.btn-success { color: #16a34a; border-color: #bbf7d0; }
.cloud-btns button.btn-success:hover { background: #f0fdf4; }
.cloud-steps { margin-top: 8px; }
.cloud-step-row {
  display: flex; align-items: center; gap: 6px; padding: 3px 0;
  font-size: 11px; color: #475569; border-bottom: 1px solid #f8fafc;
}
.cloud-step-row:last-child { border-bottom: none; }
.cloud-step-num { font-family: monospace; color: #94a3b8; min-width: 44px; }
.cloud-step-action { font-weight: 500; color: #1e293b; min-width: 56px; }
.cloud-step-phase { color: #7c3aed; min-width: 32px; }
.cloud-step-ok { min-width: 14px; }
.cloud-step-sizes { color: #64748b; flex: 1; font-family: monospace; }
.cloud-step-cost { color: #059669; font-family: monospace; min-width: 44px; text-align: right; }
/* Popup overlay for knowledge/lessons */
.cloud-popup {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 300;
}
.cloud-popup-body {
  background: #fff; border-radius: 12px; padding: 20px;
  max-width: 600px; width: 90%; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.cloud-popup-body h3 { margin-bottom: 12px; font-size: 16px; }
.cloud-popup-body pre {
  background: #f8fafc; padding: 12px; border-radius: 8px;
  font-size: 11px; line-height: 1.5; overflow-x: auto; white-space: pre-wrap;
}
.cloud-popup-close {
  float: right; background: none; border: none; font-size: 20px;
  cursor: pointer; color: #94a3b8; line-height: 1;
}
.cloud-popup-close:hover { color: #1e293b; }

/* Toast notification */
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* ─── Mobile Responsiveness ───────────────── */

/* Tablet breakpoint */
@media (max-width: 900px) {
  #panelsContainer { grid-template-columns: 1fr; gap: 8px; padding: 8px; }
  .panel { max-height: none; }
  #toolbar { flex-wrap: wrap; gap: 4px; padding: 8px; }
  #toolbar h1 { font-size: 14px; }
  .cards-grid { grid-template-columns: 1fr; }
  .dialog-body { width: 95%; max-width: none; }
}

/* ─── Mobile Shell (Telegram-style) ──────── */
@media (max-width: 768px) {
  /* Hide desktop UI completely */
  #toolbar { display: none !important; }
  #panelsContainer { display: none !important; }
  #addDialog { display: none !important; }
  html, body { overflow: hidden; overscroll-behavior: none; max-width: 100vw; touch-action: pan-y; -webkit-text-size-adjust: 100%; }
  /* Prevent iOS Safari zoom on input focus — all inputs must be 16px+ */
  input, textarea, select { font-size: 16px !important; }

  /* Mobile shell takes over */
  #mobileShell { display: flex !important; }

  /* ─── #1: Login dark theme on mobile ─── */
  #loginOverlay {
    background: #0f0f14;
  }
  #loginOverlay.mob-login {
    background: #0f0f14;
  }
  #loginForm {
    width: 92vw; max-width: 380px; padding: 24px;
    background: #16161e; color: #e2e8f0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  }
  #loginForm h2 { color: #e2e8f0; }
  #loginForm input {
    background: #1e1e2e; color: #e2e8f0;
    border-color: rgba(255,255,255,0.1);
  }
  #loginForm input::placeholder { color: #5c5c5e; }
  #loginForm input:focus {
    border-color: #5b8def;
    box-shadow: 0 0 0 3px rgba(91,141,239,0.15);
  }
  #loginForm button[type="submit"] {
    background: #5b8def;
  }
  #loginForm button[type="submit"]:hover {
    background: #4a7de0;
  }
  #loginTabs {
    width: 92vw; max-width: 380px;
  }
  .login-tab {
    background: #1e1e2e; color: #8e8e93;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .login-tab.active {
    background: #16161e; color: #e2e8f0;
  }
  .login-tab:hover:not(.active) {
    background: #252530;
  }
  #loginForm a[href*="oauth"] {
    background: #1e1e2e !important; color: #e2e8f0 !important;
    border: 1px solid rgba(255,255,255,0.1);
  }
  #loginError { color: #ef4444; }
}

/* Mobile shell structure */
#mobileShell {
  display: none;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  max-width: 100vw;
  background: #0f0f14;
  overflow: hidden;
  position: fixed;
  inset: 0;
  z-index: 50;
  overscroll-behavior: none;
}

/* ─── Mobile Top Bar (#3: iOS-style topbar) ─── */
.mob-topbar {
  display: flex;
  align-items: center;
  height: 56px;
  min-height: 56px;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0);
  background: rgba(22,22,30,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  gap: 12px;
  z-index: 10;
}
/* #13: Connection status dot */
.mob-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  flex-shrink: 0;
}
.mob-status-dot.disconnected { background: #ef4444; }
.mob-status-dot.connecting { background: #eab308; }
.mob-topbar-back {
  display: none;
  width: 36px; height: 36px;
  background: none; border: none;
  color: #5b8def;
  font-size: 22px;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s;
}
.mob-topbar-back:active { background: rgba(91,141,239,0.15); }
.mob-topbar.has-back .mob-topbar-back { display: flex; align-items: center; justify-content: center; }
.mob-topbar-title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mob-topbar-subtitle {
  font-size: 12px;
  color: #64748b;
  font-weight: 400;
}
.mob-topbar-actions {
  display: flex;
  gap: 2px;
  align-items: center;
}
.mob-topbar-btn {
  min-width: 44px; min-height: 44px;
  width: 44px; height: 44px;
  background: none; border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: rgba(255,255,255,0.08);
  border-radius: 50%;
  transition: background 0.15s;
}
.mob-topbar-btn:active { background: rgba(255,255,255,0.08); }

/* ─── Mobile Screen Container ─── */
.mob-screens {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.mob-screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: none;
  background: #0f0f14;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
}
.mob-screen.hidden { display: none; }
.mob-screen.slide-out-left { transform: translateX(-30%); opacity: 0; pointer-events: none; }
.mob-screen.slide-in-right { transform: translateX(100%); }

/* ─── Company Tabs (Telegram-style folder tabs) ─── */
.mob-company-tabs {
  display: flex;
  background: rgba(22,22,30,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  z-index: 9;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s;
  will-change: transform, opacity;
}
.mob-company-tabs.hidden-scroll {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  position: absolute;
  width: 100%;
}
.mob-company-tabs-scroll {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 0;
  width: 100%;
}
.mob-company-tabs-scroll::-webkit-scrollbar { display: none; }
.mob-company-tab {
  flex-shrink: 0;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.mob-company-tab:active { background: rgba(91,141,239,0.08); }
.mob-company-tab.active {
  color: #5b8def;
  border-bottom-color: #5b8def;
  font-weight: 600;
}
.mob-company-tab .mob-company-tab-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* ─── Bottom Tab Bar (#2: iOS-style tab bar) ─── */
.mob-tabs {
  display: flex;
  height: 60px;
  min-height: 60px;
  background: rgba(22,22,30,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 10;
}
.mob-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: #64748b;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 0.15s;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.mob-tab-icon { font-size: 22px; line-height: 1; }
.mob-tab.active { color: #5b8def; }
.mob-tab.active .mob-tab-icon { transform: scale(1.1); }
.mob-tab-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ─── Chat List (Chats Tab) (#4: Telegram-style) ─── */
.mob-chat-list { padding: 0; }
.mob-chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  height: 72px;
  border-bottom: none;
  cursor: pointer;
  transition: background 0.1s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
/* #18: Haptic press effect */
.mob-chat-item:active {
  background: rgba(255,255,255,0.06);
  transform: scale(0.98);
}
/* #4: Telegram-style separator — indented from left, starts after avatar */
.mob-chat-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 76px; /* 16px padding + 48px avatar + 12px gap */
  right: 0;
  height: 1px;
  background: rgba(255,255,255,0.06);
}
.mob-chat-item:last-child::after { display: none; }
.mob-chat-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}
/* #19: Online indicator dot on avatar */
.mob-chat-avatar .mob-avatar-online {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #0f0f14;
}
.mob-chat-info { flex: 1; min-width: 0; }
.mob-chat-name {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mob-chat-preview {
  font-size: 13px;
  color: #8e8e93;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  line-height: 1.3;
}
.mob-chat-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  align-self: flex-start;
  padding-top: 2px;
}
.mob-chat-time {
  font-size: 12px;
  color: #8e8e93;
}
.mob-chat-unread {
  background: #5b8def;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.mob-chat-status {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mob-chat-status.online { background: #22c55e; }
.mob-chat-status.busy { background: #f59e0b; }
.mob-chat-status.offline { background: #475569; }

/* ─── Search Bar (#6: pill shape like Telegram) ─── */
.mob-search {
  padding: 8px 16px;
  position: sticky;
  top: 0;
  background: #0f0f14;
  z-index: 5;
}
.mob-search input {
  width: 100%;
  height: 42px;
  padding: 10px 14px 10px 36px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  color: #e2e8f0;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.mob-search input::placeholder { color: #5c5c5e; }
.mob-search input:focus { border-color: rgba(91,141,239,0.4); }
.mob-search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: #475569;
  font-size: 14px;
  pointer-events: none;
}

/* ─── Team Grid (Contacts Tab) ─── */
.mob-team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 4px;
  padding: 8px;
}
.mob-team-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mob-team-card:active { background: rgba(255,255,255,0.06); }
.mob-team-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  position: relative;
}
/* #7: Glow for online employees */
.mob-team-avatar.is-online {
  box-shadow: 0 0 0 2px rgba(34,197,94,0.3), 0 0 12px rgba(34,197,94,0.15);
}
.mob-team-avatar .mob-chat-status {
  position: absolute;
  bottom: 2px; right: 2px;
  width: 12px; height: 12px;
  border: 2px solid #0f0f14;
}
.mob-team-name {
  font-size: 13px;
  color: #c8c8cc;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.mob-team-role {
  font-size: 10px;
  color: #475569;
  text-align: center;
}

/* ─── Dashboard Cards (Dashboard Tab) ─── */
.mob-dash-list { padding: 8px; }
.mob-dash-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  background-image: linear-gradient(135deg, rgba(255,255,255,0.02), transparent);
}
.mob-dash-card:active { background: rgba(255,255,255,0.08); }
.mob-dash-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.mob-dash-info { flex: 1; }
.mob-dash-title { font-size: 15px; font-weight: 600; color: #e2e8f0; }
.mob-dash-desc { font-size: 12px; color: #64748b; margin-top: 2px; }
.mob-dash-arrow { color: #3a3a3c; font-size: 20px; }

/* ─── Fullscreen Panel (detail view) (#9: smooth transitions) ─── */
.mob-detail-screen {
  position: absolute;
  inset: 0;
  background: #0f0f14;
  z-index: 30;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
  overscroll-behavior: none;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
  will-change: transform;
}
.mob-detail-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(100vh - 56px);
  max-height: calc(100dvh - 56px);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: none;
  max-width: 100vw;
}
/* Override panel styles inside mobile detail view */
.mob-detail-content .panel {
  border-radius: 0;
  max-height: none;
  height: 100%;
  border: none;
  background: #0f0f14;
}
.mob-detail-content .panel-header { display: none; }
.mob-detail-content .panel-body {
  height: 100%;
  max-height: none;
  overflow: visible;
  background: #0f0f14;
  color: #e2e8f0;
}
/* Boss chat fullscreen tweaks */
.mob-detail-content .bc-wrapper {
  height: 100%;
  border: none;
  border-radius: 0;
  background: #0f0f14;
}
.mob-detail-content .bc-sidebar { display: none; }
.mob-detail-content .bc-main { border-radius: 0; }
.mob-detail-content .bc-messages { padding-left: 14px; }
.mob-detail-content .bc-messages::before { display: none; }
.mob-detail-content .bc-goal-divider::before { display: none; }
.mob-detail-content .bc-activity-feed::before { display: none; }
.mob-detail-content .bc-msg-employee::after { display: none; }
.mob-detail-content .bc-msg-boss::after { display: none; }
.mob-detail-content .bc-minimap { display: none !important; }

/* ─── #5: Boss chat dark theme overrides in mobile ─── */
.mob-detail-content .bc-wrapper { background: #0f0f14; }
.mob-detail-content .bc-main { background: #0f0f14; }
.mob-detail-content .bc-messages { background: #0f0f14; }
.mob-detail-content .bc-msg-boss .bc-bubble-body {
  background: #2a5bd7; color: #fff;
  border-radius: 18px 18px 4px 18px;
}
.mob-detail-content .bc-msg-employee .bc-bubble-body {
  background: #1e1e2e; color: #e2e8f0;
  border-radius: 18px 18px 18px 4px;
  border-color: rgba(255,255,255,0.06);
}
.mob-detail-content .bc-msg-system .bc-bubble-body {
  background: rgba(245,158,11,0.12); color: #f59e0b;
}
/* ─── #11: Boss chat input bar dark theme ─── */
.mob-detail-content .chat-input,
.mob-detail-content .bc-input-row {
  background: rgba(22,22,30,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 8px 12px;
}
.mob-detail-content .chat-input textarea {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e2e8f0;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 15px;
  resize: none;
}
.mob-detail-content .chat-input textarea::placeholder { color: #5c5c5e; }
.mob-detail-content .chat-input textarea:focus {
  border-color: rgba(91,141,239,0.4);
  box-shadow: 0 0 0 2px rgba(91,141,239,0.1);
  outline: none;
}
.mob-detail-content .chat-input .chat-send-btn {
  background: #2a5bd7;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  border: none;
  color: white;
}
.mob-detail-content .chat-input .chat-send-btn:hover {
  background: #2350c0;
}
.mob-detail-content .chat-input .chat-attach-btn,
.mob-detail-content .chat-attach-btn {
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  border: none;
  color: #5b8def;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  font-size: 16px;
  flex-shrink: 0;
}
/* ─── #19: Prevent iOS zoom on textarea focus ─── */
.mob-detail-content textarea { font-size: 16px; }
.mob-detail-content .bc-sidebar { display: none !important; }
.mob-detail-content .bc-sidebar-toggle { display: none !important; }
.mob-detail-content .bc-search-bar { display: none; }
.mob-detail-content .bc-minimap { display: none !important; }
.mob-detail-content .bc-messages::before { display: none !important; }
.mob-detail-content .bc-goal-divider::before { display: none !important; }
.mob-detail-content .bc-activity-feed::before { display: none !important; }
.mob-detail-content .bc-msg-employee::after { display: none !important; }
.mob-detail-content .bc-msg-boss::after { display: none !important; }
.mob-detail-content .bc-avatar { width: 32px; height: 32px; font-size: 11px; }
.mob-detail-content .bc-msg-time { font-size: 11px; color: rgba(255,255,255,0.4); }
.mob-detail-content .bc-sender-name { color: rgba(255,255,255,0.5); }
.mob-detail-content .bc-sender-time { color: rgba(255,255,255,0.3); }
.mob-detail-content .bc-date-sep {
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.5);
}
/* #20: Boss chat empty state dark theme */
.mob-detail-content .bc-empty-state {
  color: #64748b;
  background: #0f0f14;
}
.mob-detail-content .bc-empty-icon {
  opacity: 0.3;
  animation: mob-empty-float 3s ease-in-out infinite;
}
.mob-detail-content .bc-empty-title { color: #94a3b8; }
.mob-detail-content .bc-empty-hint { color: #64748b; }
@keyframes mob-empty-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
/* Boss chat goal divider in dark mode */
.mob-detail-content .bc-goal-divider-label {
  background: rgba(91,141,239,0.12); color: #5b8def;
  border-color: rgba(91,141,239,0.2);
}
.mob-detail-content .bc-goal-divider-line {
  background: linear-gradient(to right, rgba(91,141,239,0.2), transparent);
}
/* Task progress in dark mode */
.mob-detail-content .bc-task-progress {
  background: rgba(37,99,235,0.08); border-color: rgba(37,99,235,0.2);
  color: #93c5fd;
}
/* Activity feed in dark mode */
.mob-detail-content .bc-activity-feed {
  background: rgba(255,255,255,0.03); border-left-color: #5b8def;
}
.mob-detail-content .bc-confirm-plan {
  background: rgba(234,179,8,0.08);
  border-left-color: #eab308;
}
.mob-detail-content .bc-confirm-text { color: #fbbf24; }
.mob-detail-content .bc-confirm-reject { background: rgba(255,255,255,0.06); color: #94a3b8; }
.mob-detail-content .bc-activity-header { color: #5b8def; }
.mob-detail-content .bc-act-text { color: #94a3b8; }
/* Self-assessment in dark mode */
.mob-detail-content .bc-self-assess {
  background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08);
  color: #94a3b8;
}
/* File preview in dark mode */
.mob-detail-content .bc-file-preview {
  background: #16161e; border-top-color: rgba(255,255,255,0.06);
}
/* Thinking indicator dark mode */
.mob-detail-content .bc-thinking {
  background: rgba(139,92,246,0.12); border-color: rgba(139,92,246,0.2);
  color: #a78bfa;
}
/* Show-more links in dark mode */
.mob-detail-content .bc-msg-boss .bc-show-more {
  background: linear-gradient(transparent, #2a5bd7 50%);
  color: rgba(255,255,255,0.7);
}
.mob-detail-content .bc-msg-employee .bc-show-more {
  background: linear-gradient(transparent, #1e1e2e 50%);
  color: #5b8def;
}
/* Current goal sticky in dark mode */
.mob-detail-content .bc-current-goal {
  background: rgba(91,141,239,0.1);
  border-bottom-color: rgba(91,141,239,0.15);
  color: #5b8def;
}
/* Scroll FAB in dark mode */
.mob-detail-content .bc-scroll-fab {
  background: #5b8def;
}
/* Slash autocomplete dark mode */
.mob-detail-content .slash-autocomplete {
  background: #1e1e2e; border-color: rgba(255,255,255,0.08);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.4);
}
.mob-detail-content .slash-item:hover,
.mob-detail-content .slash-selected {
  background: rgba(255,255,255,0.06);
}
.mob-detail-content .slash-desc { color: #8e8e93; }
/* Markdown in dark employee bubble */
.mob-detail-content .bc-msg-employee .bc-md-h3 {
  color: #e2e8f0; border-bottom-color: rgba(255,255,255,0.1);
}
.mob-detail-content .bc-msg-employee .bc-md-h4 { color: #cbd5e1; }
.mob-detail-content .bc-msg-employee .bc-md-code {
  background: rgba(255,255,255,0.08); color: #e2e8f0;
}
.mob-detail-content .bc-msg-employee .bc-md-pre {
  background: rgba(255,255,255,0.05); color: #e2e8f0;
}
.mob-detail-content .bc-msg-employee .bc-md-hr { border-top-color: rgba(255,255,255,0.1); }
.mob-detail-content .bc-msg-employee .bc-chip { background: rgba(255,255,255,0.08); color: #94a3b8; }
/* File links in dark mode */
.mob-detail-content .bc-msg-employee .bc-file-link {
  background: rgba(91,141,239,0.12); color: #5b8def;
  border-color: rgba(91,141,239,0.2);
}
.mob-detail-content .bc-msg-boss .bc-file-link {
  background: rgba(255,255,255,0.15); color: #fff;
  border-color: rgba(255,255,255,0.2);
}
/* Delegation buttons dark mode */
.mob-detail-content .bc-deleg-reject {
  background: rgba(255,255,255,0.06); border-color: rgba(239,68,68,0.3);
}
.mob-detail-content .bc-deleg-approve {
  background: #16a34a; color: #fff;
}
/* ─── #12: Phase markers dark mode ─── */
.mob-detail-content .bc-phase-marker {
  background: linear-gradient(135deg, rgba(91,141,239,0.15), rgba(139,92,246,0.15));
  border-color: rgba(91,141,239,0.25);
  color: #93c5fd;
}
/* ─── #12: Confirmation messages dark mode ─── */
.mob-detail-content .bc-delegation-actions {
  border-color: rgba(255,255,255,0.08);
}
/* ─── #16: Topbar avatar ─── */
.mob-topbar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  flex-shrink: 0;
}

/* ─── Empty State ─── */
.mob-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: #475569;
  text-align: center;
  min-height: 200px;
}
.mob-empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.mob-empty-text { font-size: 15px; font-weight: 500; }
.mob-empty-hint { font-size: 13px; color: #374151; margin-top: 6px; }

/* ─── Section Header ─── */
.mob-section-header {
  padding: 20px 16px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ─── Slash Autocomplete ─── */
.slash-autocomplete {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0; right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.12);
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  margin-bottom: 4px;
  padding: 4px 0;
}
.slash-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.slash-item:hover,
.slash-selected {
  background: #f1f5f9;
}
.slash-cmd {
  font-weight: 600;
  font-size: 13px;
  color: #2563eb;
  white-space: nowrap;
  min-width: 120px;
}
.slash-desc {
  font-size: 12px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Share Popup ──────────────────────────────── */
.share-trigger-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
  color: #2563eb;
  line-height: 1;
}
.share-trigger-btn:hover {
  background: #eff6ff;
}
.share-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.share-popup {
  background: #fff;
  border-radius: 12px;
  width: 420px;
  max-width: 95vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.share-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #e2e8f0;
}
.share-popup-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #94a3b8;
  padding: 0 4px;
  line-height: 1;
}
.share-popup-close:hover {
  color: #334155;
}
.share-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}
.share-search:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}
.share-popup-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px;
  min-height: 200px;
  max-height: 400px;
}
.share-section-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 0 4px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 4px;
}
.share-employee-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
}
.share-employee-row:hover {
  background: #f1f5f9;
}
.share-employee-row.selected {
  background: #eff6ff;
}
.share-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 500;
}
.share-badge.owner {
  background: #dcfce7;
  color: #16a34a;
}
.share-badge.hierarchy {
  background: #dbeafe;
  color: #2563eb;
}
.share-badge.participant {
  background: #fef3c7;
  color: #d97706;
}
.share-badge.shared {
  background: #f3e8ff;
  color: #9333ea;
}
.share-popup-footer {
  padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
}
.share-action-btn {
  padding: 6px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  color: #475569;
}
.share-action-btn:hover {
  background: #f1f5f9;
}
.share-cancel-btn {
  padding: 8px 16px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.share-submit-btn {
  padding: 8px 16px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.share-submit-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.share-submit-btn:not(:disabled):hover {
  background: #1d4ed8;
}

/* ─── #21: Telegram-style message bubble tails ─── */
.mob-detail-content .bc-msg-boss .bc-bubble-body::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: -6px;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 0 10px 8px;
  border-color: transparent transparent #2a5bd7 transparent;
}
.mob-detail-content .bc-msg-boss .bc-bubble-body {
  position: relative;
}
.mob-detail-content .bc-msg-employee .bc-bubble-body::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -6px;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 8px 10px 0;
  border-color: transparent transparent #1e1e2e transparent;
}
.mob-detail-content .bc-msg-employee .bc-bubble-body {
  position: relative;
}

/* ─── #22: Pull-to-refresh animation ─── */
.mob-pull-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 0;
  overflow: hidden;
  transition: height 0.2s ease;
  background: #0f0f14;
}
.mob-pull-indicator.active {
  height: 50px;
}
.mob-pull-indicator .mob-pull-spinner {
  width: 28px; height: 28px;
  border: 2.5px solid rgba(91,141,239,0.2);
  border-top-color: #5b8def;
  border-radius: 50%;
}
.mob-pull-indicator.active .mob-pull-spinner {
  animation: mob-pull-spin 0.8s linear infinite;
}
@keyframes mob-pull-spin {
  to { transform: rotate(360deg); }
}

/* ─── #23: Mobile typing indicator (3 bouncing dots) ─── */
.mob-typing-indicator {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 12px 16px 4px;
  align-self: flex-start;
}
.mob-typing-indicator .mob-typing-label {
  font-size: 12px;
  color: #64748b;
  margin-right: 6px;
}
.mob-typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #5b8def;
  animation: mob-typing-bounce 1.4s ease-in-out infinite;
}
.mob-typing-dot:nth-child(2) { animation-delay: 0.16s; }
.mob-typing-dot:nth-child(3) { animation-delay: 0.32s; }
@keyframes mob-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* ─── #24: Swipe-back gesture visual feedback ─── */
.mob-detail-screen.swiping-back {
  transition: none !important;
}

/* ─── #25: Pin chat & context menu ─── */
.mob-chat-item.pinned {
  background: rgba(91,141,239,0.04);
}
.mob-chat-pin-icon {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 10px;
  color: #5b8def;
  opacity: 0.7;
}
.mob-ctx-menu {
  position: fixed;
  z-index: 200;
  background: #1e1e2e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  min-width: 160px;
  padding: 4px 0;
  overflow: hidden;
  animation: mob-ctx-appear 0.15s ease-out;
}
@keyframes mob-ctx-appear {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.mob-ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 14px;
  color: #e2e8f0;
  cursor: pointer;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.mob-ctx-item:active,
.mob-ctx-item:hover {
  background: rgba(255,255,255,0.06);
}
.mob-ctx-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}
.mob-ctx-overlay {
  position: fixed;
  inset: 0;
  z-index: 199;
  background: transparent;
}

/* ─── #26: Unread badge on Chats tab ─── */
.mob-tab-badge.hidden { display: none; }

/* ─── #27: Employee status subtitle in chat list ─── */
.mob-chat-subtitle-goal {
  color: #5b8def;
  font-style: italic;
}
.mob-chat-subtitle-lastseen {
  color: #64748b;
}

/* ─── #28: Animated tab switching (crossfade) ─── */
.mob-screen-leaving {
  animation: mob-screen-fadeout 150ms ease forwards;
  pointer-events: none;
}
.mob-screen-entering {
  animation: mob-screen-fadein 150ms ease forwards;
}
@keyframes mob-screen-fadeout {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes mob-screen-fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─── #29: Goal progress banner in boss chat ─── */
.mob-goal-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
  background: linear-gradient(135deg, #1e2a4a, #1a2744);
  border-bottom: 1px solid rgba(91,141,239,0.15);
  font-size: 12px;
  color: #93c5fd;
  cursor: pointer;
  transition: background 0.15s;
  overflow: hidden;
  flex-shrink: 0;
}
.mob-goal-banner:active {
  background: linear-gradient(135deg, #243358, #1e2f52);
}
.mob-goal-banner-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.mob-goal-banner-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.mob-goal-banner-progress {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.1);
  flex-shrink: 0;
  overflow: hidden;
}
.mob-goal-banner-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: #5b8def;
  transition: width 0.3s ease;
}
.mob-goal-banner-chevron {
  font-size: 14px;
  color: rgba(147,197,253,0.5);
  flex-shrink: 0;
  transition: transform 0.2s;
}
.mob-goal-banner.expanded .mob-goal-banner-chevron {
  transform: rotate(180deg);
}
.mob-goal-banner-details {
  display: none;
  padding: 10px 14px;
  background: rgba(30,42,74,0.8);
  border-bottom: 1px solid rgba(91,141,239,0.1);
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
}
.mob-goal-banner-details.visible {
  display: block;
}
.mob-goal-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.mob-goal-detail-row:last-child { margin-bottom: 0; }
.mob-goal-detail-label {
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.mob-goal-detail-value {
  color: #cbd5e1;
  font-weight: 500;
}

/* ─── #30: Boss chat search bar ─── */
.mob-chat-search-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(22,22,30,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  animation: mob-search-slide-down 150ms ease forwards;
}
.mob-chat-search-bar.visible {
  display: flex;
}
@keyframes mob-search-slide-down {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.mob-chat-search-bar input {
  flex: 1;
  height: 34px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 17px;
  color: #e2e8f0;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.mob-chat-search-bar input::placeholder { color: #5c5c5e; }
.mob-chat-search-bar input:focus { border-color: rgba(91,141,239,0.4); }
.mob-chat-search-bar .mob-search-count {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  min-width: 40px;
  text-align: center;
}
.mob-chat-search-bar .mob-search-nav {
  display: flex;
  gap: 2px;
}
.mob-chat-search-bar .mob-search-nav button {
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mob-chat-search-bar .mob-search-nav button:active { background: rgba(255,255,255,0.08); }
.mob-chat-search-close {
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mob-chat-search-close:active { background: rgba(255,255,255,0.08); }
.mob-detail-content .bc-msg-highlight {
  background: rgba(245,158,11,0.2) !important;
  border-radius: 4px;
  transition: background 0.3s;
}
.mob-detail-content .bc-msg-highlight-current {
  background: rgba(245,158,11,0.4) !important;
}

/* ─── #31: Profile/Company header card on More tab ─── */
.mob-profile-card {
  margin: 12px 16px 4px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16162a 100%);
  border: 1px solid rgba(91,141,239,0.2);
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}
.mob-profile-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 15px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(91,141,239,0.3), rgba(139,92,246,0.2), rgba(91,141,239,0.1));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.mob-profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5b8def, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(91,141,239,0.3);
}
.mob-profile-info {
  flex: 1;
  min-width: 0;
}
.mob-profile-company {
  font-size: 16px;
  font-weight: 700;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mob-profile-username {
  font-size: 13px;
  color: #8e8e93;
  margin-top: 2px;
}
.mob-profile-plan {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(91,141,239,0.15);
  color: #5b8def;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.mob-profile-chevron {
  color: #3a3a3c;
  font-size: 20px;
  flex-shrink: 0;
}

/* ─── #32: Employee action sheet ─── */
.mob-action-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.mob-action-sheet-overlay.visible {
  opacity: 1;
}
.mob-action-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1c1c1e;
  border-radius: 14px 14px 0 0;
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding-bottom: env(safe-area-inset-bottom, 0);
  max-height: 70vh;
  overflow: hidden;
}
.mob-action-sheet.visible {
  transform: translateY(0);
}
.mob-action-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.2);
  margin: 10px auto 6px;
}
.mob-action-sheet-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.mob-action-sheet-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  flex-shrink: 0;
}
.mob-action-sheet-name {
  font-size: 16px;
  font-weight: 600;
  color: #e2e8f0;
}
.mob-action-sheet-role {
  font-size: 12px;
  color: #8e8e93;
  margin-top: 2px;
}
.mob-action-sheet-items {
  padding: 6px 0 10px;
}
.mob-action-sheet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.mob-action-sheet-item:active {
  background: rgba(255,255,255,0.08);
}
.mob-action-sheet-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.mob-action-sheet-label {
  font-size: 15px;
  color: #e2e8f0;
  font-weight: 500;
}
.mob-action-sheet-cancel {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 14px 20px;
  text-align: center;
  font-size: 15px;
  color: #ef4444;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mob-action-sheet-cancel:active {
  background: rgba(255,255,255,0.06);
}

/* ─── #33: Voice message button (mic/send toggle) ─── */
.mob-detail-content .chat-input .mob-mic-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #5b8def;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s ease, background 0.15s ease;
}
.mob-detail-content .chat-input .mob-mic-btn:active {
  transform: scale(0.9);
}
.mob-detail-content .chat-input .mob-mic-btn .mob-mic-icon,
.mob-detail-content .chat-input .mob-mic-btn .mob-send-icon {
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.mob-detail-content .chat-input .mob-mic-btn.has-text .mob-mic-icon {
  opacity: 0;
  transform: scale(0.5);
}
.mob-detail-content .chat-input .mob-mic-btn.has-text .mob-send-icon {
  opacity: 1;
  transform: scale(1);
}
.mob-detail-content .chat-input .mob-mic-btn:not(.has-text) .mob-mic-icon {
  opacity: 1;
  transform: scale(1);
}
.mob-detail-content .chat-input .mob-mic-btn:not(.has-text) .mob-send-icon {
  opacity: 0;
  transform: scale(0.5);
}

/* ─── #34: Chat list swipe actions ─── */
.mob-chat-item-wrapper {
  position: relative;
  overflow: hidden;
}
.mob-chat-item-wrapper .mob-chat-item {
  position: relative;
  z-index: 1;
  background: #0f0f14;
  transition: transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.mob-chat-item-wrapper .mob-chat-item.swiping {
  transition: none;
}
.mob-swipe-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: stretch;
  z-index: 0;
}
.mob-swipe-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  width: 72px;
  border: none;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mob-swipe-btn-mute {
  background: #636366;
}
.mob-swipe-btn-pin {
  background: #5b8def;
}
.mob-swipe-btn .mob-swipe-icon {
  font-size: 20px;
  line-height: 1;
}

/* ─── #35: Haptic feedback micro-animations ─── */
.mob-tab:active .mob-tab-icon {
  transform: scale(0.85);
  transition: transform 0.08s ease;
}
.mob-tab .mob-tab-icon {
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mob-chat-item:active {
  transform: scale(0.98);
  transition: transform 0.08s ease;
}
.mob-topbar-btn:active {
  transform: scale(0.88);
  transition: transform 0.08s ease;
}
.mob-topbar-btn {
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s;
}
.mob-dash-card:active {
  transform: scale(0.97);
  transition: transform 0.08s ease;
}
.mob-dash-card {
  transition: background 0.15s, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mob-team-card:active {
  transform: scale(0.95);
  transition: transform 0.08s ease;
}
.mob-team-card {
  transition: background 0.15s, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mob-action-sheet-item:active {
  background: rgba(255,255,255,0.1);
  transform: scale(0.98);
  transition: transform 0.08s ease, background 0.08s;
}
.mob-detail-content .chat-send-btn:active,
.mob-detail-content .mob-mic-btn:active {
  transform: scale(0.85);
  transition: transform 0.08s ease;
}
.mob-ctx-item:active {
  transform: scale(0.97);
  transition: transform 0.08s ease;
}
.mob-goal-banner:active {
  transform: scale(0.98);
  transition: transform 0.08s ease;
}
.mob-topbar-back:active {
  transform: scale(0.88);
  transition: transform 0.08s ease;
}

/* ─── #36: Dark theme for embedded panels (Fleet, Cards, Cost, Clouds, Usage) ─── */
.mob-detail-content .loading { color: #94a3b8; background: transparent; }
.mob-detail-content .empty { color: #64748b; background: transparent; }

/* Fleet Dashboard dark */
.mob-detail-content .fleet-toolbar {
  background: rgba(255,255,255,0.03); border-bottom-color: rgba(255,255,255,0.06);
}
.mob-detail-content .fleet-toolbar .fleet-count { color: #8e8e93; }
.mob-detail-content .fleet-toolbar button {
  background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.08);
  color: #94a3b8;
}
.mob-detail-content .fleet-toolbar button:hover { background: rgba(255,255,255,0.1); }
.mob-detail-content .fleet-toolbar button.active {
  background: #5b8def; color: #fff; border-color: #5b8def;
}
.mob-detail-content .fleet-grid { background: #0f0f14; }
.mob-detail-content .fleet-card {
  background: #16161e; border-color: rgba(255,255,255,0.06);
}
.mob-detail-content .fleet-card:hover {
  border-color: #5b8def; box-shadow: 0 2px 8px rgba(91,141,239,0.15);
}
.mob-detail-content .fleet-card-name { color: #e2e8f0; }
.mob-detail-content .fleet-card-template { color: #8e8e93; }
.mob-detail-content .fleet-card-stats { }
.mob-detail-content .fleet-stat {
  background: rgba(255,255,255,0.04); border-radius: 6px;
}
.mob-detail-content .fleet-stat-label { color: #64748b; }
.mob-detail-content .fleet-stat-value { color: #cbd5e1; }
.mob-detail-content .fleet-actions {
  border-top-color: rgba(255,255,255,0.06);
}
.mob-detail-content .fleet-actions button {
  background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08);
  color: #94a3b8;
}
.mob-detail-content .fleet-actions button:hover { background: rgba(255,255,255,0.08); }
.mob-detail-content .fleet-actions button.btn-danger { color: #ef4444; border-color: rgba(239,68,68,0.3); }
.mob-detail-content .fleet-actions button.btn-success { color: #22c55e; border-color: rgba(34,197,94,0.3); }

/* Employee Cards (ec-card) dark */
.mob-detail-content .cards-grid { background: #0f0f14; }
.mob-detail-content .cards-toolbar {
  background: rgba(255,255,255,0.03); border-bottom-color: rgba(255,255,255,0.06);
}
.mob-detail-content .cards-search {
  background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.08);
  color: #e2e8f0;
}
.mob-detail-content .cards-search::placeholder { color: #5c5c5e; }
.mob-detail-content .cards-sort {
  background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.08);
  color: #e2e8f0;
}
.mob-detail-content .cards-count { color: #8e8e93; }
.mob-detail-content .ec-card {
  background: #16161e; border-color: rgba(255,255,255,0.06);
}
.mob-detail-content .ec-card:hover {
  border-color: #0891b2; box-shadow: 0 2px 8px rgba(8,145,178,0.15);
}
.mob-detail-content .ec-name { color: #e2e8f0; }
.mob-detail-content .ec-role { color: #8e8e93; }
.mob-detail-content .ec-template { color: #64748b; }
.mob-detail-content .ec-mission { color: #94a3b8; }
.mob-detail-content .ec-stat {
  background: rgba(255,255,255,0.04);
}
.mob-detail-content .ec-stat-val { color: #cbd5e1; }
.mob-detail-content .ec-stat-label { color: #64748b; }
.mob-detail-content .ec-last-activity { color: #64748b; }
.mob-detail-content .ec-qtrack { background: rgba(255,255,255,0.08); }
.mob-detail-content .ec-qlabel { color: #64748b; }
.mob-detail-content .ec-qval { color: #cbd5e1; }
.mob-detail-content .ec-actions {
  border-top-color: rgba(255,255,255,0.06);
}
.mob-detail-content .ec-actions button {
  background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08);
  color: #94a3b8;
}
.mob-detail-content .ec-actions button:hover { background: rgba(255,255,255,0.08); }
.mob-detail-content .cards-pagination {
  border-top-color: rgba(255,255,255,0.06);
}
.mob-detail-content .cards-page-info { color: #64748b; }
.mob-detail-content .cards-pagination button {
  background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.08);
  color: #94a3b8;
}

/* Cost & Routing dark */
.mob-detail-content .cost-grid { background: #0f0f14; }
.mob-detail-content .cost-card {
  background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.06);
}
.mob-detail-content .cost-card .big-value { color: #e2e8f0; }
.mob-detail-content .cost-card .label { color: #64748b; }
.mob-detail-content .cost-card.highlight {
  background: rgba(22,163,74,0.08); border-color: rgba(22,163,74,0.2);
}
.mob-detail-content .cost-card.highlight .big-value { color: #22c55e; }
.mob-detail-content .cost-legend { color: #8e8e93; }

/* Execution Clouds dark */
.mob-detail-content .cloud-summary {
  background: rgba(255,255,255,0.03); border-bottom-color: rgba(255,255,255,0.06);
  color: #94a3b8;
}
.mob-detail-content .cloud-summary .cloud-count { color: #e2e8f0; }
.mob-detail-content .cloud-list { background: #0f0f14; }
.mob-detail-content .cloud-card {
  background: #16161e; border-color: rgba(255,255,255,0.06);
}
.mob-detail-content .cloud-goal-desc { color: #e2e8f0; }
.mob-detail-content .cloud-progress { color: #94a3b8; }
.mob-detail-content .cloud-progress-bar { background: rgba(255,255,255,0.08); }
.mob-detail-content .cloud-actions-breakdown { color: #94a3b8; }
.mob-detail-content .cloud-ctx { color: #8e8e93; }
.mob-detail-content .cloud-ctx-val { color: #22c55e; }
.mob-detail-content .cloud-aggregates { color: #8e8e93; }
.mob-detail-content .cloud-btns { border-top-color: rgba(255,255,255,0.06); }
.mob-detail-content .cloud-btns button {
  background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08);
  color: #94a3b8;
}
.mob-detail-content .cloud-btns button:hover { background: rgba(255,255,255,0.08); }
.mob-detail-content .cloud-btns button.active {
  background: rgba(91,141,239,0.12); border-color: rgba(91,141,239,0.3); color: #5b8def;
}
.mob-detail-content .cloud-btns button.btn-danger { color: #ef4444; border-color: rgba(239,68,68,0.3); }
.mob-detail-content .cloud-btns button.btn-success { color: #22c55e; border-color: rgba(34,197,94,0.3); }
.mob-detail-content .cloud-step-row { border-bottom-color: rgba(255,255,255,0.04); }
.mob-detail-content .cloud-step-num { color: #64748b; }
.mob-detail-content .cloud-step-action { color: #e2e8f0; }
.mob-detail-content .cloud-step-sizes { color: #8e8e93; }
.mob-detail-content .cloud-step-cost { color: #22c55e; }
.mob-detail-content .cloud-popup { background: rgba(0,0,0,0.7); }
.mob-detail-content .cloud-popup-body {
  background: #16161e; color: #e2e8f0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.mob-detail-content .cloud-popup-body h3 { color: #e2e8f0; }
.mob-detail-content .cloud-popup-body pre {
  background: rgba(255,255,255,0.04); color: #cbd5e1;
}
.mob-detail-content .cloud-popup-close { color: #64748b; }
.mob-detail-content .cloud-popup-close:hover { color: #e2e8f0; }

/* Employee Detail dark */
.mob-detail-content .detail-section {
  border-bottom-color: rgba(255,255,255,0.06);
}
.mob-detail-content .detail-section-title { color: #64748b; }
.mob-detail-content .detail-stat-card {
  background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.06);
}
.mob-detail-content .detail-stat-card .value { color: #e2e8f0; }
.mob-detail-content .detail-stat-card .label { color: #64748b; }
.mob-detail-content .detail-actions button {
  background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08);
  color: #94a3b8;
}
.mob-detail-content .detail-actions button:hover { background: rgba(255,255,255,0.08); }
.mob-detail-content .detail-actions button.primary {
  background: #5b8def; color: #fff; border-color: #5b8def;
}
.mob-detail-content .detail-actions button.danger {
  color: #ef4444; border-color: rgba(239,68,68,0.3);
}
.mob-detail-content .autonomy-gauge {
  background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.06);
}
.mob-detail-content .autonomy-bar { background: rgba(255,255,255,0.08); }
.mob-detail-content .autonomy-label { color: #cbd5e1; }

/* Training panel dark */
.mob-detail-content .training-stats { background: #0f0f14; }
.mob-detail-content .training-stat {
  background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.06);
}
.mob-detail-content .training-stat .big-value { color: #e2e8f0; }
.mob-detail-content .training-stat .label { color: #64748b; }
.mob-detail-content .draft-card {
  border-color: rgba(255,255,255,0.06); background: #16161e;
}
.mob-detail-content .draft-header { color: #8e8e93; }
.mob-detail-content .draft-content {
  background: rgba(255,255,255,0.04); color: #cbd5e1;
}
.mob-detail-content .draft-actions button {
  background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08);
  color: #94a3b8;
}
.mob-detail-content .rule-item { border-bottom-color: rgba(255,255,255,0.06); }
.mob-detail-content .rule-trigger { color: #5b8def; }
.mob-detail-content .rule-response { color: #94a3b8; }
.mob-detail-content .rule-meta { color: #64748b; }

/* Ouroboros/DNA dark */
.mob-detail-content .ouro-tabs {
  background: rgba(255,255,255,0.02); border-bottom-color: rgba(255,255,255,0.06);
}
.mob-detail-content .ouro-tab { color: #8e8e93; }
.mob-detail-content .ouro-tab:hover { color: #e2e8f0; }
.mob-detail-content .ouro-tab.active { color: #a78bfa; border-bottom-color: #a78bfa; }
.mob-detail-content .ouro-content { background: #0f0f14; }
.mob-detail-content .dna-fact {
  background: #16161e; border-color: rgba(255,255,255,0.06);
}
.mob-detail-content .dna-fact-trigger { color: #a78bfa; }
.mob-detail-content .dna-fact-confidence {
  background: rgba(139,92,246,0.12); color: #a78bfa;
}
.mob-detail-content .dna-fact-text { color: #94a3b8; }
.mob-detail-content .dna-fact-meta { color: #64748b; }
.mob-detail-content .dna-fact-actions button {
  background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08);
}
.mob-detail-content .self-model-box {
  background: rgba(139,92,246,0.08); border-color: rgba(139,92,246,0.2);
  color: #a78bfa;
}
.mob-detail-content .block-card {
  background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.06);
}
.mob-detail-content .block-date { color: #e2e8f0; }
.mob-detail-content .block-count { color: #8e8e93; }
.mob-detail-content .timeline-event { border-bottom-color: rgba(255,255,255,0.06); }
.mob-detail-content .timeline-event-type { color: #e2e8f0; }
.mob-detail-content .timeline-event-time { color: #64748b; }

/* Group Chats dark */
.mob-detail-content .gc-item { border-bottom-color: rgba(255,255,255,0.06); }
.mob-detail-content .gc-item:hover { background: rgba(255,255,255,0.04); }
.mob-detail-content .gc-item.active { background: rgba(91,141,239,0.08); }
.mob-detail-content .gc-icon {
  background: rgba(91,141,239,0.15); color: #5b8def;
}
.mob-detail-content .gc-name { color: #e2e8f0; }
.mob-detail-content .gc-members { color: #64748b; }
.mob-detail-content .gc-messages {
  background: rgba(255,255,255,0.02); border-bottom-color: rgba(255,255,255,0.06);
}
.mob-detail-content .gc-msg-content { color: #cbd5e1; }
.mob-detail-content .gc-msg.directive {
  background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.2);
}
.mob-detail-content .gc-input-row { border-top-color: rgba(255,255,255,0.06); }
.mob-detail-content .gc-input-row input {
  background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.08);
  color: #e2e8f0;
}

/* Voice panel dark */
.mob-detail-content .voice-panel { background: #0f0f14; }

/* Generic overrides for any remaining light elements */
.mob-detail-content .info-row { border-bottom-color: rgba(255,255,255,0.06); }
.mob-detail-content .info-row .label { color: #64748b; }
.mob-detail-content .info-row .value { color: #e2e8f0; }
.mob-detail-content .btn-sm {
  background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08);
  color: #94a3b8;
}
.mob-detail-content .btn-sm:hover { background: rgba(255,255,255,0.08); }
.mob-detail-content .btn-sm.primary { background: #5b8def; color: #fff; border-color: #5b8def; }
.mob-detail-content select,
.mob-detail-content input:not([type="file"]) {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.08);
  color: #e2e8f0;
}
.mob-detail-content select option { background: #16161e; color: #e2e8f0; }
.mob-detail-content table { border-collapse: collapse; width: 100%; }
.mob-detail-content th {
  background: rgba(255,255,255,0.04); color: #94a3b8;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 8px; text-align: left; font-size: 11px;
}
.mob-detail-content td {
  color: #cbd5e1; border-bottom: 1px solid rgba(255,255,255,0.04);
  padding: 6px 8px; font-size: 12px;
}
.mob-detail-content h3, .mob-detail-content h4 { color: #e2e8f0; }
.mob-detail-content a { color: #5b8def; }
.mob-detail-content hr { border-color: rgba(255,255,255,0.06); }

/* ─── #37: Toast notification system ─── */
.mob-toast-container {
  position: fixed;
  bottom: 80px;
  left: 12px;
  right: 12px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}
.mob-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(22,22,30,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  pointer-events: auto;
  animation: mob-toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 100%;
  overflow: hidden;
}
.mob-toast.removing {
  animation: mob-toast-out 0.25s ease forwards;
}
@keyframes mob-toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes mob-toast-out {
  from { transform: translateY(0); opacity: 1; }
  to   { transform: translateY(20px); opacity: 0; }
}
.mob-toast-accent {
  width: 4px;
  min-height: 28px;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: stretch;
}
.mob-toast-success .mob-toast-accent { background: #22c55e; }
.mob-toast-error .mob-toast-accent { background: #ef4444; }
.mob-toast-info .mob-toast-accent { background: #5b8def; }
.mob-toast-warning .mob-toast-accent { background: #f59e0b; }
.mob-toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.mob-toast-message {
  flex: 1;
  font-size: 14px;
  color: #e2e8f0;
  line-height: 1.4;
  min-width: 0;
  word-wrap: break-word;
}
.mob-toast-close {
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  color: #64748b;
  font-size: 16px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.mob-toast-close:active { background: rgba(255,255,255,0.08); }

/* ─── #38: File attachment preview bar ─── */
.mob-file-preview-bar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(22,22,30,0.95);
  border-top: 1px solid rgba(255,255,255,0.06);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}
.mob-file-preview-bar:empty { display: none; }
.mob-file-thumb {
  position: relative;
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mob-file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mob-file-thumb-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px;
  gap: 2px;
}
.mob-file-thumb-icon {
  font-size: 22px;
}
.mob-file-thumb-name {
  font-size: 9px;
  color: #94a3b8;
  max-width: 56px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mob-file-thumb-size {
  font-size: 8px;
  color: #64748b;
}
.mob-file-thumb-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  border: 2px solid #0f0f14;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 1;
}

/* ─── #39: Landscape mode support ─── */
@media (max-width: 768px) and (orientation: landscape) {
  .mob-tabs {
    height: 40px;
    min-height: 40px;
    padding-bottom: 0;
  }
  .mob-tab {
    font-size: 0;
    gap: 0;
    padding: 4px 12px;
  }
  .mob-tab-icon {
    font-size: 16px;
  }
  .mob-topbar {
    height: 44px;
    min-height: 44px;
  }
  .mob-topbar-title {
    font-size: 15px;
  }
  .mob-topbar-subtitle {
    font-size: 11px;
  }
  .mob-detail-content .bc-msg-boss .bc-bubble-body,
  .mob-detail-content .bc-msg-employee .bc-bubble-body {
    max-width: 70%;
  }
  .mob-search {
    padding: 6px 12px;
  }
  .mob-search input {
    height: 32px;
    font-size: 13px;
  }
  .mob-chat-search-bar {
    padding: 4px 10px;
  }
  .mob-goal-banner {
    height: 30px;
    min-height: 30px;
    font-size: 11px;
  }
  .mob-toast-container {
    bottom: 50px;
  }
}

/* ─── #40: Accessibility — prefers-reduced-motion ─── */
@media (prefers-reduced-motion: reduce) {
  .mob-detail-screen,
  .mob-screen-leaving,
  .mob-screen-entering,
  .mob-toast,
  .mob-toast.removing,
  .mob-action-sheet,
  .mob-action-sheet-overlay,
  .mob-ctx-menu,
  .mob-pull-indicator .mob-pull-spinner,
  .mob-typing-dot,
  .mob-tab .mob-tab-icon,
  .mob-chat-item,
  .mob-topbar-btn,
  .mob-dash-card,
  .mob-team-card,
  .mob-chat-search-bar,
  .mob-goal-banner-chevron,
  .mob-goal-banner-progress-fill,
  .mob-detail-content .chat-input .mob-mic-btn .mob-mic-icon,
  .mob-detail-content .chat-input .mob-mic-btn .mob-send-icon,
  .mob-detail-content .bc-empty-icon,
  .mob-msg-action-menu,
  .mob-reply-bar,
  .mob-create-group-screen,
  .mob-fab {
    animation: none !important;
    transition: none !important;
  }
  .mob-screen-leaving { opacity: 0; }
  .mob-screen-entering { opacity: 1; }
  .mob-detail-screen { transform: translateX(0); opacity: 1; }
  .mob-toast { transform: translateY(0); opacity: 1; }
  .mob-toast.removing { opacity: 0; }
}

/* ─── #41: Message action menu (long-press) ─── */
.mob-msg-action-overlay {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.mob-msg-action-menu {
  position: fixed;
  z-index: 8001;
  background: rgba(22,22,30,0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  min-width: 160px;
  overflow: hidden;
  animation: mob-action-menu-in 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes mob-action-menu-in {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.mob-msg-action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  font-size: 15px;
  color: #e2e8f0;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: background 0.1s;
}
.mob-msg-action-item:last-child { border-bottom: none; }
.mob-msg-action-item:active { background: rgba(255,255,255,0.08); }
.mob-msg-action-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

/* Reply preview bar */
.mob-reply-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(22,22,30,0.95);
  border-top: 1px solid rgba(255,255,255,0.06);
  border-left: 3px solid #5b8def;
  flex-shrink: 0;
  animation: mob-reply-bar-in 0.2s ease;
}
@keyframes mob-reply-bar-in {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.mob-reply-bar-content {
  flex: 1;
  min-width: 0;
}
.mob-reply-bar-sender {
  font-size: 12px;
  font-weight: 600;
  color: #5b8def;
  margin-bottom: 2px;
}
.mob-reply-bar-text {
  font-size: 13px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.mob-reply-bar-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: none;
  border: none;
  color: #64748b;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mob-reply-bar-close:active { background: rgba(255,255,255,0.08); }

/* ─── #42: Message read receipts ─── */
.mob-msg-status {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  font-size: 12px;
  line-height: 1;
  vertical-align: middle;
}
.mob-msg-status-sent { color: rgba(255,255,255,0.35); }
.mob-msg-status-delivered { color: rgba(255,255,255,0.45); }
.mob-msg-status-read { color: #5b8def; }

/* ─── #43: Global search results ─── */
.mob-global-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 60vh;
  overflow-y: auto;
  background: rgba(15,15,20,0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 100;
  display: none;
}
.mob-global-search-results.visible { display: block; }
.mob-global-search-group {
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mob-global-search-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 4px;
  font-size: 12px;
  font-weight: 600;
  color: #5b8def;
}
.mob-global-search-group-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.mob-global-search-item {
  padding: 8px 14px 8px 44px;
  font-size: 13px;
  color: #cbd5e1;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mob-global-search-item:active { background: rgba(255,255,255,0.05); }
.mob-global-search-item .mob-gsr-role {
  font-size: 11px;
  color: #5b8def;
  margin-right: 6px;
}
.mob-global-search-item .mob-gsr-match {
  color: #f59e0b;
  font-weight: 600;
}
.mob-global-search-loading {
  padding: 16px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
}
.mob-global-search-empty {
  padding: 24px 16px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
}

/* ─── #44: FAB + Create group UI ─── */
.mob-fab {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #5b8def;
  color: #fff;
  border: none;
  font-size: 26px;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(91,141,239,0.4);
  cursor: pointer;
  z-index: 200;
  transition: transform 0.15s, box-shadow 0.15s;
}
.mob-fab:active {
  transform: scale(0.92);
  box-shadow: 0 2px 8px rgba(91,141,239,0.3);
}
.mob-create-group-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #0f0f14;
  display: flex;
  flex-direction: column;
  animation: mob-create-group-in 0.25s ease;
}
@keyframes mob-create-group-in {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.mob-create-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #1a1a24;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.mob-create-group-header-title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  color: #e2e8f0;
}
.mob-create-group-close {
  background: none;
  border: none;
  color: #64748b;
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
}
.mob-create-group-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.mob-create-group-body input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: #e2e8f0;
  font-size: 15px;
  margin-bottom: 16px;
  outline: none;
}
.mob-create-group-body input[type="text"]:focus {
  border-color: rgba(91,141,239,0.4);
}
.mob-create-group-body input[type="text"]::placeholder { color: #5c5c5e; }
.mob-create-group-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.mob-employee-checkbox {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
}
.mob-employee-checkbox:active { opacity: 0.7; }
.mob-employee-checkbox-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.mob-employee-checkbox-info {
  flex: 1;
  min-width: 0;
}
.mob-employee-checkbox-name {
  font-size: 14px;
  color: #e2e8f0;
  font-weight: 500;
}
.mob-employee-checkbox-role {
  font-size: 12px;
  color: #64748b;
}
.mob-employee-checkbox-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.mob-employee-checkbox.selected .mob-employee-checkbox-check {
  background: #5b8def;
  border-color: #5b8def;
}
.mob-employee-checkbox.selected .mob-employee-checkbox-check::after {
  content: '\2713';
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.mob-create-group-footer {
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.mob-create-group-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: #5b8def;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.mob-create-group-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.mob-create-group-btn:active:not(:disabled) { opacity: 0.8; }

/* Groups section in chat list */
.mob-groups-section {
  padding: 8px 14px 4px;
}
.mob-groups-section-title {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.mob-group-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
}
.mob-group-item:active { background: rgba(255,255,255,0.04); }
.mob-group-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5b8def, #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.mob-group-info { flex: 1; min-width: 0; }
.mob-group-name {
  font-size: 15px;
  font-weight: 600;
  color: #e2e8f0;
}
.mob-group-members {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

/* ─── #45: Telegram-style message timestamps ─── */
.mob-detail-content .bc-date-sep {
  display: flex;
  justify-content: center;
  padding: 8px 0;
  margin: 4px 0;
}
.mob-detail-content .bc-date-sep-pill {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.08);
  color: #94a3b8;
  font-size: 12px;
  font-weight: 500;
}
.mob-detail-content .bc-msg-time-inline {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  line-height: 1;
}
.mob-detail-content .bc-msg-employee .bc-msg-time-inline {
  color: rgba(255,255,255,0.4);
}
.mob-detail-content .bc-msg-boss .bc-msg-time-inline {
  color: rgba(255,255,255,0.5);
}

/* ═══════════════════════════════════════════════════════════════════════
   ITERATIONS 46-50 — Emoji reactions, Link previews, Image viewer,
   Scroll-to-bottom, Virtual scroll
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── #46: Emoji Reaction Bar (long-press on messages) ─── */
.mob-reaction-bar {
  position: absolute;
  display: flex;
  gap: 2px;
  background: #1e1e2e;
  border-radius: 24px;
  padding: 4px 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.08);
  z-index: 310;
  transform: scale(0);
  opacity: 0;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.15s ease;
  pointer-events: none;
}
.mob-reaction-bar.visible {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
}
.mob-reaction-bar-emoji {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.mob-reaction-bar-emoji:hover {
  background: rgba(255,255,255,0.1);
}
.mob-reaction-bar-emoji:active {
  transform: scale(1.3);
}
.mob-reaction-bar-overlay {
  position: fixed;
  inset: 0;
  z-index: 309;
  background: transparent;
}

/* Reaction badges below messages */
.mob-reaction-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  padding: 0 4px;
}
.mob-reaction-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 2px 8px 2px 6px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.mob-reaction-badge:active {
  background: rgba(255,255,255,0.12);
}
.mob-reaction-badge.mob-reaction-mine {
  background: rgba(91,141,239,0.15);
  border-color: rgba(91,141,239,0.3);
}
.mob-reaction-badge-count {
  font-size: 12px;
  color: #8e8e93;
  min-width: 8px;
  text-align: center;
}
.mob-reaction-badge.mob-reaction-mine .mob-reaction-badge-count {
  color: #5b8def;
}

/* Bounce animation for newly added reaction */
@keyframes mobReactionBounce {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
.mob-reaction-badge.mob-reaction-new {
  animation: mobReactionBounce 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ─── #47: Link Preview Cards ─── */
.mob-link-preview {
  display: block;
  margin-top: 8px;
  padding: 8px 10px 8px 12px;
  background: rgba(255,255,255,0.04);
  border-left: 3px solid #5b8def;
  border-radius: 0 8px 8px 0;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
  overflow: hidden;
}
.mob-link-preview:active {
  background: rgba(255,255,255,0.08);
}
.mob-link-preview-site {
  font-size: 12px;
  font-weight: 600;
  color: #5b8def;
  margin-bottom: 2px;
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mob-link-preview-url {
  font-size: 12px;
  color: #8e8e93;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ─── #48: Image Viewer / Gallery ─── */
.mob-image-thumb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.mob-image-thumb {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  transition: opacity 0.15s ease;
}
.mob-image-thumb:active {
  opacity: 0.7;
}
.mob-image-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.mob-image-overlay.visible {
  opacity: 1;
}
.mob-image-viewer {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}
.mob-image-viewer img {
  max-width: 95vw;
  max-height: 85vh;
  object-fit: contain;
  transition: transform 0.2s ease;
  user-select: none;
  -webkit-user-drag: none;
}
.mob-image-viewer img.mob-image-zoomed {
  transition: none;
}
.mob-image-viewer-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 510;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mob-image-viewer-close:active {
  background: rgba(255,255,255,0.3);
}
.mob-image-viewer-counter {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  z-index: 510;
}
.mob-image-viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 510;
  width: 40px;
  height: 60px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.mob-image-viewer-nav:active {
  background: rgba(255,255,255,0.25);
}
.mob-image-viewer-nav.prev { left: 8px; }
.mob-image-viewer-nav.next { right: 8px; }

/* ─── #49: Scroll-to-bottom floating button ─── */
.mob-scroll-bottom-btn {
  position: absolute;
  bottom: 70px;
  right: 14px;
  z-index: 50;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #1e1e2e;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #8e8e93;
  font-size: 18px;
  transition: opacity 0.2s ease, transform 0.2s ease;
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}
.mob-scroll-bottom-btn.visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
.mob-scroll-bottom-btn:active {
  background: #2a2a3e;
}
.mob-scroll-bottom-btn .mob-scroll-unread {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #5b8def;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ─── #50: Virtual scroll placeholders ─── */
.mob-virtual-placeholder {
  height: 72px;
  width: 100%;
  flex-shrink: 0;
}
.mob-chat-item.mob-virtual-hidden {
  visibility: hidden;
  height: 0;
  overflow: hidden;
  padding: 0;
  margin: 0;
  border: none;
  min-height: 0;
}

/* ─── Direct Messages (DM) ─── */

/* Section header in chat list */
.mob-dm-section {
  padding: 8px 14px 4px;
}
.mob-dm-section-title {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.mob-dm-section-divider {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 14px 4px;
}

/* DM conversation item in chat list — WhatsApp style */
.mob-dm-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  min-height: 72px;
  cursor: pointer;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.mob-dm-item:active {
  background: rgba(255,255,255,0.06);
  transform: scale(0.98);
}
.mob-dm-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 76px;
  right: 0;
  height: 1px;
  background: rgba(255,255,255,0.06);
}
.mob-dm-item:last-child::after { display: none; }
.mob-dm-quick-call {
  background: none;
  border: none;
  font-size: 22px;
  padding: 8px 12px;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 50%;
  transition: background 0.15s;
}
.mob-dm-quick-call:active {
  background: rgba(124, 110, 245, 0.2);
}
.mob-topbar-call-btn {
  transition: background 0.15s;
  border-radius: 50%;
}
.mob-topbar-call-btn:active {
  background: rgba(124, 110, 245, 0.25) !important;
}
.mob-dm-avatar {
  width: 50px; height: 50px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}
.mob-dm-info { flex: 1; min-width: 0; }
.mob-dm-name {
  font-size: 16px;
  font-weight: 500;
  color: #e9edef;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mob-dm-preview {
  font-size: 14px;
  color: #8696a0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  line-height: 1.3;
}
.mob-dm-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  align-self: flex-start;
  padding-top: 2px;
}
.mob-dm-time {
  font-size: 12px;
  color: #8e8e93;
}
.mob-dm-unread {
  background: #5b8def;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* DM fullscreen chat container */
.mob-dm-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0b141a;
  overflow-x: hidden;
  max-width: 100vw;
}

/* DM messages area — WhatsApp-style dark background */
.mob-dm-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: none;
  background: #0b141a;
}
.mob-dm-messages::-webkit-scrollbar { width: 0; }

/* DM message bubbles — WhatsApp Android style */
.mob-dm-msg {
  display: flex;
  max-width: 80%;
  animation: mob-dm-msg-enter 0.15s ease-out;
}
@keyframes mob-dm-msg-enter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.mob-dm-msg-sent {
  align-self: flex-end;
}
.mob-dm-msg-received {
  align-self: flex-start;
}
.mob-dm-bubble {
  padding: 6px 8px 4px 9px;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  overflow: hidden;
  font-size: 15.5px;
  line-height: 1.35;
  position: relative;
  max-width: 100%;
  box-shadow: 0 1px 1px rgba(0,0,0,0.13);
}
.mob-dm-msg-sent .mob-dm-bubble {
  background: #005c4b;
  color: #e9edef;
  border-radius: 8px 8px 2px 8px;
}
.mob-dm-msg-received .mob-dm-bubble {
  background: #1f2c34;
  color: #e9edef;
  border-radius: 8px 8px 8px 2px;
}

/* Message footer (time + read receipts) — inline like WhatsApp */
.mob-dm-msg-footer {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 0;
  padding: 0;
  float: right;
  margin-left: 8px;
  position: relative;
  top: 4px;
}
.mob-dm-msg-time {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}
.mob-dm-msg-sent .mob-dm-msg-time {
  color: rgba(255,255,255,0.55);
}

/* Read receipts — checkmarks */
.mob-dm-check {
  font-size: 12px;
  line-height: 1;
}
.mob-dm-check-sent {
  color: rgba(255,255,255,0.4);
}
.mob-dm-check-read {
  color: #5b8def;
}

/* Date separators — WhatsApp style */
.mob-dm-date-sep {
  display: flex;
  justify-content: center;
  padding: 6px 0;
}
.mob-dm-date-pill {
  background: #182229;
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 8px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.13);
}

/* ═══ DM input area — WhatsApp Android style ═══ */
.mob-dm-input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 4px 6px;
  padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
  background: #0f0f14;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
/* "+" attach button — left of input, WhatsApp style */
.mob-dm-attach-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  background: none;
  border: none;
  font-size: 26px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #94a3b8;
  flex-shrink: 0;
  -webkit-tap-highlight-color: rgba(255,255,255,0.1);
  transition: background 0.15s, color 0.15s;
}
.mob-dm-attach-btn:active {
  background: rgba(255,255,255,0.1);
  color: #e2e8f0;
}
/* Input wrapper: pill container with textarea + inline action buttons */
.mob-dm-input-wrap {
  flex: 1;
  min-width: 0;
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  display: flex;
  align-items: flex-end;
  transition: border-color 0.2s, background 0.2s;
  overflow: hidden;
}
.mob-dm-input-wrap:focus-within {
  border-color: rgba(91,141,239,0.5);
  background: #1a2744;
}
.mob-dm-input-row textarea {
  flex: 1;
  background: transparent;
  border: none;
  padding: 11px 4px 11px 16px;
  color: #e2e8f0;
  font-size: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  resize: none;
  outline: none;
  max-height: 150px;
  min-height: 44px;
  line-height: 1.4;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}
.mob-dm-input-row textarea::placeholder {
  color: #64748b;
}
/* Inline buttons (camera, GIF) — inside the pill, right side */
.mob-dm-input-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-right: 4px;
  gap: 0;
  align-self: flex-end;
  padding-bottom: 4px;
}
.mob-dm-inline-btn {
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #64748b;
  -webkit-tap-highlight-color: rgba(255,255,255,0.1);
  transition: color 0.15s;
}
.mob-dm-inline-btn:active { color: #e2e8f0; }
/* Hide inline buttons when user is typing (like WhatsApp) */
.mob-dm-input-wrap.has-text .mob-dm-input-actions { display: none; }
/* Send button — green circle, right of input */
.mob-dm-send-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #00a884;
  color: #fff;
  border: none;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s, background 0.15s;
  -webkit-tap-highlight-color: rgba(0,168,132,0.3);
}
.mob-dm-send-btn:active {
  transform: scale(0.9);
  background: #008f72;
}
.mob-dm-send-btn:disabled {
  background: #1e293b;
  color: #64748b;
  cursor: not-allowed;
}

/* New DM FAB button */
.mob-dm-fab {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #5b8def;
  color: #fff;
  border: none;
  font-size: 22px;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(91,141,239,0.4);
  cursor: pointer;
  z-index: 200;
  transition: transform 0.15s, box-shadow 0.15s;
}
.mob-dm-fab:active {
  transform: scale(0.92);
  box-shadow: 0 2px 8px rgba(91,141,239,0.3);
}

/* User picker screen for new DM */
.mob-dm-picker {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #0f0f14;
  display: flex;
  flex-direction: column;
  animation: mob-dm-picker-in 0.25s ease;
}
@keyframes mob-dm-picker-in {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.mob-dm-picker-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mob-dm-picker-close {
  background: none;
  border: none;
  color: #8e8e93;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.mob-dm-picker-title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}
.mob-dm-picker-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.mob-dm-picker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.1s;
}
.mob-dm-picker-item:active {
  background: rgba(255,255,255,0.06);
}
.mob-dm-picker-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  flex-shrink: 0;
}
.mob-dm-picker-name {
  font-size: 15px;
  font-weight: 600;
  color: #e2e8f0;
}
.mob-dm-picker-email {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

/* Empty state for DM messages */
.mob-dm-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #64748b;
  gap: 8px;
}
.mob-dm-empty-icon {
  font-size: 48px;
  opacity: 0.4;
}
.mob-dm-empty-text {
  font-size: 14px;
}

/* ─── E2E Encryption & P2P Indicators ─── */

/* Lock icon next to message timestamp */
.mob-dm-encrypted-icon {
  font-size: 10px;
  margin-left: 3px;
  opacity: 0.6;
  display: inline;
  vertical-align: middle;
  line-height: 1;
}
.mob-dm-msg-sent .mob-dm-encrypted-icon {
  color: rgba(255,255,255,0.5);
}
.mob-dm-msg-received .mob-dm-encrypted-icon {
  color: #64748b;
}

/* P2P badge in topbar */
.mob-dm-p2p-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(34,197,94,0.15);
  color: #22c55e;
  margin-left: 8px;
  flex-shrink: 0;
  animation: mob-dm-p2p-pulse 2s ease infinite;
}
.mob-dm-p2p-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}
@keyframes mob-dm-p2p-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* E2E banner at top of chat */
.mob-dm-e2e-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  background: transparent;
  border-bottom: none;
  font-size: 12px;
  font-weight: 400;
  color: rgba(255,255,255,0.5);
  flex-shrink: 0;
}
.mob-dm-e2e-banner-icon {
  font-size: 10px;
}

/* Fingerprint verification popup */
.mob-dm-fingerprint {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: mob-dm-fp-fade 0.2s ease;
}
@keyframes mob-dm-fp-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.mob-dm-fingerprint-card {
  background: #1c1c24;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 24px;
  width: 300px;
  max-width: 90vw;
  text-align: center;
}
.mob-dm-fingerprint-title {
  font-size: 16px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 16px;
}
.mob-dm-fingerprint-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.mob-dm-fingerprint-value {
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 14px;
  color: #5b8def;
  letter-spacing: 1.5px;
  padding: 8px;
  background: rgba(91,141,239,0.08);
  border-radius: 8px;
  margin-bottom: 16px;
  word-break: break-all;
}
.mob-dm-fingerprint-close {
  padding: 8px 24px;
  background: #334155;
  color: #e2e8f0;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.mob-dm-fingerprint-close:active {
  background: #475569;
}

/* ─── DM File Attachments ─── */

/* Attach button (paperclip) */
.mob-dm-attach-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: none;
  color: #8e8e93;
  border: none;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, transform 0.1s;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.mob-dm-attach-btn:active {
  color: #5b8def;
  transform: scale(0.9);
}

/* File preview bar above input */
.mob-dm-file-bar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: #0f0f14;
  flex-shrink: 0;
  scrollbar-width: none;
}
.mob-dm-file-bar::-webkit-scrollbar { width: 0; height: 0; }

/* Thumbnail preview in file bar */
.mob-dm-file-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: #1c1c24;
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.mob-dm-file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mob-dm-file-thumb-icon {
  font-size: 22px;
  opacity: 0.7;
}
.mob-dm-file-thumb-name {
  font-size: 8px;
  color: #8e8e93;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  margin-top: 2px;
}
.mob-dm-file-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

/* Upload progress indicator */
.mob-dm-upload-progress {
  padding: 4px 12px 8px;
  background: #0f0f14;
  flex-shrink: 0;
}
.mob-dm-upload-bar {
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.mob-dm-upload-fill {
  height: 100%;
  background: #5b8def;
  border-radius: 2px;
  transition: width 0.2s ease;
  width: 0%;
}

/* ─── Inline Media in DM Messages ─── */

.mob-dm-msg-files {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}

/* Inline image */
.mob-dm-msg-image {
  max-width: 240px;
  max-height: 240px;
  border-radius: 10px;
  object-fit: cover;
  cursor: pointer;
  display: block;
  -webkit-tap-highlight-color: transparent;
}
.mob-dm-msg-image:active {
  opacity: 0.85;
}

/* Inline video */
.mob-dm-msg-video {
  position: relative;
  max-width: 240px;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mob-dm-msg-video video {
  width: 100%;
  max-height: 240px;
  display: block;
  border-radius: 10px;
  object-fit: cover;
  background: #000;
}
.mob-dm-msg-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  pointer-events: auto;
}

/* Inline audio */
.mob-dm-msg-audio {
  width: 100%;
  max-width: 240px;
  height: 36px;
  border-radius: 18px;
}

/* File download card */
.mob-dm-msg-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  max-width: 240px;
  -webkit-tap-highlight-color: transparent;
}
.mob-dm-msg-file:active {
  background: rgba(255,255,255,0.08);
}
.mob-dm-msg-file-icon {
  font-size: 24px;
  flex-shrink: 0;
}
.mob-dm-msg-file-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.mob-dm-msg-file-name {
  font-size: 13px;
  font-weight: 600;
  color: #5b8def;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mob-dm-msg-file-size {
  font-size: 11px;
  color: #64748b;
  margin-top: 1px;
}

/* ─── DM Message Edit/Delete ─── */
.mob-dm-action-overlay {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.mob-dm-action-menu {
  background: rgba(22,22,30,0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  min-width: 160px;
  overflow: hidden;
  animation: mob-action-menu-in 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mob-dm-action-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  font-size: 15px;
  color: #e2e8f0;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mob-dm-action-item:last-child { border-bottom: none; }
.mob-dm-action-item:active { background: rgba(255,255,255,0.08); }
.mob-dm-action-danger { color: #ef4444; }
.mob-dm-edited {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  font-style: italic;
  margin-right: 4px;
}

/* ─── Desktop DM Panel — Telegram Desktop Dark Theme ─────────────────── */
.dm-desk-container {
  display: flex; height: 100%; min-height: 400px;
}
.dm-desk-sidebar {
  width: 280px; min-width: 220px; border-right: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column; background: #17212b;
}
.dm-desk-search {
  width: 100%; padding: 10px 14px; border: none; border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13px; background: #242f3d; color: #d5dde6; outline: none;
  border-radius: 0;
}
.dm-desk-search::placeholder { color: #6c7883; }
.dm-desk-search:focus { box-shadow: inset 0 -2px 0 #4eabf9; }
.dm-desk-contact-list {
  flex: 1; overflow-y: auto;
}
.dm-desk-contact-list::-webkit-scrollbar { width: 6px; }
.dm-desk-contact-list::-webkit-scrollbar-track { background: transparent; }
.dm-desk-contact-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
.dm-desk-contact {
  display: flex; align-items: center; gap: 12px; padding: 8px 14px;
  cursor: pointer; border-bottom: none; transition: background 0.12s;
}
.dm-desk-contact:hover { background: #202b36; }
.dm-desk-contact.active { background: #2b5278; }
.dm-desk-avatar {
  width: 48px; height: 48px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; color: #fff;
  font-weight: 700; font-size: 16px; flex-shrink: 0;
}
.dm-desk-avatar-support {
  background: #4eabf9 !important;
  font-size: 20px;
}
.dm-desk-contact-info { flex: 1; min-width: 0; }
.dm-desk-contact-name-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
}
.dm-desk-contact-name {
  font-size: 15px; font-weight: 600; color: #e1e3e6;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dm-desk-contact-time { font-size: 11px; color: #6c7883; white-space: nowrap; flex-shrink: 0; }
.dm-desk-contact-preview {
  font-size: 13px; color: #6c7883; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
}
.dm-desk-unread {
  background: #4eabf9; color: #fff; font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; padding: 0 6px; flex-shrink: 0;
}
.dm-desk-no-contacts, .dm-desk-error {
  padding: 32px 16px; text-align: center; color: #6c7883; font-size: 13px;
}

/* ─── Chat Area ─── */
.dm-desk-chat {
  flex: 1; display: flex; flex-direction: column; min-width: 0; background: #0e1621;
}
.dm-desk-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; color: #6c7883; padding: 40px;
}
.dm-desk-empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.dm-desk-empty-title { font-size: 16px; font-weight: 600; color: #8a9099; margin-bottom: 6px; }
.dm-desk-empty-sub { font-size: 13px; color: #6c7883; }

/* ─── Chat Header ─── */
.dm-desk-header {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06); background: #17212b; flex-shrink: 0;
}
.dm-desk-header-avatar {
  width: 40px; height: 40px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; color: #fff;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.dm-desk-header-info { flex: 1; min-width: 0; }
.dm-desk-header-name { font-size: 15px; font-weight: 600; color: #e1e3e6; }
.dm-desk-call-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  color: #6c7883;
  border-radius: 50%;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.dm-desk-call-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #e1e3e6;
}
.dm-desk-header-status { font-size: 12px; color: #3dcc6e; }

/* ─── Messages ─── */
.dm-desk-messages {
  flex: 1; overflow-y: auto; padding: 12px 16px;
  display: flex; flex-direction: column; gap: 4px;
  background: #0e1621;
}
.dm-desk-messages::-webkit-scrollbar { width: 6px; }
.dm-desk-messages::-webkit-scrollbar-track { background: transparent; }
.dm-desk-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
.dm-desk-date-sep {
  text-align: center; margin: 12px 0 8px; font-size: 12px;
  color: #6c7883; position: relative;
}
.dm-desk-date-sep::before, .dm-desk-date-sep::after {
  content: ''; position: absolute; top: 50%; width: 30%;
  height: 1px; background: rgba(255,255,255,0.06);
}
.dm-desk-date-sep::before { left: 5%; }
.dm-desk-date-sep::after { right: 5%; }

.dm-desk-msg-row { display: flex; margin-bottom: 2px; }
.dm-desk-msg-sent { justify-content: flex-end; }
.dm-desk-msg-received { justify-content: flex-start; }

.dm-desk-bubble {
  max-width: 55%; padding: 8px 12px; border-radius: 12px;
  font-size: 14px; line-height: 1.45; word-wrap: break-word;
  position: relative;
}
.dm-desk-msg-sent .dm-desk-bubble {
  background: #2b5278; color: #e1e3e6; border-bottom-right-radius: 4px;
}
.dm-desk-msg-received .dm-desk-bubble {
  background: #182533; color: #e1e3e6; border-bottom-left-radius: 4px;
  border: none;
}

.dm-desk-msg-text { margin-bottom: 2px; }
.dm-desk-msg-img {
  max-width: 400px; max-height: 320px; border-radius: 8px;
  cursor: pointer; display: block; margin-bottom: 4px;
}
.dm-desk-search-hl {
  background: rgba(78,171,249,0.15) !important;
  box-shadow: 0 0 0 2px rgba(78,171,249,0.3);
}
.dm-desk-msg-file {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; background: rgba(255,255,255,0.06); border-radius: 8px;
  font-size: 12px; color: #4eabf9; text-decoration: none;
  margin-bottom: 4px;
}
.dm-desk-msg-sent .dm-desk-msg-file {
  background: rgba(255,255,255,0.08); color: #7fc8f8;
}

.dm-desk-msg-meta {
  display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end;
  float: right; margin-left: 10px; margin-top: 4px;
}
.dm-desk-msg-time { font-size: 11px; opacity: 0.55; color: inherit; }
.dm-desk-edited { font-size: 10px; opacity: 0.45; font-style: italic; }
.dm-desk-receipt { font-size: 12px; opacity: 0.5; }
.dm-desk-receipt-read { color: #4eabf9; opacity: 1; }
.dm-desk-msg-sent .dm-desk-receipt-read { color: #7fc8f8; }

/* ─── Input Area ─── */
.dm-desk-input-row {
  display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px;
  border-top: 1px solid rgba(255,255,255,0.06); background: #17212b; flex-shrink: 0;
}
.dm-desk-attach {
  background: none; border: none; font-size: 20px; cursor: pointer;
  padding: 6px; color: #6c7883; line-height: 1; flex-shrink: 0;
  border-radius: 50%; transition: background 0.15s, color 0.15s;
}
.dm-desk-attach:hover { color: #e1e3e6; background: rgba(255,255,255,0.08); }
.dm-desk-input-wrap { flex: 1; min-width: 0; }
.dm-desk-textarea {
  width: 100%; padding: 10px 16px; border: none; border-radius: 20px;
  font-size: 14px; font-family: inherit; resize: none; outline: none;
  max-height: 150px; line-height: 1.4;
  background: #242f3d; color: #e1e3e6;
}
.dm-desk-textarea::placeholder { color: #6c7883; }
.dm-desk-textarea:focus { border: none; box-shadow: 0 0 0 2px rgba(78,171,249,0.25); }
.dm-desk-send {
  background: #4fae4e; color: #fff; border: none; border-radius: 50%;
  width: 40px; height: 40px; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background 0.15s;
}
.dm-desk-send:hover { background: #45a044; }
.dm-desk-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* File preview in input */
.dm-desk-file-preview {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px;
}
.dm-desk-file-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; background: #242f3d; border-radius: 6px;
  font-size: 11px; color: #8a9099;
}
.dm-desk-file-rm {
  cursor: pointer; color: #6c7883; font-size: 10px; margin-left: 2px;
}
.dm-desk-file-rm:hover { color: #ef4444; }

/* ─── Context Menu ─── */
.dm-desk-ctx-menu {
  position: fixed; z-index: 9999; background: #17212b;
  border: 1px solid rgba(255,255,255,0.08); border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4); min-width: 140px; overflow: hidden;
}
.dm-desk-ctx-item {
  padding: 10px 16px; font-size: 13px; cursor: pointer; color: #e1e3e6;
  display: flex; align-items: center; gap: 8px;
}
.dm-desk-ctx-item:hover { background: #202b36; }
.dm-desk-ctx-danger { color: #e55454; }
.dm-desk-ctx-danger:hover { background: rgba(229,84,84,0.12); }

/* ═══════════════════════════════════════════════════════════════════════
   DM GROUP CHATS — dm-grp- prefix
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── Desktop: Group section in DM sidebar ─── */
.dm-grp-sidebar-section {
  border-top: 1px solid rgba(255,255,255,0.06); padding-top: 8px; margin-top: 8px;
}
.dm-grp-sidebar-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: #6c7883; padding: 4px 12px 8px; letter-spacing: 0.5px;
}
.dm-grp-sidebar-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; cursor: pointer; transition: background 0.15s;
}
.dm-grp-sidebar-item:hover { background: #202b36; }
.dm-grp-sidebar-item.active { background: #2b5278; }
.dm-grp-sidebar-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff; flex-shrink: 0;
}
.dm-grp-sidebar-info { flex: 1; min-width: 0; }
.dm-grp-sidebar-name {
  font-size: 15px; font-weight: 600; color: #e1e3e6;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dm-grp-sidebar-preview {
  font-size: 13px; color: #6c7883;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dm-grp-sidebar-time {
  font-size: 11px; color: #6c7883; white-space: nowrap; flex-shrink: 0;
}
.dm-grp-sidebar-create {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; cursor: pointer; color: #4eabf9; font-size: 13px; font-weight: 600;
}
.dm-grp-sidebar-create:hover { background: #202b36; }

/* ─── Desktop: Group chat header ─── */
.dm-grp-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid #e2e8f0;
}
.dm-grp-header-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0;
}
.dm-grp-header-info { flex: 1; min-width: 0; }
.dm-grp-header-name { font-size: 14px; font-weight: 600; color: #1a1a1a; }
.dm-grp-header-sub { font-size: 11px; color: #64748b; }

/* ─── Desktop: Group messages ─── */
.dm-grp-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 2px;
}
.dm-grp-msg-row { display: flex; margin-bottom: 2px; }
.dm-grp-msg-mine { justify-content: flex-end; }
.dm-grp-msg-other { justify-content: flex-start; }
.dm-grp-bubble {
  max-width: 70%; border-radius: 12px; padding: 8px 12px;
  font-size: 14px; line-height: 1.5; position: relative;
}
.dm-grp-msg-mine .dm-grp-bubble {
  background: #dcfce7; border-bottom-right-radius: 4px;
}
.dm-grp-msg-other .dm-grp-bubble {
  background: #f1f5f9; border-bottom-left-radius: 4px;
}
.dm-grp-sender-name {
  font-size: 12px; font-weight: 600; margin-bottom: 2px;
}
.dm-grp-msg-text { margin-bottom: 2px; }
.dm-grp-msg-meta { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.dm-grp-msg-time { font-size: 10px; opacity: 0.6; }

/* ─── Desktop: Topic tabs ─── */
.dm-grp-topic-bar {
  display: flex; gap: 4px; padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0; overflow-x: auto;
  flex-shrink: 0;
}
.dm-grp-topic-bar::-webkit-scrollbar { height: 0; }
.dm-grp-topic-tab {
  padding: 5px 14px; border-radius: 16px; font-size: 12px; font-weight: 500;
  cursor: pointer; white-space: nowrap; border: 1px solid #e2e8f0;
  color: #64748b; background: transparent; transition: all 0.15s;
}
.dm-grp-topic-tab:hover { background: #f0f2f5; }
.dm-grp-topic-tab.active { background: #059669; color: #fff; border-color: #059669; }
.dm-grp-topic-new {
  padding: 5px 12px; border-radius: 16px; font-size: 12px;
  cursor: pointer; white-space: nowrap; border: 1px dashed #94a3b8;
  color: #94a3b8; background: transparent;
}
.dm-grp-topic-new:hover { border-color: #059669; color: #059669; }

/* ─── Desktop: Create group modal ─── */
.dm-grp-create-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.5); display: flex;
  align-items: center; justify-content: center;
}
.dm-grp-create-modal {
  background: #fff; border-radius: 16px; padding: 24px;
  max-width: 440px; width: 90%; max-height: 70vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.dm-grp-create-title {
  font-size: 18px; font-weight: 700; color: #1a1a1a; margin-bottom: 16px;
}
.dm-grp-create-input {
  width: 100%; box-sizing: border-box; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 10px;
  font-size: 14px; margin-bottom: 12px; outline: none; color: #1a1a1a;
}
.dm-grp-create-input:focus { border-color: #059669; box-shadow: 0 0 0 2px rgba(5,150,105,0.15); }
.dm-grp-create-label {
  font-size: 12px; font-weight: 600; color: #64748b;
  text-transform: uppercase; margin: 12px 0 8px; letter-spacing: 0.5px;
}
.dm-grp-create-toggle {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  cursor: pointer; font-size: 13px; color: #1a1a1a;
}
.dm-grp-create-toggle input { width: 16px; height: 16px; accent-color: #059669; }
.dm-grp-create-user-list { max-height: 200px; overflow-y: auto; }
.dm-grp-create-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 8px; cursor: pointer; transition: background 0.15s;
}
.dm-grp-create-user:hover { background: #f0f2f5; }
.dm-grp-create-user.selected { background: #ecfdf5; }
.dm-grp-create-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.dm-grp-create-user-name { font-size: 13px; color: #1a1a1a; flex: 1; }
.dm-grp-create-user-check {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid #d1d5db;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: transparent; transition: all 0.15s;
}
.dm-grp-create-user.selected .dm-grp-create-user-check {
  background: #059669; border-color: #059669; color: #fff;
}
.dm-grp-create-actions {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px;
}
.dm-grp-create-btn {
  padding: 8px 20px; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
}
.dm-grp-create-btn-cancel { background: #f1f5f9; color: #64748b; }
.dm-grp-create-btn-create { background: #059669; color: #fff; }
.dm-grp-create-btn-create:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Desktop: Group details panel ─── */
.dm-grp-details {
  position: absolute; right: 0; top: 0; bottom: 0; width: 280px;
  background: #fff; border-left: 1px solid #e2e8f0; overflow-y: auto; z-index: 10;
  box-shadow: -4px 0 16px rgba(0,0,0,0.06);
}
.dm-grp-details-header { padding: 16px; text-align: center; border-bottom: 1px solid #e2e8f0; }
.dm-grp-details-avatar {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 20px; color: #fff;
}
.dm-grp-details-name { font-size: 16px; font-weight: 700; color: #1a1a1a; }
.dm-grp-details-sub { font-size: 12px; color: #64748b; margin-top: 2px; }
.dm-grp-details-section { padding: 12px 16px; }
.dm-grp-details-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: #94a3b8; margin-bottom: 8px; letter-spacing: 0.5px;
}
.dm-grp-details-member {
  display: flex; align-items: center; gap: 10px; padding: 6px 0;
}
.dm-grp-details-member-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.dm-grp-details-member-name { font-size: 13px; color: #1a1a1a; flex: 1; }
.dm-grp-details-member-role { font-size: 11px; color: #94a3b8; }
.dm-grp-details-close {
  position: absolute; top: 12px; right: 12px; background: none;
  border: none; color: #94a3b8; font-size: 18px; cursor: pointer;
}
.dm-grp-details-action {
  display: block; width: 100%; padding: 10px; margin-top: 8px;
  border: none; border-radius: 8px; font-size: 13px; cursor: pointer;
  text-align: center; font-weight: 600;
}
.dm-grp-details-action-forum { background: rgba(5,150,105,0.1); color: #059669; }
.dm-grp-details-action-leave { background: rgba(239,68,68,0.1); color: #ef4444; }

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE: Group Chats — dm-grp- prefix
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── Group items in Chats list ─── */
.mob-dm-grp-section {
  padding: 0;
}
.mob-dm-grp-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: #5c5c5e; padding: 16px 16px 8px; letter-spacing: 0.5px;
}
.mob-dm-grp-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; position: relative;
  transition: background 0.15s;
}
.mob-dm-grp-item:active { background: rgba(255,255,255,0.04); }
.mob-dm-grp-item::after {
  content: ''; position: absolute; bottom: 0; left: 68px; right: 16px;
  height: 0.5px; background: rgba(255,255,255,0.06);
}
.mob-dm-grp-item:last-child::after { display: none; }
.mob-dm-grp-avatar {
  width: 50px; height: 50px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; color: #fff; flex-shrink: 0;
  background: linear-gradient(135deg, #059669, #0891b2);
}
.mob-dm-grp-info { flex: 1; min-width: 0; }
.mob-dm-grp-name {
  font-size: 16px; font-weight: 600; color: #e2e8f0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mob-dm-grp-preview {
  font-size: 13px; color: #8e8e93; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mob-dm-grp-meta {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 4px; flex-shrink: 0;
}
.mob-dm-grp-time {
  font-size: 12px; color: #5c5c5e;
}

/* ─── Mobile: Group Chat View ─── */
.mob-dm-grp-chat {
  display: flex; flex-direction: column; height: 100%;
  background: #000; position: relative;
}
.mob-dm-grp-topic-bar {
  display: flex; gap: 6px; padding: 8px 12px;
  overflow-x: auto; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  -webkit-overflow-scrolling: touch;
}
.mob-dm-grp-topic-bar::-webkit-scrollbar { display: none; }
.mob-dm-grp-topic-tab {
  padding: 6px 14px; border-radius: 16px; font-size: 13px; font-weight: 500;
  white-space: nowrap; border: 1px solid rgba(255,255,255,0.12);
  color: #8e8e93; background: transparent; cursor: pointer;
  transition: all 0.15s; flex-shrink: 0;
}
.mob-dm-grp-topic-tab.active {
  background: #059669; color: #fff; border-color: #059669;
}
.mob-dm-grp-topic-new {
  padding: 6px 12px; border-radius: 16px; font-size: 13px;
  white-space: nowrap; border: 1px dashed rgba(255,255,255,0.15);
  color: #5c5c5e; background: transparent; cursor: pointer; flex-shrink: 0;
}
.mob-dm-grp-messages {
  flex: 1; overflow-y: auto; padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
}
.mob-dm-grp-messages::-webkit-scrollbar { width: 0; }
.mob-dm-grp-msg {
  margin-bottom: 2px;
  animation: mob-dm-msg-enter 0.2s ease;
}
.mob-dm-grp-msg-mine { display: flex; justify-content: flex-end; }
.mob-dm-grp-msg-other { display: flex; justify-content: flex-start; }
.mob-dm-grp-bubble {
  max-width: 80%; border-radius: 18px; padding: 8px 12px;
  font-size: 16px; line-height: 1.4;
}
.mob-dm-grp-msg-mine .mob-dm-grp-bubble {
  background: #059669; color: #fff; border-bottom-right-radius: 4px;
}
.mob-dm-grp-msg-other .mob-dm-grp-bubble {
  background: #1c1c1e; color: #e2e8f0; border-bottom-left-radius: 4px;
}
.mob-dm-grp-sender {
  font-size: 12px; font-weight: 600; margin-bottom: 2px;
  color: #34d399;
}
.mob-dm-grp-msg-mine .mob-dm-grp-sender { display: none; }
.mob-dm-grp-msg-text { word-break: break-word; }
.mob-dm-grp-msg-footer {
  display: flex; align-items: center; gap: 4px;
  justify-content: flex-end; margin-top: 2px;
}
.mob-dm-grp-msg-time { font-size: 11px; opacity: 0.6; }
.mob-dm-grp-msg-mine .mob-dm-grp-msg-time { color: rgba(255,255,255,0.7); }

/* ─── Mobile: Group Input Row ─── */
.mob-dm-grp-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 12px; padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: #1c1c1e; border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.mob-dm-grp-input-row textarea {
  flex: 1; background: #2c2c2e; border: none; border-radius: 20px;
  padding: 10px 16px; color: #e2e8f0; font-size: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  resize: none; outline: none; max-height: 120px; line-height: 1.4;
  min-height: 20px;
}
.mob-dm-grp-input-row textarea::placeholder { color: #5c5c5e; }
.mob-dm-grp-input-row textarea:focus {
  box-shadow: 0 0 0 1px rgba(5,150,105,0.3);
}
.mob-dm-grp-send-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: #059669; border: none; color: #fff;
  font-size: 16px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  transition: transform 0.1s;
}
.mob-dm-grp-send-btn:active { transform: scale(0.9); }
.mob-dm-grp-send-btn:disabled { opacity: 0.5; }
.mob-dm-grp-attach-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: transparent; border: none; color: #8e8e93;
  font-size: 20px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}

/* ─── Mobile: Group Details ─── */
/* Group/contact details panel — ensure scrollable on mobile */
.mob-dm-grp-details {
  padding: 16px;
  max-height: calc(100vh - 56px);
  max-height: calc(100dvh - 56px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
.mob-dm-grp-details-header {
  text-align: center; padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mob-dm-grp-details-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  margin: 0 auto 12px; display: flex;
  align-items: center; justify-content: center;
  font-weight: 700; font-size: 28px; color: #fff;
  background: linear-gradient(135deg, #059669, #0891b2);
}
.mob-dm-grp-details-name {
  font-size: 20px; font-weight: 700; color: #e2e8f0;
}
.mob-dm-grp-details-sub {
  font-size: 13px; color: #8e8e93; margin-top: 4px;
}
.mob-dm-grp-details-section {
  padding: 16px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mob-dm-grp-details-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  color: #5c5c5e; margin-bottom: 12px; letter-spacing: 0.5px;
}
.mob-dm-grp-details-member {
  display: flex; align-items: center; gap: 12px; padding: 8px 0;
}
.mob-dm-grp-details-member-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.mob-dm-grp-details-member-name {
  font-size: 15px; color: #e2e8f0; flex: 1;
}
.mob-dm-grp-details-member-role {
  font-size: 12px; color: #5c5c5e; padding: 2px 8px;
  border-radius: 8px; background: rgba(255,255,255,0.04);
}
.mob-dm-grp-details-btn {
  display: block; width: 100%; padding: 12px; margin-top: 12px;
  border: none; border-radius: 12px; font-size: 15px;
  font-weight: 600; cursor: pointer; text-align: center;
}
.mob-dm-grp-details-btn-forum {
  background: rgba(5,150,105,0.12); color: #34d399;
}
.mob-dm-grp-details-btn-add {
  background: rgba(91,141,239,0.12); color: #5b8def;
}
.mob-dm-grp-details-btn-leave {
  background: rgba(239,68,68,0.12); color: #ef4444;
}

/* ─── Mobile: Create Group Screen (new, server-backed) ─── */
.mob-dm-grp-create {
  position: fixed; inset: 0; z-index: 10000;
  background: #000; color: #e2e8f0;
  display: flex; flex-direction: column;
  animation: mob-dm-picker-in 0.25s ease;
}
.mob-dm-grp-create-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px; border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.mob-dm-grp-create-close {
  background: none; border: none; color: #8e8e93;
  font-size: 24px; cursor: pointer; padding: 0; line-height: 1;
}
.mob-dm-grp-create-title {
  font-size: 18px; font-weight: 700; color: #e2e8f0; flex: 1;
}
.mob-dm-grp-create-body {
  flex: 1; overflow-y: auto; padding: 16px;
  -webkit-overflow-scrolling: touch;
}
.mob-dm-grp-create-input {
  width: 100%; box-sizing: border-box; padding: 12px 16px;
  background: #1c1c1e; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px; color: #e2e8f0; font-size: 16px;
  outline: none; margin-bottom: 16px;
}
.mob-dm-grp-create-input:focus {
  border-color: #059669; box-shadow: 0 0 0 2px rgba(5,150,105,0.2);
}
.mob-dm-grp-create-input::placeholder { color: #5c5c5e; }
.mob-dm-grp-create-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  color: #5c5c5e; margin: 12px 0 8px; letter-spacing: 0.5px;
}
.mob-dm-grp-create-toggle {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  font-size: 15px; color: #e2e8f0;
}
.mob-dm-grp-create-toggle input[type="checkbox"] {
  width: 20px; height: 20px; accent-color: #059669;
}
.mob-dm-grp-create-user {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px; border-radius: 10px; cursor: pointer;
}
.mob-dm-grp-create-user.selected { background: rgba(5,150,105,0.08); }
.mob-dm-grp-create-user-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.mob-dm-grp-create-user-name { font-size: 15px; color: #e2e8f0; flex: 1; }
.mob-dm-grp-create-user-check {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid #3a3a3c;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: transparent; transition: all 0.15s; flex-shrink: 0;
}
.mob-dm-grp-create-user.selected .mob-dm-grp-create-user-check {
  background: #059669; border-color: #059669; color: #fff;
}
.mob-dm-grp-create-footer {
  padding: 16px; border-top: 1px solid rgba(255,255,255,0.06);
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  flex-shrink: 0;
}
.mob-dm-grp-create-btn {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: #059669; color: #fff; font-size: 16px;
  font-weight: 600; cursor: pointer;
}
.mob-dm-grp-create-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Mobile: FAB menu (New Message / New Group) ─── */
.mob-dm-fab-menu {
  position: fixed; bottom: 100px; right: 20px; z-index: 9998;
  background: #1c1c1e; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px; overflow: hidden; min-width: 180px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: mob-dm-picker-in 0.15s ease;
}
.mob-dm-fab-menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; color: #e2e8f0; font-size: 15px;
  cursor: pointer; transition: background 0.1s;
}
.mob-dm-fab-menu-item:active { background: rgba(255,255,255,0.06); }
.mob-dm-fab-menu-item + .mob-dm-fab-menu-item {
  border-top: 1px solid rgba(255,255,255,0.06);
}
.mob-dm-fab-menu-icon {
  font-size: 18px; width: 24px; text-align: center;
}
.mob-dm-fab-overlay {
  position: fixed; inset: 0; z-index: 9997;
}

/* ─── Mobile: Group date separator ─── */
.mob-dm-grp-date-sep {
  text-align: center; padding: 12px 0;
}
.mob-dm-grp-date-pill {
  display: inline-block; padding: 4px 14px;
  background: rgba(255,255,255,0.06); border-radius: 12px;
  font-size: 12px; color: #8e8e93; font-weight: 500;
}

/* ─── Mobile: Group file bar ─── */
.mob-dm-grp-file-bar {
  display: flex; gap: 8px; padding: 8px 12px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: #1c1c1e; border-top: 1px solid rgba(255,255,255,0.06);
}
.mob-dm-grp-file-bar::-webkit-scrollbar { display: none; }

/* ─── Mobile: Group message files ─── */
.mob-dm-grp-msg-files { margin-bottom: 4px; }
.mob-dm-grp-msg-image {
  max-width: 100%; border-radius: 12px; cursor: pointer;
  display: block; margin-bottom: 4px;
}
.mob-dm-grp-msg-file {
  display: flex; align-items: center; gap: 8px;
  padding: 8px; background: rgba(255,255,255,0.06);
  border-radius: 8px; margin-bottom: 4px;
  text-decoration: none; color: inherit;
}
.mob-dm-grp-msg-file-icon { font-size: 20px; }
.mob-dm-grp-msg-file-name {
  font-size: 13px; flex: 1; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════
   ENHANCED GROUP CHATS — Telegram-style features
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── Sender avatar + name row ─── */
.mob-dm-grp-sender-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 4px;
}
.mob-dm-grp-sender-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.mob-dm-grp-msg-mine .mob-dm-grp-sender-row { display: none; }

/* ─── Reply quote inside message bubble ─── */
.mob-dm-grp-reply-quote {
  padding: 4px 8px; margin-bottom: 4px;
  border-left: 3px solid #5b8def;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  cursor: pointer;
}
.mob-dm-grp-msg-mine .mob-dm-grp-reply-quote {
  background: rgba(255,255,255,0.12);
}
.mob-dm-grp-reply-quote-sender {
  font-size: 12px; font-weight: 600; margin-bottom: 1px;
}
.mob-dm-grp-reply-quote-text {
  font-size: 13px; color: #94a3b8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 220px;
}
.mob-dm-grp-msg-mine .mob-dm-grp-reply-quote-text {
  color: rgba(255,255,255,0.7);
}

/* ─── Reply bar above input ─── */
.mob-dm-grp-reply-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: rgba(22,22,30,0.95);
  border-top: 1px solid rgba(255,255,255,0.06);
  border-left: 3px solid #5b8def;
  flex-shrink: 0;
  animation: mob-reply-bar-in 0.2s ease;
}
.mob-dm-grp-reply-content {
  flex: 1; min-width: 0;
}
.mob-dm-grp-reply-sender {
  font-size: 12px; font-weight: 600; color: #5b8def;
  margin-bottom: 2px;
}
.mob-dm-grp-reply-text {
  font-size: 13px; color: #94a3b8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 260px;
}
.mob-dm-grp-reply-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: none; border: none; color: #64748b;
  font-size: 16px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.mob-dm-grp-reply-close:active { background: rgba(255,255,255,0.08); }

/* ─── Scroll to bottom button ─── */
.mob-dm-grp-scroll-btn {
  position: absolute;
  bottom: 80px; right: 16px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(28,28,30,0.95);
  border: 1px solid rgba(255,255,255,0.12);
  color: #e2e8f0;
  font-size: 20px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  transition: opacity 0.2s, transform 0.2s;
  animation: mob-dm-grp-scroll-in 0.2s ease;
}
.mob-dm-grp-scroll-btn:active { transform: scale(0.9); }
@keyframes mob-dm-grp-scroll-in {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

/* ─── Pinned message banner ─── */
.mob-dm-grp-pinned-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  background: rgba(28,28,30,0.95);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  cursor: pointer;
}
.mob-dm-grp-pinned-icon {
  font-size: 16px; flex-shrink: 0;
}
.mob-dm-grp-pinned-content {
  flex: 1; min-width: 0;
}
.mob-dm-grp-pinned-label {
  font-size: 11px; font-weight: 700; color: #5b8def;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.mob-dm-grp-pinned-text {
  font-size: 13px; color: #94a3b8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mob-dm-grp-pinned-close {
  width: 24px; height: 24px; border-radius: 50%;
  background: none; border: none; color: #5c5c5e;
  font-size: 14px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}

/* ─── Edited indicator for group messages ─── */
.mob-dm-grp-edited {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  font-style: italic;
  margin-right: 4px;
}
.mob-dm-grp-msg-mine .mob-dm-grp-edited {
  color: rgba(255,255,255,0.5);
}

/* ─── Edit input for group messages ─── */
.mob-dm-grp-edit-input {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid #5b8def;
  border-radius: 8px;
  color: #e2e8f0;
  padding: 6px 8px;
  font-size: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  resize: none;
  outline: none;
  min-height: 36px;
  line-height: 1.4;
}

/* ─── Topic tab enhancements ─── */
.mob-dm-grp-topic-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: rgba(255,255,255,0.12);
  font-size: 10px; font-weight: 700; color: #8e8e93;
  margin-left: 6px;
}
.mob-dm-grp-topic-tab.active .mob-dm-grp-topic-count {
  background: rgba(255,255,255,0.25); color: #fff;
}
.mob-dm-grp-topic-closed {
  color: #5c5c5e !important;
  border-style: dashed !important;
  font-style: italic;
}
.mob-dm-grp-topic-closed-item {
  color: #5c5c5e !important;
  border-color: rgba(255,255,255,0.08) !important;
  text-decoration: line-through;
}

/* ─── Enhanced Group Details ─── */
.mob-dm-grp-details-name-row {
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.mob-dm-grp-details-edit-btn {
  background: none; border: none; font-size: 16px;
  cursor: pointer; padding: 4px; color: #5b8def;
  border-radius: 50%;
}
.mob-dm-grp-details-edit-btn:active { background: rgba(91,141,239,0.15); }
.mob-dm-grp-details-created {
  font-size: 12px; color: #5c5c5e; margin-top: 6px;
  font-style: italic;
}
.mob-dm-grp-details-desc {
  font-size: 14px; color: #b0b0b3; line-height: 1.5;
  padding: 4px 0;
  word-break: break-word;
}
.mob-dm-grp-details-edit-desc {
  background: none; border: none;
  color: #5b8def; font-size: 13px; font-weight: 600;
  cursor: pointer; padding: 6px 0 0; display: block;
}
.mob-dm-grp-details-edit-desc:active { opacity: 0.7; }

/* ─── Forum toggle switch (iOS-style) ─── */
.mob-dm-grp-details-setting {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; font-size: 15px; color: #e2e8f0;
}
.mob-dm-grp-toggle {
  position: relative; display: inline-block;
  width: 48px; height: 28px;
}
.mob-dm-grp-toggle input {
  opacity: 0; width: 0; height: 0;
}
.mob-dm-grp-toggle-slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #3a3a3c;
  border-radius: 14px;
  transition: background 0.3s;
}
.mob-dm-grp-toggle-slider::before {
  content: '';
  position: absolute;
  height: 22px; width: 22px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
}
.mob-dm-grp-toggle input:checked + .mob-dm-grp-toggle-slider {
  background: #059669;
}
.mob-dm-grp-toggle input:checked + .mob-dm-grp-toggle-slider::before {
  transform: translateX(20px);
}
.mob-dm-grp-toggle input:disabled + .mob-dm-grp-toggle-slider {
  opacity: 0.4; cursor: not-allowed;
}

/* ─── Member info in details ─── */
.mob-dm-grp-details-member-info {
  flex: 1; min-width: 0;
}
.mob-dm-grp-details-member-username {
  font-size: 12px; color: #5c5c5e; margin-top: 1px;
}

/* ═══════════════════════════════════════════════════════════════════════
   FEATURE: Swipe to Reply
   ═══════════════════════════════════════════════════════════════════════ */
.mob-dm-msg.swiping, .mob-dm-grp-msg.swiping {
  transition: none !important;
}
.mob-dm-msg, .mob-dm-grp-msg {
  transition: transform 0.25s ease;
  position: relative;
}
.mob-dm-swipe-reply-icon {
  position: absolute;
  left: -36px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(91,141,239,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.mob-dm-swipe-reply-icon.visible {
  opacity: 1;
}

/* DM Reply bar (mobile) */
.mob-dm-reply-bar {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  background: #1a1a22;
  border-top: 1px solid rgba(255,255,255,0.06);
  gap: 8px;
}
.mob-dm-reply-bar-content {
  flex: 1;
  min-width: 0;
  border-left: 3px solid #5b8def;
  padding-left: 10px;
}
.mob-dm-reply-bar-sender {
  font-size: 12px;
  font-weight: 700;
  color: #5b8def;
}
.mob-dm-reply-bar-text {
  font-size: 13px;
  color: #8e8e93;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mob-dm-reply-bar-close {
  background: none;
  border: none;
  color: #8e8e93;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}
.mob-dm-reply-bar-close:active { color: #fff; }

/* DM Reply quote inside message bubble */
.mob-dm-reply-quote {
  border-left: 3px solid #5b8def;
  padding: 3px 8px;
  margin-bottom: 4px;
  border-radius: 2px;
  background: rgba(91,141,239,0.08);
}
.mob-dm-reply-quote-sender {
  font-size: 11px;
  font-weight: 700;
  color: #5b8def;
}
.mob-dm-reply-quote-text {
  font-size: 12px;
  color: #8e8e93;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.mob-dm-msg-sent .mob-dm-reply-quote {
  background: rgba(255,255,255,0.08);
}
.mob-dm-msg-sent .mob-dm-reply-quote-text {
  color: rgba(255,255,255,0.6);
}

/* Desktop DM reply bar */
.dm-desk-reply-bar {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: #17212b;
  border-top: 1px solid rgba(255,255,255,0.06);
  gap: 8px;
}
.dm-desk-reply-bar-content {
  flex: 1;
  min-width: 0;
  border-left: 3px solid #4eabf9;
  padding-left: 10px;
}
.dm-desk-reply-bar-sender {
  font-size: 12px;
  font-weight: 700;
  color: #4eabf9;
}
.dm-desk-reply-bar-text {
  font-size: 13px;
  color: #8a9099;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dm-desk-reply-bar-close {
  background: none;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 50%;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  color: #6c7883;
  font-size: 14px;
  cursor: pointer;
}
.dm-desk-reply-bar-close:hover { background: rgba(255,255,255,0.08); color: #e1e3e6; }

/* Desktop reply quote in message bubble */
.dm-desk-reply-quote {
  border-left: 3px solid #4eabf9;
  padding: 3px 8px;
  margin-bottom: 6px;
  border-radius: 2px;
  background: rgba(78,171,249,0.08);
  cursor: pointer;
}
.dm-desk-reply-quote-sender {
  font-size: 11px;
  font-weight: 700;
  color: #4eabf9;
}
.dm-desk-reply-quote-text {
  font-size: 12px;
  color: #8a9099;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

/* ═══════════════════════════════════════════════════════════════════════
   FEATURE: Typing Indicator
   ═══════════════════════════════════════════════════════════════════════ */
.mob-dm-typing-indicator, .dm-desk-typing-indicator {
  font-size: 12px;
  color: #5b8def;
  display: none;
}
.mob-dm-typing-indicator.active, .dm-desk-typing-indicator.active {
  display: block;
}
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 4px;
}
.typing-dots span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #5b8def;
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════════════
   FEATURE: Online / Last Seen Status
   ═══════════════════════════════════════════════════════════════════════ */
.mob-dm-online-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #0f0f14;
  display: none;
}
.mob-dm-online-dot.online {
  display: block;
}
.dm-desk-online-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #3dcc6e;
  border: 2px solid #17212b;
  display: none;
}
.dm-desk-online-dot.online {
  display: block;
}
.dm-desk-avatar, .mob-dm-avatar {
  position: relative;
}
.dm-desk-header-status {
  font-size: 12px;
  color: #3dcc6e;
}
.dm-desk-header-status.offline {
  color: #6c7883;
}

/* ═══════════════════════════════════════════════════════════════════════
   FEATURE: Drafts
   ═══════════════════════════════════════════════════════════════════════ */
.mob-dm-draft-label, .mob-dm-grp-draft-label {
  color: #ef4444;
  font-weight: 700;
  font-size: 13px;
}
.dm-desk-draft-label {
  color: #e55454;
  font-weight: 600;
  font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════
   FEATURE: New Messages Divider
   ═══════════════════════════════════════════════════════════════════════ */
.mob-dm-new-msgs-divider, .dm-desk-new-msgs-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  margin: 4px 0;
}
.mob-dm-new-msgs-divider::before, .mob-dm-new-msgs-divider::after,
.dm-desk-new-msgs-divider::before, .dm-desk-new-msgs-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #5b8def;
}
.mob-dm-new-msgs-divider span, .dm-desk-new-msgs-divider span {
  font-size: 12px;
  font-weight: 600;
  color: #5b8def;
  white-space: nowrap;
  padding: 0 4px;
}
.dm-desk-new-msgs-divider::before, .dm-desk-new-msgs-divider::after {
  background: #4eabf9;
}
.dm-desk-new-msgs-divider span {
  color: #4eabf9;
}

/* ═══════════════════════════════════════════════════════════════════════
   CONTENT FEATURES #6-#10 — Voice, Emoji, Caption, Link Preview, Formatting
   Prefix: .mob-content-
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── #10: Text Formatting (Markdown-lite) ─── */
.mob-content-codeblock {
  display: block;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 13px;
  color: #a5d6ff;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 4px 0;
  overflow-x: auto;
}
.mob-content-code {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  color: #ffa657;
}
.mob-dm-bubble strong,
.mob-dm-grp-bubble strong {
  font-weight: 700;
}
.mob-dm-bubble em,
.mob-dm-grp-bubble em {
  font-style: italic;
}

/* ─── Formatting hint below textarea ─── */
.mob-content-format-hint {
  padding: 2px 12px 4px;
  font-size: 10px;
  color: #64748b;
  background: #0f0f14;
  line-height: 1.4;
  flex-shrink: 0;
}
.mob-content-format-hint b {
  font-weight: 700;
  color: #8e8e93;
}
.mob-content-format-hint em {
  font-style: italic;
  color: #8e8e93;
}
.mob-content-format-hint code {
  font-family: 'SF Mono', monospace;
  font-size: 10px;
  color: #8e8e93;
  background: rgba(255,255,255,0.06);
  padding: 0 3px;
  border-radius: 3px;
}

/* ─── #9: Link Preview ─── */
.mob-content-link-preview {
  display: block;
  text-decoration: none;
  margin: 6px 0 4px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
  transition: background 0.15s;
}
.mob-content-link-preview:active {
  background: rgba(255,255,255,0.08);
}
.mob-content-link-preview-inner {
  padding: 8px 10px;
  border-left: 3px solid #5b8def;
}
.mob-content-link-domain {
  font-size: 12px;
  font-weight: 600;
  color: #5b8def;
  margin-bottom: 2px;
}
.mob-content-link-url {
  font-size: 11px;
  color: #8e8e93;
  word-break: break-all;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── #7: Emoji Picker ─── */
.mob-content-emoji-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: none;
  border: none;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s;
}
.mob-content-emoji-btn:active {
  transform: scale(0.9);
}
.mob-content-emoji-panel {
  background: #1c1c24;
  border-top: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px 12px 0 0;
  flex-shrink: 0;
  max-height: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
  animation: mob-content-emoji-slide-up 0.2s ease-out;
}
@keyframes mob-content-emoji-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.mob-content-emoji-search-row {
  padding: 8px 10px 4px;
  flex-shrink: 0;
}
.mob-content-emoji-search {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 6px 10px;
  color: #e2e8f0;
  font-size: 14px;
  outline: none;
}
.mob-content-emoji-search::placeholder {
  color: #64748b;
}
.mob-content-emoji-search:focus {
  border-color: rgba(91,141,239,0.4);
}
.mob-content-emoji-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding: 4px 6px;
  flex-shrink: 0;
  scrollbar-width: none;
}
.mob-content-emoji-tabs::-webkit-scrollbar { display: none; }
.mob-content-emoji-tab {
  background: none;
  border: none;
  padding: 4px 8px;
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.mob-content-emoji-tab:active,
.mob-content-emoji-tab.active {
  background: rgba(91,141,239,0.2);
}
.mob-content-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 4px 8px 10px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.mob-content-emoji-grid::-webkit-scrollbar {
  width: 4px;
}
.mob-content-emoji-grid::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}
.mob-content-emoji-item {
  background: none;
  border: none;
  font-size: 24px;
  padding: 4px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
  min-height: 36px;
}
.mob-content-emoji-item:active {
  background: rgba(255,255,255,0.1);
  transform: scale(1.15);
}
.mob-content-emoji-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px;
  color: #64748b;
  font-size: 13px;
}

/* ─── #8: Caption on Photos ─── */
.mob-content-caption-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.mob-content-caption-card {
  background: #1c1c24;
  border-radius: 16px;
  overflow: hidden;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.mob-content-caption-preview {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 300px;
  overflow: hidden;
}
.mob-content-caption-preview img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
}
.mob-content-caption-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.06);
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 12px 14px;
  color: #e2e8f0;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 44px;
  max-height: 100px;
}
.mob-content-caption-input::placeholder {
  color: #64748b;
}
.mob-content-caption-btns {
  display: flex;
  gap: 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.mob-content-caption-cancel {
  flex: 1;
  padding: 14px;
  background: none;
  border: none;
  color: #8e8e93;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.mob-content-caption-cancel:active {
  background: rgba(255,255,255,0.05);
}
.mob-content-caption-send {
  flex: 1;
  padding: 14px;
  background: none;
  border: none;
  border-left: 1px solid rgba(255,255,255,0.06);
  color: #5b8def;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.mob-content-caption-send:active {
  background: rgba(91,141,239,0.1);
}

/* ─── #6: Voice Messages ─── */

/* Mic button */
.mob-content-mic-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #5b8def;
  border: none;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  color: #fff;
}
.mob-content-mic-btn:active {
  background: #4a7de0;
  transform: scale(0.92);
}

/* Recording overlay (replaces input row) */
.mob-content-recording-overlay {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: #0f0f14;
  border-top: 1px solid rgba(255,50,50,0.3);
  flex-shrink: 0;
  animation: mob-content-rec-fade-in 0.2s ease-out;
}
@keyframes mob-content-rec-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.mob-content-recording-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.mob-content-recording-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  animation: mob-content-rec-pulse 1s infinite;
  flex-shrink: 0;
}
@keyframes mob-content-rec-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}
.mob-content-recording-timer {
  font-size: 16px;
  font-weight: 600;
  color: #ef4444;
  font-variant-numeric: tabular-nums;
  min-width: 36px;
}
.mob-content-recording-slide {
  font-size: 13px;
  color: #64748b;
  margin-left: auto;
  animation: mob-content-slide-hint 2s ease-in-out infinite;
}
@keyframes mob-content-slide-hint {
  0%, 100% { opacity: 0.6; transform: translateX(0); }
  50% { opacity: 1; transform: translateX(-8px); }
}

/* Waveform voice message player */
.mob-content-voice-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  min-width: 180px;
  max-width: 240px;
}
.mob-content-voice-play {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #5b8def;
  border: none;
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
  padding: 0;
  padding-left: 2px; /* visual centering for triangle */
}
.mob-content-voice-play:active {
  background: #4a7de0;
  transform: scale(0.9);
}
.mob-content-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  height: 28px;
}
.mob-content-waveform-bar {
  width: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.25);
  flex-shrink: 0;
  transition: background 0.2s;
  min-height: 4px;
}
.mob-content-waveform-bar.active {
  background: #5b8def;
}
.mob-content-voice-dur {
  font-size: 11px;
  color: #8e8e93;
  font-variant-numeric: tabular-nums;
  min-width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* #11-15: Chat Organization Features                                 */
/* ═══════════════════════════════════════════════════════════════════ */

/* ─── #11: Chat Folder Tabs ─── */
.mob-org-folder-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: #0d0d14;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.mob-org-folder-tabs::-webkit-scrollbar { display: none; }

.mob-org-folder-tab {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  color: #8e8e93;
  background: rgba(255,255,255,0.06);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.mob-org-folder-tab.active {
  background: #5b8def;
  color: #fff;
}
.mob-org-folder-tab:active {
  transform: scale(0.95);
}
.mob-org-folder-add {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: #8e8e93;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.mob-org-folder-add:active {
  background: rgba(255,255,255,0.12);
  transform: scale(0.9);
}

/* ─── Create Folder Dialog ─── */
.mob-org-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: mob-org-fade-in 0.15s ease-out;
}
.mob-org-overlay.transparent {
  background: transparent;
}
@keyframes mob-org-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.mob-org-dialog {
  width: 90%;
  max-width: 360px;
  max-height: 80vh;
  background: #1e1e2e;
  border-radius: 16px;
  padding: 20px;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  animation: mob-org-dialog-appear 0.2s ease-out;
}
@keyframes mob-org-dialog-appear {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.mob-org-dialog-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 14px;
}
.mob-org-dialog-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: #e2e8f0;
  font-size: 15px;
  outline: none;
  margin-bottom: 12px;
  box-sizing: border-box;
}
.mob-org-dialog-input:focus {
  border-color: #5b8def;
}
.mob-org-dialog-subtitle {
  font-size: 13px;
  color: #8e8e93;
  margin-bottom: 8px;
}
.mob-org-dialog-chatlist {
  max-height: 40vh;
  overflow-y: auto;
  margin-bottom: 16px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
}
.mob-org-dialog-chatrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: #e2e8f0;
  cursor: pointer;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.mob-org-dialog-chatrow:active {
  background: rgba(255,255,255,0.06);
}
.mob-org-dialog-chatrow-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.mob-org-dialog-chatrow-check.checked {
  background: #5b8def;
  border-color: #5b8def;
}
.mob-org-dialog-chatrow-check.checked::after {
  content: '\2713';
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.mob-org-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.mob-org-dialog-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mob-org-dialog-btn-cancel {
  background: rgba(255,255,255,0.08);
  color: #8e8e93;
}
.mob-org-dialog-btn-cancel:active {
  background: rgba(255,255,255,0.14);
}
.mob-org-dialog-btn-ok {
  background: #5b8def;
  color: #fff;
}
.mob-org-dialog-btn-ok:active {
  background: #4a7de0;
  transform: scale(0.97);
}

/* ─── Folder context menu ─── */
.mob-org-ctx-menu {
  position: fixed;
  z-index: 301;
  background: #1e1e2e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  min-width: 180px;
  padding: 4px 0;
  overflow: hidden;
  animation: mob-ctx-appear 0.15s ease-out;
}
.mob-org-ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 14px;
  color: #e2e8f0;
  cursor: pointer;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.mob-org-ctx-item:active {
  background: rgba(255,255,255,0.06);
}
.mob-org-ctx-danger {
  color: #ef4444;
}
.mob-org-ctx-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* ─── #12: Pin icon ─── */
.mob-org-pin-icon {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 10px;
  color: #5b8def;
  opacity: 0.8;
  z-index: 1;
}

/* ─── #13: Mute icon ─── */
.mob-org-mute-icon {
  font-size: 12px;
  color: #636366;
  margin-left: 4px;
  flex-shrink: 0;
}

/* ─── Mute submenu ─── */
.mob-org-mute-submenu {
  position: fixed;
  z-index: 302;
  background: #1e1e2e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
  min-width: 130px;
  padding: 4px 0;
  animation: mob-ctx-appear 0.12s ease-out;
}
.mob-org-mute-option {
  padding: 10px 16px;
  font-size: 14px;
  color: #e2e8f0;
  cursor: pointer;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.mob-org-mute-option:active {
  background: rgba(255,255,255,0.06);
}

/* ─── #14: Archive section ─── */
.mob-org-archived-section {
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.mob-org-archived-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 14px;
  color: #8e8e93;
  cursor: pointer;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.mob-org-archived-header:active {
  background: rgba(255,255,255,0.04);
}
.mob-org-archived-icon {
  font-size: 16px;
}
.mob-org-archived-label {
  flex: 1;
  font-weight: 500;
}
.mob-org-archived-count {
  background: rgba(255,255,255,0.08);
  color: #8e8e93;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.mob-org-archived-chevron {
  font-size: 10px;
  color: #636366;
  transition: transform 0.2s;
}
.mob-org-archived-content {
  padding: 0 8px 8px;
}
.mob-org-archived-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.mob-org-archived-item:active {
  background: rgba(255,255,255,0.04);
}
.mob-org-archived-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.mob-org-archived-name {
  flex: 1;
  font-size: 14px;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mob-org-archived-type {
  font-size: 11px;
  color: #636366;
  font-weight: 400;
}
.mob-org-archived-unarchive {
  padding: 5px 12px;
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 8px;
  color: #5b8def;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mob-org-archived-unarchive:active {
  background: rgba(91,141,239,0.2);
  transform: scale(0.95);
}

/* ─── #14: Swipe-to-archive action ─── */
.mob-org-swipe-archive {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 100px;
  background: #ef4444;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  gap: 4px;
  border-radius: 0 10px 10px 0;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: -1;
  pointer-events: none;
}

/* ─── #15: Unread dot ─── */
.mob-org-unread-dot {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #5b8def;
  z-index: 1;
}

/* ─── Extended context menu (wider) ─── */
.mob-org-extended-menu {
  min-width: 190px;
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* GROUP ENHANCEMENTS #16-#20: Polls, @Mentions, Permissions, Invite, Slow Mode */
/* ═══════════════════════════════════════════════════════════════════════ */

/* ─── #16: Poll Button in Input Row ─── */
.mob-grp-enh-poll-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  color: #8e8e93;
}
.mob-grp-enh-poll-btn:active {
  background: rgba(91,141,239,0.15);
  transform: scale(0.92);
}

/* ─── #16: Poll Creation Modal ─── */
.mob-grp-enh-poll-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: mob-grp-enh-fade-in 0.2s ease-out;
}
@keyframes mob-grp-enh-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.mob-grp-enh-poll-modal {
  background: #1c1c1e;
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.mob-grp-enh-poll-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
  text-align: center;
}
.mob-grp-enh-poll-question {
  width: 100%;
  padding: 12px 14px;
  background: #2c2c2e;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  outline: none;
  margin-bottom: 12px;
  box-sizing: border-box;
}
.mob-grp-enh-poll-question:focus {
  border-color: #5b8def;
}
.mob-grp-enh-poll-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.mob-grp-enh-poll-option {
  width: 100%;
  padding: 10px 14px;
  background: #2c2c2e;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}
.mob-grp-enh-poll-option:focus {
  border-color: #5b8def;
}
.mob-grp-enh-poll-opt-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mob-grp-enh-poll-opt-row .mob-grp-enh-poll-option {
  flex: 1;
}
.mob-grp-enh-poll-opt-remove {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(239,68,68,0.15);
  border: none;
  color: #ef4444;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.mob-grp-enh-poll-opt-remove:active {
  background: rgba(239,68,68,0.3);
}
.mob-grp-enh-poll-add-opt {
  width: 100%;
  padding: 10px;
  background: none;
  border: 1px dashed rgba(255,255,255,0.15);
  border-radius: 10px;
  color: #5b8def;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 16px;
  transition: background 0.15s;
}
.mob-grp-enh-poll-add-opt:active {
  background: rgba(91,141,239,0.1);
}
.mob-grp-enh-poll-toggles {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.mob-grp-enh-poll-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c7c7cc;
  font-size: 14px;
  cursor: pointer;
}
.mob-grp-enh-poll-toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #5b8def;
}
.mob-grp-enh-poll-actions {
  display: flex;
  gap: 10px;
}
.mob-grp-enh-poll-cancel {
  flex: 1;
  padding: 12px;
  background: #2c2c2e;
  border: none;
  border-radius: 10px;
  color: #8e8e93;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.mob-grp-enh-poll-cancel:active {
  background: #3a3a3c;
}
.mob-grp-enh-poll-send {
  flex: 1;
  padding: 12px;
  background: #5b8def;
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.mob-grp-enh-poll-send:active {
  background: #4a7de0;
}

/* ─── #16: Poll Card (in-message) ─── */
.mob-grp-enh-poll-card {
  padding: 12px;
  min-width: 220px;
  max-width: 300px;
}
.mob-grp-enh-poll-card-question {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
  line-height: 1.3;
}
.mob-grp-enh-poll-card-type {
  font-size: 11px;
  color: #8e8e93;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.mob-grp-enh-poll-option-row {
  position: relative;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mob-grp-enh-poll-option-row:active {
  background: rgba(255,255,255,0.1);
}
.mob-grp-enh-poll-option-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(91,141,239,0.15);
  border-radius: 8px;
  transition: width 0.4s ease-out;
}
.mob-grp-enh-poll-voted .mob-grp-enh-poll-option-bar {
  background: rgba(91,141,239,0.3);
}
.mob-grp-enh-poll-option-text {
  position: relative;
  z-index: 1;
  font-size: 14px;
  color: #e5e5ea;
}
.mob-grp-enh-poll-voted .mob-grp-enh-poll-option-text {
  color: #5b8def;
  font-weight: 600;
}
.mob-grp-enh-poll-option-pct {
  position: relative;
  z-index: 1;
  font-size: 13px;
  color: #8e8e93;
  font-weight: 500;
  min-width: 32px;
  text-align: right;
}
.mob-grp-enh-poll-voted .mob-grp-enh-poll-option-pct {
  color: #5b8def;
}
.mob-grp-enh-poll-correct {
  border-left: 3px solid #34d399;
}
.mob-grp-enh-poll-correct .mob-grp-enh-poll-option-bar {
  background: rgba(52,211,153,0.2);
}
.mob-grp-enh-poll-wrong {
  border-left: 3px solid #ef4444;
}
.mob-grp-enh-poll-wrong .mob-grp-enh-poll-option-bar {
  background: rgba(239,68,68,0.15);
}
.mob-grp-enh-poll-total {
  font-size: 12px;
  color: #636366;
  margin-top: 6px;
  text-align: center;
}

/* ─── #17: @Mention Dropdown ─── */
.mob-grp-enh-mention-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: #1c1c1e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
  max-height: 220px;
  overflow-y: auto;
  z-index: 100;
  margin-bottom: 4px;
  animation: mob-grp-enh-slide-up 0.15s ease-out;
}
@keyframes mob-grp-enh-slide-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.mob-grp-enh-mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.mob-grp-enh-mention-item:active,
.mob-grp-enh-mention-item.active {
  background: rgba(91,141,239,0.15);
}
.mob-grp-enh-mention-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.mob-grp-enh-mention-name {
  font-size: 14px;
  color: #e5e5ea;
  font-weight: 500;
}

/* ─── #17: @Mention Highlight in Messages ─── */
.mob-grp-enh-mention {
  color: #5b8def;
  font-weight: 600;
  cursor: pointer;
}

/* ─── #18: Permissions Loading ─── */
.mob-grp-enh-perms-loading {
  color: #8e8e93;
  font-size: 13px;
  padding: 8px 0;
}

/* ─── #18: No-send notice ─── */
.mob-grp-enh-no-send-notice {
  padding: 14px 16px;
  text-align: center;
  color: #8e8e93;
  font-size: 13px;
  background: #1c1c1e;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

/* ─── #19: Invite Link ─── */
.mob-grp-enh-invite-link-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}
.mob-grp-enh-invite-link-text {
  flex: 1;
  font-size: 13px;
  color: #5b8def;
  word-break: break-all;
  line-height: 1.3;
}
.mob-grp-enh-invite-copy-btn {
  padding: 6px 14px;
  background: #5b8def;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.mob-grp-enh-invite-copy-btn:active {
  background: #4a7de0;
}
.mob-grp-enh-invite-stats {
  font-size: 12px;
  color: #636366;
  padding: 4px 0 8px;
}
.mob-grp-enh-invite-gen-btn {
  width: 100%;
  padding: 10px;
  background: rgba(91,141,239,0.1);
  border: 1px solid rgba(91,141,239,0.2);
  border-radius: 10px;
  color: #5b8def;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s;
}
.mob-grp-enh-invite-gen-btn:active {
  background: rgba(91,141,239,0.2);
}
.mob-grp-enh-invite-opt-row {
  margin-bottom: 12px;
}
.mob-grp-enh-invite-opt-row label {
  display: block;
  font-size: 13px;
  color: #8e8e93;
  margin-bottom: 6px;
}

/* ─── #20: Slow Mode ─── */
.mob-grp-enh-slowmode-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
}
.mob-grp-enh-slowmode-btn {
  padding: 8px 14px;
  background: #2c2c2e;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  color: #c7c7cc;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.mob-grp-enh-slowmode-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.mob-grp-enh-slowmode-btn.active {
  background: rgba(91,141,239,0.15);
  border-color: #5b8def;
  color: #5b8def;
  font-weight: 600;
}
.mob-grp-enh-slowmode-btn:not(:disabled):active {
  background: rgba(91,141,239,0.1);
}

/* ─── #20: Slow mode active state on send button ─── */
.mob-grp-enh-slowmode-active {
  background: #2c2c2e !important;
  color: #ef4444 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  font-variant-numeric: tabular-nums;
}

/* ─── #20: Slow mode indicator in header ─── */
.mob-grp-enh-slow-indicator {
  color: #f59e0b;
  font-size: 11px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* Smart Messaging: Gear button, Settings popup, Corrected toast,    */
/* Merge highlight, Album-style photo grid                           */
/* ═══════════════════════════════════════════════════════════════════ */

/* ─── Gear button (in input row) ─── */
.mob-smart-gear-btn {
  background: none;
  border: none;
  color: #8e8e93;
  font-size: 18px;
  padding: 6px 4px;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mob-smart-gear-btn:hover,
.mob-smart-gear-btn:active {
  color: #5b8def;
}
.mob-smart-gear-btn-desk {
  font-size: 16px;
  padding: 4px 6px;
}

/* ─── Settings popup ─── */
.mob-smart-settings-popup {
  position: fixed;
  z-index: 99999;
  background: #1c1c1e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 16px;
  min-width: 240px;
  max-width: 300px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: mob-smart-popup-in 0.15s ease-out;
}
@keyframes mob-smart-popup-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.mob-smart-settings-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}
.mob-smart-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  position: relative;
  gap: 12px;
}
.mob-smart-settings-label {
  font-size: 13px;
  color: #c7c7cc;
  flex: 1;
  user-select: none;
}

/* Toggle switch */
.mob-smart-toggle {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.mob-smart-slider {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  background: #3a3a3c;
  border-radius: 13px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.mob-smart-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.mob-smart-toggle:checked + .mob-smart-slider {
  background: #34c759;
}
.mob-smart-toggle:checked + .mob-smart-slider::after {
  transform: translateX(18px);
}

/* ─── Corrected toast ─── */
.mob-smart-corrected-toast {
  position: fixed;
  z-index: 100000;
  background: rgba(52,199,89,0.9);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 8px;
  transform: translate(-50%, 0);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.mob-smart-corrected-show {
  opacity: 1;
  transform: translate(-50%, -4px);
}
.mob-smart-corrected-hide {
  opacity: 0;
  transform: translate(-50%, 4px);
}

/* ─── Merge highlight ─── */
.mob-smart-merge-highlight {
  animation: mob-smart-merge-flash 1.5s ease-out;
}
@keyframes mob-smart-merge-flash {
  0%   { background-color: rgba(91,141,239,0.25); }
  100% { background-color: transparent; }
}

/* ─── Album-style photo grid ─── */
.mob-smart-album {
  display: grid;
  gap: 2px;
  border-radius: 12px;
  overflow: hidden;
  max-width: 280px;
  margin-bottom: 4px;
}
.mob-smart-album-2 {
  grid-template-columns: 1fr 1fr;
}
.mob-smart-album-3 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
}
.mob-smart-album-3 .mob-smart-album-item:first-child {
  grid-column: 1 / -1;
}
.mob-smart-album-grid {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.mob-smart-album-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: #1c1c1e;
  min-height: 80px;
}
.mob-smart-album-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.15s;
}
.mob-smart-album-item:active img {
  transform: scale(0.97);
}
.mob-smart-album-more {
  position: relative;
}
.mob-smart-album-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  pointer-events: none;
}

/* Desktop adjustments for album */
@media (min-width: 769px) {
  .mob-smart-album {
    max-width: 360px;
  }
  .mob-smart-album-item {
    min-height: 100px;
  }
}
