/* CatIRC WebChat — custom stylesheet
 * Loaded after dist/tailwind.min.css.
 * Extracted from the inline <style> block in index.html.
 */

html, body { font-family: 'Inter', sans-serif; background-color: #0a0e1a; overflow: hidden; margin: 0; padding: 0; height: 100%; }

/* ── EMBED MODE: ocultar login/registro/branding ── */
body.embed-mode .standalone-only { display: none !important; }
body.embed-mode #app { display: flex !important; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.catmage-panel { background-color: #111827; border: 1px solid #1e293b; }
.catmage-sidebar { background-color: #0f1420; }
.input-field {
  background: #0a0e1a; border: 1px solid #1e293b; color: #e2e8f0;
  transition: all 0.2s ease;
}
.input-field:focus {
  border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2); outline: none;
}
.btn-primary {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0a0e1a; font-weight: 700; transition: all 0.3s ease;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 25px -5px rgba(245, 158, 11, 0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.badge-root  { background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%); color: white; }
.badge-admin { background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%); color: white; }
.badge-oper  { background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%); color: white; }
.badge-help  { background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%); color: white; }
.badge-mod   { background: linear-gradient(135deg, #059669 0%, #047857 100%); color: white; }
.badge-verified { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.channel-tag {
  background: #111827; border: 1px solid #1e293b; color: #94a3b8; transition: all 0.2s;
}
.channel-tag:hover { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.3); color: #f59e0b; }
.channel-tag.active { background: rgba(245, 158, 11, 0.15); border-color: #f59e0b; color: #f59e0b; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.2); } }
.pulse-dot { animation: pulse-dot 2s infinite; }
@keyframes slide-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.slide-in { animation: slide-in 0.6s ease-out forwards; }
.slide-in-delay { animation: slide-in 0.6s ease-out 0.1s forwards; opacity: 0; }
.slide-in-delay-2 { animation: slide-in 0.6s ease-out 0.2s forwards; opacity: 0; }
.avatar-pattern {
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  position: relative; overflow: hidden;
}
.avatar-pattern::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 50% 50%, transparent 20%, rgba(255,255,255,0.1) 21%, rgba(255,255,255,0.1) 22%, transparent 23%),
    radial-gradient(circle at 30% 30%, transparent 15%, rgba(255,255,255,0.15) 16%, rgba(255,255,255,0.15) 17%, transparent 18%),
    radial-gradient(circle at 70% 30%, transparent 15%, rgba(255,255,255,0.15) 16%, rgba(255,255,255,0.15) 17%, transparent 18%),
    radial-gradient(circle at 30% 70%, transparent 15%, rgba(255,255,255,0.15) 16%, rgba(255,255,255,0.15) 17%, transparent 18%),
    radial-gradient(circle at 70% 70%, transparent 15%, rgba(255,255,255,0.15) 16%, rgba(255,255,255,0.15) 17%, transparent 18%);
}
.stat-card { background: #111827; border: 1px solid #1e293b; transition: all 0.2s; }
.stat-card:hover { border-color: rgba(245, 158, 11, 0.3); }

/* Chat scrollbar */
.chat-scroll::-webkit-scrollbar { width: 8px; }
.chat-scroll::-webkit-scrollbar-track { background: #111827; }
.chat-scroll::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 4px; }
.chat-scroll::-webkit-scrollbar-thumb:hover { background: #334155; }

/* Tabs */
.tab-active { background-color: #0a0e1a; border-top: 2px solid #f59e0b; color: #f59e0b; }
.tab-inactive { background-color: #111827; color: #64748b; border-top: 2px solid transparent; }
.tab-inactive:hover { background-color: #1a1f35; color: #94a3b8; }
.login-tab-active { color: #f59e0b; border-bottom-color: #f59e0b; background-color: #0a0e1a; }
.login-tab-inactive { color: #64748b; border-bottom-color: transparent; background-color: #111827; }
.login-tab-inactive:hover { color: #94a3b8; }

/* Messages */
.msg-server { color: #64748b; font-style: italic; }
.msg-join { color: #10b981; }
.msg-part { color: #ef4444; }
.msg-action { color: #8b5cf6; }
.msg-highlight { color: #f59e0b; font-weight: bold; }
.nick-op { color: #f59e0b; }
.nick-voice { color: #10b981; }
.nick-regular { color: #94a3b8; }
.catmage-input { background-color: #0a0e1a; border: 1px solid #1e293b; color: #e2e8f0; }
.catmage-input:focus { outline: none; border-color: #f59e0b; box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2); }
.chat-window a { color: #38bdf8; text-decoration: underline; text-decoration-color: rgba(56, 189, 248, 0.3); transition: all 0.15s; }
.chat-window a:hover { color: #7dd3fc; text-decoration-color: #38bdf8; }

/* Inline image previews */
.msg-img-preview { max-width: 260px; max-height: 200px; border-radius: 6px; margin-top: 4px; cursor: zoom-in; object-fit: cover; border: 1px solid #1e293b; display: block; }
.msg-img-preview:hover { border-color: #f59e0b; }

/* Image lightbox */
#img-lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 9999; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
#img-lightbox img { max-width: 90vw; max-height: 88vh; border-radius: 8px; box-shadow: 0 25px 60px rgba(0,0,0,.7); }
#img-lightbox-close { position: fixed; top: 16px; right: 20px; color: #fff; font-size: 28px; cursor: pointer; line-height: 1; }

/* Paste image preview */
#paste-preview { position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; background: #111827; border: 1px solid #1e293b; border-radius: 6px; padding: 8px; display: flex; align-items: center; gap: 8px; z-index: 30; }
#paste-preview img { max-height: 64px; max-width: 120px; border-radius: 4px; object-fit: cover; }
#paste-preview-name { font-size: 11px; color: #94a3b8; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-catmage { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: #0a0e1a; font-weight: 700; transition: all 0.2s; }
.btn-catmage:hover { box-shadow: 0 0 20px rgba(245, 158, 11, 0.4); transform: translateY(-1px); }
.btn-catmage:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }
.typing-dots span { width: 4px; height: 4px; border-radius: 50%; background: #64748b; display: inline-block; animation: typingBounce 1.4s infinite; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Context Menu */
.ctx-menu { position: fixed; background: #111827; border: 1px solid #1e293b; border-radius: 6px; box-shadow: 0 4px 24px rgba(0,0,0,0.5); min-width: 180px; z-index: 200; padding: 4px 0; }
.ctx-menu-item { display: block; width: 100%; padding: 6px 12px; background: none; border: none; color: #e2e8f0; font-size: 11px; font-family: 'JetBrains Mono', monospace; text-align: left; cursor: pointer; transition: background 0.15s; }
.ctx-menu-item:hover { background: #1a1f35; }
.ctx-menu-item.danger { color: #ef4444; }
.ctx-menu-item.danger:hover { background: rgba(239,68,68,0.1); }
.ctx-menu-divider { height: 1px; background: #1e293b; margin: 4px 0; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(4px); }
/* .hidden must beat .modal-overlay{display:flex} — higher specificity wins */
.modal-overlay.hidden { display: none; }
.modal-card { background: #111827; border: 1px solid #1e293b; border-radius: 10px; width: 100%; max-width: 440px; box-shadow: 0 4px 24px rgba(0,0,0,0.5); }
.modal-card.wide { max-width: 640px; }

/* Message reactions */
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.msg-reaction {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px;
  background: #0a0e1a; border: 1px solid #1e293b; border-radius: 10px;
  font-size: 11px; cursor: pointer; transition: all 0.15s;
}
.msg-reaction:hover { border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.05); }
.msg-reaction.active { border-color: rgba(245, 158, 11, 0.6); background: rgba(245, 158, 11, 0.1); }
.msg-reaction-count { color: #94a3b8; font-family: 'JetBrains Mono', monospace; font-size: 10px; }
.msg-hover-bar {
  position: absolute; right: 8px; top: -12px;
  display: none; align-items: center; gap: 2px;
  background: #111827; border: 1px solid #1e293b; border-radius: 6px;
  padding: 2px 4px; z-index: 10;
}
.msg-row:hover .msg-hover-bar { display: flex; }
.msg-hover-btn {
  padding: 2px 4px; border-radius: 4px; font-size: 12px;
  cursor: pointer; transition: background 0.15s; border: none; background: none;
}
.msg-hover-btn:hover { background: #1a1f35; }
.reaction-picker {
  position: absolute; bottom: 100%; right: 0; margin-bottom: 4px;
  background: #111827; border: 1px solid #1e293b; border-radius: 8px;
  padding: 6px; display: none; gap: 4px; flex-wrap: wrap; width: 200px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4); z-index: 20;
}
.reaction-picker.active { display: flex; }
.reaction-picker button { padding: 4px; font-size: 14px; border-radius: 4px; cursor: pointer; background: none; border: none; transition: background 0.15s; }
.reaction-picker button:hover { background: #1a1f35; }

/* Suggestion popup */
.suggestion-popup {
  position: fixed; background: #111827; border: 1px solid #1e293b; border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5); min-width: 280px; max-width: 380px;
  z-index: 500; overflow: hidden; max-height: 220px; overflow-y: auto;
}
.suggestion-popup.hidden { display: none; }
.suggestion-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  cursor: pointer; transition: background 0.1s;
}
.suggestion-item:hover, .suggestion-item.active { background: rgba(245, 158, 11, 0.1); }
.suggestion-cmd { color: #f59e0b; font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 600; min-width: 90px; }
.suggestion-args { color: #64748b; font-family: 'JetBrains Mono', monospace; font-size: 10px; flex: 1; }
.suggestion-desc { color: #94a3b8; font-size: 10px; margin-left: auto; white-space: nowrap; }
.suggestion-nick { color: #e2e8f0; font-size: 11px; font-weight: 500; }
.suggestion-avatar {
  width: 20px; height: 20px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: #fff; flex-shrink: 0;
}

/* Mobile nicklist */
@media (max-width: 768px) {
  #nicklistContainer {
    position: fixed; right: 0; top: 0; bottom: 0;
    width: 260px; z-index: 150;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -4px 0 24px rgba(0,0,0,0.5);
  }
  #nicklistContainer.open { transform: translateX(0); }
  .nicklist-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 140; display: none; }
  .nicklist-overlay.show { display: block; }
  #mobile-nicklist-toggle { display: flex !important; }
}
@media (min-width: 769px) {
  #mobile-nicklist-toggle { display: none !important; }
  #nicklistContainer { position: static !important; transform: none !important; }
}

/* Menu styles */
.menubar-item { padding: 0.375rem 0.625rem; font-size: 0.75rem; color: #94a3b8; cursor: pointer; border-radius: 0.375rem; transition: all 0.15s; position: relative; }
.menubar-item:hover { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.menubar-item.active { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.menu-item { padding: 0.5rem 0.75rem; display: flex; align-items: center; gap: 0.75rem; color: #e2e8f0; font-size: 0.8125rem; cursor: pointer; transition: all 0.15s; border-radius: 0.375rem; }
.menu-item:hover { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.menu-item.danger:hover { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.menu-icon { width: 1rem; height: 1rem; color: #94a3b8; flex-shrink: 0; }
.menu-separator { height: 1px; background: #1e293b; margin: 0.375rem 0; }
.menu-section-title { font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.1em; color: #64748b; padding: 0.375rem 0.75rem; font-weight: 600; }
.menu-shortcut { margin-left: auto; font-size: 0.6875rem; color: #64748b; font-family: 'JetBrains Mono', monospace; }
.dropdown-enter { animation: dropdownIn 0.15s ease-out; }
@keyframes dropdownIn { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* Mobile drawer */
.mobile-drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 100%; max-width: 320px; background: #0f1420; border-right: 1px solid #1e293b; z-index: 50; overflow-y: auto; transform: translateX(-100%); transition: transform 0.25s ease-out; }
.mobile-drawer.open { transform: translateX(0); }
.mobile-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 40; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.mobile-overlay.open { opacity: 1; pointer-events: auto; }
.drawer-section { padding: 0.75rem 1rem 0.375rem; font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.15em; color: #64748b; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.drawer-item { padding: 0.625rem 1rem; display: flex; align-items: center; gap: 0.75rem; color: #e2e8f0; font-size: 0.8125rem; cursor: pointer; transition: all 0.15s; border-left: 2px solid transparent; }
.drawer-item:hover { background: rgba(245, 158, 11, 0.08); color: #f59e0b; border-left-color: #f59e0b; }
.drawer-item.danger:hover { background: rgba(239, 68, 68, 0.08); color: #ef4444; border-left-color: #ef4444; }
.drawer-icon { width: 1.125rem; height: 1.125rem; color: #94a3b8; flex-shrink: 0; }
.drawer-separator { height: 1px; background: #1e293b; margin: 0.25rem 1rem; }
@media (min-width: 768px) { .mobile-drawer, .mobile-overlay { display: none !important; } }

/* History loading indicator */
.history-loading { padding: 8px 12px; margin: 4px 0; background: rgba(245, 158, 11, 0.05); border-left: 2px solid #f59e0b; border-radius: 0 4px 4px 0; display: flex; align-items: center; gap: 8px; font-size: 11px; color: #94a3b8; animation: historyFadeIn 0.3s ease-out; }
.history-loading-spinner { width: 14px; height: 14px; border: 2px solid #1e293b; border-top-color: #f59e0b; border-radius: 50%; animation: historySpin 0.8s linear infinite; flex-shrink: 0; }
@keyframes historySpin { to { transform: rotate(360deg); } }
@keyframes historyFadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ═══════════════════════════════════════════
   MOBILE UI — bottom nav, sheets, bubbles
   Visible below md (768px), hidden above.
   ═══════════════════════════════════════════ */

/* ── Scroll area (touch-friendly) ── */
.scroll-area { overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: #1e293b #0a0e1a; -webkit-overflow-scrolling: touch; }
.scroll-area::-webkit-scrollbar { width: 4px; }
.scroll-area::-webkit-scrollbar-track { background: transparent; }
.scroll-area::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 2px; }

/* ── App header (mobile) ── */
.app-header { background: #0f1420; border-bottom: 1px solid #1e293b; padding: 0.75rem 1rem; padding-top: calc(0.75rem + env(safe-area-inset-top, 0)); display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-shrink: 0; }
.header-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; flex: 1; }
.header-logo { width: 2.25rem; height: 2.25rem; border-radius: 50%; background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }
.header-title { font-weight: 700; color: #e2e8f0; font-size: 1rem; line-height: 1.2; }
.header-subtitle { font-size: 0.6875rem; color: #64748b; display: flex; align-items: center; gap: 0.375rem; }
.header-actions { display: flex; gap: 0.25rem; flex-shrink: 0; }
.header-btn { width: 2.25rem; height: 2.25rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #94a3b8; transition: all 0.15s; position: relative; -webkit-tap-highlight-color: transparent; }
.header-btn:active { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.header-btn .notif-dot { position: absolute; top: 0.375rem; right: 0.375rem; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #ef4444; border: 2px solid #0f1420; }

/* Status pill */
.status-pill { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.25rem 0.625rem; background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); border-radius: 9999px; font-size: 0.6875rem; color: #10b981; font-weight: 600; }
.status-dot { width: 0.375rem; height: 0.375rem; border-radius: 50%; background: #10b981; animation: mobileStatusPulse 2s infinite; }
@keyframes mobileStatusPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.status-pill.disconnected { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: #ef4444; }
.status-pill.disconnected .status-dot { background: #ef4444; }

/* ── Channel tabs (mobile horizontal pill scroll) ── */
.channel-tabs { display: flex; gap: 0.5rem; padding: 0.5rem 0.75rem; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; background: #0f1420; border-bottom: 1px solid #1e293b; flex-shrink: 0; }
.channel-tabs::-webkit-scrollbar { display: none; }
.channel-tab { flex-shrink: 0; padding: 0.4rem 0.875rem; border-radius: 9999px; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; scroll-snap-align: start; transition: all 0.2s; display: flex; align-items: center; gap: 0.375rem; -webkit-tap-highlight-color: transparent; font-family: 'JetBrains Mono', monospace; }
.channel-tab.active { background: #f59e0b; color: #0a0e1a; }
.channel-tab:not(.active) { background: #111827; color: #94a3b8; border: 1px solid #1e293b; }
.channel-tab:not(.active):active { background: #1e293b; color: #e2e8f0; }
.channel-tab .unread-dot { width: 6px; height: 6px; border-radius: 50%; background: #ef4444; }

/* ── Mobile view overlays (users / channels) ── */
.mobile-view { position: absolute; inset: 0; background: #0a0e1a; z-index: 10; flex-direction: column; }
.mobile-view.hidden { display: none; }
.mobile-view:not(.hidden) { display: flex; }

/* ── Nick rows in mobile users view ── */
.nick-row-mobile { padding: 0.75rem 1.25rem; display: flex; align-items: center; gap: 0.875rem; border-bottom: 1px solid rgba(30, 41, 59, 0.5); -webkit-tap-highlight-color: transparent; cursor: pointer; }
.nick-row-mobile:active { background: rgba(245, 158, 11, 0.08); }
.nick-avatar-mobile { width: 2.5rem; height: 2.5rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.875rem; color: white; flex-shrink: 0; position: relative; }
.nick-status-dot { position: absolute; bottom: 0; right: 0; width: 0.75rem; height: 0.75rem; border-radius: 50%; border: 2px solid #0f1420; }

/* ── Channel list rows in mobile channels view ── */
.channel-row-mobile { padding: 1rem 1.25rem; display: flex; align-items: center; gap: 0.875rem; border-bottom: 1px solid rgba(30, 41, 59, 0.5); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.channel-row-mobile:active { background: rgba(245, 158, 11, 0.08); }
.channel-row-mobile.active-channel { background: rgba(245, 158, 11, 0.05); }

/* ── FAB (floating action button) ── */
.fab { position: absolute; right: 1rem; bottom: 0.75rem; width: 3.5rem; height: 3.5rem; border-radius: 50%; background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: #0a0e1a; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4); z-index: 30; transition: all 0.2s; -webkit-tap-highlight-color: transparent; }
.fab:active { transform: scale(0.9); }

/* ── Quick actions bar ── */
.quick-actions-bar { display: flex; gap: 0.5rem; padding: 0.4rem 0.75rem; overflow-x: auto; scrollbar-width: none; background: #0f1420; border-top: 1px solid #1e293b; flex-shrink: 0; }
.quick-actions-bar::-webkit-scrollbar { display: none; }
.quick-action-btn { flex-shrink: 0; padding: 0.3rem 0.65rem; border-radius: 9999px; font-size: 0.75rem; font-family: 'JetBrains Mono', monospace; background: #111827; color: #94a3b8; border: 1px solid #1e293b; transition: all 0.15s; -webkit-tap-highlight-color: transparent; }
.quick-action-btn:active { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border-color: #f59e0b; }

/* ── Mobile input area ── */
.mobile-input-area { background: #0f1420; border-top: 1px solid #1e293b; padding: 0.625rem 0.75rem; padding-bottom: calc(0.625rem + env(safe-area-inset-bottom, 0)); flex-shrink: 0; }
.mobile-input-row { display: flex; align-items: center; gap: 0.5rem; background: #111827; border: 1px solid #1e293b; border-radius: 9999px; padding: 0.375rem 0.375rem 0.375rem 1rem; transition: border-color 0.2s, box-shadow 0.2s; }
.mobile-input-row:focus-within { border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2); }
.mobile-input-field { flex: 1; background: transparent; border: none; color: #e2e8f0; font-family: 'JetBrains Mono', monospace; font-size: 0.9375rem; outline: none; min-width: 0; }
.mobile-input-field::placeholder { color: #64748b; }
.mobile-send-btn { width: 2.25rem; height: 2.25rem; border-radius: 50%; background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: #0a0e1a; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.15s; -webkit-tap-highlight-color: transparent; }
.mobile-send-btn:active { transform: scale(0.9); }
.mobile-input-action { width: 2rem; height: 2rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #64748b; transition: all 0.15s; flex-shrink: 0; -webkit-tap-highlight-color: transparent; }
.mobile-input-action:active { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

/* ── Bottom navigation ── */
.bottom-nav { background: #0f1420; border-top: 1px solid #1e293b; padding-bottom: env(safe-area-inset-bottom, 0); flex-shrink: 0; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0.5rem 0.25rem; color: #64748b; transition: all 0.2s; position: relative; gap: 0.25rem; -webkit-tap-highlight-color: transparent; border: none; background: none; }
.nav-item:active { background: rgba(245, 158, 11, 0.1); }
.nav-item.active { color: #f59e0b; }
.nav-item.active::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 24px; height: 2px; background: #f59e0b; border-radius: 1px; }
.nav-badge { position: absolute; top: 0.25rem; right: 50%; transform: translateX(12px); background: #ef4444; color: white; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 9999px; min-width: 16px; text-align: center; }

/* ── Sheet overlay ── */
.sheet-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 40; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.sheet-overlay.open { opacity: 1; pointer-events: auto; }

/* ── Bottom sheets ── */
.bottom-sheet { position: fixed; left: 0; right: 0; bottom: 0; background: #0f1420; border-top-left-radius: 1.25rem; border-top-right-radius: 1.25rem; border-top: 1px solid #1e293b; z-index: 50; transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1); max-height: 85vh; display: flex; flex-direction: column; }
.bottom-sheet.open { transform: translateY(0); }
.sheet-handle { width: 36px; height: 4px; background: #1e293b; border-radius: 2px; margin: 0.75rem auto 0; flex-shrink: 0; }
.sheet-header { padding: 1rem 1.25rem 0.75rem; border-bottom: 1px solid #1e293b; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: #1e293b transparent; }
.sheet-body::-webkit-scrollbar { width: 4px; }
.sheet-body::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 2px; }
.sheet-menu-item { padding: 0.875rem 1.25rem; display: flex; align-items: center; gap: 1rem; color: #e2e8f0; font-size: 0.9375rem; cursor: pointer; transition: all 0.15s; border-bottom: 1px solid rgba(30, 41, 59, 0.5); -webkit-tap-highlight-color: transparent; }
.sheet-menu-item:active { background: rgba(245, 158, 11, 0.1); }
.sheet-menu-item.danger:active { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.sheet-menu-icon { width: 1.5rem; height: 1.5rem; color: #94a3b8; flex-shrink: 0; }
.sheet-menu-item:active .sheet-menu-icon { color: #f59e0b; }
.sheet-section-title { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.15em; color: #64748b; padding: 1rem 1.25rem 0.5rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.sheet-badge { background: #f59e0b; color: #0a0e1a; font-size: 0.625rem; font-weight: 700; padding: 2px 8px; border-radius: 9999px; margin-left: auto; }
.sheet-badge.red { background: #ef4444; color: white; }
.sheet-badge.green { background: #10b981; color: white; }
.sheet-close-btn { padding: 0.5rem; border-radius: 0.5rem; color: #94a3b8; -webkit-tap-highlight-color: transparent; background: none; border: none; cursor: pointer; }
.sheet-close-btn:active { background: #1e293b; }

/* ── Mobile message bubbles ── */
.mobile-msg-bubble { display: flex; gap: 0.5rem; align-items: flex-end; padding: 0.25rem 0; }
.mobile-msg-bubble.own { flex-direction: row-reverse; }
.bubble-avatar { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.7rem; color: white; }
.bubble-body { max-width: 76%; }
.bubble-nick { font-size: 0.6875rem; font-weight: 700; margin-bottom: 0.125rem; padding-left: 0.5rem; }
.bubble-box { padding: 0.5rem 0.75rem; border-radius: 1rem; word-break: break-word; font-size: 0.875rem; line-height: 1.4; }
.bubble-box.own { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: #0a0e1a; border-bottom-right-radius: 0.25rem; }
.bubble-box.other { background: #111827; color: #e2e8f0; border-bottom-left-radius: 0.25rem; }
.bubble-time { font-size: 0.625rem; color: #64748b; margin-top: 0.2rem; padding-left: 0.5rem; }
.bubble-box.own + .bubble-time { text-align: right; padding-right: 0.5rem; color: rgba(10,14,26,0.5); padding-left: 0; }
.mobile-sys-msg { text-align: center; padding: 0.375rem 1rem; font-size: 0.75rem; color: #64748b; font-style: italic; }
.mobile-sys-msg.join { color: #10b981; font-style: normal; }
.mobile-sys-msg.part { color: #ef4444; font-style: normal; }
.mobile-sys-msg.action { color: #8b5cf6; font-style: normal; }
.mobile-typing-indicator { display: flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.75rem; font-size: 0.75rem; color: #64748b; font-style: italic; }
.mobile-typing-dots { display: flex; gap: 0.25rem; }
.mobile-typing-dots span { width: 0.375rem; height: 0.375rem; border-radius: 50%; background: #64748b; animation: mobileTypingBounce 1.4s infinite; }
.mobile-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.mobile-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mobileTypingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }

/* ── Date separator ── */
.date-sep-mobile { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0; color: #64748b; font-size: 0.6875rem; }
.date-sep-mobile::before, .date-sep-mobile::after { content: ''; flex: 1; height: 1px; background: #1e293b; }

/* ── Empty state ── */
.mobile-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem 2rem; text-align: center; color: #64748b; }
.mobile-empty-icon { width: 4rem; height: 4rem; border-radius: 50%; background: #111827; display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; font-size: 2rem; }

/* ── Override: on mobile hide desktop-specific elements ── */
@media (max-width: 767px) {
  /* The old nicklist float-out behaviour is replaced by the mobile users view */
  #nicklistContainer, #dmCard { display: none !important; }
  /* Hide old mobile drawer (replaced by sheets) */
  .mobile-drawer, .mobile-overlay { display: none !important; }
  /* chatWindow on mobile: full height, touch scroll, no desktop scrollbar */
  #chatWindow { scrollbar-width: thin; scrollbar-color: #1e293b transparent; }
  #chatWindow::-webkit-scrollbar { width: 3px; }
  /* Input area on mobile hidden (replaced by mobile-input-area) */
  .desktop-input-area { display: none !important; }
  /* Tab container hidden (replaced by channel-tabs pills) */
  #tabContainer { display: none !important; }
  /* Desktop toolbar hidden */
  .desktop-toolbar { display: none !important; }
  /* Desktop title bar hidden */
  .desktop-titlebar { display: none !important; }
  /* Desktop status bar hidden */
  .desktop-statusbar { display: none !important; }
  /* Desktop menu bar stays hidden (it already has hidden md:flex) */
  /* Prevent body scroll on mobile when sheet is open */
  body.sheet-open { overflow: hidden; }
}
@media (min-width: 768px) {
  /* On desktop: hide all mobile-only elements */
  .mobile-only { display: none !important; }
}

/* ═══════════════════════════════════════════
   CUSTOM THEMES
   Applied via data-theme attribute on <html>.
   Default is "dark" (base styles above).
   ═══════════════════════════════════════════ */

/* ── Light theme ── */
[data-theme="light"] html,
[data-theme="light"] body,
html[data-theme="light"],
html[data-theme="light"] body { background-color: #f1f5f9 !important; color: #0f172a !important; }
[data-theme="light"] .catmage-panel { background-color: #ffffff !important; border-color: #e2e8f0 !important; }
[data-theme="light"] .catmage-sidebar { background-color: #f8fafc !important; }
[data-theme="light"] .catmage-input { background: #f8fafc !important; border-color: #cbd5e1 !important; color: #0f172a !important; }
[data-theme="light"] .input-field { background: #ffffff !important; border-color: #cbd5e1 !important; color: #0f172a !important; }
[data-theme="light"] .channel-tab:not(.active) { background: #e2e8f0 !important; color: #475569 !important; border-color: #cbd5e1 !important; }
[data-theme="light"] .app-header { background: #ffffff !important; border-color: #e2e8f0 !important; }
[data-theme="light"] .channel-tabs { background: #f8fafc !important; border-color: #e2e8f0 !important; }
[data-theme="light"] .bottom-nav { background: #ffffff !important; border-color: #e2e8f0 !important; }
[data-theme="light"] .nav-item { color: #64748b !important; }
[data-theme="light"] .nav-item.active { color: #f59e0b !important; }
[data-theme="light"] .bottom-sheet { background: #ffffff !important; border-color: #e2e8f0 !important; }
[data-theme="light"] .sheet-menu-item { color: #0f172a !important; }
[data-theme="light"] .sheet-menu-item:hover { background: #f1f5f9 !important; }
[data-theme="light"] .mobile-view { background: #f1f5f9 !important; }
[data-theme="light"] .nick-row-mobile { border-color: rgba(203,213,225,0.5) !important; }
[data-theme="light"] .channel-row-mobile { border-color: rgba(203,213,225,0.5) !important; }
[data-theme="light"] .mobile-input-field { background: #f1f5f9 !important; border-color: #cbd5e1 !important; color: #0f172a !important; }
[data-theme="light"] .bubble-box.other { background: #e2e8f0 !important; color: #0f172a !important; }
[data-theme="light"] .mobile-sys-msg { color: #94a3b8 !important; }
[data-theme="light"] .sheet-overlay { background: rgba(0,0,0,0.4) !important; }

/* ── Monokai theme ── */
[data-theme="monokai"] html,
html[data-theme="monokai"],
html[data-theme="monokai"] body { background-color: #272822 !important; }
[data-theme="monokai"] .catmage-panel { background-color: #3e3d32 !important; border-color: #49483e !important; }
[data-theme="monokai"] .catmage-sidebar { background-color: #2d2c27 !important; }
[data-theme="monokai"] .catmage-input { background: #272822 !important; border-color: #49483e !important; color: #f8f8f2 !important; }
[data-theme="monokai"] .input-field { background: #272822 !important; border-color: #49483e !important; color: #f8f8f2 !important; }
[data-theme="monokai"] .input-field:focus { border-color: #a6e22e !important; box-shadow: 0 0 0 2px rgba(166,226,46,0.2) !important; }
[data-theme="monokai"] .btn-primary { background: linear-gradient(135deg, #a6e22e 0%, #7ab500 100%) !important; }
[data-theme="monokai"] .channel-tab.active { background: #a6e22e !important; color: #272822 !important; }
[data-theme="monokai"] .channel-tab:not(.active) { background: #3e3d32 !important; border-color: #49483e !important; color: #75715e !important; }
[data-theme="monokai"] .app-header { background: #2d2c27 !important; border-color: #49483e !important; }
[data-theme="monokai"] .channel-tabs { background: #2d2c27 !important; border-color: #49483e !important; }
[data-theme="monokai"] .bottom-nav { background: #2d2c27 !important; border-color: #49483e !important; }
[data-theme="monokai"] .nav-item.active { color: #a6e22e !important; }
[data-theme="monokai"] .bottom-sheet { background: #3e3d32 !important; border-color: #49483e !important; }
[data-theme="monokai"] .fab { background: #a6e22e !important; color: #272822 !important; }
[data-theme="monokai"] .bubble-box.own { background: #a6e22e !important; color: #272822 !important; }
[data-theme="monokai"] .mobile-send-btn { background: #a6e22e !important; color: #272822 !important; }
[data-theme="monokai"] .mobile-view { background: #272822 !important; }

/* ── Solarized Dark theme ── */
[data-theme="solarized"] html,
html[data-theme="solarized"],
html[data-theme="solarized"] body { background-color: #002b36 !important; }
[data-theme="solarized"] .catmage-panel { background-color: #073642 !important; border-color: #0d4654 !important; }
[data-theme="solarized"] .catmage-sidebar { background-color: #002b36 !important; }
[data-theme="solarized"] .catmage-input { background: #002b36 !important; border-color: #0d4654 !important; color: #839496 !important; }
[data-theme="solarized"] .input-field { background: #002b36 !important; border-color: #0d4654 !important; color: #839496 !important; }
[data-theme="solarized"] .input-field:focus { border-color: #268bd2 !important; box-shadow: 0 0 0 2px rgba(38,139,210,0.2) !important; }
[data-theme="solarized"] .btn-primary { background: linear-gradient(135deg, #268bd2 0%, #1a6fa8 100%) !important; color: #fdf6e3 !important; }
[data-theme="solarized"] .channel-tab.active { background: #268bd2 !important; color: #fdf6e3 !important; }
[data-theme="solarized"] .channel-tab:not(.active) { background: #073642 !important; border-color: #0d4654 !important; color: #586e75 !important; }
[data-theme="solarized"] .app-header { background: #073642 !important; border-color: #0d4654 !important; }
[data-theme="solarized"] .channel-tabs { background: #073642 !important; border-color: #0d4654 !important; }
[data-theme="solarized"] .bottom-nav { background: #073642 !important; border-color: #0d4654 !important; }
[data-theme="solarized"] .nav-item.active { color: #268bd2 !important; }
[data-theme="solarized"] .bottom-sheet { background: #073642 !important; border-color: #0d4654 !important; }
[data-theme="solarized"] .fab { background: #268bd2 !important; }
[data-theme="solarized"] .bubble-box.own { background: #268bd2 !important; color: #fdf6e3 !important; }
[data-theme="solarized"] .mobile-send-btn { background: #268bd2 !important; }
[data-theme="solarized"] .mobile-view { background: #002b36 !important; }
