:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;

  /* Light theme tokens */
  --bg-app: #f4f6f9;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-active: #eef2ff;
  --bg-bubble-in: #ffffff;
  --bg-bubble-out: #4f46e5;
  --bg-input: #f8fafc;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-on-accent: #ffffff;

  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.12);
  --teal: #0d9488;
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --online: #10b981;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.09);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.18);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
}

[data-theme="dark"] {
  --bg-app: #0b1120;
  --bg-surface: #111827;
  --bg-subtle: #161f33;
  --bg-elevated: #1e293b;
  --bg-hover: #1e293b;
  --bg-active: rgba(99, 102, 241, 0.18);
  --bg-bubble-in: #1e293b;
  --bg-bubble-out: #4f46e5;
  --bg-input: #172033;

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-on-accent: #ffffff;

  --border-subtle: #1f2a40;
  --border-strong: #334155;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.2);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.15);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.65);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  height: 100dvh;
  width: 100%;
  overflow-x: hidden;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button, input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.app-root {
  height: 100%;
  width: 100%;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
}

.btn-danger-ghost:hover {
  background: var(--danger-soft);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.icon-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-btn-sm {
  width: 30px;
  height: 30px;
  font-size: 20px;
  line-height: 1;
}

/* Avatars */
.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: #ffffff;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
  letter-spacing: 0.02em;
}

.avatar-xs { width: 26px; height: 26px; font-size: 11px; }
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.avatar-md { width: 42px; height: 42px; font-size: 15px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }

.avatar-btn {
  padding: 2px;
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  background: transparent;
  display: inline-flex;
  transition: border-color 0.15s ease;
}

.avatar-btn:hover {
  border-color: var(--accent);
}

.presence-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--online);
  border: 2px solid var(--bg-surface);
}

/* Auth Screen */
.auth-view {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.14), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(13, 148, 136, 0.14), transparent 40%),
    var(--bg-app);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.brand-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-tabs, .modal-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 18px;
  border: 1px solid var(--border-subtle);
}

.auth-tab {
  border: none;
  background: transparent;
  padding: 8px 12px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease;
}

.auth-tab.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.field input, .field textarea, .modal-search {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--text-primary);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.field input:focus, .field textarea:focus, .modal-search:focus {
  border-color: var(--accent);
  background: var(--bg-surface);
  outline: none;
}

.form-error {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 14px;
}

.demo-box, .quick-switch-box {
  margin-top: 22px;
}

.demo-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.demo-divider::before, .demo-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.demo-hint {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.demo-hint code {
  background: var(--bg-hover);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

.demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.demo-account-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.demo-account-btn:hover {
  border-color: var(--accent);
  background: var(--bg-active);
}

.demo-account-info {
  min-width: 0;
}

.demo-account-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-account-handle {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Main Messenger Layout */
.messenger-shell {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg-app);
}

/* Sidebar */
.sidebar {
  width: 340px;
  min-width: 300px;
  max-width: 380px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.conn-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.14);
  color: #059669;
}

[data-theme="dark"] .conn-pill {
  color: #34d399;
}

.conn-pill.offline {
  background: rgba(245, 158, 11, 0.16);
  color: #d97706;
}

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

.sidebar-search {
  padding: 12px 14px 8px;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 11px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-wrap input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  font-size: 13.5px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.search-input-wrap input:focus {
  border-color: var(--accent);
  background: var(--bg-surface);
  outline: none;
}

.filter-bar {
  display: flex;
  gap: 6px;
  padding: 4px 14px 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.filter-pill {
  border: none;
  background: transparent;
  padding: 5px 11px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.filter-pill:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.filter-pill.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.search-results-panel {
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
}

.search-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 4px 8px;
}

.search-result-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-result-item:hover {
  background: var(--bg-hover);
}

.search-result-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
}

.search-result-snippet {
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conv-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  text-align: left;
  transition: background 0.12s ease;
}

.conv-item:hover {
  background: var(--bg-hover);
}

.conv-item.active {
  background: var(--bg-active);
}

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

.conv-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.conv-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
}

.conv-time {
  font-size: 11.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.conv-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.conv-preview {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-preview.typing {
  color: var(--accent);
  font-weight: 500;
}

.conv-badges {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.unread-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.conv-flag {
  font-size: 12px;
  color: var(--text-muted);
}

.list-empty-msg {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* Chat Pane */
.chat-pane {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
  position: relative;
}

.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  max-width: 440px;
  margin: 0 auto;
}

.empty-illustration {
  width: 82px;
  height: 82px;
  border-radius: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  margin-bottom: 18px;
}

.chat-empty-state h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.chat-empty-state p {
  margin: 0 0 22px;
  color: var(--text-muted);
  font-size: 14px;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

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

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chat-header-meta {
  min-width: 0;
}

.chat-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-subtitle {
  margin: 1px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-subtitle.online {
  color: var(--online);
  font-weight: 500;
}

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

.chat-body-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.chat-thread-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Drop overlay */
.drop-overlay {
  position: absolute;
  inset: 12px;
  z-index: 20;
  border-radius: 16px;
  border: 2px dashed var(--accent);
  background: rgba(79, 70, 229, 0.1);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.drop-overlay-card {
  padding: 14px 24px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--accent);
  font-weight: 700;
  box-shadow: var(--shadow-md);
}

/* Message Feed */
.message-feed {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 12px;
  display: flex;
  flex-direction: column;
}

.load-older-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.messages-container {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: auto;
}

.date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0 12px;
}

.date-divider span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 3px 12px;
  border-radius: var(--radius-full);
}

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 78%;
  position: relative;
  animation: msgFadeIn 0.16s ease-out;
}

@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.msg-row.incoming {
  align-self: flex-start;
}

.msg-row.group-start {
  margin-top: 10px;
}

.msg-row.highlight-pulse .msg-bubble {
  box-shadow: 0 0 0 3px var(--accent);
}

.msg-avatar-slot {
  width: 30px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}

.msg-content-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.msg-row.outgoing .msg-content-col {
  align-items: flex-end;
}

.msg-row.incoming .msg-content-col {
  align-items: flex-start;
}

.msg-sender-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 3px 10px;
}

.msg-bubble-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg-row.outgoing .msg-bubble-wrap {
  flex-direction: row-reverse;
}

.msg-bubble {
  padding: 9px 13px;
  border-radius: 16px;
  background: var(--bg-bubble-in);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  transition: box-shadow 0.25s ease;
}

.msg-row.outgoing .msg-bubble {
  background: var(--bg-bubble-out);
  color: var(--text-on-accent);
  border-color: transparent;
}

.msg-row.incoming .msg-bubble {
  border-bottom-left-radius: 6px;
}

.msg-row.outgoing .msg-bubble {
  border-bottom-right-radius: 6px;
}

.msg-bubble.deleted {
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  font-style: italic;
  box-shadow: none;
}

.msg-text {
  margin: 0;
  white-space: pre-wrap;
  font-size: 14.5px;
  line-height: 1.45;
}

/* Reply quote inside bubble */
.reply-quote {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 9px;
  margin-bottom: 7px;
  border-radius: 9px;
  border-left: 3px solid var(--accent);
  background: rgba(15, 23, 42, 0.05);
  cursor: pointer;
  font-size: 12.5px;
  max-width: 100%;
}

[data-theme="dark"] .reply-quote {
  background: rgba(255, 255, 255, 0.06);
}

.msg-row.outgoing .reply-quote {
  border-left-color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.14);
}

.reply-quote-author {
  font-weight: 700;
  font-size: 11.5px;
}

.reply-quote-text {
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Attachments inside bubble */
.msg-attachment-img {
  display: block;
  max-width: 280px;
  max-height: 240px;
  border-radius: 10px;
  margin-bottom: 6px;
  cursor: zoom-in;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.msg-attachment-file {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.05);
  color: inherit;
  text-decoration: none;
  margin-bottom: 6px;
  font-size: 13px;
}

.msg-row.outgoing .msg-attachment-file {
  background: rgba(255, 255, 255, 0.16);
}

.msg-attachment-meta {
  display: flex;
  flex-direction: column;
}

.msg-attachment-name {
  font-weight: 600;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-attachment-size {
  font-size: 11px;
  opacity: 0.8;
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.72;
}

.receipt-check {
  font-weight: 700;
  letter-spacing: -0.15em;
}

.receipt-check.read {
  color: #a5f3fc;
}

/* Hover actions toolbar */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 5px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  flex-shrink: 0;
}

.msg-row:hover .msg-actions,
.msg-row:focus-within .msg-actions {
  opacity: 1;
  pointer-events: auto;
}

.msg-action-btn {
  border: none;
  background: transparent;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.msg-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.msg-action-btn.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Reactions */
.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-size: 12.5px;
  color: var(--text-primary);
  transition: border-color 0.12s ease, background 0.12s ease;
}

.reaction-chip:hover {
  border-color: var(--accent);
}

.reaction-chip.mine {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* Typing indicator */
.typing-indicator {
  padding: 8px 4px 2px 40px;
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
}

.typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounceDot 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.typing-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes bounceDot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* Composer */
.composer-wrap {
  padding: 10px 18px 16px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  position: relative;
}

.composer-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: var(--bg-subtle);
  border-left: 3px solid var(--accent);
}

.composer-context-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.composer-context-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.composer-context-text {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.staged-attachment-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
}

.staged-attachment-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 13px;
}

.staged-attachment-preview img {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
}

.emoji-popover {
  position: absolute;
  bottom: 72px;
  left: 56px;
  z-index: 30;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.emoji-opt {
  border: none;
  background: transparent;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-opt:hover {
  background: var(--bg-hover);
}

.composer-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 6px 8px;
  transition: border-color 0.15s ease;
}

.composer-form:focus-within {
  border-color: var(--accent);
  background: var(--bg-surface);
}

.composer-form textarea {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  max-height: 140px;
  padding: 7px 4px;
  line-height: 1.4;
  outline: none;
}

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.1s ease;
}

.send-btn:hover {
  background: var(--accent-hover);
}

.send-btn:active {
  transform: scale(0.95);
}

/* Details Drawer */
.info-drawer {
  width: 280px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.info-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.info-drawer-header h3 {
  margin: 0;
  font-size: 15px;
}

.info-drawer-body {
  padding: 18px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.info-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.info-hero-title {
  font-size: 17px;
  font-weight: 700;
}

.info-hero-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.info-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.info-bio {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.member-meta {
  min-width: 0;
  flex: 1;
}

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

.member-status {
  font-size: 12px;
  color: var(--text-muted);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.modal-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.user-picker-list {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px;
}

.user-picker-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  text-align: left;
}

.user-picker-item:hover {
  background: var(--bg-hover);
}

.user-picker-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.user-picker-check:hover {
  background: var(--bg-hover);
}

.user-picker-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.profile-preview-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
}

.profile-preview-name {
  font-size: 16px;
  font-weight: 700;
}

.profile-preview-handle {
  font-size: 13px;
  color: var(--text-muted);
}

.color-swatch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.selected {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--bg-surface) inset;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.modal-footer-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.modal-footer-right {
  display: flex;
  gap: 8px;
}

/* Lightbox */
.lightbox-card {
  max-width: 90vw;
  max-height: 90vh;
  background: var(--bg-surface);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-lg);
}

.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lightbox-img {
  max-width: 84vw;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 10px;
}

/* Toasts */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 14px;
  border-radius: 10px;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: msgFadeIn 0.16s ease-out;
}

[data-theme="dark"] .toast {
  background: #f1f5f9;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.12);
}

.toast.error {
  background: var(--danger);
  color: #ffffff;
}

.auth-footer-links {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.e2ee-note {
  font-size: 12px;
  color: var(--text-muted);
}

.owner-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.owner-link:hover {
  text-decoration: underline;
}

.chat-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.e2ee-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(13, 148, 136, 0.14);
  color: #0f766e;
  flex-shrink: 0;
}

[data-theme="dark"] .e2ee-badge {
  color: #5eead4;
}

.fingerprint-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.5;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  word-break: break-all;
}

.owner-vault-btn {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
}

.owner-vault-btn:hover {
  background: rgba(220, 38, 38, 0.2);
  color: #b91c1c;
}

[data-theme="dark"] .owner-vault-btn {
  color: #f87171;
  background: rgba(248, 113, 113, 0.14);
}

[data-theme="dark"] .owner-vault-btn:hover {
  background: rgba(248, 113, 113, 0.26);
  color: #fecaca;
}

.owner-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(220, 38, 38, 0.14);
  color: #dc2626;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

[data-theme="dark"] .owner-pill {
  color: #fca5a5;
}

.owner-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
}

.owner-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: #991b1b;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  flex-wrap: wrap;
}

.owner-top-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.owner-top-pill {
  background: rgba(255, 255, 255, 0.22);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.owner-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.owner-bar-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.owner-bar-btn:hover {
  background: rgba(255, 255, 255, 0.26);
}

.owner-bar-btn-strong {
  background: #ffffff;
  color: #991b1b;
  border: 1px solid #ffffff;
}

.owner-bar-btn-strong:hover {
  background: #fee2e2;
}

.owner-overlay-body {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.owner-readonly-footer {
  padding: 12px 18px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted);
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.audit-table th, .audit-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.audit-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.admin-panel-btn {
  color: var(--accent);
  background: var(--accent-soft);
}

.admin-panel-btn:hover {
  background: rgba(79, 70, 229, 0.22);
}

.admin-modal-card {
  max-width: 680px;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.admin-stat-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 12px;
}

.admin-stat-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.admin-stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.admin-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--border-subtle);
}

.admin-tab-panel {
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
}

.admin-user-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.admin-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.member-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-hover);
  color: var(--text-muted);
}

.social-btn {
  position: relative;
}

.icon-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.blocked-composer-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 600;
}

.user-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

.user-action-row:hover {
  background: var(--bg-hover);
}

.user-action-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.user-action-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.drawer-social-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar-utility-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 4px;
}

.utility-pill {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.utility-pill:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.utility-pill.admin-panel-btn {
  border-color: rgba(79, 70, 229, 0.28);
}

.utility-pill.owner-vault-btn {
  border-color: rgba(220, 38, 38, 0.28);
}

.pill-badge {
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-user-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  flex-shrink: 0;
}

.sidebar-user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  border: none;
  background: transparent;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  text-align: left;
}

.sidebar-user-btn:hover {
  background: var(--bg-hover);
}

.sidebar-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-handle {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrap input {
  padding-right: 60px;
}

.password-toggle-btn {
  position: absolute;
  right: 8px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 6px;
}

.password-toggle-btn:hover {
  background: var(--accent-soft);
}

.form-success {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 14px;
}

[data-theme="dark"] .form-success {
  color: #34d399;
}

.terms-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-secondary);
  cursor: pointer;
}

.terms-check input[type="checkbox"] {
  margin-top: 2px;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.terms-check a,
.legal-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.terms-check a:hover,
.legal-links a:hover {
  text-decoration: underline;
}

.legal-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.danger-zone-box {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(220, 38, 38, 0.35);
  background: var(--danger-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.danger-zone-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--text-secondary);
}

.danger-zone-info strong {
  color: var(--danger);
  font-size: 13px;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  border: none;
}

.btn-danger:hover {
  filter: brightness(0.92);
}

.admin-tabs-4 {
  grid-template-columns: repeat(4, 1fr);
}

.admin-tabs-5 {
  grid-template-columns: repeat(5, 1fr);
}

.report-card {
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.report-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.report-status-pill {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
}

.report-status-pill.open {
  background: var(--danger-soft);
  color: var(--danger);
}

.report-status-pill.reviewed {
  background: rgba(16, 185, 129, 0.16);
  color: #059669;
}

.report-status-pill.dismissed {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.report-details {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  white-space: pre-wrap;
}

.report-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.vault-access-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(217, 119, 6, 0.14);
  border-bottom: 1px solid rgba(217, 119, 6, 0.35);
  color: #92400e;
  font-size: 12.5px;
  line-height: 1.45;
  flex-shrink: 0;
}

[data-theme="dark"] .vault-access-banner {
  background: rgba(245, 158, 11, 0.14);
  border-bottom-color: rgba(245, 158, 11, 0.35);
  color: #fde68a;
}

.vault-access-icon {
  font-size: 15px;
  line-height: 1.3;
  flex-shrink: 0;
}

.security-settings-box {
  margin-top: 14px;
}

.security-settings-box .demo-divider {
  margin-bottom: 12px;
}

.lockdown-auth-banner {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(220, 38, 38, 0.45);
  background: var(--danger-soft);
  color: var(--danger);
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.45;
}

.lockdown-auth-banner p {
  margin: 4px 0 6px;
  color: var(--text-primary);
}

.lockdown-auth-note {
  display: block;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.owner-lockdown-bar {
  position: fixed;
  top: env(safe-area-inset-top);
  left: 0;
  right: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: #b91c1c;
  color: #ffffff;
  font-size: 13px;
  box-shadow: var(--shadow-md);
}

.app-root.has-lockdown-bar .messenger-shell {
  padding-top: 44px;
}

.lockdown-control-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(220, 38, 38, 0.38);
  background: var(--danger-soft);
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lockdown-control-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.lockdown-status-pill {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
}

.lockdown-status-pill.online {
  background: rgba(16, 185, 129, 0.18);
  color: #059669;
}

.lockdown-status-pill.active {
  background: #dc2626;
  color: #ffffff;
}

.lockdown-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lockdown-form input {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  font-size: 13px;
}

.lockdown-form-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.lockdown-form-row input {
  flex: 1;
  min-width: 180px;
}

/* Native GIF Picker & Encrypted GIF Messages */
.gif-trigger-btn {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  width: auto;
  min-width: 36px;
  padding: 0 7px;
  border: 1.5px solid currentColor;
  height: 26px;
  border-radius: 7px;
  align-self: center;
}

.gif-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 16px;
  width: min(360px, calc(100% - 32px));
  max-height: 390px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 35;
}

.gif-popover-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.gif-search-input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  font-size: 13px;
}

.gif-category-pills {
  display: flex;
  gap: 6px;
  padding: 6px 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.gif-cat-pill {
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.gif-cat-pill.active,
.gif-cat-pill:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.gif-results-grid {
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 180px;
}

.gif-tile {
  position: relative;
  border: none;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-subtle);
  height: 108px;
  cursor: pointer;
}

.gif-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gif-tile:hover {
  outline: 2px solid var(--accent);
  transform: translateY(-1px);
}

.gif-tile-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3px 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(transparent, rgba(15, 23, 42, 0.78));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.gif-popover-footer {
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  text-align: center;
}

.msg-gif-wrap {
  position: relative;
  display: inline-block;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 4px;
  max-width: 280px;
  background: rgba(15, 23, 42, 0.08);
}

.msg-gif-img {
  display: block;
  width: 100%;
  max-width: 280px;
  max-height: 240px;
  object-fit: cover;
  cursor: zoom-in;
}

.msg-gif-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 5px;
  pointer-events: none;
}

@media (max-width: 640px) {
  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile responsiveness */
.mobile-only {
  display: none;
}

@media (max-width: 820px) {
  .mobile-only {
    display: inline-flex;
  }

  .sidebar {
    width: 100%;
    max-width: none;
  }

  .messenger-shell.mobile-chat-open .sidebar {
    display: none;
  }

  .messenger-shell:not(.mobile-chat-open) .chat-pane {
    display: none;
  }

  .info-drawer {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 30;
    box-shadow: var(--shadow-lg);
  }

  .msg-row {
    max-width: 90%;
  }

  /* Prevent iOS Safari forced auto-zoom on form fields & improve touch scrolling */
  input, textarea, select {
    font-size: 16px !important;
  }

  .auth-view {
    align-items: flex-start;
    padding: 16px 12px 32px;
  }

  .auth-card {
    padding: 20px 16px;
  }
}
