* {
  box-sizing: border-box;
}

:root {
  --bg-main: #0f0f0f;
  --bg-panel: #171717;
  --bg-soft: #202020;
  --bg-hover: #272522;

  --accent: #d8c18a;
  --accent-strong: #f0d99b;
  --accent-dark: #5a4724;

  --text-main: #f2efe7;
  --text-muted: #9c9484;

  --danger: #d86b6b;
  --danger-bg: rgba(216, 107, 107, 0.12);
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.app {
  height: 100vh;
  display: grid;
  grid-template-columns: 300px 1fr;
  background: var(--bg-main);
}

/* Sidebar */

.sidebar {
  background: var(--bg-panel);
  border-right: 1px solid #2a2a2a;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.profile {
  min-height: 84px;
  padding: 16px;
  border-bottom: 1px solid #2a2a2a;
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-main {
  min-width: 0;
  flex: 1;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
}

.profile-main:hover .avatar {
  border-color: rgba(240, 217, 155, 0.55);
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #3a2f1f;
  border: 1px solid rgba(216, 193, 138, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--accent-strong);
  flex-shrink: 0;
}

.profile-info {
  min-width: 0;
  flex: 1;
  display: block;
}

.profile-name {
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.profile-status {
  margin-top: 3px;
  font-size: 13px;
  color: var(--accent-strong);
}

.profile-status.offline {
  color: #ff7777;
}

.change-name-button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: #232323;
  color: #d0d0d0;
  cursor: pointer;
}

.change-name-button:hover {
  background: #303030;
}

.change-name-button {
  display: none;
}

.logout-button {
  min-width: 58px;
  height: 32px;
  padding: 0 10px;
  border: none;
  border-radius: 8px;
  background: #3a2020;
  color: #ffb0b0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.logout-button:hover {
  background: #512929;
}

.sidebar-section {
  padding: 14px 12px;
  border-bottom: 1px solid #222222;
}

.online-section {
  flex: 1;
  overflow-y: auto;
}

.friends-list {
  max-height: 180px;
}

.friend-requests-list {
  max-height: 150px;
}

.section-title {
  margin: 0 0 8px 4px;
  font-size: 12px;
  color: #8f8f8f;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.chat-list,
.online-users,
.friends-list,
.friend-requests-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-item {
  width: 100%;
  padding: 11px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #dddddd;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  cursor: pointer;
  text-align: left;
}

.chat-item:hover {
  background: #242424;
}

.chat-item.active {
  background: #303030;
}

.chat-item-title {
  max-width: 100%;
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-item-meta {
  max-width: 100%;
  color: #8e8e8e;
  font-size: 13px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.online-user,
.friend-item {
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 9px;
  background: var(--bg-soft);
  color: #d8d8d8;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}

.online-user:hover,
.friend-item:hover {
  background: var(--bg-hover);
}

.online-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #3a2f1f;
  border: 1px solid rgba(216, 193, 138, 0.25);
  color: var(--accent-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

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

.online-user-status {
  font-size: 12px;
  flex-shrink: 0;
}

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

.friend-status {
  font-size: 12px;
}

.friend-request-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(216, 193, 138, 0.16);
  border-radius: 8px;
  background: #202020;
}

.friend-request-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #dddddd;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.friend-request-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.friend-action-button {
  min-height: 26px;
  padding: 0 7px;
  border: none;
  border-radius: 7px;
  background: var(--accent-dark);
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.friend-action-button.secondary {
  background: #2b2b2b;
  color: #dddddd;
}

.friend-action-button:hover {
  background: #6b552b;
}

.friend-action-button.secondary:hover {
  background: #373737;
}

.friend-badge {
  margin-left: auto;
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(216, 193, 138, 0.12);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--accent-strong);
}

.status-dot.idle {
  background: #b89b5e;
}

.status-dot.offline {
  background: #555;
}

.status-text.online {
  color: var(--accent-strong);
}

.status-text.idle {
  color: #b89b5e;
}

.status-text.offline {
  color: #777;
}

.empty-list {
  padding: 9px 10px;
  color: #777777;
  font-size: 14px;
}

/* Chat */

.chat {
  display: grid;
  grid-template-rows: 76px 1fr auto auto;
  min-width: 0;
  background: #101010;
}

.chat-header {
  padding: 0 24px;
  border-bottom: 1px solid #2a2a2a;
  display: flex;
  align-items: center;
}

.mobile-back-button,
.sidebar-item-menu-button {
  display: none;
}

.chat-header h1 {
  margin: 0;
  font-size: 21px;
}

.chat-header p {
  margin: 4px 0 0;
  color: #8f8f8f;
  font-size: 14px;
}

.messages {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-state {
  margin: auto;
  max-width: 420px;
  text-align: center;
  color: #999999;
}

.empty-state h2 {
  margin: 0 0 8px;
  color: #dddddd;
}

.empty-state p {
  margin: 0;
  line-height: 1.4;
}

.message {
  max-width: min(680px, 70%);
  padding: 10px 14px;
  border-radius: 14px;
  background: #252525;
  align-self: flex-start;
  word-wrap: break-word;
}

.message.mine {
  background: #3a2f1f;
  border: 1px solid rgba(216, 193, 138, 0.16);
  align-self: flex-end;
}

.message-author {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  color: #bdbdbd;
}

.message.mine .message-author {
  color: #fff0c2;
}

.message-text {
  margin: 0;
  line-height: 1.4;
  white-space: pre-wrap;
}

.message-time {
  margin-top: 6px;
  font-size: 11px;
  color: #8f8f8f;
  text-align: right;
}

.message.mine .message-time {
  color: #d8c18a;
}

.file-message {
  width: min(460px, 76%);
}

.file-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(216, 193, 138, 0.2);
  border-radius: 8px;
  background: #1a1916;
}

.file-card-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(216, 193, 138, 0.12);
  color: var(--accent-strong, #f0d99b);
  font-size: 22px;
}

.file-card-main {
  min-width: 0;
}

.file-card-title {
  overflow: hidden;
  color: var(--text-main, #f2efe7);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-card-meta {
  margin-top: 4px;
  color: var(--text-muted, #9c9484);
  font-size: 12px;
  line-height: 1.35;
}

.file-card-download {
  min-height: 36px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  background: var(--accent-dark, #5a4724);
  color: var(--accent-strong, #f0d99b);
  cursor: pointer;
  font-weight: 800;
}

.file-card-download:hover {
  background: #6f582c;
}

.file-card.is-unavailable {
  border-color: rgba(156, 148, 132, 0.18);
  background: #171613;
  cursor: pointer;
  opacity: 0.82;
}

.file-card.is-unavailable .file-card-icon {
  background: rgba(156, 148, 132, 0.1);
  color: var(--text-muted, #9c9484);
}

.file-unavailable-badge {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid rgba(156, 148, 132, 0.24);
  border-radius: 8px;
  color: var(--text-muted, #9c9484);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.file-message-caption {
  margin-top: 8px;
  color: var(--text-main, #f2efe7);
  line-height: 1.35;
  white-space: pre-wrap;
}

.system-message {
  align-self: center;
  max-width: 70%;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  color: #8f8f8f;
  font-size: 13px;
  text-align: center;
}

.system-message-time {
  margin-left: 6px;
  color: #666;
  font-size: 11px;
}

.group-invite-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 4px 0;
}

.group-invite-card {
  max-width: 460px;
  padding: 16px;
  border: 1px solid rgba(216, 193, 138, 0.22);
  border-radius: 14px;
  background: #1a1916;
  color: var(--text-main);
  text-align: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.group-invite-title {
  margin-bottom: 6px;
  color: var(--accent-strong);
  font-weight: 800;
}

.group-invite-text,
.group-invite-card p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.45;
}

.group-invite-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.group-invite-button {
  padding: 9px 14px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

.group-invite-button.accept {
  background: var(--accent-dark);
  color: var(--accent-strong);
}

.group-invite-button.accept:hover {
  background: #6b552b;
}

.group-invite-button.decline {
  background: rgba(216, 107, 107, 0.16);
  color: #d86b6b;
}

.group-invite-button.decline:hover {
  background: #512929;
}

.group-invite-status {
  margin-top: 12px;
  color: var(--text-muted);
  font-weight: 700;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #171717;
  border: 1px solid rgba(216, 193, 138, 0.14);
}

.volume-icon {
  width: 22px;
  text-align: center;
  color: var(--accent-strong, #f0d99b);
}

.volume-value {
  min-width: 42px;
  color: var(--text-muted, #9c9484);
  font-size: 12px;
  text-align: right;
}

.volume-slider {
  --volume-percent: 50%;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
  background:
    linear-gradient(
      to right,
      var(--accent-strong, #f0d99b) 0%,
      var(--accent-strong, #f0d99b) var(--volume-percent),
      #2a2926 var(--volume-percent),
      #2a2926 100%
    );
}

.modal-window input.volume-slider {
  flex: none;
  min-width: 0;
  padding: 0;
  border: none;
  color: inherit;
  background:
    linear-gradient(
      to right,
      var(--accent-strong, #f0d99b) 0%,
      var(--accent-strong, #f0d99b) var(--volume-percent),
      #2a2926 var(--volume-percent),
      #2a2926 100%
    );
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 8px;
  background: var(--accent-strong, #f0d99b);
  border: 2px solid #3a2f1f;
  box-shadow: 0 0 0 4px rgba(216, 193, 138, 0.12);
}

.volume-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 6px rgba(216, 193, 138, 0.18);
}

.volume-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 8px;
  background: var(--accent-strong, #f0d99b);
  border: 2px solid #3a2f1f;
  box-shadow: 0 0 0 4px rgba(216, 193, 138, 0.12);
}

.volume-slider::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: #2a2926;
}

.volume-slider::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--accent-strong, #f0d99b);
}

.message-form {
  padding: 16px 24px;
  border-top: 1px solid #2a2a2a;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  min-height: 82px;
  max-height: 280px;
  background: #101010;
}

.message-form textarea {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  max-height: 220px;
  padding: 14px 16px;
  border: 1px solid #2b2b2b;
  border-radius: 12px;
  outline: none;
  background: #202020;
  color: #ffffff;
  resize: none;
  line-height: 1.35;
  overflow-y: hidden;
  scrollbar-width: none;
}

.message-form textarea::-webkit-scrollbar {
  display: none;
}

.message-form textarea:focus {
  border-color: var(--accent, #d8c18a);
}

.message-form textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.message-form button {
  width: 120px;
  min-width: 120px;
  height: 48px;
  padding: 0 16px;
  border: none;
  border-radius: 12px;
  background: var(--accent-dark, #5a4724);
  color: var(--accent-strong, #f0d99b);
  cursor: pointer;
  font-weight: 700;
  flex-shrink: 0;
}

.message-form button:hover:not(:disabled) {
  background: #6f582c;
}

.message-form button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.message-form .file-button {
  width: 48px;
  min-width: 48px;
  padding: 0;
  border: 1px solid rgba(216, 193, 138, 0.18);
  background: #202020;
  color: var(--accent-strong, #f0d99b);
  font-size: 20px;
}

.message-form .file-button:hover:not(:disabled) {
  background: #2d2618;
  border-color: rgba(216, 193, 138, 0.42);
}

/* Modal */

.modal,
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.show,
.modal-overlay.show {
  display: flex;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-window {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  border-radius: 18px;
  background: #171717;
  border: 1px solid rgba(216, 193, 138, 0.22);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.45);
}

.modal-window h2 {
  margin: 0 0 8px;
}

.modal-window p {
  margin: 0 0 18px;
  color: #9a9a9a;
  line-height: 1.4;
}

.modal-note {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.modal-window form {
  display: flex;
  gap: 10px;
}

.modal-window input {
  flex: 1;
  min-width: 0;
  padding: 12px;
  border: 1px solid #2b2b2b;
  border-radius: 10px;
  outline: none;
  background: #202020;
  color: #ffffff;
}

.modal-window select {
  width: 100%;
  min-width: 0;
  padding: 12px;
  border: 1px solid #2b2b2b;
  border-radius: 10px;
  outline: none;
  background: #202020;
  color: #ffffff;
}

.modal-window input:focus {
  border-color: var(--accent-dark);
}

.modal-window select:focus {
  border-color: var(--accent-dark);
}

.modal-window button {
  padding: 0 16px;
  border: none;
  border-radius: 10px;
  background: var(--accent-dark);
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  flex: 0 0 20px;
  display: inline-grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(240, 217, 155, 0.58);
  border-radius: 6px;
  background: #202020;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

input[type="checkbox"]::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid #18130b;
  border-bottom: 2px solid #18130b;
  transform: rotate(-45deg) scale(0);
  transform-origin: center;
  transition: transform 0.14s ease;
}

input[type="checkbox"]:checked {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

input[type="checkbox"]:checked::after {
  transform: rotate(-45deg) scale(1);
}

input[type="checkbox"]:hover {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(216, 193, 138, 0.1);
}

input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(240, 217, 155, 0.22);
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-modal.show {
  display: flex;
}

.auth-window {
  width: 100%;
  max-width: 380px;
  padding: 24px;
  border-radius: 18px;
  background: #171717;
  border: 1px solid rgba(216, 193, 138, 0.18);
}

.auth-window h2 {
  margin: 0 0 18px;
}

.auth-window form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-window input {
  padding: 12px;
  border: 1px solid #2b2b2b;
  border-radius: 10px;
  outline: none;
  background: #202020;
  color: #ffffff;
}

.auth-window input:focus {
  border-color: var(--accent, #d8c18a);
}

.auth-window form button {
  margin-top: 6px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--accent-dark, #5a4724);
  color: var(--accent-strong, #f0d99b);
  cursor: pointer;
  font-weight: 700;
}

.auth-switch {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 8px;
  color: #9c9484;
  font-size: 14px;
}

.auth-switch button {
  border: none;
  background: transparent;
  color: var(--accent-strong, #f0d99b);
  cursor: pointer;
  font-weight: 700;
}

.auth-error {
  min-height: 18px;
  margin-top: 12px;
  color: #d86b6b;
  font-size: 14px;
  text-align: center;
}

/* Mobile */

@media (max-width: 760px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .message {
    max-width: 88%;
  }

  .chat {
    grid-template-rows: auto 1fr auto;
  }

  .chat-header {
    padding: 0 16px;
  }

  .messages {
    padding: 16px;
  }

  .message-form {
    padding: 12px;
  }

  .file-message {
    width: 88%;
  }

  .file-card {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .file-card-download {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* Chat requests */

.chat-item.request {
  border: 1px solid rgba(255, 193, 7, 0.25);
  background: rgba(255, 193, 7, 0.06);
}

.chat-item.request:hover {
  background: rgba(255, 193, 7, 0.1);
}

.chat-item-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-request-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #6b5b1f;
  color: #ffd966;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.request-panel {
  margin: auto;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid rgba(255, 193, 7, 0.22);
  border-radius: 18px;
  background: #171717;
  text-align: center;
}

.request-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #6b5b1f;
  color: #ffd966;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
}

.request-panel h2 {
  margin: 0 0 8px;
  color: #ffffff;
}

.request-panel p {
  margin: 0;
  color: #a0a0a0;
  line-height: 1.45;
}

.request-actions {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.request-button {
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

.request-button.accept {
  background: var(--accent-dark);
  color: var(--accent-strong);
}

.request-button.accept:hover {
  background: #6f582c;
}

.request-button.decline {
  background: #3a2020;
  color: #ffb0b0;
}

.request-button.decline:hover {
  background: #512929;
}

/* Layout fix: messages should scroll, not stretch the page */

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.app {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.sidebar-section {
  min-height: 0;
}

.chat-list,
.online-users,
.friends-list,
.friend-requests-list {
  min-height: 0;
  overflow-y: auto;
}

.chat {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.messages {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.message {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message-form {
  flex-shrink: 0;
  overflow: hidden;
}

/* Declined chat request */

.chat-item.declined {
  border: 1px solid rgba(255, 80, 80, 0.28);
  background: rgba(255, 80, 80, 0.07);
}

.chat-item.declined:hover {
  background: rgba(255, 80, 80, 0.12);
}

.chat-request-badge.declined {
  background: #5a2020;
  color: #ff9d9d;
}

.request-panel.declined {
  border-color: rgba(255, 80, 80, 0.28);
  background: #171111;
}

.request-icon.declined {
  background: #5a2020;
  color: #ff9d9d;
}

/* Declined chat remove button */

.chat-delete-button {
  width: 22px;
  height: 22px;
  margin-left: auto;
  border-radius: 50%;
  background: rgba(255, 80, 80, 0.16);
  color: #ff9d9d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

.chat-delete-button:hover {
  background: rgba(255, 80, 80, 0.28);
  color: #ffffff;
}

.chat-muted-badge {
  margin-left: 6px;
  color: #8f8f8f;
  font-size: 12px;
  opacity: 0.8;
}

.group-badge {
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(216, 193, 138, 0.12);
  color: var(--accent-strong, #f0d99b);
  font-size: 11px;
  flex-shrink: 0;
}

.create-group-button {
  width: calc(100% - 8px);
  margin: 0 4px 10px;
  padding: 10px 12px;
  border: 1px solid rgba(216, 193, 138, 0.2);
  border-radius: 8px;
  background: #2a2418;
  color: var(--accent-strong, #f0d99b);
  cursor: pointer;
  font-weight: 700;
}

.create-group-button:hover {
  background: #3a2f1f;
}

.join-code-button {
  background: #232323;
  color: #dddddd;
}

.join-code-button:hover {
  background: #303030;
}

.group-modal,
.members-modal,
.join-code-modal,
.group-code-modal,
.add-to-group-modal {
  z-index: 100;
}

.group-modal-window,
.members-modal-window {
  max-width: 460px;
}

.group-form {
  flex-direction: column;
}

.group-members-list,
.members-list,
.manageable-groups-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.group-member-option,
.member-row,
.manageable-group-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #2b2b2b;
  border-radius: 8px;
  background: #202020;
}

.group-member-option input {
  width: auto;
  flex: 0 0 auto;
}

.member-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.member-name {
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.member-meta {
  font-size: 12px;
}

.member-admin-actions,
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.member-admin-actions {
  flex-wrap: wrap;
}

.member-action-button,
.secondary-modal-button {
  min-height: 38px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  background: #2b2b2b;
  color: #dddddd;
  cursor: pointer;
  font-weight: 700;
}

.member-action-button:hover,
.secondary-modal-button:hover {
  background: #373737;
}

.member-action-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.member-action-button:disabled:hover {
  background: #2b2b2b;
}

.member-action-button.danger {
  background: #3a2020;
  color: #ffb0b0;
}

.member-action-button.danger:hover {
  background: #512929;
}

.member-row,
.member-item {
  justify-content: space-between;
}

.member-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.member-action-button.transfer {
  background: var(--accent-dark, #5a4724);
  color: var(--accent-strong, #f0d99b);
}

.member-action-button.transfer:hover {
  filter: brightness(1.12);
}

.ownership-transfer-panel {
  width: 100%;
  flex: 1 0 100%;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid rgba(216, 193, 138, 0.2);
  border-radius: 8px;
  background: #202020;
}

.ownership-transfer-panel h3 {
  margin: 0 0 10px;
  color: var(--text-main, #f2efe7);
  font-size: 15px;
}

.ownership-transfer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ownership-transfer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.confirm-modal.hidden {
  display: none !important;
}

.confirm-window {
  width: 100%;
  max-width: 420px;
  padding: 22px;
  border-radius: 18px;
  background: #171717;
  border: 1px solid rgba(216, 193, 138, 0.2);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.55);
}

.confirm-window h2 {
  margin: 0 0 10px;
  color: var(--text-main, #f2efe7);
  font-size: 22px;
}

.confirm-window p {
  margin: 0;
  color: var(--text-muted, #9c9484);
  line-height: 1.45;
}

.confirm-extra-content {
  margin-top: 14px;
}

.confirm-input {
  width: 100%;
  border: 1px solid rgba(216, 193, 138, 0.2);
  border-radius: 10px;
  background: #101010;
  color: var(--text-main, #f2efe7);
  padding: 11px 12px;
  font: inherit;
  outline: none;
}

.confirm-input:focus {
  border-color: rgba(240, 217, 155, 0.55);
}

.group-settings-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main, #f2efe7);
  font-weight: 700;
}

.confirm-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.confirm-button {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
}

.confirm-button.secondary {
  background: #242424;
  color: var(--text-main, #f2efe7);
}

.confirm-button.primary {
  background: var(--accent-dark, #5a4724);
  color: var(--accent-strong, #f0d99b);
}

.confirm-button.danger {
  background: rgba(216, 107, 107, 0.18);
  color: #ff9d9d;
}

.confirm-button:hover {
  filter: brightness(1.12);
}

.file-upload-modal .modal-window {
  max-width: 460px;
}

.join-code-modal .modal-window {
  max-width: 560px;
}

.join-code-modal form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.join-code-modal input {
  width: 100%;
}

.join-code-modal .modal-actions {
  margin-top: 0;
  justify-content: flex-end;
}

.file-upload-summary {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid rgba(216, 193, 138, 0.18);
  border-radius: 8px;
  background: #202020;
}

.file-preview-image {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(216, 193, 138, 0.14);
  background: #101010;
}

.file-caption-input {
  width: 100%;
  min-height: 72px;
  max-height: 140px;
  resize: vertical;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(216, 193, 138, 0.16);
  background: #202020;
  color: var(--text-main, #f2efe7);
}

.attachment-composer {
  margin: 0 24px 12px;
  padding: 14px;
  border: 1px solid rgba(216, 193, 138, 0.2);
  border-radius: 12px;
  background: #171717;
  display: grid;
  gap: 12px;
  max-height: min(58dvh, 520px);
  overflow-y: auto;
}

.attachment-preview {
  display: grid;
  grid-template-columns: minmax(96px, 180px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.attachment-preview-image {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid rgba(216, 193, 138, 0.14);
  background: #101010;
}

.attachment-preview-image.hidden + .attachment-file-info {
  grid-column: 1 / -1;
}

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

.attachment-file-name {
  overflow: hidden;
  color: var(--text-main);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-file-meta {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.attachment-caption {
  width: 100%;
  min-height: 70px;
  max-height: 150px;
  resize: vertical;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(216, 193, 138, 0.16);
  background: #202020;
  color: var(--text-main);
}

.attachment-caption:focus {
  outline: none;
  border-color: var(--accent-dark);
}

.attachment-storage {
  display: grid;
  gap: 7px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}

.attachment-storage select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #2b2b2b;
  border-radius: 10px;
  outline: none;
  background: #202020;
  color: #ffffff;
}

.attachment-no-compress,
.file-no-compress {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
}

.attachment-no-compress.hidden,
.file-no-compress.hidden {
  display: none;
}

.attachment-no-compress input,
.file-no-compress input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.attachment-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.attachment-actions button {
  min-height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: 10px;
  background: var(--accent-dark);
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 800;
}

.attachment-actions .secondary-modal-button {
  background: #2a2a2a;
  color: #dddddd;
}

.attachment-progress {
  padding: 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(216, 193, 138, 0.16);
}

.group-code-box,
.group-code-value {
  margin: 16px 0;
  padding: 16px;
  border-radius: 8px;
  background: #202020;
  border: 1px solid rgba(216, 193, 138, 0.2);
  color: var(--accent-strong, #f0d99b);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 16px;
  line-height: 1.45;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.04em;
  user-select: all;
  word-break: keep-all;
  overflow-wrap: normal;
  white-space: normal;
}

/* Chat header */

.chat-header {
  min-height: 76px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.chat-subtitle.online {
  color: var(--accent-strong);
}

.chat-subtitle.idle {
  color: #b89b5e;
}

.chat-header-info h1,
.chat-header-info p {
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-subtitle.offline {
  color: #8f8f8f;
}

.chat-subtitle.declined {
  color: #ff9d9d;
}

/* Delete chat button */

.chat-delete-button {
  width: 22px;
  height: 22px;
  margin-left: auto;
  border-radius: 50%;
  background: rgba(255, 80, 80, 0.12);
  color: #ff9d9d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.75;
}

.chat-delete-button:hover {
  background: rgba(255, 80, 80, 0.28);
  color: #ffffff;
  opacity: 1;
}

/* Online visibility button */

.visibility-button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: #232323;
  color: #d0d0d0;
  cursor: pointer;
}

.visibility-button:hover {
  background: #303030;
}

.visibility-button.active {
  background: #3a2f1f;
  color: #ffd966;
}

/* Blocked list */

.blocked-section {
  border-bottom: 1px solid #222222;
}

.blocked-users {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.blocked-chat-item {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(255, 80, 80, 0.22);
  border-radius: 10px;
  background: rgba(255, 80, 80, 0.06);
  color: #dddddd;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  cursor: pointer;
  text-align: left;
}

.blocked-chat-item:hover {
  background: rgba(255, 80, 80, 0.12);
}

/* App version */

.app-version {
  margin-top: auto;
  padding: 10px 14px;
  border-top: 1px solid #222222;
  color: #666666;
  font-size: 12px;
  letter-spacing: 0.03em;
  user-select: none;
}

.hidden-chats-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.group-actions-menu {
  min-width: 210px;
}

.group-actions-trigger {
  min-width: 26px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}

.profile-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-field input:not([type="color"]) {
  width: 100%;
}

.profile-avatar-controls {
  display: grid;
  grid-template-columns: 1fr 54px;
  gap: 10px;
}

.profile-avatar-controls input[type="color"] {
  width: 54px;
  min-width: 54px;
  height: 44px;
  padding: 4px;
}

.profile-sound-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.profile-sound-test-button {
  min-height: 42px;
  white-space: nowrap;
}

.profile-notifications {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(216, 193, 138, 0.16);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
}

.profile-notifications h3 {
  margin: 0 0 2px;
  color: var(--text-main);
  font-size: 15px;
}

.profile-notification-action {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.profile-notification-statuses {
  display: grid;
  gap: 4px;
}

.profile-notification-status {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.profile-notification-hint {
  margin: -2px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.35;
}

.profile-check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  font-weight: 700;
}

.profile-check input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.profile-sidebar-visibility {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(216, 193, 138, 0.16);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
}

.profile-sidebar-visibility h3 {
  margin: 0 0 2px;
  color: var(--text-main);
  font-size: 15px;
}

.mes-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  font-weight: 700;
}

.sidebar-section-hidden {
  display: none !important;
}

.sidebar-all-hidden-message {
  padding: 14px 12px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
}

.sidebar-scroll,
.messages,
.modal-scroll,
.context-menu,
.members-list,
.friends-list,
.groups-list,
.hidden-chats-list,
.blocked-users {
  scrollbar-width: thin;
  scrollbar-color: rgba(216, 193, 138, 0.55) rgba(255, 255, 255, 0.04);
}

.sidebar-scroll::-webkit-scrollbar,
.messages::-webkit-scrollbar,
.modal-scroll::-webkit-scrollbar,
.context-menu::-webkit-scrollbar,
.members-list::-webkit-scrollbar,
.friends-list::-webkit-scrollbar,
.groups-list::-webkit-scrollbar,
.hidden-chats-list::-webkit-scrollbar,
.blocked-users::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.sidebar-scroll::-webkit-scrollbar-button,
.messages::-webkit-scrollbar-button,
.modal-scroll::-webkit-scrollbar-button,
.context-menu::-webkit-scrollbar-button,
.members-list::-webkit-scrollbar-button,
.friends-list::-webkit-scrollbar-button,
.groups-list::-webkit-scrollbar-button,
.hidden-chats-list::-webkit-scrollbar-button,
.blocked-users::-webkit-scrollbar-button {
  display: none;
}

.sidebar-scroll::-webkit-scrollbar-track,
.messages::-webkit-scrollbar-track,
.modal-scroll::-webkit-scrollbar-track,
.context-menu::-webkit-scrollbar-track,
.members-list::-webkit-scrollbar-track,
.friends-list::-webkit-scrollbar-track,
.groups-list::-webkit-scrollbar-track,
.hidden-chats-list::-webkit-scrollbar-track,
.blocked-users::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.035);
  border-radius: 999px;
}

.sidebar-scroll::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb,
.modal-scroll::-webkit-scrollbar-thumb,
.context-menu::-webkit-scrollbar-thumb,
.members-list::-webkit-scrollbar-thumb,
.friends-list::-webkit-scrollbar-thumb,
.groups-list::-webkit-scrollbar-thumb,
.hidden-chats-list::-webkit-scrollbar-thumb,
.blocked-users::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(240, 217, 155, 0.85), rgba(90, 71, 36, 0.95));
  border: 2px solid #111;
  border-radius: 999px;
}

/* Sidebar v0.4 */

html,
body {
  height: 100%;
  overflow: hidden;
}

.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  overflow: hidden;
}

.sidebar {
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.profile {
  flex-shrink: 0;
}

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

#sidebarScroll > .sidebar-section:not(.new-sidebar-section) {
  display: none;
}

.app-version {
  flex-shrink: 0;
  margin-top: 0;
}

.sidebar-section {
  padding: 0;
  border-bottom: 1px solid #222;
}

.sidebar-section-header {
  width: 100%;
  padding: 12px 20px 8px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  user-select: none;
}

.section-count {
  color: #706a5f;
  font-weight: 800;
}

.sidebar-section-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}

.section-action-button {
  border: none;
  border-radius: 8px;
  background: #232323;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
}

.section-action-button:hover {
  background: #2b2924;
  color: var(--accent-strong);
}

.section-action-button.active {
  background: #3a2f1f;
  color: var(--accent-strong);
}

.sidebar-section-body {
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: none;
  overflow: visible;
}

.sidebar-section.collapsed .sidebar-section-body {
  display: none;
}

.sidebar-item {
  width: 100%;
  min-height: 54px;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}

.sidebar-item:hover {
  background: #22201c;
}

.sidebar-item.active {
  background: #2a251b;
  border: 1px solid rgba(216, 193, 138, 0.18);
}

.sidebar-item.danger {
  color: #ffd1d1;
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #3a2f1f;
  border: 1px solid rgba(216, 193, 138, 0.25);
  color: var(--accent-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.sidebar-item-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-item-title {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-item-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-item-meta {
  max-width: 92px;
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.sidebar-pin-marker {
  color: var(--accent-strong);
  font-size: 13px;
  line-height: 1;
  flex: 0 0 auto;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.35));
}

.sidebar-item.is-pinned {
  box-shadow: inset 3px 0 0 rgba(240, 217, 155, 0.65);
}

.unread-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent-strong, #f0d99b);
  color: #18130b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  flex-shrink: 0;
}

.toast-container {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1200;
  width: min(360px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 12px 12px 12px 14px;
  border: 1px solid rgba(216, 193, 138, 0.22);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  background: rgba(23, 23, 23, 0.96);
  color: var(--text-main);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 10px;
  align-items: start;
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

.toast-success {
  border-left-color: #8fcf8f;
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-warning {
  border-left-color: #f0c36b;
}

.toast-message {
  min-width: 0;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.toast-close {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(216, 193, 138, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.toast-close:hover {
  color: var(--accent-strong);
  border-color: rgba(216, 193, 138, 0.35);
}

.toast-hide {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.chat-subtitle.typing {
  color: var(--accent-strong);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-item.has-unread,
.friend-item.has-unread,
.sidebar-item.has-unread {
  border: 1px solid rgba(240, 217, 155, 0.35);
  border-color: rgba(240, 217, 155, 0.35);
  background: rgba(216, 193, 138, 0.08);
}

.quick-actions-section .sidebar-section-header {
  cursor: default;
}

.quick-actions-section .create-group-button {
  width: 100%;
  margin: 0;
}

.context-menu {
  position: fixed;
  z-index: 200;
  min-width: 220px;
  padding: 6px;
  border-radius: 12px;
  background: #171717;
  border: 1px solid rgba(216, 193, 138, 0.18);
  box-shadow: 0 18px 60px rgba(0,0,0,0.45);
}

.context-menu.hidden {
  display: none !important;
}

.context-menu-item {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}

.context-menu-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.context-menu-item:hover {
  background: #24211b;
}

.context-menu-item.danger {
  color: #d86b6b;
}

.context-menu-separator {
  height: 1px;
  margin: 6px;
  background: #2a2a2a;
}

@media (max-width: 760px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }
}

.file-upload-progress {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  background: #141414;
  border: 1px solid rgba(216, 193, 138, 0.14);
}

.file-upload-progress.hidden {
  display: none !important;
}

.file-upload-progress-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--text-muted, #9c9484);
  font-size: 13px;
  font-weight: 700;
}

.file-upload-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #26231d;
  overflow: hidden;
}

.file-upload-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(240, 217, 155, 0.9),
    rgba(90, 71, 36, 0.95)
  );
  transition: width 0.15s ease;
}

.file-download-progress {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(216, 193, 138, 0.12);
}

.file-download-progress.hidden {
  display: none !important;
}

.file-download-progress-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--text-muted, #9c9484);
  font-size: 12px;
  font-weight: 700;
}

.file-download-progress-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #26231d;
  overflow: hidden;
}

.file-download-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(240, 217, 155, 0.9),
    rgba(90, 71, 36, 0.95)
  );
}

.file-download-progress {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(216, 193, 138, 0.12);
}

.file-download-progress.hidden {
  display: none !important;
}

.file-download-progress-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--text-muted, #9c9484);
  font-size: 12px;
  font-weight: 700;
}

.file-download-progress-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #26231d;
  overflow: hidden;
}

.file-download-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(240, 217, 155, 0.9),
    rgba(90, 71, 36, 0.95)
  );
}

/* Image messages */
.message.image-message {
  width: min(520px, 78%);
  max-width: min(520px, 78%);
  padding: 10px;
}

.message.image-message.image-unavailable {
  width: fit-content;
  max-width: min(520px, 78%);
}

.message.image-message .message-author {
  margin-bottom: 8px;
}

.chat-photo {
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  display: block;
  border-radius: 12px;
  background: #101010;
  cursor: zoom-in;
}

.image-message .file-message-caption {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.35;
}

.image-message .message-time {
  margin-top: 8px;
}

.message-image-unavailable,
.image-unavailable-message {
  min-height: 36px;
  max-height: 44px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-muted, #9c9484);
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
}

.message-image-unavailable {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  cursor: pointer;
  text-align: center;
}

.message-image-unavailable:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-main, #f6ecd8);
}
