:root {
  --bg-main: #0c0d12;
  --bg-sidebar: #13141b;
  --bg-card: #1a1c26;
  --bg-hover: #222533;
  --bg-input: #151620;
  
  --border-color: #272a3b;
  --border-subtle: #1e202e;
  
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.2);
  --accent-red: #e11d48;
  --accent-red-glow: rgba(225, 29, 72, 0.2);
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
  
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  width: 100%;
  height: 100%;
  height: var(--vvh, 100dvh);
  margin: 0;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  width: 100%;
  height: 100%;
  height: var(--vvh, 100dvh);
  margin: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 0px;
}
::-webkit-scrollbar:horizontal {
  display: none !important;
  width: 0px !important;
  height: 0px !important;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #2a2e40;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #3b425c;
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #2a2e40 transparent;
}

/* Base App Layout */
#app {
  display: flex;
  width: 100%;
  max-width: 100%;
  height: 100%;
  height: var(--vvh, 100dvh);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* Sidebar */
.sidebar {
  width: 320px;
  min-width: 320px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 20;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.theatre-brand {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.05) 0%, transparent 100%);
}

.brand-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 12px var(--accent-red-glow);
}

.brand-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

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

/* User Card in Sidebar */
.current-user-card {
  padding: 14px 18px;
  margin: 12px 14px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: #334155;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  overflow: visible;
}

.avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.profile-avatar-wrap {
  position: relative;
  display: inline-block;
  cursor: pointer;
  transition: transform 0.2s;
}

.profile-avatar-wrap:hover {
  transform: scale(1.04);
}

.profile-avatar-wrap .avatar {
  overflow: hidden;
  border: 3px solid var(--accent-gold);
  box-shadow: 0 4px 16px var(--accent-gold-glow);
}

.avatar-camera-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--accent-gold);
  color: #000;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border: 2px solid var(--bg-sidebar);
  box-shadow: var(--shadow-sm);
}

.emoji-picker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0;
}

.emoji-pick-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.emoji-pick-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-gold);
  transform: scale(1.15);
}

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

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

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

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-top: 3px;
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

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

.icon-btn.danger:hover {
  background: rgba(225, 29, 72, 0.15);
  color: var(--accent-red);
}

/* Navigation List */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 4px 10px;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.add-channel-quick-btn {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--accent-gold);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: none;
  letter-spacing: normal;
}

.add-channel-quick-btn:hover {
  background: var(--accent-gold);
  color: #000;
  box-shadow: 0 2px 8px var(--accent-gold-glow);
}

.channel-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.channel-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
  user-select: none;
}

.channel-item:hover {
  background-color: var(--bg-card);
  color: var(--text-main);
}

.channel-item.active {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.05) 100%);
  color: var(--accent-gold);
  border-left: 3px solid var(--accent-gold);
  font-weight: 600;
}

.channel-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.channel-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-badge {
  font-size: 10px;
  background: var(--accent-red);
  color: #fff;
  border-radius: var(--radius-full);
  padding: 2px 7px;
  font-weight: 700;
  box-shadow: 0 0 10px var(--accent-red-glow);
  animation: badge-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badge-pop {
  0% { transform: scale(0.6); }
  100% { transform: scale(1); }
}

.msg-roles-wrap {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

/* Admin Button in Sidebar */
.admin-bar {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-sidebar);
}

.admin-trigger-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.12) 0%, rgba(225, 29, 72, 0.04) 100%);
  border: 1px solid rgba(225, 29, 72, 0.3);
  color: #fca5a5;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-trigger-btn:hover {
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.25) 0%, rgba(225, 29, 72, 0.1) 100%);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-red-glow);
}

.admin-badge-count {
  background-color: var(--accent-red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Chat Main Area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 100%;
  height: var(--vvh, 100dvh);
  background-color: var(--bg-main);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* Chat Header */
.chat-header {
  height: 64px;
  min-height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

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

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 20px;
  cursor: pointer;
  position: relative;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
}

.mobile-menu-badge {
  position: absolute;
  top: 1px;
  right: -5px;
  background-color: var(--accent-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  line-height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.7);
  border: 1.5px solid var(--bg-card);
  animation: pulse-badge 2s infinite;
}

/* Pull-to-Refresh Indicator */
.ptr-indicator {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translate(-50%, -100%);
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-card);
  border: 1px solid var(--accent-gold);
  border-radius: var(--radius-full);
  padding: 8px 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 16px var(--accent-gold-glow);
  z-index: 95;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
}

.ptr-spinner-circle {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold);
  transition: transform 0.08s linear;
}

.ptr-icon-svg {
  display: block;
}

.ptr-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

.ptr-indicator.ready {
  border-color: #34d399;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 18px rgba(52, 211, 153, 0.4);
}

.ptr-indicator.ready .ptr-spinner-circle,
.ptr-indicator.ready .ptr-label {
  color: #34d399;
}

.ptr-indicator.refreshing .ptr-icon-svg {
  animation: ptr-spin 0.65s linear infinite;
}

@keyframes ptr-spin {
  100% { transform: rotate(360deg); }
}

/* Floating Mobile In-App Toast Notification */
.mobile-toast-banner {
  position: absolute;
  top: 56px;
  left: 12px;
  right: 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--accent-gold);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.8), 0 0 15px rgba(218, 165, 32, 0.2);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 99;
  cursor: pointer;
  animation: slide-toast-down 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 520px;
  margin: 0 auto;
}

@keyframes slide-toast-down {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.toast-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.toast-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toast-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast-text {
  font-size: 12px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast-close-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
}

.toast-close-btn:hover {
  color: #fff;
}

.header-title-box {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-desc {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-input-wrap {
  position: relative;
}

.search-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 6px 14px 6px 32px;
  font-size: 12px;
  color: var(--text-main);
  outline: none;
  width: 170px;
  transition: width 0.2s;
}

.search-input:focus {
  width: 230px;
  border-color: var(--accent-gold);
}

.search-icon-pos {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 13px;
  pointer-events: none;
}

/* Pinned Message Sticky Banner */
.pinned-banner {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.12) 0%, rgba(245, 158, 11, 0.04) 100%);
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  z-index: 5;
}

.pinned-content {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pinned-icon {
  color: var(--accent-gold);
  font-size: 14px;
}

.pinned-text {
  font-size: 12px;
  color: var(--accent-gold);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Messages Scroll Container */
.messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.empty-chat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: auto;
  color: var(--text-dim);
  gap: 12px;
  text-align: center;
}

.empty-chat-icon {
  font-size: 40px;
  opacity: 0.5;
}

/* Message Bubble */
.message-item {
  display: flex;
  gap: 12px;
  position: relative;
  transition: background 0.15s;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  width: 100%;
  box-sizing: border-box;
}

.message-item:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.message-item:hover .msg-actions {
  opacity: 1;
}

.msg-body {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-break: break-word;
}

.msg-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
  max-width: 100%;
}

.msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s;
}

.msg-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.msg-avatar:hover {
  transform: scale(1.08);
}

.msg-author {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: color 0.15s;
}

.msg-author:hover {
  color: var(--accent-gold);
  text-decoration: underline;
}

.msg-time {
  font-size: 11px;
  color: var(--text-dim);
}

/* Quote/Reply Preview in message */
.msg-reply-quote {
  background-color: var(--bg-hover);
  border-left: 3px solid var(--accent-gold);
  border-radius: 4px;
  padding: 4px 10px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-muted);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

.msg-text {
  font-size: 14px;
  line-height: 1.5;
  color: #e2e8f0;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  max-width: 100%;
}

/* Attachments */
.msg-media {
  margin-top: 8px;
  max-width: 100%;
  width: fit-content;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-sizing: border-box;
}

.msg-image {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid var(--border-color);
  transition: transform 0.2s;
  box-sizing: border-box;
}

.msg-video {
  max-width: 100%;
  width: 100%;
  max-height: 320px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #000;
  box-sizing: border-box;
}

/* Voice Message Bubble */
.msg-audio-player {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  width: fit-content;
  max-width: 100%;
  margin-top: 6px;
  box-sizing: border-box;
}

.audio-play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-gold);
  color: #000;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  flex-shrink: 0;
}

.audio-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.audio-seek-slider {
  width: 120px;
  height: 4px;
  accent-color: var(--accent-gold);
}

/* Document Attachment */
.msg-file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  width: fit-content;
  max-width: 100%;
  margin-top: 6px;
  text-decoration: none;
  color: var(--text-main);
  transition: background 0.15s;
  box-sizing: border-box;
}

.msg-file-card:hover {
  background-color: var(--bg-hover);
  border-color: var(--accent-gold);
}

.file-icon {
  font-size: 24px;
}

.file-details {
  display: flex;
  flex-direction: column;
}

.file-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.file-size {
  font-size: 11px;
  color: var(--text-dim);
}

/* Floating message actions (Reply, Pin, Delete) */
.msg-actions {
  position: absolute;
  top: -8px;
  right: 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  gap: 2px;
  padding: 2px;
  opacity: 0;
  transition: opacity 0.15s;
  box-shadow: var(--shadow-sm);
  z-index: 5;
}

.msg-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
}

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

.msg-action-btn.danger:hover {
  color: var(--accent-red);
}

/* Acknowledge Button under News */
.news-ack-section {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ack-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
  color: #34d399;
  transition: all 0.2s;
}

.ack-btn:hover {
  background: rgba(16, 185, 129, 0.2);
}

.ack-btn.acknowledged {
  background: var(--accent-green);
  color: #000;
  border-color: var(--accent-green);
}

.ack-list-link {
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: underline;
  cursor: pointer;
}

.ack-list-link:hover {
  color: var(--text-muted);
}

/* Chat Input Bar */
.chat-input-wrapper {
  padding: 12px 24px 18px 24px;
  background-color: var(--bg-sidebar);
  border-top: 1px solid var(--border-color);
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Read-Only Notice */
.readonly-notice {
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  text-align: center;
  font-size: 13px;
  color: #fca5a5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Quoted reply indicator */
.replying-bar {
  background-color: var(--bg-hover);
  border-left: 3px solid var(--accent-gold);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.reply-close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
}

.reply-close-btn:hover {
  color: var(--text-main);
}

/* File Attachment Preview Bar */
.attachment-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

/* Audio Recording Bar */
.recording-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(225, 29, 72, 0.1);
  border: 1px solid rgba(225, 29, 72, 0.3);
  border-radius: var(--radius-md);
  padding: 10px 18px;
}

.rec-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-red);
  font-weight: 600;
  font-size: 13px;
}

.rec-dot {
  width: 10px;
  height: 10px;
  background: var(--accent-red);
  border-radius: 50%;
  animation: pulse-red 1s infinite;
}

@keyframes pulse-red {
  0% { transform: scale(0.9); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; }
  100% { transform: scale(0.9); opacity: 1; }
}

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

/* Main Input Control */
.input-controls {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  transition: border-color 0.2s;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.input-controls:focus-within {
  border-color: var(--accent-gold);
}

.chat-textarea {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  resize: none;
  max-height: 120px;
  min-height: 24px;
  padding: 4px 0;
  box-sizing: border-box;
}

.chat-textarea::placeholder {
  color: var(--text-dim);
}

.send-btn {
  background: var(--accent-gold);
  border: none;
  color: #000;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  font-size: 16px;
}

.send-btn:hover {
  background: #fbbf24;
  transform: scale(1.05);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-content {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: modal-fade-in 0.2s ease-out;
}

.modal-content.wide {
  max-width: 760px;
}

@keyframes modal-fade-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background-color: rgba(0,0,0,0.15);
}

/* Forms */
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-input, .form-select {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-gold);
}

.btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent-gold);
  color: #000;
}
.btn-primary:hover {
  background: #fbbf24;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-danger {
  background: var(--accent-red);
  color: #fff;
}
.btn-danger:hover {
  background: #f43f5e;
}

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

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 18px;
  overflow-x: auto;
  white-space: nowrap;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-hover);
  border-color: rgba(245, 158, 11, 0.25);
}

.tab-btn.active {
  color: #000;
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  box-shadow: 0 2px 8px var(--accent-gold-glow);
}

.admin-card-row {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
}

@media (max-width: 600px) {
  .admin-card-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
  }
}

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Track Card in Message */
.msg-track-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  max-width: 100%;
  width: fit-content;
  margin-top: 6px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.msg-track-card:hover {
  border-color: var(--accent-gold);
}

.track-icon-disc {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e1e2d 0%, #000 100%);
  border: 2px solid var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--accent-gold-glow);
}

.track-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.track-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.track-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.track-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Sticky Mini Audio Player */
.mini-audio-player {
  position: absolute;
  bottom: 84px;
  left: 20px;
  right: 20px;
  max-width: 680px;
  margin: 0 auto;
  background: rgba(18, 19, 29, 0.96);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.75), 0 0 15px rgba(212, 175, 55, 0.15);
  z-index: 25;
  animation: slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  gap: 12px;
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.mini-player-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  cursor: pointer;
  flex: 1;
}

.mini-player-disc {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle, #2a2c3d 0%, #10111a 60%, #000 100%);
  border: 2px solid var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
  transition: transform 0.2s;
}

.mini-player-disc.playing {
  animation: spin-vinyl 6s linear infinite;
}

.mini-player-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.mini-player-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.mini-player-time {
  font-size: 11px;
  color: var(--accent-gold);
  font-weight: 600;
  margin-top: 1px;
}

.mini-player-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.player-seek-slider {
  width: 140px;
  height: 5px;
  accent-color: var(--accent-gold);
  cursor: pointer;
}

/* Fullscreen Theatrical Audio Player */
.fullscreen-vinyl-disc {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, #2a2c3d 0%, #10111a 60%, #000 100%);
  border: 4px solid var(--accent-gold);
  box-shadow: 0 10px 40px var(--accent-gold-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
  position: relative;
}

.fullscreen-vinyl-disc.playing {
  animation: spin-vinyl 12s linear infinite;
}

@keyframes spin-vinyl {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.vinyl-center-art {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.fs-seek {
  width: 100%;
  height: 6px;
}

.fs-play-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-gold);
  color: #000;
  border: none;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 18px var(--accent-gold-glow);
  transition: transform 0.15s;
}

.fs-play-btn:hover {
  transform: scale(1.08);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  html, body {
    width: 100%;
    height: 100%;
    height: var(--vvh, 100dvh);
    overflow: hidden;
  }

  #app {
    width: 100%;
    max-width: 100%;
    height: 100%;
    height: var(--vvh, 100dvh);
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100%;
    height: var(--vvh, 100dvh);
    width: 290px;
    max-width: 82vw;
    min-width: unset;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
    box-sizing: border-box;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    z-index: 90;
  }
  
  .sidebar.open ~ .sidebar-backdrop {
    display: block;
  }
  
  .mobile-menu-btn {
    display: flex;
  }
  
  .chat-header {
    height: 56px;
    min-height: 56px;
    padding: 0 12px;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .ptr-indicator {
    top: 56px;
    padding: 6px 14px;
    gap: 8px;
  }
  .ptr-label {
    font-size: 11px;
  }
  .ptr-spinner-circle {
    width: 18px;
    height: 18px;
  }

  .header-left {
    gap: 8px;
    flex: 1;
    min-width: 0;
  }

  .header-title {
    font-size: 15px;
  }

  .header-desc {
    font-size: 11px;
  }

  .header-right {
    gap: 6px;
    flex-shrink: 0;
  }
  
  .search-input {
    width: 95px;
    font-size: 11px;
    padding: 5px 10px 5px 28px;
  }
  .search-input:focus {
    width: 125px;
  }
  
  .messages-container {
    padding: 10px 8px;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .message-item {
    padding: 6px 8px;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
  }

  .msg-avatar {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }
  
  .chat-input-wrapper {
    padding: 8px 10px 10px 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .input-controls {
    padding: 6px 8px;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .mini-audio-player {
    bottom: 68px;
    left: 8px;
    right: 8px;
    width: calc(100% - 16px);
    max-width: calc(100% - 16px);
    padding: 6px 8px;
    gap: 6px;
    box-sizing: border-box;
  }
  .mini-player-title {
    max-width: 95px;
    font-size: 11px;
  }
  .player-seek-slider {
    width: 50px;
  }

  .attach-dropdown-menu {
    min-width: 250px;
    max-width: calc(100vw - 24px);
    left: 0;
    box-sizing: border-box;
  }

  .msg-track-card {
    padding: 8px 10px;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 100%;
    box-sizing: border-box;
  }
  .track-icon-disc {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .track-details {
    min-width: 120px;
  }
  .track-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 4px;
  }

  .msg-poll-card {
    padding: 10px 12px;
    gap: 10px;
    max-width: 100%;
    box-sizing: border-box;
  }
  .poll-option-row {
    padding: 8px 10px;
  }
  .poll-percent {
    min-width: 30px;
    font-size: 11px;
  }

  .modal-overlay {
    padding: 10px 8px;
    align-items: center;
  }

  .modal-content {
    width: 100%;
    max-width: 100%;
    margin: auto;
    max-height: 88vh;
    max-height: 88dvh;
    border-radius: var(--radius-lg);
  }
  .modal-header {
    padding: 12px 14px;
  }
  .modal-title {
    font-size: 15px;
    font-weight: 700;
  }
  .modal-body {
    padding: 14px 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal-footer {
    padding: 12px 14px;
  }

  .tabs {
    gap: 6px;
    margin-bottom: 14px;
  }
  .tab-btn {
    padding: 6px 11px;
    font-size: 12px;
  }
}

@media (max-width: 380px) {
  .search-input {
    width: 75px;
  }
  .search-input:focus {
    width: 105px;
  }
  .chat-header {
    padding: 0 8px;
  }
  .chat-input-wrapper {
    padding: 6px 8px 8px 8px;
  }
}

/* ---------------- SIDEBAR TABS & DMS ---------------- */

.sidebar-tabs {
  display: flex;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 6px 12px;
  gap: 8px;
}

.sidebar-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.sidebar-tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}

.sidebar-tab-btn.active {
  color: var(--accent-gold);
  background: rgba(212, 175, 55, 0.12);
  border-color: rgba(212, 175, 55, 0.3);
}

.sidebar-tab-badge {
  background: var(--accent-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
  box-shadow: 0 0 8px rgba(225, 29, 72, 0.6);
}

/* Direct Messages List */
.dm-list {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

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

.dm-item.active {
  background: rgba(212, 175, 55, 0.15);
  border-left: 3px solid var(--accent-gold);
}

.dm-avatar-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.dm-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}

.dm-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.dm-content {
  flex: 1;
  min-width: 0;
}

.dm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dm-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-role {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.chan-lock-badge {
  font-size: 11px;
  padding: 2px 6px;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Employee Directory Modal */
.dir-user-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 440px;
  overflow-y: auto;
  padding-right: 4px;
}

.dir-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.2s;
  gap: 12px;
}

.dir-user-card:hover {
  border-color: rgba(212, 175, 55, 0.4);
  background: var(--bg-hover);
}

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

.dir-user-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}

.dir-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.dir-user-meta {
  min-width: 0;
}

.dir-user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dir-user-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

.dir-user-phone {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
}

.dir-user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ========================================================
   ATTACHMENT MENU DROPDOWN
   ======================================================== */
.attach-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.attach-dropdown-menu {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  min-width: 260px;
  max-width: calc(100vw - 24px);
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 20px rgba(218, 165, 32, 0.08);
  z-index: 100;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  animation: modal-fade-in 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.attach-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.15s ease;
}

.attach-menu-item:hover {
  background-color: var(--bg-hover);
  color: var(--accent-gold);
}

.attach-menu-item.highlight:hover {
  background-color: rgba(218, 165, 32, 0.12);
}

.attach-item-icon {
  font-size: 20px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  flex-shrink: 0;
}

.attach-item-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}

.attach-item-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.attach-item-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.attach-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 6px;
}

/* ========================================================
   POLL STYLES IN MESSAGES & MODAL
   ======================================================== */
.msg-poll-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 8px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-left: 3px solid var(--accent-gold);
  box-sizing: border-box;
}

.poll-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.poll-badge-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

.poll-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.poll-question {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

.poll-meta {
  font-size: 11px;
  color: var(--text-dim);
}

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

.poll-option-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  transition: all 0.2s ease;
}

.poll-option-row:hover {
  border-color: var(--accent-gold);
  background: rgba(218, 165, 32, 0.04);
}

.poll-option-row.voted {
  border-color: var(--accent-gold);
  background: rgba(218, 165, 32, 0.08);
  font-weight: 600;
}

.poll-option-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(218, 165, 32, 0.25) 0%, rgba(218, 165, 32, 0.12) 100%);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.poll-option-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.poll-indicator {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  font-size: 11px;
}

.poll-indicator.multi {
  border-radius: 4px;
}

.poll-option-row.voted .poll-indicator {
  border-color: var(--accent-gold);
  background: var(--accent-gold);
  color: #000;
}

.poll-option-text {
  font-size: 13px;
  color: var(--text-main);
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
}

.poll-option-stats {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-dim);
  margin-left: 8px;
}

.poll-percent {
  font-weight: 700;
  color: var(--accent-gold);
  min-width: 36px;
  text-align: right;
}

.poll-votes-count {
  font-size: 11px;
}

.poll-option-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.poll-del-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-dim);
  border-radius: var(--radius-md);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.poll-del-btn:hover:not(:disabled) {
  color: #ef4444;
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.poll-del-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

