/* === Themes === */
:root {
  --nc-bg-deep: #020617;
  --nc-bg-panel: #111827;
  --nc-bg-surface: #1f2937;
  --nc-border: #374151;
  --nc-bg-chat-top: #0f172a;
  --nc-text: #e5e7eb;
  --nc-text-muted: #9ca3af;
  --nc-text-faint: #6b7280;
  --nc-text-soft: #cbd5e1;
}
:root.light-theme {
  --nc-bg-deep: #eef2f7;
  --nc-bg-panel: #ffffff;
  --nc-bg-surface: #f1f5f9;
  --nc-border: #e2e8f0;
  --nc-bg-chat-top: #f8fafc;
  --nc-text: #0f172a;
  --nc-text-muted: #64748b;
  --nc-text-faint: #94a3b8;
  --nc-text-soft: #475569;
}
* {
      box-sizing: border-box;
    }

    html,
    body {
      margin: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
      font-family: Arial, sans-serif;
      background: var(--nc-bg-deep);
      color: var(--nc-text);
    }

    button,
    input,
    textarea {
      font-family: Arial, sans-serif;
    }

    .hidden {
      display: none !important;
    }

    /* AUTH */

    .auth {
      position: fixed;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--nc-bg-deep);
      padding: 16px;
    }

    .auth-card {
      width: 100%;
      max-width: 380px;
      background: var(--nc-bg-panel);
      border: 1px solid var(--nc-bg-surface);
      border-radius: 18px;
      padding: 24px;
      box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    }

    .auth-card h1 {
      margin: 0 0 20px;
      text-align: center;
      font-size: 28px;
    }

    .auth-tabs {
      display: flex;
      gap: 8px;
      margin-bottom: 16px;
      background: var(--nc-bg-deep);
      padding: 5px;
      border-radius: 12px;
      border: 1px solid var(--nc-bg-surface);
    }

    .auth-tab {
      flex: 1;
      border: none;
      border-radius: 9px;
      padding: 10px;
      background: transparent;
      color: var(--nc-text-muted);
      font-weight: bold;
      cursor: pointer;
    }

    .auth-tab.active {
      background: #2563eb;
      color: white;
    }

    .field-label {
      font-size: 12px;
      color: var(--nc-text-muted);
      margin-bottom: 6px;
    }

    .auth-card input {
      width: 100%;
      margin-bottom: 12px;
      padding: 13px;
      border-radius: 10px;
      border: 1px solid var(--nc-border);
      background: var(--nc-bg-deep);
      color: var(--nc-text);
      font-size: 15px;
      outline: none;
    }

    .auth-card button#authButton {
      width: 100%;
      padding: 13px;
      border-radius: 10px;
      border: none;
      background: #2563eb;
      color: white;
      font-weight: bold;
      font-size: 15px;
      cursor: pointer;
      margin-top: 4px;
    }

    .auth-error {
      display: none;
      background: rgba(239, 68, 68, 0.12);
      color: #fecaca;
      border: 1px solid rgba(239, 68, 68, 0.35);
      padding: 10px;
      border-radius: 10px;
      font-size: 13px;
      margin-bottom: 12px;
    }

    .auth-success {
      display: none;
      background: rgba(34, 197, 94, 0.12);
      color: #bbf7d0;
      border: 1px solid rgba(34, 197, 94, 0.35);
      padding: 10px;
      border-radius: 10px;
      font-size: 13px;
      margin-bottom: 12px;
    }

    .hint {
      text-align: center;
      color: var(--nc-text-muted);
      font-size: 13px;
      margin-top: 14px;
    }

    /* APP */

    .app {
      position: fixed;
      inset: 0;
      display: flex;
      width: auto;
      height: auto;
      overflow: hidden;
      background: var(--nc-bg-chat-top);
    }

    .sidebar {
      flex: 0 0 360px;
      width: 360px;
      height: 100%;
      background: var(--nc-bg-panel);
      border-right: 1px solid var(--nc-bg-surface);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .sidebar-header {
      min-height: 86px;
      padding: 16px 18px;
      border-bottom: 1px solid var(--nc-bg-surface);
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      flex-shrink: 0;
    }

    .app-name {
      font-size: 24px;
      font-weight: bold;
      line-height: 1.1;
    }

    .me {
      font-size: 12px;
      color: var(--nc-text-muted);
      margin-top: 6px;
      font-weight: normal;
    }

    .logout-btn {
      border: none;
      background: var(--nc-border);
      color: var(--nc-text);
      border-radius: 9px;
      padding: 8px 11px;
      font-size: 12px;
      cursor: pointer;
      flex-shrink: 0;
    }

    .search-box {
      padding: 12px;
      border-bottom: 1px solid var(--nc-bg-surface);
      flex-shrink: 0;
    }

    .search-box input {
      width: 100%;
      border: none;
      outline: none;
      border-radius: 999px;
      padding: 12px 15px;
      background: var(--nc-bg-surface);
      color: var(--nc-text);
      font-size: 14px;
    }

    .search-box input::placeholder {
      color: var(--nc-text-faint);
    }

    .users {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      overflow-x: hidden;
    }

    .user-item {
      padding: 14px 16px;
      border-bottom: 1px solid var(--nc-bg-surface);
      cursor: pointer;
      transition: background 0.2s;
    }

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

    .user-item.active {
      background: #2563eb;
    }

    .user-name {
      font-size: 15px;
      font-weight: bold;
      margin-bottom: 4px;
    }

    .user-status {
      font-size: 12px;
      color: var(--nc-text-muted);
      margin-bottom: 6px;
    }

    .status-online {
      color: #22c55e;
    }

    .status-offline {
      color: var(--nc-text-muted);
    }

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

    .dialog-preview {
      font-size: 13px;
      color: var(--nc-text-muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      min-width: 0;
    }

    .dialog-time {
      font-size: 11px;
      color: var(--nc-text-faint);
      margin-top: 5px;
    }

    .unread-badge {
      min-width: 20px;
      height: 20px;
      padding: 0 6px;
      border-radius: 999px;
      background: #22c55e;
      color: white;
      font-size: 12px;
      font-weight: bold;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .user-item.active .user-status,
    .user-item.active .dialog-preview,
    .user-item.active .dialog-time {
      color: #dbeafe;
    }

    /* CHAT */

    .chat {
      flex: 1 1 auto;
      min-width: 0;
      height: 100%;
      display: flex;
      flex-direction: column;
      background: linear-gradient(180deg, var(--nc-bg-chat-top) 0%, var(--nc-bg-deep) 100%);
      overflow: hidden;
    }

    .chat-header {
      min-height: 72px;
      padding: 14px 20px;
      border-bottom: 1px solid var(--nc-bg-surface);
      background: var(--nc-bg-panel);
      display: flex;
      align-items: center;
      gap: 12px;
      flex-shrink: 0;
    }

    .back-btn {
      display: none;
      border: none;
      background: var(--nc-bg-surface);
      color: var(--nc-text);
      border-radius: 10px;
      padding: 8px 10px;
      font-size: 14px;
      cursor: pointer;
      flex-shrink: 0;
    }

    .chat-title {
      font-size: 18px;
      font-weight: bold;
    }

    .chat-subtitle {
      font-size: 12px;
      color: var(--nc-text-muted);
      margin-top: 4px;
    }

    .messages {
      flex: 1 1 auto;
      min-height: 0;
      width: 100%;
      padding: 18px 20px;
      overflow-y: auto;
      overflow-x: hidden;
      display: flex;
      flex-direction: column;
      gap: 10px;
      scroll-behavior: smooth;
    }

    .empty-chat {
      margin: auto;
      color: #64748b;
      text-align: center;
      font-size: 16px;
    }

    .date-separator {
      align-self: center;
      background: var(--nc-bg-surface);
      color: var(--nc-text-soft);
      font-size: 12px;
      padding: 6px 12px;
      border-radius: 999px;
      margin: 8px 0;
    }

    .message-row {
      display: flex;
      width: 100%;
    }

    .message-row.me {
      justify-content: flex-end;
    }

    .message-row.other {
      justify-content: flex-start;
    }

    .message-bubble {
      max-width: min(65%, 620px);
      padding: 10px 13px;
      border-radius: 16px;
      font-size: 15px;
      line-height: 1.4;
      word-wrap: break-word;
      white-space: pre-wrap;
    }

    .message-row.me .message-bubble {
      background: #2563eb;
      color: white;
      border-bottom-right-radius: 4px;
    }

    .message-row.other .message-bubble {
      background: var(--nc-bg-surface);
      color: var(--nc-text);
      border-bottom-left-radius: 4px;
    }

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

.message-delete-button {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
  cursor: pointer;
  padding: 0 0 0 6px;
  line-height: 1;
}

.message-delete-button:hover {
  color: #fecaca;
}

.message-edit-button {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
  cursor: pointer;
  padding: 0 0 0 6px;
  line-height: 1;
}

.message-edit-button:hover {
  color: #bfdbfe;
}
    .message-status.read {
      color: #22c55e;
    }

    .composer {
      flex-shrink: 0;
      padding: 12px 14px;
      background: var(--nc-bg-panel);
      border-top: 1px solid var(--nc-bg-surface);
      display: flex;
      gap: 10px;
      width: 100%;
      align-items: flex-end;
    }

    .composer textarea {
      flex: 1;
      min-width: 0;
      border: none;
      outline: none;
      border-radius: 18px;
      padding: 13px 16px;
      background: var(--nc-bg-surface);
      color: var(--nc-text);
      font-size: 15px;
      font-family: Arial, sans-serif;
      resize: none;
      min-height: 46px;
      max-height: 130px;
      overflow-y: auto;
      line-height: 1.4;
    }

    .composer textarea::placeholder {
      color: var(--nc-text-faint);
    }

    .composer button {
      border: none;
      border-radius: 999px;
      padding: 0 20px;
      min-height: 46px;
      background: #2563eb;
      color: white;
      font-size: 15px;
      font-weight: bold;
      cursor: pointer;
      flex-shrink: 0;
    }

    .composer button:disabled {
      background: var(--nc-border);
      cursor: not-allowed;
      color: var(--nc-text-soft);
    }

    @media (max-width: 768px) {
      .app {
        width: 100%;
        height: 100%;
      }

      .sidebar {
        flex: 0 0 100%;
        width: 100%;
        height: 100%;
        border-right: none;
      }

      .chat {
        display: none;
        width: 100%;
        height: 100%;
      }

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

      body.mobile-chat-open .chat {
        display: flex;
      }

      .back-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
      }

      .sidebar-header {
        min-height: 78px;
        padding: 14px;
      }

      .app-name {
        font-size: 22px;
      }

      .chat-header {
        min-height: 64px;
        padding: 10px 12px;
      }

      .messages {
        padding: 14px;
      }

      .message-bubble {
        max-width: 85%;
      }

      .composer {
        padding: 10px;
        gap: 8px;
      }

      .composer textarea {
        font-size: 16px;
      }

      .composer button {
        padding: 0 14px;
        min-height: 46px;
        font-size: 14px;
      }
    }

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  flex-shrink: 0;
  text-transform: uppercase;
}

.avatar.small {
  width: 36px;
  height: 36px;
  font-size: 15px;
}

.avatar.large {
  width: 44px;
  height: 44px;
  font-size: 18px;
}

.avatar.color-0 { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.avatar.color-1 { background: linear-gradient(135deg, #7c3aed, #5b21b6); }
.avatar.color-2 { background: linear-gradient(135deg, #db2777, #9d174d); }
.avatar.color-3 { background: linear-gradient(135deg, #ea580c, #c2410c); }
.avatar.color-4 { background: linear-gradient(135deg, #16a34a, #15803d); }
.avatar.color-5 { background: linear-gradient(135deg, #0891b2, #0e7490); }
.avatar.color-6 { background: linear-gradient(135deg, #ca8a04, #a16207); }
.avatar.color-7 { background: linear-gradient(135deg, #4f46e5, #3730a3); }

.dialog-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dialog-main {
  flex: 1;
  min-width: 0;
}

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

.chat-header-user-info {
  min-width: 0;
}

.chat-header-user-info .chat-title,
.chat-header-user-info .chat-subtitle {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.chat-header-user {
  flex: 1;
}

#chatAvatar:empty {
  display: none;
}

#chatAvatar {
  flex-shrink: 0;
}

.chat-title {
  font-weight: 700;
  line-height: 1.2;
}

.chat-subtitle {
  margin-top: 3px;
  font-size: 13px;
}

.empty-state {
  padding: 28px 18px;
  text-align: center;
  color: var(--nc-text-muted);
}

.empty-state-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--nc-text);
  margin-bottom: 6px;
}

.empty-state-text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--nc-text-muted);
}

.skeleton-list {
  padding: 8px;
}

.skeleton-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  border-radius: 14px;
}

.skeleton-avatar,
.skeleton-line,
.skeleton-line-short {
  background: linear-gradient(90deg, var(--nc-bg-surface), var(--nc-border), var(--nc-bg-surface));
  background-size: 200% 100%;
  animation: skeleton-loading 1.2s ease-in-out infinite;
}

.skeleton-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-content {
  flex: 1;
}

.skeleton-line {
  height: 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.skeleton-line-short {
  width: 55%;
  height: 10px;
  border-radius: 999px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

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

.profile-info {
  min-width: 0;
}

.profile-name {
  color: #f9fafb;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-email {
  color: var(--nc-text-muted);
  font-size: 12px;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
}

.user-item .avatar {
  flex-shrink: 0;
}

.dialog-main {
  flex: 1;
  min-width: 0;
}

.dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-name {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status {
  margin-top: 2px;
}

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

.dialog-preview {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dialog-time {
  flex-shrink: 0;
  font-size: 12px;
}

.profile-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 18px;
}

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

.profile-modal {
  width: 100%;
  max-width: 360px;
  background: var(--nc-bg-panel);
  border: 1px solid var(--nc-bg-surface);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.profile-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.profile-modal-name {
  font-size: 20px;
  font-weight: 800;
  color: #f9fafb;
}

.profile-modal-status {
  margin-top: 4px;
  font-size: 13px;
  color: var(--nc-text-muted);
}

.profile-modal-row {
  padding: 12px 0;
  border-top: 1px solid var(--nc-bg-surface);
}

.profile-modal-label {
  font-size: 12px;
  color: var(--nc-text-muted);
  margin-bottom: 4px;
}

.profile-modal-value {
  font-size: 15px;
  color: var(--nc-text);
  word-break: break-word;
}

.profile-modal-close {
  width: 100%;
  margin-top: 18px;
  border: none;
  border-radius: 14px;
  background: #2563eb;
  color: white;
  padding: 12px;
  font-weight: 700;
  cursor: pointer;
}

.chat-header-user {
  cursor: pointer;
}
.message-state {
  margin: auto;
  text-align: center;
  color: var(--nc-text-muted);
  padding: 24px;
}

.message-state-title {
  color: var(--nc-text);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.message-state-text {
  color: var(--nc-text-muted);
  font-size: 13px;
  line-height: 1.4;
}

.messages-loading {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--nc-text-muted);
  font-size: 14px;
}

.messages-loading-dot {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid var(--nc-bg-surface);
  border-top-color: #2563eb;
  animation: messages-spin 0.8s linear infinite;
}

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

.dialog-error {
  margin: 18px 12px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(127, 29, 29, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.25);
  text-align: center;
}

.dialog-error-title {
  color: #fecaca;
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 6px;
}

.dialog-error-text {
  color: #fca5a5;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 14px;
}

.dialog-error button {
  border: none;
  border-radius: 12px;
  background: #ef4444;
  color: #ffffff;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.dialog-error button:hover {
  background: #dc2626;
}

.message-state-button {
  margin-top: 14px;
  border: none;
  border-radius: 14px;
  background: #2563eb;
  color: #ffffff;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.message-state-button:hover {
  background: #1d4ed8;
}

.attach-btn {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 16px;
  background: var(--nc-bg-surface);
  color: #d1d5db;
  font-size: 22px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attach-btn:hover {
  background: var(--nc-border);
  color: #ffffff;
}

.attach-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.attach-toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  background: var(--nc-bg-panel);
  color: var(--nc-text);
  border: 1px solid var(--nc-border);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  z-index: 10000;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
  display: none;
}

.attach-toast.show {
  display: block;
}

@media (max-width: 768px) {
  .attach-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 20px;
  }

  .attach-toast {
    bottom: 82px;
    max-width: calc(100% - 32px);
    text-align: center;
  }
}

.message-image {
  display: block;
  max-width: 260px;
  max-height: 320px;
  width: auto;
  height: auto;
  border-radius: 14px;
  object-fit: cover;
  cursor: pointer;
}

.message-image-wrap {
  display: block;
}

.message-bubble.image-bubble {
  padding: 6px;
}

.message-bubble.image-bubble .message-meta {
  padding: 4px 4px 1px;
}

@media (max-width: 768px) {
  .message-image {
    max-width: 220px;
    max-height: 280px;
  }
}

.image-viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 11000;
  padding: 18px;
}

.image-viewer-overlay.open {
  display: flex;
}

.image-viewer-content {
  position: relative;
  max-width: 96vw;
  max-height: 92vh;
}

.image-viewer-content img {
  max-width: 96vw;
  max-height: 88vh;
  border-radius: 18px;
  display: block;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.55);
}

.image-viewer-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: var(--nc-bg-panel);
  color: #ffffff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--nc-border);
}

.image-viewer-close:hover {
  background: var(--nc-bg-surface);
}

@media (max-width: 768px) {
  .image-viewer-content img {
    max-width: 94vw;
    max-height: 82vh;
    border-radius: 14px;
  }

  .image-viewer-close {
    top: -46px;
    right: 0;
  }
}
button.message-image-wrap {
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  display: block;
}

.file-message {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
  max-width: 280px;
}

.file-message-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.file-message-info {
  min-width: 0;
}

.file-message-name {
  color: inherit;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-message-link {
  display: inline-block;
  margin-top: 4px;
  color: #bfdbfe;
  font-size: 13px;
  text-decoration: none;
}

.file-message-link:hover {
  text-decoration: underline;
}

.reply-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-left: 3px solid #4f7cff;
  border-radius: 10px;
  background: rgba(79, 124, 255, 0.10);
}

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

.reply-panel-body {
  min-width: 0;
}

.reply-panel-label {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.8;
}

.reply-panel-text {
  font-size: 13px;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-panel-close {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
}

.message-reply-box {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-left: 3px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
}

.message-reply-label {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.8;
}

.message-reply-text {
  font-size: 13px;
  opacity: 0.95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-reply-button {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.75;
}

.message-reply-button:hover {
  opacity: 1;
}

.message-highlight .message-bubble {
  outline: 2px solid rgba(79, 124, 255, 0.8);
  outline-offset: 2px;
}

.reply-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-left: 3px solid #4f7cff;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

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

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

.reply-panel-label {
  font-size: 12px;
  font-weight: 600;
  color: #7ea2ff;
  margin-bottom: 2px;
}

.reply-panel-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-panel-close {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
}

.reply-panel-close:hover {
  color: #fff;
}

.message-reply-box {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-left: 3px solid #7ea2ff;
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.10);
  cursor: pointer;
}

.message-row.me .message-reply-box {
  background: rgba(255, 255, 255, 0.14);
}

.message-row.other .message-reply-box {
  background: rgba(255, 255, 255, 0.08);
}

.message-reply-label {
  font-size: 11px;
  font-weight: 600;
  color: #c7d7ff;
  margin-bottom: 2px;
}

.message-reply-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-reply-button {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
  padding: 0 2px;
  margin-left: 6px;
}

.message-reply-button:hover {
  color: #fff;
}

.message-highlight .message-bubble {
  outline: 2px solid rgba(79, 124, 255, 0.85);
  outline-offset: 2px;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Message action menu */
.message-action-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.message-action-button {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  opacity: 0.7;
  padding: 0 4px;
  color: inherit;
}

.message-action-button:hover {
  opacity: 1;
}

.message-action-menu {
  display: none;
  position: absolute;
  right: 0;
  bottom: 22px;
  min-width: 150px;
  padding: 6px;
  border-radius: 12px;
  background: var(--nc-bg-surface);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  z-index: 50;
}

.message-action-menu.open {
  display: block;
}

.message-row.other .message-action-menu {
  right: auto;
  left: 0;
}

.message-action-item {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  text-align: left;
  cursor: pointer;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
}

.message-action-item:hover {
  background: rgba(255,255,255,0.10);
}

.message-action-item.danger {
  color: #ff8a8a;
}

.avatar.has-photo { background: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

.profile-avatar-wrap { cursor: pointer; border-radius: 50%; display: inline-flex; }
.profile-avatar-wrap:hover { opacity: 0.85; }

.profile-status { font-size: 12px; color: #2563eb; cursor: pointer; margin-top: 2px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-status:hover { text-decoration: underline; }
.profile-status.is-empty { color: #94a3b8; font-style: italic; }
.profile-status-input { font-size: 12px; margin-top: 2px; width: 180px; padding: 2px 6px; border: 1px solid var(--nc-text-soft); border-radius: 6px; outline: none; }

.message-audio audio { max-width: 240px; display: block; }

#voiceButton.recording { color: #dc2626; animation: voicePulse 1s ease-in-out infinite; }
@keyframes voicePulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.message-circle { width: 220px; height: 220px; border-radius: 50%; overflow: hidden; background: #000; }
.message-circle video { width: 100%; height: 100%; object-fit: cover; display: block; }

#circleButton.recording { color: #dc2626; animation: voicePulse 1s ease-in-out infinite; }
.circle-preview { position: fixed; bottom: 90px; right: 24px; width: 160px; height: 160px; border-radius: 50%; overflow: hidden; background: #000; box-shadow: 0 6px 24px rgba(0,0,0,0.35); z-index: 9999; border: 3px solid #dc2626; }
.circle-preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }

.story-bar { overflow: hidden; }
.story-bar-fill { height: 100%; width: 0; background: #fff; }
.story-viewer-delete { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; }

.stories-tray { display: flex; gap: 10px; overflow-x: auto; padding: 10px 12px; border-bottom: 1px solid var(--nc-text); }
.stories-tray:empty { display: none; }
.story-item { flex: 0 0 auto; width: 60px; text-align: center; cursor: pointer; position: relative; }
.story-ring { padding: 2px; border-radius: 50%; background: linear-gradient(135deg, #2563eb, #db2777); display: inline-flex; }
.story-add-plus { position: absolute; left: 50%; transform: translateX(-50%); top: 26px; background: #2563eb; color: #fff; width: 18px; height: 18px; border-radius: 50%; font-size: 13px; line-height: 18px; border: 2px solid #fff; }
.story-label { font-size: 11px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-viewer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.9); display: none; align-items: center; justify-content: center; z-index: 10000; }
.story-viewer-overlay.open { display: flex; }
.story-viewer { position: relative; width: min(420px, 96vw); height: min(80vh, 740px); background: #000; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.story-viewer-bars { display: flex; gap: 4px; padding: 8px; }
.story-bar { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.3); }
.story-bar.seen, .story-bar.active { background: #fff; }
.story-viewer-head { display: flex; align-items: center; gap: 8px; padding: 0 12px 8px; color: #fff; z-index: 2; }
.story-viewer-name { flex: 1; font-size: 14px; }
.story-viewer-close { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; }
.story-viewer-media { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.story-viewer-media img, .story-viewer-media video { max-width: 100%; max-height: 100%; object-fit: contain; }
.story-viewer-caption { color: #fff; padding: 10px 12px; font-size: 14px; text-align: center; }
.story-nav { position: absolute; top: 60px; bottom: 60px; width: 40%; }
.story-nav-left { left: 0; }
.story-nav-right { right: 0; }

.story-viewer-views { color: #fff; padding: 8px 12px; font-size: 13px; cursor: pointer; border-top: 1px solid rgba(255,255,255,0.15); }
.story-viewer-views-list { max-height: 35%; overflow-y: auto; background: rgba(0,0,0,0.6); }
.story-viewer-row { display: flex; align-items: center; gap: 8px; color: #fff; padding: 6px 12px; font-size: 13px; }

.password-wrap { position: relative; }
.password-wrap input { width: 100%; padding-right: 42px; box-sizing: border-box; }
.password-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 16px; opacity: 0.7; padding: 4px; }
.password-toggle:hover { opacity: 1; }

.danger-btn { color: #ef4444; }
.danger-btn:hover { color: #dc2626; }
