
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, sans-serif;
  background: #100d19;
  color: #f4efff;
  height: 100vh;
  overflow: hidden;
}

button {
  font: inherit;
}

button:disabled,
input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.app {
  display: flex;
  height: 100vh;
}

.servers {
  width: 76px;
  flex-shrink: 0;
  background: #100c18;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0;
  gap: 15px;
  overflow-y: auto;
}

.logo, .server {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #292039;
  color: #d9baff;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  flex-shrink: 0;
  transition: border-radius 0.15s, background 0.15s;
}

.logo {
  background: linear-gradient(135deg, #9b5cff, #5723a8);
  color: white;
  border-radius: 16px;
  font-size: 20px;
}

.server:hover {
  border-radius: 15px;
  background: #6740a0;
  color: white;
}

.server.active {
  background: #8747d9;
  color: white;
  border-radius: 15px;
}

.add-server {
  background: #292039;
  color: #c59aff;
  font-size: 27px;
}

.add-server:hover {
  background: #6840a0;
  color: white;
}

.channels {
  width: 245px;
  flex-shrink: 0;
  background: #191322;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 0;
  min-height: 0;
}

.brand {
  display: flex;
  justify-content: space-between;
  padding: 4px 6px 22px;
}

.brand h2 {
  font-size: 19px;
}

.brand span {
  color: #b8a8cc;
}

.server-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 10px;
  background: #251c31;
  border-radius: 8px;
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 15px;
  gap: 8px;
}

.server-heading span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-heading button {
  background: transparent;
  border: none;
  color: #cbb8e8;
  cursor: pointer;
  font-size: 17px;
}

.server-heading button:hover {
  color: white;
}

.channel-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.channel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 6px;
  color: #a99bb9;
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 3px;
}

.channel:hover {
  background: #2b2138;
  color: #eee4ff;
}

.channel.active {
  background: #39264f;
  color: white;
}

.channel-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-icons {
  display: flex;
  gap: 4px;
  font-size: 11px;
}

.add-channel,
.add-category {
  border: none;
  background: transparent;
  color: #a98acb;
  text-align: left;
  padding: 10px;
  cursor: pointer;
  font-size: 13px;
}

.add-channel:hover,
.add-category:hover {
  color: white;
  background: #2b2138;
  border-radius: 6px;
}

.category {
  margin-top: 13px;
  margin-bottom: 5px;
}

.category-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 7px;
  color: #8e7ba4;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
}

.category-heading:hover {
  color: #e5d5ff;
}

.category-heading button {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
}

.category-content.collapsed {
  display: none;
}

.profile {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 5px;
  margin: 12px -5px 0;
  background: #251c31;
  border-radius: 9px;
  cursor: pointer;
}

.profile:hover {
  background: #30233e;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a46aff, #6333a3);
  display: grid;
  place-items: center;
  color: white;
  font-weight: bold;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.profile-details strong {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-details small {
  color: #a99bb9;
  font-size: 10px;
}

.profile-settings {
  color: #a99bb9;
}

.role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 4px;
  margin-top: 3px;
}

.chat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #211a2b;
}

.chat-header {
  height: 67px;
  flex-shrink: 0;
  border-bottom: 1px solid #34283f;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
}

.chat-header h2 {
  font-size: 16px;
}

.chat-header small {
  display: block;
  margin-top: 5px;
  color: #a99bb9;
  font-size: 11px;
}

.header-actions {
  display: flex;
  gap: 13px;
}

.header-actions button {
  border: none;
  background: transparent;
  color: #b8a8cc;
  font-size: 19px;
  cursor: pointer;
}

.header-actions button:hover {
  color: white;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
}

.message {
  display: flex;
  gap: 12px;
  margin-bottom: 21px;
}

.message-content {
  min-width: 0;
  flex: 1;
}

.message-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 5px;
}

.message-author {
  font-size: 14px;
  font-weight: bold;
}

.message-time {
  font-size: 10px;
  color: #857991;
}

.message-text {
  font-size: 14px;
  line-height: 1.55;
  color: #ded5e8;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 20px 20px;
  padding: 10px 13px;
  background: #30263c;
  border-radius: 9px;
}

.message-form input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: white;
  font-size: 14px;
}

.message-form input::placeholder {
  color: #94869f;
}

.message-form button {
  border: none;
  background: transparent;
  color: #bda0e8;
  cursor: pointer;
  font-size: 20px;
}

.message-form button:hover {
  color: white;
}

.message-form .send {
  background: #8145c5;
  color: white;
  border-radius: 6px;
  width: 32px;
  height: 30px;
  font-size: 15px;
}

.message-form .send:hover {
  background: #9b5be0;
}

.members {
  width: 205px;
  flex-shrink: 0;
  background: #191322;
  padding: 22px 15px;
  border-left: 1px solid #34283f;
  overflow-y: auto;
}

.members h3 {
  font-size: 11px;
  letter-spacing: 1px;
  color: #897b99;
  margin-bottom: 18px;
}

.member {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 13px;
  font-size: 12px;
  color: #d8cce5;
}

.member .avatar {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.member-details {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.member-details > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #43c982;
}

.purple {
  background: #7544bd;
}

.join-server {
  background: #292039;
  color: #c59aff;
  font-size: 22px;
}

.join-server:hover {
  background: #6840a0;
  color: white;
}

/* Scrollbars */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #49365b;
  border-radius: 10px;
}

/* General modal styling */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal {
  width: 440px;
  max-width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  background: #211a2b;
  border: 1px solid #49365b;
  border-radius: 12px;
  padding: 23px;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
}

.modal h2 {
  font-size: 20px;
  margin-bottom: 9px;
}

.modal p {
  color: #ad9fbd;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 15px;
}

.modal label {
  display: block;
  font-size: 12px;
  color: #c9b9dc;
  margin: 13px 0 6px;
}

.modal input,
.modal textarea,
.modal select {
  width: 100%;
  padding: 11px;
  border: 1px solid #49365b;
  border-radius: 7px;
  background: #17111f;
  color: white;
  outline: none;
  font: inherit;
  font-size: 13px;
}

.modal textarea {
  min-height: 85px;
  resize: vertical;
}

.modal input:focus,
.modal textarea:focus,
.modal select:focus {
  border-color: #9b5be0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 20px;
}

.modal-actions button,
.modal button.primary {
  border: none;
  border-radius: 7px;
  padding: 10px 15px;
  background: #8145c5;
  color: white;
  cursor: pointer;
  font-size: 13px;
}

.modal-actions button:hover,
.modal button.primary:hover {
  background: #9b5be0;
}

.modal-actions button.secondary {
  background: #392d46;
  color: #d8cce5;
}

.modal-actions button.danger {
  background: #a63d55;
}

.modal-actions button.danger:hover {
  background: #c94d68;
}

/* Server settings and management */

.settings-section {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #3a2c48;
}

.settings-section h3 {
  font-size: 14px;
  margin-bottom: 10px;
  color: #e1d3f1;
}

.settings-section p {
  font-size: 12px;
  color: #a99bb9;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  font-size: 13px;
  color: #d8cce5;
}

.settings-row button {
  border: none;
  border-radius: 6px;
  padding: 7px 10px;
  background: #392d46;
  color: white;
  cursor: pointer;
}

.settings-row button:hover {
  background: #6840a0;
}

.settings-row button.danger {
  background: #a63d55;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: 7px;
  background: #2b2138;
  font-size: 13px;
}

.settings-item-actions {
  display: flex;
  gap: 5px;
}

.settings-item-actions button {
  border: none;
  border-radius: 5px;
  padding: 6px 8px;
  background: #49365b;
  color: white;
  cursor: pointer;
}

.settings-item-actions button:hover {
  background: #6840a0;
}

.invite-preview {
  padding: 14px;
  background: #2b2138;
  border-radius: 8px;
  margin-top: 12px;
}

.invite-preview h3 {
  margin-bottom: 8px;
}

.invite-preview p {
  margin-bottom: 7px;
}

.invite-code {
  padding: 10px;
  background: #17111f;
  border-radius: 6px;
  font-family: monospace;
  font-size: 15px;
  letter-spacing: 1px;
  overflow-wrap: anywhere;
  color: #d9baff;
}

/* Role management */

.role-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.role-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #2b2138;
  border-radius: 7px;
}

.role-name {
  font-size: 13px;
  font-weight: bold;
}

.role-actions {
  display: flex;
  gap: 5px;
}

.role-actions button {
  border: none;
  background: #49365b;
  color: white;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
}

.role-actions button:hover {
  background: #6840a0;
}

/* Friends and direct messages */

.friends-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1100;
}

.friends-window {
  width: 760px;
  max-width: 100%;
  height: 520px;
  max-height: 85vh;
  display: flex;
  overflow: hidden;
  background: #211a2b;
  border: 1px solid #49365b;
  border-radius: 12px;
}

.friends-sidebar {
  width: 210px;
  flex-shrink: 0;
  background: #191322;
  padding: 18px 12px;
}

.friends-sidebar h2 {
  font-size: 17px;
  margin: 5px 8px 20px;
}

.friends-tab {
  padding: 11px;
  border-radius: 6px;
  color: #aa9bb9;
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 5px;
}

.friends-tab:hover,
.friends-tab.active {
  background: #39264f;
  color: white;
}

.friends-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.friends-header {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid #3a2c48;
}

.friends-header h3 {
  font-size: 15px;
}

.friends-header button {
  border: none;
  background: transparent;
  color: #bda0e8;
  font-size: 20px;
  cursor: pointer;
}

.friends-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

.friend-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px;
  border-bottom: 1px solid #382c43;
}

.friend-row .friend-info {
  flex: 1;
  min-width: 0;
}

.friend-info strong {
  display: block;
  font-size: 13px;
}

.friend-info small {
  color: #9f90ae;
  font-size: 11px;
}

.friend-row button {
  border: none;
  border-radius: 6px;
  padding: 7px 10px;
  background: #49365b;
  color: white;
  cursor: pointer;
  font-size: 11px;
}

.friend-row button:hover {
  background: #8145c5;
}

.dm-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.dm-list {
  width: 190px;
  flex-shrink: 0;
  border-right: 1px solid #3a2c48;
  overflow-y: auto;
  padding: 10px;
}

.dm-conversation {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.dm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
}

.dm-message {
  padding: 8px 0;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.dm-message strong {
  color: #c9a4ff;
}

.dm-form {
  display: flex;
  gap: 8px;
  padding: 12px;
}

.dm-form input {
  flex: 1;
  min-width: 0;
  padding: 10px;
  background: #30263c;
  border: none;
  border-radius: 6px;
  color: white;
  outline: none;
}

.dm-form button {
  border: none;
  border-radius: 6px;
  padding: 0 13px;
  background: #8145c5;
  color: white;
  cursor: pointer;
}

/* Empty states and notices */

.empty-state {
  text-align: center;
  padding: 35px 15px;
  color: #9f90ae;
  font-size: 13px;
  line-height: 1.6;
}

.empty-state strong {
  display: block;
  color: #e2d5f1;
  font-size: 16px;
  margin-bottom: 7px;
}

.notice {
  padding: 10px 13px;
  background: #39264f;
  border: 1px solid #6840a0;
  border-radius: 7px;
  color: #e6d5ff;
  font-size: 12px;
  margin-bottom: 12px;
}

.error-notice {
  background: #48222d;
  border-color: #a63d55;
  color: #ffd4dc;
}

.success-notice {
  background: #1d3b32;
  border-color: #34795e;
  color: #c9ffe3;
}

/* Buttons and interactive elements */

.primary-button {
  background: #8145c5;
  color: white;
  border: none;
  border-radius: 7px;
  padding: 10px 14px;
  cursor: pointer;
}

.primary-button:hover {
  background: #9b5be0;
}

.secondary-button {
  background: #392d46;
  color: #e1d3f1;
  border: none;
  border-radius: 7px;
  padding: 10px 14px;
  cursor: pointer;
}

.secondary-button:hover {
  background: #49365b;
}

.danger-button {
  background: #a63d55;
  color: white;
  border: none;
  border-radius: 7px;
  padding: 10px 14px;
  cursor: pointer;
}

.danger-button:hover {
  background: #c94d68;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #b78aff;
  outline-offset: 2px;
}

/* Responsive layout */

@media (max-width: 950px) {
  .members {
    display: none;
  }
}

@media (max-width: 650px) {
  .servers {
    width: 60px;
  }

  .logo,
  .server {
    width: 40px;
    height: 40px;
  }

  .channels {
    width: 190px;
    padding-left: 9px;
    padding-right: 9px;
  }

  .chat-header {
    padding: 0 12px;
  }

  .messages {
    padding: 15px 12px;
  }

  .message-form {
    margin: 0 10px 12px;
  }

  .header-actions {
    gap: 7px;
  }

  .modal {
    padding: 17px;
  }
}

/* Additional server and channel indicators */

.channel-icons span {
  opacity: 0.85;
}

.channel.private {
  color: #c49aff;
}

.channel.read-only {
  color: #a99bb9;
}

.channel.announcement {
  color: #d9baff;
}

/* Message and profile polish */

.message .avatar {
  width: 40px;
  height: 40px;
}

.message-author .role-badge {
  margin-left: 4px;
  vertical-align: middle;
}

.message-text a {
  color: #bd91ff;
  text-decoration: underline;
}

/* Modal close and form helpers */

.modal-close {
  border: none;
  background: transparent;
  color: #bda0e8;
  font-size: 21px;
  cursor: pointer;
}

.modal-close:hover {
  color: white;
}

.form-help {
  color: #9685a8;
  font-size: 11px;
  margin-top: 5px;
}

.hidden {
  display: none !important;
}

/* Small-screen friends window */

@media (max-width: 550px) {
  .friends-window {
    height: 90vh;
  }

  .friends-sidebar {
    width: 125px;
    padding: 12px 7px;
  }

  .friends-sidebar h2 {
    font-size: 14px;
    margin-left: 5px;
  }

  .dm-list {
    width: 120px;
  }

  .friends-content {
    padding: 10px;
  }
}

/* NEBULACHAT - SETTINGS AND CREATION PANELS FIX */

.profile-panel,
.server-panel,
.roles-panel,
.invite-panel,
.category-panel,
.channel-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  width: min(440px, calc(100vw - 32px));
  max-height: 85vh;
  overflow-y: auto;
  padding: 25px;
  background: #211a30;
  color: #f3eaff;
  border: 1px solid #67449a;
  border-radius: 14px;
  box-shadow: 0 15px 60px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}

.profile-panel h2,
.server-panel h2,
.roles-panel h2,
.invite-panel h2,
.category-panel h2,
.channel-panel h2 {
  margin: 0 0 8px;
  color: #d8b4fe;
}

.profile-panel label,
.server-panel label,
.roles-panel label,
.invite-panel label,
.category-panel label,
.channel-panel label {
  color: #d8c8eb;
  font-size: 13px;
}

.profile-panel input,
.server-panel input,
.roles-panel input,
.invite-panel input,
.category-panel input,
.channel-panel input,
.category-panel select,
.channel-panel select,
.roles-panel select,
.invite-panel select,
.channel-panel textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 11px;
  color: #ffffff;
  background: #171120;
  border: 1px solid #514064;
  border-radius: 7px;
}

.profile-panel button,
.server-panel button,
.roles-panel button,
.invite-panel button,
.category-panel button,
.channel-panel button {
  padding: 10px 14px;
  color: #ffffff;
  background: #7041a5;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.profile-panel button:hover,
.server-panel button:hover,
.roles-panel button:hover,
.invite-panel button:hover,
.category-panel button:hover,
.channel-panel button:hover {
  background: #8955c4;
}

.profile-panel .close-profile,
.server-panel .close-server,
.roles-panel .close-roles,
.invite-panel .close-invite,
.category-panel .close-category,
.channel-panel .close-channel {
  background: #40334f;
}

.profile-panel .delete-server,
.server-panel .delete-server,
.roles-panel .delete-role,
.category-panel .delete-category,
.channel-panel .delete-channel {
  background: #9d354d;
}

.roles-panel .role-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roles-panel .role-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.roles-panel .role-item-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.roles-panel .role-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.invite-panel .invite-result {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-wrap: anywhere;
}

/* ==========================================
   NEBULACHAT - ADVANCED MESSAGE STYLING
   ========================================== */

.message {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 9px;
  transition: background 0.2s ease;
}

.message:hover {
  background: rgba(167, 139, 250, 0.06);
}

.message-content {
  min-width: 0;
  flex: 1;
}

.message-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 5px;
}

.message-time {
  color: #9588a8;
  font-size: 11px;
}

.message-text {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: #e9e0f4;
  line-height: 1.5;
}

.message-edited {
  color: #9588a8;
  font-size: 10px;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 9px;
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

.message:hover .message-actions {
  opacity: 1;
}

.message-action {
  min-width: 30px;
  min-height: 27px;
  padding: 4px 7px;
  color: #cdb9e9;
  background: #30243f;
  border: 1px solid #49375e;
  border-radius: 6px;
  cursor: pointer;
}

.message-action:hover {
  color: white;
  background: #7041a5;
}

.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.message-reaction {
  padding: 5px 9px;
  color: #e9def8;
  background: #30243f;
  border: 1px solid #514064;
  border-radius: 12px;
  cursor: pointer;
}

.message-reaction:hover,
.message-reaction.reaction-selected {
  background: #67449a;
  border-color: #b58ae7;
}

.message-pinned {
  border-left: 3px solid #b58ae7;
  background: rgba(167, 139, 250, 0.07);
}

.message-pin-label {
  display: inline-block;
  margin-top: 7px;
  color: #d8b4fe;
  font-size: 11px;
}

.message-reply-reference {
  margin: 0 0 9px;
  padding: 7px 10px;
  border-left: 2px solid #a78bfa;
  border-radius: 4px;
  background: rgba(167, 139, 250, 0.08);
}

.message-reply-reference span {
  color: #d8b4fe;
  font-size: 11px;
}

.message-reply-reference p {
  margin: 3px 0 0;
  color: #b8a8cc;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.message-reply-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding: 9px 12px;
  color: #e9def8;
  background: #30243f;
  border-left: 3px solid #a78bfa;
  border-radius: 6px;
  font-size: 12px;
}

.message-reply-preview[hidden] {
  display: none;
}

.message-reply-preview button {
  color: #e9def8;
  background: transparent;
  border: 0;
  font-size: 20px;
  cursor: pointer;
}

@media (max-width: 600px) {
  .message {
    padding: 9px 5px;
    gap: 8px;
  }

  .message-actions {
    opacity: 1;
  }

  .message-action {
    min-height: 32px;
  }
}
/* ==========================================
   NEBULACHAT - STEP 13 STYLING
   ========================================== */

/* Header search and notification buttons */

#nebulaSearchButton,
#nebulaNotificationButton {
  min-width: 32px;
  min-height: 32px;
  border-radius: 7px;
  transition: background 0.2s;
}

#nebulaSearchButton:hover,
#nebulaNotificationButton:hover {
  background: #39264f;
}

/* Search modal */

.nebula-search-modal {
  width: 560px;
}

.nebula-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 15px;
}

.nebula-panel-heading h2 {
  margin-bottom: 5px;
}

.nebula-panel-heading p {
  margin-bottom: 0;
}

.nebula-search-input {
  width: 100%;
  padding: 13px;
  border: 1px solid #67449a;
  border-radius: 8px;
  background: #17111f;
  color: white;
  outline: none;
  font-size: 14px;
}

.nebula-search-input:focus {
  border-color: #b58ae7;
}

.nebula-search-options {
  margin: 13px 0;
  color: #bdaecc;
  font-size: 12px;
}

.nebula-search-options label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nebula-search-options input {
  accent-color: #9b5be0;
}

.nebula-search-results {
  max-height: 400px;
  overflow-y: auto;
}

.nebula-result-count {
  color: #a99bb9;
  font-size: 12px;
  margin: 10px 0;
}

.nebula-search-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 12px;
  margin-bottom: 7px;
  text-align: left;
  border: 1px solid #49365b;
  border-radius: 8px;
  background: #2b2138;
  color: #e9def8;
  cursor: pointer;
}

.nebula-search-result:hover {
  background: #39264f;
  border-color: #9561ce;
}

.nebula-search-result strong {
  font-size: 13px;
}

.nebula-search-result small {
  margin: 4px 0 7px;
  color: #b58ae7;
  font-size: 10px;
}

.nebula-search-result span {
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* Search result highlight */

.nebula-search-highlight {
  background: rgba(155, 91, 224, 0.2) !important;
  outline: 1px solid #a66be5;
}

/* Mention highlighting */

.nebula-mention {
  padding: 2px 4px;
  border-radius: 4px;
  color: #e8caff;
  background: rgba(155, 91, 224, 0.25);
  font-weight: bold;
}

/* Unread channel indicators */

.channel.has-unread {
  color: #f0e6ff;
  font-weight: bold;
}

.nebula-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  margin-left: auto;
  border-radius: 10px;
  background: #7544bd;
  color: white;
  font-size: 10px;
  font-weight: bold;
}

.nebula-unread.mention-unread {
  background: #b34b8d;
}

/* Notification settings */

.nebula-notification-modal {
  width: 490px;
}

.nebula-setting {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  padding: 13px 0;
  border-bottom: 1px solid #3a2c48;
  cursor: pointer;
}

.nebula-setting span {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nebula-setting strong {
  color: #e9def8;
  font-size: 13px;
}

.nebula-setting small {
  color: #a99bb9;
  font-size: 11px;
  font-weight: normal;
}

.nebula-setting input {
  width: 17px;
  height: 17px;
  accent-color: #9b5be0;
  flex-shrink: 0;
}

.nebula-notification-modal .settings-section {
  margin-top: 17px;
}

.nebula-notification-modal .settings-section button {
  margin-top: 10px;
}

/* Mobile search */

@media (max-width: 550px) {
  .nebula-search-modal,
  .nebula-notification-modal {
    width: 100%;
  }

  .nebula-search-results {
    max-height: 50vh;
  }
}

/* ==========================================
   NEBULACHAT - INTEGRATED FRIENDS & DMS
   ========================================== */

.nebula-dm-sidebar {
  padding: 12px 0 14px;
  border-bottom: 1px solid #34283f;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.nebula-dm-sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 7px 10px;
  color: #a99bb9;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: .7px;
}

.nebula-add-friend-button {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid #7652a8;
  border-radius: 7px;
  background: linear-gradient(135deg, #7041a5, #523080);
  color: white;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
}

.nebula-add-friend-button:hover {
  background: #8955c4;
}

.nebula-add-friend-form {
  padding: 10px;
  margin-bottom: 12px;
  background: #110d19;
  border: 1px solid #49365b;
  border-radius: 8px;
}

.nebula-add-friend-form input {
  width: 100%;
  padding: 9px;
  margin-bottom: 7px;
  background: #211a2b;
  border: 1px solid #49365b;
  border-radius: 6px;
  color: white;
  outline: none;
}

.nebula-add-friend-form button {
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: #8145c5;
  color: white;
  cursor: pointer;
}

.nebula-add-friend-results {
  max-height: 150px;
  overflow-y: auto;
  margin-top: 8px;
}

.nebula-add-friend-results:empty {
  display: none;
}

.nebula-dm-sidebar-list {
  max-height: 190px;
  overflow-y: auto;
}

.nebula-dm-sidebar-item {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 9px;
  padding: 8px;
  margin-bottom: 3px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #cfc2dc;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
}

.nebula-dm-sidebar-item:hover,
.nebula-dm-sidebar-item.active {
  background: #39264f;
  color: white;
}

.nebula-dm-sidebar-item .nebula-dm-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #a46aff, #6333a3);
  color: white;
  font-weight: bold;
}

.nebula-dm-sidebar-info {
  min-width: 0;
  flex: 1;
}

.nebula-dm-sidebar-info strong,
.nebula-dm-sidebar-info small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nebula-dm-sidebar-info small {
  margin-top: 3px;
  color: #9f90ae;
  font-size: 10px;
}

.nebula-dm-empty {
  padding: 12px 8px;
  color: #92849f;
  font-size: 11px;
  line-height: 1.5;
}

.nebula-friend-inline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 8px 3px;
  border-bottom: 1px solid #30253d;
  color: #e2d5f1;
  font-size: 11px;
}

.nebula-friend-inline-row button {
  padding: 6px 8px;
  border: 0;
  border-radius: 5px;
  background: #7041a5;
  color: white;
  cursor: pointer;
  font-size: 10px;
}

.nebula-friend-inline-row button:hover {
  background: #8955c4;
}

#nebulaFriendsStatus {
  min-height: 15px;
  margin-top: 8px;
  color: #b9e8c4;
  font-size: 10px;
  overflow-wrap: anywhere;
}

/* Main DM conversation */

#nebulaDMMain {
  display: none;
  flex: 1;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: #211a2b;
}

#nebulaDMMain.active {
  display: flex;
}

.nebula-dm-main-header {
  min-height: 67px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 22px;
  border-bottom: 1px solid #34283f;
}

.nebula-dm-main-heading {
  min-width: 0;
}

.nebula-dm-main-heading strong {
  display: block;
  font-size: 15px;
  color: #f4efff;
}

.nebula-dm-main-heading small {
  display: block;
  margin-top: 5px;
  color: #a99bb9;
  font-size: 11px;
}

.nebula-dm-main-header button {
  padding: 7px 10px;
  border: 1px solid #49365b;
  border-radius: 6px;
  background: #30263c;
  color: #d8cce5;
  cursor: pointer;
}

.nebula-dm-main-header button:hover {
  background: #49365b;
}

#nebulaDMMainMessages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px;
}

.nebula-dm-main-message {
  display: flex;
  gap: 11px;
  padding: 11px;
  margin-bottom: 9px;
  border-radius: 8px;
}

.nebula-dm-main-message:hover {
  background: rgba(167, 139, 250, .06);
}

.nebula-dm-main-message .nebula-dm-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #a46aff, #6333a3);
  color: white;
  font-weight: bold;
}

.nebula-dm-main-message-content {
  min-width: 0;
  flex: 1;
}

.nebula-dm-main-message-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 5px;
}

.nebula-dm-main-message-top strong {
  color: #d9baff;
  font-size: 13px;
}

.nebula-dm-main-message-top small {
  color: #9588a8;
  font-size: 10px;
}

.nebula-dm-main-message-text {
  color: #e9e0f4;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#nebulaDMMainForm {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 20px 20px;
  padding: 10px 13px;
  border-radius: 9px;
  background: #30263c;
}

#nebulaDMMainInput {
  flex: 1;
  min-width: 0;
  padding: 8px;
  border: 0;
  outline: none;
  background: transparent;
  color: white;
  font-size: 14px;
}

#nebulaDMMainForm button {
  width: 34px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: #8145c5;
  color: white;
  cursor: pointer;
}

/* Bottom-right friends dock */

#nebulaFriendsDock {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 900;
  width: 245px;
  max-height: 330px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #67449a;
  border-radius: 11px;
  background: #191322;
  box-shadow: 0 10px 35px rgba(0,0,0,.45);
  color: #f4efff;
  font-family: Arial, sans-serif;
}

.nebula-friends-dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: #251c31;
  cursor: pointer;
}

.nebula-friends-dock-header strong {
  color: #d9baff;
  font-size: 12px;
}

.nebula-friends-dock-header span {
  color: #a99bb9;
  font-size: 11px;
}

#nebulaFriendsDockContent {
  max-height: 270px;
  overflow-y: auto;
  padding: 9px 11px;
}

#nebulaFriendsDockContent.collapsed {
  display: none;
}

.nebula-dock-section-title {
  padding: 6px 2px;
  color: #9588a8;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: .7px;
  text-transform: uppercase;
}

.nebula-dock-friend {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #e5d9f0;
  text-align: left;
  cursor: pointer;
  font-size: 11px;
}

.nebula-dock-friend:hover {
  background: #30243f;
}

.nebula-dock-friend span:first-child {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #43c982;
}

.nebula-dock-friend span:first-child.offline {
  background: #777080;
}

.nebula-dock-request {
  padding: 8px 2px;
  border-bottom: 1px solid #30253d;
}

.nebula-dock-request strong {
  display: block;
  margin-bottom: 6px;
  color: #e5d9f0;
  font-size: 11px;
}

.nebula-dock-request button {
  padding: 5px 8px;
  margin-right: 5px;
  border: 0;
  border-radius: 5px;
  background: #7041a5;
  color: white;
  cursor: pointer;
  font-size: 10px;
}

.nebula-dock-empty {
  padding: 8px 2px;
  color: #9588a8;
  font-size: 11px;
}

@media (max-width: 800px) {
  #nebulaFriendsDock {
    right: 8px;
    bottom: 8px;
    width: 205px;
  }

  .nebula-dm-main-header {
    padding: 0 12px;
  }

  #nebulaDMMainMessages {
    padding: 12px;
  }

  #nebulaDMMainForm {
    margin: 0 10px 12px;
  }
}

@media (max-width: 550px) {
  #nebulaFriendsDock {
    width: 175px;
    max-height: 230px;
  }

  #nebulaFriendsDockContent {
    max-height: 170px;
  }

  .nebula-dm-sidebar {
    padding-top: 8px;
  }
}

/* Direct Messages is a separate view opened by the N logo */
.nebula-dm-sidebar-panel {
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.app.nebula-dm-mode > .channels {
  display: none !important;
}

.app.nebula-dm-mode > .nebula-dm-sidebar-panel {
  display: flex !important;
}

.app.nebula-dm-mode > .chat {
  display: flex;
  flex: 1;
  min-width: 0;
}

.app.nebula-dm-mode .members {
  display: none;
}

.app .logo {
  cursor: pointer;
}

.app .logo:hover {
  filter: brightness(1.2);
}

.nebula-dm-sidebar-panel > .brand {
  flex-shrink: 0;
}

.nebula-dm-sidebar-panel .nebula-dm-sidebar {
  padding: 15px;
}

.nebula-add-friend-form {
  display: none;
}

.nebula-add-friend-form.open {
  display: block;
}
