/* ============================================================
   Ágora — Layout (Brutalist Renaissance · Studiolo Digital)
   ============================================================ */

/* App shell grid — 4 columns */
.app-grid {
  display: grid;
  grid-template-columns: 60px 240px 1fr 200px;
  grid-template-rows: 100vh;
  height: 100vh;
  overflow: hidden;
}

/* Collapse members on narrow screens */
@media (max-width: 1200px) {
  .app-grid {
    grid-template-columns: 60px 240px 1fr;
  }
  .members-bar {
    display: none;
  }
}

@media (max-width: 768px) {
  .app-grid {
    grid-template-columns: 60px 1fr;
  }
  .channels-bar {
    display: none;
  }
}

/* ============================================================
   Server Bar (60px)
   ============================================================ */

.servers-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  padding: 12px 0;
  gap: 8px;
  background: #14120e;
}

/* Server icon — perfect circle, medalhão */
.server-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 15px;
  transition: background var(--transition-fast);
  margin: 0 auto;
  box-shadow: inset 0 1px 0 rgba(184, 147, 78, 0.08);
  border: 1px solid transparent;
}

.server-icon:hover {
  background: #2d2a20;
  color: var(--text-primary);
}

.server-icon.active {
  background: var(--bg-elevated);
  color: var(--accent-olive);
  border-color: var(--accent-olive);
}

/* Active indicator — pillar (not dot) */
.server-icon.active::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 28px;
  background: var(--accent-olive);
}

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

/* Tooltip */
.server-icon .tooltip {
  display: none;
  position: absolute;
  left: 56px;
  top: 50%;
  transform: translateY(-50%);
  background: #0d0c09;
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-hard);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
}

.server-icon:hover .tooltip {
  display: block;
}

/* Server separator — gold line */
.server-separator {
  width: 24px;
  height: 1px;
  background: rgba(184, 147, 78, 0.12);
  margin: 2px auto;
  flex-shrink: 0;
}

/* ============================================================
   Channels Bar (240px)
   ============================================================ */

.channels-bar {
  background: var(--bg-panel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.channels-header {
  min-height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
  background: var(--bg-panel);
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(
    to right,
    rgba(184, 147, 78, 0.10) 0%,
    transparent 100%
  ) 1;
}

.channels-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

/* Category header */
.channel-category {
  margin-top: 16px;
  padding: 0 12px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-olive);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.channel-category .arrow {
  font-size: 12px;
  transition: transform var(--transition-fast);
}

.channel-category-group.collapsed .channel-category .arrow {
  transform: rotate(-90deg);
}

/* Category group — collapse hides all channel items within */
.channel-category-group.collapsed .channel-item {
  display: none;
}

.channel-category-group.collapsed .channel-category {
  margin-bottom: 0;
}

/* Channel item */
.channel-item {
  padding: 6px 12px;
  margin: 0 4px;
  border-radius: var(--radius-hard);
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  transition: color var(--transition-fast);
}

.channel-item:hover {
  color: var(--text-primary);
}

.channel-item .hash {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.channel-item.active {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.channel-item.active .hash {
  color: var(--accent-olive);
}

/* Unread indicator — marginal line, not dot */
.channel-item.unread::before {
  content: '';
  position: absolute;
  left: 1px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 14px;
  background: var(--accent-olive);
}

/* ============================================================
   Members Bar (200px)
   ============================================================ */

.members-bar {
  background: var(--bg-base);
  overflow-y: auto;
}

.member-category {
  padding: 20px 12px 4px 12px;
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-olive);
}

.member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  border-radius: var(--radius-hard);
  cursor: pointer;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.member-item:hover {
  color: var(--text-primary);
}

/* Avatar */
.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  flex-shrink: 0;
  position: relative;
}

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

/* Status indicator — losango (diamond, not circle) */
.member-status {
  width: 6px;
  height: 6px;
  position: absolute;
  bottom: -1px;
  right: -1px;
  transform: rotate(45deg);
}

.member-status.online { background: var(--status-online); }
.member-status.idle   { background: var(--status-idle); }
.member-status.dnd    { background: var(--status-dnd); }
.member-status.offline { background: var(--status-offline); }

/* ============================================================
   User Area (bottom of channels bar)
   ============================================================ */

.user-area {
  flex-shrink: 0;
  padding: 8px;
  border-top: 1px solid var(--border-panel);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: #181510;
  transition: background var(--transition-fast);
}

.user-area:hover {
  background: var(--bg-elevated);
}

.user-area .member-avatar {
  flex-shrink: 0;
}

.user-area .user-info {
  flex: 1;
  min-width: 0;
}

.user-area .user-info .username {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.user-area .user-info .status-label {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
}

/* ============================================================
   Channels Header Actions
   ============================================================ */

.channels-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.channels-header-action {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-hard);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: color var(--transition-fast);
  flex-shrink: 0;
  border-left: 2px solid transparent;
}

.channels-header-action:hover {
  color: var(--text-primary);
  border-left-color: var(--accent-olive);
}

.channels-header-action.primary {
  color: var(--accent-olive);
}

.channels-header-action.danger {
  color: var(--alert-terracotta);
}

.channels-header-action.has-badge {
  position: relative;
}

.channels-header-action .badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--alert-terracotta);
  color: #fff;
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  border-radius: var(--radius-hard);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* ============================================================
   Main Content / Chat Area
   ============================================================ */

.main-content {
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  min-width: 0;
}

.chat-header {
  min-height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
  gap: 8px;
  background: var(--bg-panel);
  border-bottom: 1px solid rgba(184, 147, 78, 0.08);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  /* Radial vignette — studiolo depth */
  background: radial-gradient(ellipse at center, #1e1b16 0%, #161410 70%);
}

.chat-input-area {
  padding: 0 16px 24px;
  flex-shrink: 0;
  position: relative;
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.chat-input-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-hard);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.chat-input-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-olive);
}

.chat-input-row .chat-input {
  flex: 1;
  width: auto;
}

.chat-input {
  width: 100%;
  padding: 10px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-hard);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  resize: none;
  outline: none;
  line-height: 1.5;
  transition: border-color var(--transition-fast);
}

.chat-input:focus {
  border-color: var(--accent-olive);
}

.chat-input::placeholder {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-secondary);
}

.chat-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================================
   Messages — no bubble, left-border hover
   ============================================================ */

.message {
  display: flex;
  gap: 12px;
  padding: 4px 16px;
  border-radius: 0;
  transition: none;
  position: relative;
}

/* Hover: vertical gold line in margin (not background) */
.message:hover::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: rgba(184, 147, 78, 0.20);
  pointer-events: none;
}

.message.continuation {
  margin-top: -4px;
}

.message.continuation .message-avatar {
  visibility: hidden;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  flex-shrink: 0;
  margin-top: 4px;
}

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

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

.message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.message-author {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 13px;
  color: var(--accent-gold);
  cursor: pointer;
}

.message-author:hover {
  text-decoration: underline;
}

.message-time {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text-secondary);
}

.message-content {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 380;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message.edited .message-time::after {
  content: ' (editado)';
  font-size: 10px;
  color: var(--text-secondary);
}

/* Continuation hover timestamp */
.continuation-time {
  display: none;
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.message.continuation:hover .continuation-time {
  display: block;
}

/* ============================================================
   Friend List
   ============================================================ */

.friend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-hard);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.friend-item:hover {
  color: var(--text-primary);
}

.friend-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  flex-shrink: 0;
  position: relative;
}

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

/* ============================================================
   Modals
   ============================================================ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 90%;
  max-width: 440px;
  max-height: 80vh;
  overflow-y: auto;
  animation: modalIn var(--transition-fast);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}

.modal h2 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-hard);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

/* ============================================================
   Context Menu
   ============================================================ */

.context-menu {
  position: fixed;
  z-index: 2000;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-hard);
  padding: 4px;
  min-width: 160px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  animation: contextIn var(--transition-fast);
}

@keyframes contextIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

.context-item {
  padding: 8px 12px;
  border-radius: var(--radius-hard);
  cursor: pointer;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-left: 2px solid transparent;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.context-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-left-color: var(--accent-olive);
}

.context-item.danger {
  color: var(--alert-terracotta);
}

.context-item.danger:hover {
  background: var(--alert-terracotta);
  color: var(--bg-base);
  border-left-color: transparent;
}

.context-separator {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 8px;
}

/* ============================================================
   Profile Modal
   ============================================================ */

.profile-card {
  text-align: center;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-elevated);
  margin: 0 auto 16px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

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

.profile-avatar .overlay {
  display: none;
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  font-weight: 600;
}

.profile-avatar:hover .overlay {
  display: flex;
}

.profile-username {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

/* ============================================================
   Toasts
   ============================================================ */

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

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-hard);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  animation: toastIn 150ms ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  max-width: 360px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
}

.toast.success {
  border-left: 3px solid var(--accent-olive);
}

.toast.error {
  border-left: 3px solid var(--alert-terracotta);
}

.toast.info {
  border-left: 3px solid var(--accent-gold);
}

.toast.removing {
  animation: toastOut 150ms ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(16px); }
}

/* ============================================================
   Typing Indicator — three diamonds
   ============================================================ */

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 20px 12px;
  height: 28px;
}

.typing-diamond {
  width: 4px;
  height: 4px;
  background: var(--accent-olive);
  transform: rotate(45deg);
  animation: diamondBreathe 1.4s infinite;
}

.typing-diamond:nth-child(1) { animation-delay: 0ms; }
.typing-diamond:nth-child(2) { animation-delay: 180ms; }
.typing-diamond:nth-child(3) { animation-delay: 360ms; }

@keyframes diamondBreathe {
  0%, 60%, 100% {
    opacity: 0.35;
    transform: rotate(45deg) scale(0.8);
  }
  30% {
    opacity: 1;
    transform: rotate(45deg) scale(1.2);
  }
}

/* ============================================================
   Loading / Skeleton
   ============================================================ */

.loading-state {
  padding: 40px 16px;
}

.skeleton {
  background: var(--bg-elevated);
  border-radius: var(--radius-hard);
  animation: shimmer 1.8s infinite;
}

@keyframes shimmer {
  0%   { opacity: 0.4; }
  50%  { opacity: 0.7; }
  100% { opacity: 0.4; }
}

/* ============================================================
   Empty / Error States
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 14px;
  max-width: 320px;
  line-height: 1.6;
}

.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--alert-terracotta);
}

.error-state p {
  font-size: 14px;
  margin-bottom: 16px;
}

/* ============================================================
   Notification Bell
   ============================================================ */

.notification-bell {
  position: relative;
  margin-left: auto;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-hard);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  transition: color var(--transition-fast);
}

.notification-bell:hover {
  color: var(--text-primary);
}

.notification-badge {
  position: absolute;
  top: 0;
  right: -2px;
  background: var(--alert-terracotta);
  color: #fff;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-hard);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Notification dropdown */
.notification-dropdown {
  z-index: 2500;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 360px;
  max-height: 480px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: dropdownIn 100ms ease;
}

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

.notif-header {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 15px;
  position: sticky;
  top: 0;
  background: var(--bg-panel);
  z-index: 1;
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent-olive);
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-hard);
  transition: color var(--transition-fast);
}

.btn-text:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.notif-list {
  padding: 4px 0;
}

.notif-loading,
.notif-empty {
  padding: 32px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

.notif-item {
  position: relative;
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  border-radius: var(--radius-hard);
  margin: 2px 4px;
  transition: background var(--transition-fast);
}

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

.notif-item.unread {
  background: rgba(92, 122, 74, 0.06);
}

.notif-item.unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 14px;
  background: var(--accent-olive);
}

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

.notif-title {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-body {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-time {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ============================================================
   Server Settings
   ============================================================ */

.settings-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.settings-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.settings-tab:hover {
  color: var(--text-primary);
}

.settings-tab.active {
  color: var(--accent-olive);
  border-bottom-color: var(--accent-olive);
}

.settings-panel.hidden {
  display: none;
}

.role-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-hard);
  margin-bottom: 4px;
}

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

/* ============================================================
   Phase 2 — Markdown / Message Embellishment
   ============================================================ */

.message-content strong {
  font-weight: 700;
  color: var(--text-primary);
}

.message-content em {
  font-style: italic;
}

.message-content s {
  text-decoration: line-through;
  opacity: 0.75;
}

.inline-code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-hard);
  padding: 1px 5px;
  color: var(--accent-gold);
}

.code-block {
  display: block;
  margin: 6px 0;
  padding: 12px 14px;
  background: #14120e;
  border: 1px solid var(--border-subtle);
  border-left: 2px solid var(--accent-olive);
  border-radius: var(--radius-hard);
  overflow-x: auto;
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
  white-space: pre;
}

/* ============================================================
   Phase 2 — Attachments
   ============================================================ */

.message-attachments {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
  max-width: 420px;
}

.attachment-image {
  display: inline-block;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-width: 100%;
  cursor: zoom-in;
  background: var(--bg-panel);
}

.attachment-image img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

.attachment-image:hover {
  border-color: var(--accent-olive);
}

.attachment-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  text-decoration: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.attachment-file:hover {
  border-color: var(--accent-olive);
  background: var(--bg-elevated);
  text-decoration: none;
}

.attachment-file-icon {
  flex-shrink: 0;
  color: var(--accent-olive);
  display: flex;
}

.attachment-file-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.attachment-file-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* ============================================================
   Phase 2 — Lightbox
   ============================================================ */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.lightbox-overlay.open {
  display: flex;
}

.lightbox-inner img {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
}

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

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ============================================================
   Phase 2 — Embed Cards
   ============================================================ */

.embed-card {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  padding: 12px;
  max-width: 420px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-gold);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: background var(--transition-fast);
}

.embed-card:hover {
  background: var(--bg-elevated);
  text-decoration: none;
}

.embed-card-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.embed-card-domain {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-olive);
  font-weight: 600;
}

.embed-card-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.embed-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.embed-card-thumb {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  border-radius: var(--radius-hard);
  background-size: cover;
  background-position: center;
  background-color: var(--bg-elevated);
}

/* ============================================================
   Phase 2 — Emoji Picker
   ============================================================ */

.emoji-picker {
  position: absolute;
  bottom: 100%;
  right: 16px;
  margin-bottom: 8px;
  width: 280px;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  z-index: 1500;
}

.emoji-option {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: transparent;
  border: none;
  border-radius: var(--radius-hard);
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

/* ============================================================
   Phase 2 — Attachment Preview (before send)
   ============================================================ */

.attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
  margin-bottom: 4px;
}

.attachment-preview-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-hard);
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 220px;
}

.attachment-preview-item.image {
  padding: 4px;
}

.attachment-preview-item.image img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-hard);
}

.attachment-preview-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.attachment-preview-remove {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.attachment-preview-remove:hover {
  color: #fff;
  background: var(--alert-terracotta);
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent-olive);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.chat-input-area.drag-over {
  outline: 2px dashed var(--accent-olive);
  outline-offset: 2px;
  border-radius: var(--radius-lg);
}
