* {
  box-sizing: border-box;
}

.chat-avatar.talkhub-brand-avatar {
  background: transparent url('./logo.png?v=talkhub-1') no-repeat;
  background-size: 152.3px 60px;
  background-position: -11.2px -10.2px;
}

:root {
  --tg-blue: #3390ec;
  --tg-blue-active: #4ea4f6;
  --tg-text: #111827;
  --tg-muted: #707579;
  --tg-border: #dadce0;
  --tg-panel: #ffffff;
  --tg-hover: #f4f4f5;
  --tg-in: #ffffff;
  --tg-out: #d9fdd3;
  --tg-chat-fallback: #eef4f8;
}

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #ffffff;
  color: var(--tg-text);
  overflow: hidden;
  overscroll-behavior: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  user-select: none;
}

.hidden {
  display: none !important;
}

.layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  min-width: 860px;
  background: #fff;
  overflow: hidden;
}

/* LEFT PANEL */

.sidebar {
  background: var(--tg-panel);
  border-right: 1px solid #dfe3e8;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.sidebar-toolbar {
  height: 48px;
  min-height: 48px;
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  position: relative;
}

.round-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #707579;
  cursor: pointer;
  font-size: 22px;
  display: grid;
  place-items: center;
  line-height: 1;
  flex: 0 0 auto;
}

.round-btn:hover {
  background: #f1f3f4;
}

.add-btn {
  color: var(--tg-blue);
  font-size: 24px;
}

.search-box {
  height: 36px;
  flex: 1;
  position: relative;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #9aa0a6;
  font-size: 20px;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 36px;
  border: 0;
  outline: 0;
  border-radius: 18px;
  padding: 0 14px 0 39px;
  background: #f1f3f4;
  color: #202124;
}

.search-box input:focus {
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--tg-blue);
}

.search-box input::placeholder {
  color: #8b949e;
}

.contacts {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 6px 10px;
}

.contacts-empty {
  color: var(--tg-muted);
  text-align: center;
  padding: 28px 12px;
  font-size: 14px;
}

.contact {
  width: 100%;
  height: 72px;
  border: 0;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
}

.contact:hover {
  background: var(--tg-hover);
}

.contact.active {
  background: var(--tg-blue-active);
  color: #fff;
}

.avatar,
.chat-avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 0;
  background: linear-gradient(135deg, #6ec6ff, #3f8cff);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
}

.contact-body {
  min-width: 0;
  flex: 1;
}

.contact-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.contact-name {
  font-weight: 600;
  font-size: 15px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.provider {
  color: #8b949e;
  font-size: 12px;
  flex: 0 0 auto;
}

.contact.active .provider {
  color: rgba(255, 255, 255, 0.82);
}

.last-message {
  margin-top: 5px;
  color: var(--tg-muted);
  font-size: 14px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact.active .last-message {
  color: rgba(255, 255, 255, 0.9);
}

/* DROPDOWNS */

.menu-wrap,
.header-actions {
  position: relative;
  flex: 0 0 auto;
  z-index: 30;
}

.dropdown {
  position: absolute;
  z-index: 20;
  top: 42px;
  left: 0;
  min-width: 190px;
  padding: 6px 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.contact-dropdown {
  left: auto;
  right: 0;
  top: 42px;
}

.dropdown.hidden {
  display: none;
}

.dropdown-item {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 10px 16px;
  text-align: left;
  cursor: pointer;
  color: #202124;
  font-size: 14px;
}

.dropdown-item:hover {
  background: #f4f4f5;
}

.dropdown-item.danger {
  color: #d93025;
}

/* CHAT */

.chat {
  display: grid;
  grid-template-rows: 56px auto minmax(0, 1fr) auto;
  grid-template-areas:
    "header"
    "topics"
    "messages"
    "composer";
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #f4efe9;
}

.chat-header {
  grid-area: header;
  height: 56px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: #fff;
  border-bottom: 1px solid #dfe3e8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  z-index: 5;
  overflow: visible;
}

.chat-peer {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1 1 auto;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  font-size: 15px;
}

.chat-meta {
  min-width: 0;
}

.chat-title {
  font-weight: 600;
  font-size: 16px;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-subtitle {
  color: var(--tg-muted);
  font-size: 13px;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #707579;
  cursor: pointer;
  font-size: 25px;
  display: grid;
  place-items: center;
  line-height: 1;
}

.header-btn:hover:not(:disabled) {
  background: #f1f3f4;
}

.header-btn:disabled {
  cursor: default;
  opacity: 0.35;
}

.messages {
  grid-area: messages;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background-color: var(--tg-chat-fallback);
  background-image:
    linear-gradient(rgba(238, 244, 248, 0.36), rgba(238, 244, 248, 0.36)),
    url("./bg.png?v=talkhub-2");
  background-repeat: repeat, repeat;
  background-size: auto, 512px 512px;
  background-position: left top, left top;
}

.empty-state {
  margin: auto;
  color: #fff;
  background: rgba(84, 112, 96, 0.72);
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 14px;
}

.message {
  position: relative;
  max-width: min(620px, 72%);
  padding: 6px 8px 5px;
  border-radius: 8px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.13);
  color: #111827;
  font-size: 14px;
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.message.in {
  align-self: flex-start;
  background: var(--tg-in);
  border-bottom-left-radius: 3px;
}

.message.out {
  align-self: flex-end;
  background: var(--tg-out);
  border-bottom-right-radius: 3px;
}

.message-sender {
  font-size: 12px;
  font-weight: 600;
  color: #2f80ed;
  margin-bottom: 2px;
}

.message.out .message-sender {
  color: #168246;
}

.message-text {
  white-space: pre-wrap;
  padding-right: 46px;
}

.message-time {
  float: right;
  margin-top: -2px;
  margin-left: 8px;
  font-size: 11px;
  line-height: 15px;
  color: #7a8a79;
}

.composer {
  grid-area: composer;
  min-height: 58px;
  max-height: 156px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(244, 239, 233, 0.92);
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.composer textarea {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  max-height: 140px;
  resize: none;
  border: 0;
  outline: 0;
  border-radius: 12px;
  padding: 11px 14px;
  background: #fff;
  color: #202124;
  font-family: inherit;
  font-size: 15px;
  line-height: 20px;
  overflow-y: auto;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.composer textarea::placeholder {
  color: #8b949e;
}

.composer-icon,
.send-btn {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #707579;
  cursor: pointer;
  font-size: 22px;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.composer-icon:hover,
.send-btn:hover {
  color: var(--tg-blue);
}

.send-btn {
  color: #fff;
  background: var(--tg-blue);
  font-size: 18px;
  padding-left: 3px;
}

.send-btn:hover {
  color: #fff;
  background: #2584df;
}

/* DIALOGS */

dialog {
  border: 0;
  border-radius: 14px;
  background: #fff;
  color: #202124;
  width: 430px;
  padding: 0;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.32);
}

.settings-dialog {
  width: min(560px, calc(100vw - 40px));
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.dialog-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 20px;
}

.dialog-form h3 {
  margin: 0 0 4px;
  font-size: 20px;
}

.dialog-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 500;
}

.field-hint {
  color: #707579;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 400;
}

.dialog-form input,
.dialog-form select {
  width: 100%;
  border: 1px solid #dfe3e8;
  outline: 0;
  border-radius: 9px;
  padding: 10px 11px;
  background: #fff;
  color: #202124;
}

.dialog-form input:focus,
.dialog-form select:focus {
  border-color: var(--tg-blue);
  box-shadow: 0 0 0 3px rgba(51, 144, 236, 0.14);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.dialog-actions button {
  border: 0;
  border-radius: 9px;
  padding: 10px 14px;
  cursor: pointer;
  color: #202124;
  background: #f1f3f4;
}

.dialog-actions button:last-child {
  background: var(--tg-blue);
  color: white;
}

.dialog-actions button:disabled {
  opacity: 0.65;
  cursor: default;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-height: min(68vh, 640px);
  overflow-y: auto;
  padding-right: 4px;
}

.settings-grid fieldset {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-grid legend {
  color: #111827;
  font-weight: 700;
  padding: 0 5px;
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.settings-status {
  min-height: 18px;
  color: var(--tg-muted);
  font-size: 13px;
}

/* SCROLLBARS */

.contacts::-webkit-scrollbar,
.messages::-webkit-scrollbar,
.settings-grid::-webkit-scrollbar {
  width: 8px;
}

.contacts::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb,
.settings-grid::-webkit-scrollbar-thumb {
  background: rgba(112, 117, 121, 0.35);
  border-radius: 999px;
}

.contacts::-webkit-scrollbar-track,
.messages::-webkit-scrollbar-track,
.settings-grid::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 900px) {
.layout {
    grid-template-columns: 330px 1fr;
    min-width: 760px;
  }

  .message {
    max-width: 82%;
  }
}

@media (max-width: 760px) {
  body {
    overflow: hidden;
  }

.layout {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .sidebar {
    display: none;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }
}


/* TELEGRAM TOPICS MENU */

.dropdown-section {
  padding: 0;
}

.dropdown-separator {
  height: 1px;
  margin: 6px 0;
  background: #eceff1;
}

.dropdown-title {
  padding: 7px 16px 5px;
  color: #707579;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dropdown-item.nested {
  padding-left: 28px;
}

.dropdown-item:disabled {
  cursor: default;
  color: #b0b6bc;
  background: transparent;
}

.dropdown-item.danger:disabled {
  color: #d8a4a0;
}

.chat.no-dialog .composer {
  display: none !important;
}

.chat.no-dialog .topic-tabs {
  display: none !important;
}

.chat.no-dialog .messages {
  padding: 20px 24px;
}

/* TOPICS AS TABS INSIDE TELEGRAM GROUP */

.topic-tabs {
  grid-area: topics;
  height: 38px;
  min-height: 38px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 6px;
  padding: 0 8px 0 12px;
  background: #fff;
  border-bottom: 1px solid #dfe3e8;
  overflow: visible;
  z-index: 4;
}

.topic-tabs.hidden {
  display: none !important;
}

.topic-tabs-list {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
}

.topic-menu-wrap {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  z-index: 25;
}

.topic-menu-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #707579;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.topic-menu-btn:hover {
  background: #f1f3f4;
}

.topic-dropdown {
  left: auto;
  right: 0;
  top: 36px;
  min-width: 210px;
}

.topic-tab {
  position: relative;
  border: 0;
  background: transparent;
  color: #707579;
  padding: 0 10px;
  min-width: max-content;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.topic-tab:hover {
  background: #f4f4f5;
  color: #202124;
}

.topic-tab.active {
  color: var(--tg-blue);
}

.topic-tab.active::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--tg-blue);
}

.topic-tabs-list::-webkit-scrollbar {
  height: 0;
}

.message-topic {
  display: inline-block;
  color: #707579;
  background: rgba(51, 144, 236, 0.12);
  border-radius: 6px;
  padding: 2px 6px;
  margin-bottom: 3px;
  font-size: 11px;
  font-weight: 600;
}

.composer textarea:disabled {
  color: #9aa0a6;
  background: #f4f4f5;
  cursor: not-allowed;
}

.send-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ATTACHMENTS */

.composer {
  flex-wrap: wrap;
  max-height: 220px;
}

.selected-files-preview {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 0 2px 50px;
}

.selected-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 260px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(51, 144, 236, 0.12);
  color: #202124;
  font-size: 12px;
}

.selected-file-chip span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.selected-file-chip button {
  border: 0;
  background: transparent;
  color: #707579;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}

.selected-file-chip button:hover {
  color: #d93025;
}

.message-attachments {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 2px 0 5px;
}

.attachment-image-link {
  display: block;
  line-height: 0;
}

.message-image {
  display: block;
  max-width: min(420px, 100%);
  max-height: 380px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.04);
}

.attachment-file,
.attachment-card {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(51, 144, 236, 0.10);
  color: #1f5f99;
  text-decoration: none;
}

.attachment-file:hover,
.attachment-card a:hover {
  text-decoration: underline;
}

.attachment-file-icon {
  font-size: 19px;
  flex: 0 0 auto;
}

.attachment-file-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.message-video {
  width: min(420px, 100%);
  max-height: 320px;
  border-radius: 8px;
  background: #000;
}

.message-audio {
  width: min(360px, 100%);
}

.composer-icon:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ATTACHMENTS AND DRAG-DROP UPDATE */

.chat {
  position: relative;
}

.drop-overlay {
  position: absolute;
  inset: 56px 0 58px 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(51, 144, 236, 0.15);
  backdrop-filter: blur(2px);
  pointer-events: none;
}

.drop-overlay-card {
  min-width: 320px;
  padding: 24px 28px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.22);
  text-align: center;
  color: #202124;
  border: 2px dashed rgba(51, 144, 236, 0.65);
}

.drop-overlay-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: #56c568;
  font-size: 28px;
  font-weight: 800;
}

.drop-overlay-title {
  font-weight: 700;
  font-size: 18px;
}

.drop-overlay-subtitle {
  margin-top: 4px;
  color: #707579;
  font-size: 14px;
}

.selected-files-preview {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 0 2px 50px;
}

.selected-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 300px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(51, 144, 236, 0.12);
  color: #202124;
  font-size: 12px;
}

.selected-file-chip::before {
  content: "▣";
  color: #56c568;
  font-weight: 900;
}

.selected-file-chip span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.message.attachments-only {
  min-width: min(360px, 72%);
}

.message-attachments {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 2px 0 3px;
}

.attachment-file,
.attachment-card .attachment-file {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: min(430px, 100%);
  max-width: 430px;
  min-height: 50px;
  padding: 6px 8px;
  border-radius: 12px;
  background: transparent;
  color: #111827;
  text-decoration: none;
}

.message.in .attachment-file,
.message.in .attachment-card .attachment-file {
  background: rgba(51, 144, 236, 0.07);
}

.message.out .attachment-file,
.message.out .attachment-card .attachment-file {
  background: rgba(82, 185, 97, 0.12);
}

.attachment-file:hover .attachment-file-name {
  text-decoration: underline;
}

.attachment-file-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #56c568;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  flex: 0 0 auto;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.attachment-file-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.attachment-file-name {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 600;
  color: #111827;
}

.attachment-file-size {
  color: #4cae52;
  font-size: 12px;
  line-height: 1.2;
  min-height: 14px;
}

.attachment-card.media-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  max-width: 430px;
  padding: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-decoration: none;
}

.attachment-card.media-card .attachment-file.compact {
  width: 100%;
  max-width: 100%;
}

.message-image {
  display: block;
  max-width: min(430px, 100%);
  max-height: 380px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.04);
}

.message-video {
  width: min(430px, 100%);
  max-height: 320px;
  border-radius: 8px;
  background: #000;
}

.message-audio {
  width: min(360px, 100%);
}

.composer.drag-ready {
  box-shadow: inset 0 0 0 2px rgba(51, 144, 236, 0.35);
}

/* UNREAD COUNTERS */
.contact-side {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 0;
}

.contact-unread-badge,
.topic-unread-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: #b8bec4;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  white-space: nowrap;
}

.contact.active .contact-unread-badge {
  background: rgba(255, 255, 255, 0.33);
  color: #fff;
}

.topic-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.topic-tab .topic-unread-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  line-height: 18px;
  background: #c4c9ce;
}

.topic-tab.active .topic-unread-badge {
  background: var(--tg-blue);
}


/* PINNED CONTACTS AND PROVIDER AVATARS */

.provider-avatar {
  background-color: transparent;
  background-image: none;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  color: transparent;
  font-size: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
}

.provider-avatar-telegram {
  background-image: url("./telegram.png");
}

.provider-avatar-max {
  background-image: url("./max.png");
}

.provider-avatar-mailru {
  background-image: url("./mailru.png");
}

.chat-avatar.provider-avatar {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
}

.pinned-separator {
  height: 1px;
  margin: 5px 12px;
  background: #dfe3e8;
}

.contact-pin {
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  color: #8b949e;
  font-size: 12px;
  line-height: 1;
  opacity: 0.75;
  transform: rotate(-12deg);
}

.contact.active .contact-pin {
  color: rgba(255, 255, 255, 0.9);
  opacity: 0.95;
}

/* FILE TYPE ICONS, VOICE PLAYER AND REPLY QUOTES */

.message {
  overflow: visible;
}

.message-reply-btn {
  position: absolute;
  top: 4px;
  right: 6px;
  z-index: 3;
  border: 0;
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--tg-blue);
  font-size: 12px;
  line-height: 18px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.message:hover .message-reply-btn {
  opacity: 1;
  transform: translateY(0);
}

.message.out .message-reply-btn {
  right: auto;
  left: 6px;
}

.message-reply-quote {
  margin: 2px 0 6px;
  padding: 5px 8px 5px 9px;
  border-left: 3px solid var(--tg-blue);
  border-radius: 6px;
  background: rgba(51, 144, 236, 0.10);
  max-width: 100%;
}

.message.out .message-reply-quote {
  border-left-color: #4fae54;
  background: rgba(79, 174, 84, 0.12);
}

.message-reply-quote-sender {
  color: var(--tg-blue);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message.out .message-reply-quote-sender {
  color: #168246;
}

.message-reply-quote-text {
  margin-top: 1px;
  color: #707579;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-preview {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 9px;
  padding: 7px 8px 7px 54px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.reply-preview-marker {
  width: 4px;
  align-self: stretch;
  border-radius: 999px;
  background: var(--tg-blue);
}

.reply-preview-body {
  min-width: 0;
}

.reply-preview-title {
  color: var(--tg-blue);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-preview-text {
  margin-top: 2px;
  color: #707579;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-preview-close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #707579;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.reply-preview-close:hover {
  background: #f1f3f4;
  color: #d93025;
}

.attachment-file-icon {
  width: 40px;
  height: 40px;
  border-radius: 0;
  display: grid;
  place-items: center;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.attachment-file-icon-img,
.voice-file-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
  display: block;
}

.selected-file-chip::before {
  content: "";
  width: 16px;
  height: 16px;
  background: url("./fileicons/_page.png") center / contain no-repeat;
  flex: 0 0 16px;
}

.voice-player {
  width: min(430px, 100%);
  min-height: 58px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 12px;
  background: rgba(51, 144, 236, 0.07);
}

.message.out .voice-player {
  background: rgba(82, 185, 97, 0.12);
}

.voice-play-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding-left: 2px;
  color: #fff;
  background: #3fa7e8;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}

.voice-player.playing .voice-play-btn {
  padding-left: 0;
}

.voice-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.voice-wave {
  position: relative;
  height: 26px;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
  cursor: pointer;
}

.voice-wave span {
  width: 3px;
  min-width: 3px;
  border-radius: 999px;
  background: #c6d9e8;
}

.message.out .voice-wave span {
  background: #a8d8a7;
}

.voice-progress {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(63, 167, 232, 0.20), rgba(63, 167, 232, 0.03));
  border-radius: 8px;
}

.message.out .voice-progress {
  background: linear-gradient(90deg, rgba(72, 166, 78, 0.20), rgba(72, 166, 78, 0.03));
}

.voice-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  color: #7a8a79;
  font-size: 12px;
  line-height: 1;
}

.voice-download {
  width: 30px;
  height: 42px;
  display: grid;
  place-items: center;
  opacity: 0.85;
}

.voice-download:hover {
  opacity: 1;
}

/* AUTH, NOTIFICATIONS AND MUTED CONTACTS */
.auth-hidden {
  display: none !important;
}

.login-screen {
  background-color: #eef4f8;
  background-size: auto, 512px 512px;
  overflow-y: auto;
  padding: 24px 0;
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(238, 244, 248, 0.28), rgba(238, 244, 248, 0.28)),
    url("./bg.png?v=talkhub-2");
  background-repeat: repeat, repeat;
}

.login-card {
  width: min(420px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 28px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 24px 70px rgba(20, 48, 75, 0.12);
}

.login-logo {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fff;
  background: var(--tg-blue);
  font-weight: 800;
  font-size: 24px;
}

.login-card h1 {
  margin: 0;
  font-size: 22px;
}

.login-card p {
  margin: -6px 0 4px;
  color: var(--tg-muted);
  font-size: 14px;
  line-height: 1.35;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 600;
}

.login-card input {
  border: 1px solid #dfe3e8;
  outline: 0;
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
  color: #202124;
}

.login-card input:focus {
  border-color: var(--tg-blue);
  box-shadow: 0 0 0 3px rgba(51, 144, 236, 0.14);
}

.login-card button {
  height: 42px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--tg-blue);
  cursor: pointer;
  font-weight: 700;
}

.login-card button:hover {
  background: #2584df;
}

.login-error {
  min-height: 18px;
  color: #d93025;
  font-size: 13px;
}

.settings-grid .settings-wide {
  grid-column: 1 / -1;
}

.dialog-form textarea {
  width: 100%;
  min-height: 94px;
  border: 1px solid #dfe3e8;
  outline: 0;
  border-radius: 9px;
  padding: 10px 11px;
  background: #fff;
  color: #202124;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.4;
}

.dialog-form textarea:focus {
  border-color: var(--tg-blue);
  box-shadow: 0 0 0 3px rgba(51, 144, 236, 0.14);
}

.contact-muted {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: #8b949e;
  font-size: 13px;
  line-height: 1;
  opacity: 0.82;
}

.contact.active .contact-muted {
  color: rgba(255, 255, 255, 0.92);
}

/* TELEGRAM ADD BOT LINK IN CONTACT DIALOG */

.telegram-add-bot-block {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px;
  border: 1px solid rgba(51, 144, 236, 0.22);
  border-radius: 12px;
  background: rgba(51, 144, 236, 0.07);
}

.telegram-add-bot-title {
  color: #111827;
  font-size: 14px;
  font-weight: 700;
}

.telegram-add-bot-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.telegram-add-bot-link-row input {
  min-width: 0;
  background: #fff;
}

.telegram-add-bot-link-row button,
.telegram-add-bot-actions button {
  border: 0;
  border-radius: 9px;
  padding: 9px 11px;
  cursor: pointer;
  color: #202124;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.telegram-add-bot-link-row button:hover:not(:disabled),
.telegram-add-bot-actions button:hover:not(:disabled) {
  color: var(--tg-blue);
  background: #f8fafc;
}

.telegram-add-bot-link-row button:disabled,
.telegram-add-bot-actions button:disabled {
  opacity: 0.58;
  cursor: default;
}

.telegram-add-bot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.telegram-add-bot-actions button:first-child {
  background: var(--tg-blue);
  color: #fff;
}

.telegram-add-bot-actions button:first-child:hover:not(:disabled) {
  background: #2584df;
  color: #fff;
}

.telegram-add-bot-status {
  min-height: 16px;
  color: var(--tg-muted);
  font-size: 12px;
  line-height: 1.35;
}

.telegram-add-bot-status-ok {
  color: #168246;
}

.telegram-add-bot-status-error {
  color: #d93025;
}

/* SETTINGS CLEANUP */
.settings-hidden-fields {
  display: none !important;
}

.settings-form .settings-grid {
  grid-template-columns: 1fr;
}

.settings-form .two-cols {
  grid-template-columns: 1fr;
}

.settings-form .settings-wide {
  grid-column: auto;
}

/* TELEGRAM @MENTIONS */
.composer {
  position: relative;
}

.mention-suggestions {
  position: absolute;
  left: 64px;
  bottom: calc(100% - 4px);
  width: min(360px, calc(100% - 96px));
  max-height: 260px;
  overflow-y: auto;
  z-index: 80;
  padding: 6px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.24);
}

.mention-suggestion {
  width: 100%;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #202124;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 7px 8px;
  text-align: left;
  cursor: pointer;
}

.mention-suggestion:hover,
.mention-suggestion.selected {
  background: rgba(51, 144, 236, 0.10);
}

.mention-suggestion-disabled {
  opacity: 0.55;
  cursor: default;
}

.mention-suggestion-disabled:hover,
.mention-suggestion-disabled.selected {
  background: transparent;
}

.mention-suggestion-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--tg-blue);
  font-weight: 700;
  font-size: 14px;
}

.mention-suggestion-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mention-suggestion-name,
.mention-suggestion-username {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mention-suggestion-name {
  color: #111827;
  font-size: 14px;
  font-weight: 600;
}

.mention-suggestion-username {
  color: var(--tg-muted);
  font-size: 12px;
}

/* MENTION POPUP LAYER FIX
   The mention dropdown is positioned above the composer. The composer used
   overflow:hidden for attachments, so the dropdown was clipped or covered by
   the chat background. Keep the composer above the message background and let
   the dropdown overflow upward. */
.composer {
  position: relative;
  z-index: 120;
  overflow: visible !important;
}

.messages {
  position: relative;
  z-index: 1;
}

.mention-suggestions {
  z-index: 250;
}

/* TalkHub identity */
.login-brand { display: flex; justify-content: center; margin: -8px 0 0; }
.login-brand img { display: block; width: min(300px, 100%); height: auto; }
.login-card h1 { color: #102844; font-size: 22px; line-height: 1.3; letter-spacing: -0.4px; }
.login-card p { margin: 0 0 8px; color: #63768b; line-height: 1.55; }
.login-card input:focus { border-color: #178aaf; box-shadow: 0 0 0 3px rgba(23, 138, 175, 0.12); }
.login-card button { height: 46px; background: #147fa2; }
.login-card button:hover { background: #116d8c; }
.login-card button:focus-visible { outline: 3px solid #77c9dc; outline-offset: 3px; }

.login-screen { background-size: auto, 512px 512px; }
.login-card { background: #ffffff; }


/* Settings connections accordion */
.settings-dialog { max-height: calc(100dvh - 32px); width: min(580px, calc(100vw - 32px)); }
.settings-form { max-height: calc(100dvh - 32px); gap: 12px; }
.settings-intro { margin: 0 0 4px; color: #63768b; font-size: 14px; line-height: 1.5; }
.settings-form .settings-grid { min-height: 0; max-height: none; overflow-y: auto; flex: 1 1 auto; padding-right: 3px; }
.settings-section { border: 1px solid #dfe7ed; border-radius: 12px; background: #fff; }
.settings-section > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 15px; color: #102844; }
.settings-section > summary::-webkit-details-marker { display: none; }
.settings-section > summary::before { content: "›"; font-size: 24px; transition: transform .15s; }
.settings-section[open] > summary::before { transform: rotate(90deg); }
.section-heading { display: flex; flex: 1; flex-direction: column; gap: 4px; font-weight: 650; }
.section-heading small { color: #718096; font-size: 12px; font-weight: 400; }
.help-circle { display: grid; place-items: center; border-radius: 50%; width: 25px; height: 25px; padding: 0; border: 1px solid #bdd0dd; background: #f2f8fb; color: #376b88; font-weight: 700; cursor: pointer; }
.help-circle:focus-visible, .settings-section summary:focus-visible { outline: 2px solid #147fa2; outline-offset: 3px; }
.section-body { display: flex; flex-direction: column; gap: 13px; padding: 0 15px 15px; }
.section-body > p { margin:0; line-height:1.45; }
.section-body .dialog-actions { margin:0; padding:0; justify-content:flex-start; gap:8px; flex-wrap:wrap; }
.section-body [id$="PhoneFields"] > .dialog-actions { margin-top:8px; }
.settings-section > summary .section-heading { min-width:0; }
.settings-help { background: #eef6fa; color: #35566b; border-radius: 9px; padding: 12px; font-size: 13px; line-height: 1.55; }
.settings-help p { margin: 7px 0 0; }
.settings-help a { color: #147fa2; }
.mail-advanced { border-top: 1px solid #e7edf1; padding-top: 10px; }
.mail-advanced > summary { color: #587186; font-size: 13px; cursor: pointer; padding: 4px 0; }
.mail-advanced .section-body { padding: 12px 0 0; }
.settings-form .two-cols { grid-template-columns: minmax(0, 1fr) 100px; }
.connection-note { font-size: 13px; line-height: 1.5; color: #63768b; margin: 0 0 10px; }
.connect-mail-btn { border: 0; border-radius: 9px; background: #147fa2; color: white; padding: 11px 15px; cursor: pointer; }
.connect-mail-btn:disabled { background: #e9eef2; color: #6a7c89; cursor: default; }
.provider-avatar-email { background: #e0eff7; color: #147fa2; }
.provider-avatar-email::before { content: "@"; font-size: 24px; font-weight: 600; }
.settings-form .dialog-actions { flex-shrink: 0; }
@media (max-width: 420px) { .settings-form { padding: 16px; } .settings-form .dialog-actions button { padding: 10px; font-size: 13px; } }

/* Contact creation */
.contact-dialog { width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); }
.contact-form { padding: 22px; gap: 12px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.contact-intro { margin: 6px 0 0; color: #718096; font-size: 13px; line-height: 1.5; }
.contact-form .telegram-add-bot-block { padding: 14px; gap: 10px; border-color: #d7e8f4; background: #f3f8fc; }
.contact-form .telegram-add-bot-title { color: #214962; }
.contact-form .telegram-add-bot-block p { margin: 0; }
.contact-telegram-open { border: 0; border-radius: 9px; background: #147fa2; color: #fff; padding: 11px 13px; font-weight: 600; text-align: center; cursor: pointer; }
.contact-telegram-open:disabled { opacity: .55; cursor: default; }
.contact-link-details > summary { font-size: 12px; color: #587186; cursor: pointer; padding: 3px 0; }
.contact-link-details .field-hint { margin: 9px 0 !important; }
.contact-refresh-link { border: 0; padding: 8px 0 0; font-size: 12px; background: transparent; color: #147fa2; cursor: pointer; }
.contact-form .telegram-add-bot-status { font-size: 12px; line-height: 1.4; }
.contact-error { color: #a83232; font-size: 13px; line-height: 1.5; background: #fff2f2; border-radius: 8px; padding: 10px 12px; }
.contact-form input[aria-invalid="true"] { border-color: #d15555; }
.contact-form .dialog-actions { margin-top: 0; }
.contact-form .dialog-actions button:last-child { background: #147fa2; }
@media (max-width: 420px) { .contact-form { padding: 18px; } }
/* Folders and personal workspace */
.sidebar-toolbar { gap: 6px; }
.sidebar-toolbar .search-box { min-width: 0; }
.sidebar-toolbar .round-btn { flex-shrink: 0; }
.folder-tabs { display: flex; gap: 5px; padding: 8px 10px; overflow-x: auto; flex-shrink: 0; border-bottom: 1px solid #e5ebf2; }
.folder-tab { white-space: nowrap; padding: 7px 11px; border: 0; border-radius: 16px; background: #f0f4f8; color: #516174; font-size: 13px; cursor: pointer; }
.folder-tab.active { background: #e1efff; color: #196bb9; font-weight: 600; }
.folder-tab.drop-target { outline: 2px dashed #328ff0; background: #d5eaff; }
.contact-filters { display: flex; align-items: center; gap: 8px; padding: 7px 10px; font-size: 12px; color: #64748b; }
.contact-filters select { width: auto; min-width: 0; padding: 6px; border: 1px solid #dce4ee; border-radius: 7px; background: white; }
.contact-filters label { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.contact-filters input { width: auto; margin: 0; }
.history-search { max-height: 45%; min-height: 80px; overflow-y: auto; padding: 8px; border-bottom: 1px solid #dce4ee; flex-shrink: 0; }
.search-heading { color: #64748b; font-size: 12px; margin-bottom: 6px; }
.history-result { display: block; width: 100%; text-align: left; padding: 8px; background: #f5f8fc; border: 0; border-radius: 8px; margin-bottom: 5px; cursor: pointer; }
.history-result strong, .history-result span { display: block; overflow-wrap: anywhere; }
.history-result strong { font-size: 13px; color: #26374e; }
.history-result span { font-size: 12px; color: #64748b; margin-top: 3px; white-space: pre-wrap; }
.search-highlight { outline: 3px solid #f4b740; }
.workspace-dialog { width: min(500px, calc(100vw - 24px)); max-height: 85vh; border: 0; border-radius: 16px; padding: 0; overflow: auto; }
.workspace-dialog::backdrop { background: #24354c70; }
.workspace-dialog .dialog-form { padding: 24px; }
.workspace-dialog h3 { margin-top: 0; overflow-wrap: anywhere; }
.folder-manage-row { display: flex; align-items: center; gap: 6px; padding: 9px 0; border-bottom: 1px solid #e5ebf2; }
.folder-manage-row strong { flex: 1; overflow-wrap: anywhere; }
.folder-manage-row button { padding: 6px 8px; }
#folderManageList > button { margin: 12px 6px 0 0; }
.move-contact-list { max-height: 300px; overflow: auto; }
.move-contact-list label { display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 8px 0; }
.move-contact-list input { width: auto; flex-shrink: 0; }
.notes-hint { padding: 10px 12px; background: #fff6d9; color: #826219; font-size: 13px; border-radius: 8px; }
.internal-note { margin-top: 12px; padding: 12px; border-radius: 10px; background: #fff9e9; }
.internal-note small { color: #8c7a54; }
.internal-note p { white-space: pre-wrap; overflow-wrap: anywhere; }
.internal-note button { margin-right: 6px; padding: 6px 10px; }
@media (max-width: 600px) { .sidebar-toolbar { padding-left: 6px; padding-right: 6px; } .contact-filters { flex-wrap: wrap; } .workspace-dialog .dialog-form { padding: 18px; } }
#notesBtn { width: auto; min-width: 76px; padding: 0 10px; font-size: 13px; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 4px; }
.workspace-dialog .contact-error:empty { display: none; }
.workspace-dialog button { border: 0; border-radius: 8px; background: #eef2f6; color: #334155; padding: 9px 12px; cursor: pointer; }
.workspace-dialog button:hover { background: #e2eaf3; }
.workspace-dialog button[type=submit] { background: #328ff0; color: white; }
.workspace-dialog button:disabled { opacity: .5; cursor: default; }
.history-search { max-height: none; flex: 1; min-height: 0; }
/* Single compact folder/filter row */
.sidebar-filter-row { display:flex; align-items:center; gap:6px; padding:7px 8px; border-bottom:1px solid #e5ebf2; flex:0 0 auto; min-width:0; }
.sidebar-filter-row .folder-tabs { flex:1; min-width:0; padding:0; border:0; gap:4px; }
.sidebar-filter-row .folder-tab { height:32px; padding:0 10px; border-radius:10px; font-size:12px; }
.sidebar-filter-row .contact-filters { display:flex; flex-wrap:nowrap; flex:0 0 auto; gap:4px; padding:0; }
.sidebar-filter-row #channelFilter { width:50px; height:32px; padding:0 3px; border:0; border-radius:10px; background:#f0f4f8; color:#516174; font-size:12px; cursor:pointer; }
.sidebar-filter-row #channelFilter:has(option:checked:not([value=""])) { background:#e1efff; color:#196bb9; }
.sidebar-filter-row .unread-toggle { position:relative; display:grid; place-items:center; width:32px; height:32px; border-radius:10px; background:#f0f4f8; color:#516174; cursor:pointer; }
.unread-toggle input { position:absolute; width:1px; height:1px; opacity:0; }
.sidebar-filter-row .unread-toggle:has(input:checked) { background:#e1efff; color:#196bb9; }
.sidebar-filter-row .unread-toggle:has(input:focus-visible), .sidebar-filter-row select:focus-visible { outline:2px solid #328ff0; outline-offset:2px; }
.channel-select-wrap { position:relative; width:50px; height:32px; }
.sidebar-filter-row .channel-select-wrap #channelFilter { appearance:none; color:transparent; padding:0; }
.sidebar-filter-row .channel-select-wrap #channelFilter option { color:#334155; background:white; }
#channelFilterIcon { position:absolute; left:0; top:0; width:35px; height:32px; display:grid; place-items:center; font-size:12px; color:#516174; pointer-events:none; }
.channel-select-wrap:has(option:checked:not([value=""])) #channelFilterIcon { color:#196bb9; }
.channel-select-wrap::after { content:""; position:absolute; right:7px; top:12px; width:5px; height:5px; border-right:1.5px solid #516174; border-bottom:1.5px solid #516174; transform:rotate(45deg); pointer-events:none; }
.channel-select-wrap { width:68px; }
#channelFilterButton { width:68px; height:32px; padding:0 25px 0 12px; border:0; border-radius:10px; background:#f0f4f8; color:#516174; font-size:12px; cursor:pointer; text-align:left; }
#channelFilterButton #channelFilterIcon { position:static; display:inline; width:auto; height:auto; }
.channel-select-wrap::after { right:11px; }
.channel-filter-options { position:absolute; right:0; top:38px; z-index:100; min-width:148px; padding:6px; background:white; border:1px solid #dce4ee; border-radius:12px; box-shadow:0 6px 24px #24354c26; }
.channel-filter-options button { display:block; width:100%; padding:10px 14px; border:0; border-radius:7px; background:transparent; color:#334155; text-align:left; font-size:13px; cursor:pointer; }
.channel-filter-options button[aria-selected=true], .channel-filter-options button:hover, .channel-filter-options button:focus-visible { background:#e1efff; color:#196bb9; outline:none; }
#channelFilterButton:focus-visible { outline:2px solid #328ff0; outline-offset:2px; }
.manage-folders-btn { margin-right:auto; border:0; background:transparent; color:#64748b; font-size:12px; padding:6px 8px; cursor:pointer; border-radius:8px; }
.manage-folders-btn:hover { background:#f0f4f8; }
.contact-folder { margin:3px 0; }
.contact-folder-heading { list-style:none; display:flex; align-items:center; gap:9px; min-height:49px; padding:7px 10px; color:#334155; cursor:pointer; border-radius:9px; user-select:none; }
.contact-folder-heading::-webkit-details-marker { display:none; }
.contact-folder-heading:hover { background:#f0f5fa; }
.folder-chevron { font-size:23px; color:#8c9bab; transition:transform .15s; flex-shrink:0; }
.contact-folder[open] > summary .folder-chevron { transform:rotate(90deg); }
.contact-folder-icon { display:grid; place-items:center; width:33px; height:33px; background:#e8f2ff; color:#328ff0; border-radius:9px; flex-shrink:0; }
.contact-folder-name { font-weight:600; font-size:14px; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.contact-folder-count { font-size:12px; color:#8c9bab; }
.folder-inline-menu { border:0; background:transparent; color:#64748b; font-size:19px; padding:4px 6px; cursor:pointer; }
.contact-folder-contents { margin-left:16px; border-left:1px solid #e2eaf3; padding-left:4px; }
.folder-empty { padding:10px 12px; color:#8c9bab; font-size:12px; }
.unfiled-label { padding:13px 12px 5px; font-size:11px; color:#8c9bab; }
.contact-folder-heading.drop-target { outline:2px dashed #328ff0; background:#e1efff; }
.contact-folder-heading:focus-visible { outline:2px solid #328ff0; outline-offset:-2px; }

.emoji-picker { position:fixed; z-index:120; width:min(344px, calc(100vw - 16px)); padding:12px; background:white; border:1px solid #dce4ee; border-radius:16px; box-shadow:0 8px 32px #24354c30; overflow:auto; }
.emoji-picker-title { display:flex; align-items:center; justify-content:space-between; color:#08245d; font-weight:600; margin-bottom:8px; }
.emoji-picker-title button { border:0; background:transparent; color:#64748b; font-size:24px; cursor:pointer; }
.emoji-tabs { display:flex; gap:4px; margin-bottom:10px; }
.emoji-tabs button { flex:1; border:0; border-radius:8px; padding:7px 3px; background:#f0f4f8; color:#516174; font-size:12px; cursor:pointer; }
.emoji-tabs button[aria-pressed=true] { background:#e1efff; color:#196bb9; }
.emoji-grid { display:grid; grid-template-columns:repeat(8, minmax(0,1fr)); gap:3px; }
.emoji-grid button { border:0; background:transparent; min-height:36px; border-radius:8px; font:24px 'Segoe UI Emoji','Apple Color Emoji',sans-serif; cursor:pointer; padding:3px 0; }
.emoji-grid button:hover,.emoji-grid button:focus-visible { background:#e1efff; outline:2px solid #328ff0; }
#personalMaxSection button { border:0; border-radius:9px; padding:10px 14px; background:#328ff0; color:white; font:inherit; cursor:pointer; }
#personalMaxSection button:disabled { background:#eef2f6; color:#8c9bab; cursor:default; }
#personalMaxSection #personalMaxQrLogin { background:#e1efff; color:#196bb9; }
#personalMaxQrImage { display:block; max-width:100%; height:auto; margin:12px auto; }
.personal-max-selection { padding:8px 0 12px; border-bottom:1px solid #e5ebf2; margin-bottom:10px; }
.personal-max-selection label { display:flex; flex-direction:row; align-items:center; gap:9px; padding:5px 0; font-size:13px; }
.personal-max-selection input { width:auto; margin:0; flex-shrink:0; }
.personal-max-type-filter { display:flex; align-items:center; gap:10px; margin:10px 0; }
.personal-max-type-filter select { flex:1; min-width:0; padding:9px 12px; border:1px solid #dce4ee; border-radius:9px; background:white; font:inherit; }
#personalMaxFilterCount { font-size:12px; color:#718096; white-space:nowrap; }
#personalMaxChatList label[hidden] { display:none; }
.real-avatar { overflow:hidden; border-radius:50%; }
.real-avatar img { width:100%; height:100%; object-fit:cover; display:block; }

@font-face { font-family:Roboto; src:url('fonts/Roboto-variable.ttf') format('truetype'); font-weight:100 900; font-style:normal; font-display:swap; }
body { font-family:Roboto,Arial,sans-serif; font-size:15px; }
button,input,textarea,select { font-family:inherit; }
.contact-name,.contact.active .contact-name { font-size:16px; font-weight:400; }
.last-message { font-size:14px; line-height:20px; }
.message .message-text { font-size:16px; line-height:21px; }
.message-sender { font-size:12px; }
.message-time { font-size:11px; display:flex; justify-content:flex-end; align-items:center; gap:5px; }
.composer textarea { font-size:16px; }
.dialog-form label,.settings-intro,.field-hint { font-size:14px; }
.chat-title { font-size:16px; }
.provider-indicator { display:inline-block; width:20px; height:20px; border-radius:50%; flex:0 0 20px; background-size:cover; background-position:center; }
.provider-indicator.provider-avatar-email { background-image:url('mailru.png'); }
.provider-indicator.provider-avatar-email::before { content:none; }
.message-receipt { font-size:12px; letter-spacing:-3px; padding-right:3px; color:#8f9bab; }
.message-receipt.is-read { color:#169bd5; }
.message-text strong { font-weight:700; }
.message-text code { font-family:Consolas,monospace; background:#eef2f5; border-radius:3px; padding:0 2px; }
.message-text a { color:#1688ca; text-decoration:underline; }
.image-gallery { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:3px; width:360px; max-width:100%; border-radius:10px; overflow:hidden; }
.image-gallery.single { display:block; width:fit-content; max-width:100%; }
.gallery-tile { position:relative; padding:0; border:0; background:#edf2f5; aspect-ratio:1; cursor:zoom-in; overflow:hidden; }
.image-gallery.single .gallery-tile { display:block; aspect-ratio:auto; max-width:100%; background:transparent; }
.gallery-tile img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.image-gallery.single .gallery-tile img { position:static; display:block; width:auto; height:auto; max-width:min(320px,100%); max-height:480px; object-fit:contain; }
.message:has(.image-gallery.single) { width:fit-content; max-width:min(360px,85%); }
.message-date-separator { align-self:center; flex:0 0 auto; margin:10px 0; padding:5px 12px; border-radius:16px; background:#4f8096c9; color:#fff; font-size:13px; line-height:1.3; text-align:center; box-shadow:0 1px 3px #153f5220; }
.gallery-more { position:absolute; inset:0; display:grid; place-items:center; background:#0007; color:white; font-size:28px; }
.message:has(.image-gallery) { width:380px; max-width:85%; }
#imageViewer { position:fixed; inset:0; width:100vw; height:100dvh; max-width:none; max-height:none; margin:0; padding:0; border:0; background:#16212bed; color:white; }
#imageViewer::backdrop { background:#000c; }
.viewer-top { position:absolute; top:0; left:0; right:0; display:flex; justify-content:center; align-items:center; height:50px; background:#0004; z-index:2; }
#viewerClose { position:absolute; right:16px; top:7px; font-size:28px; }
#imageViewer button,#imageViewer a { border:0; background:#0004; color:white; border-radius:8px; padding:8px 12px; font:inherit; cursor:pointer; text-decoration:none; }
#imageViewer button:disabled { opacity:.3; cursor:default; }
.viewer-stage { position:absolute; inset:52px 60px 115px; overflow:auto; }
#viewerCanvas { min-width:100%; min-height:100%; display:grid; place-items:center; }
#viewerImage { display:block; max-width:none; max-height:none; object-fit:contain; }
.viewer-arrow { position:absolute; top:45%; z-index:2; font-size:36px!important; }
.viewer-arrow.previous { left:10px; }.viewer-arrow.next { right:10px; }
.viewer-bottom { position:absolute; bottom:10px; left:16px; right:16px; text-align:center; }
#viewerCaption { max-width:800px; margin:0 auto 8px; max-height:40px; overflow:auto; font-size:14px; }
.viewer-controls { display:flex; justify-content:center; gap:8px; align-items:center; flex-wrap:wrap; }
#viewerSender { max-width:200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
@media(max-width:600px){.viewer-stage{left:8px;right:8px;bottom:145px}.viewer-bottom{left:5px;right:5px}.viewer-controls{gap:3px;font-size:12px}#viewerSender{display:none}.viewer-arrow{background:#0008!important}.message:has(.image-gallery){max-width:95%}}

#personalTelegramSection button { border:0; border-radius:9px; padding:10px 14px; background:#328ff0; color:white; font:inherit; cursor:pointer; }
#personalTelegramSection button:disabled { background:#eef2f6; color:#8c9bab; cursor:default; }
#personalTelegramSection #personalTelegramQrLogin { background:#e1efff; color:#196bb9; }
#personalTelegramQrImage { display:block; max-width:100%; height:auto; margin:12px auto; }

#personalTelegramFilterCount{font-size:12px;color:#718096;white-space:nowrap}#personalTelegramChatList label[hidden]{display:none}

#personalWhatsappSection button { border:0; border-radius:9px; padding:10px 14px; background:#328ff0; color:white; font:inherit; cursor:pointer; }
#personalWhatsappSection button:disabled { background:#eef2f6; color:#8c9bab; cursor:default; }
#personalWhatsappSection #personalWhatsappQrLogin { background:#e1efff; color:#196bb9; }
#personalWhatsappQrImage { display:block; max-width:100%; height:auto; margin:12px auto; }
#personalWhatsappFilterCount{font-size:12px;color:#718096;white-space:nowrap}#personalWhatsappChatList label[hidden]{display:none}
.provider-avatar-whatsapp { background:#25d366 url("whatsapp.svg") center/cover no-repeat; }
.message { max-width:min(520px,85%); }
.message-text blockquote { margin:4px 0; padding:5px 9px; border-left:3px solid #60a3b1; border-radius:4px; background:#dceef077; }
.message-action-menu { position:absolute; right:5px; top:3px; z-index:10; }
.message-action-menu > summary { list-style:none; cursor:pointer; color:#6b8092; padding:0 6px; font-size:22px; line-height:24px; }
.message-action-menu > summary::-webkit-details-marker { display:none; }
.message-action-menu > div { position:absolute; top:25px; right:0; min-width:160px; background:white; border:1px solid #dfe7ed; border-radius:10px; padding:5px; box-shadow:0 4px 18px #20304022; }
.message-action-menu button { display:block; width:100%; text-align:left; border:0; padding:9px 12px; background:white; border-radius:6px; cursor:pointer; font:inherit; color:#203040; }
.message-action-menu button:hover { background:#edf5fc; }
.message:has(.message-action-menu) .message-sender { padding-right:25px; }
.message.is-deleted { color:#a4abb3; background:#f4f6f7; }
.message.is-deleted .message-text,.message.is-deleted .message-text a,.message.is-deleted .message-sender,.message.is-deleted .message-reply-quote { color:#a4abb3!important; }
.message.is-deleted .message-attachments { opacity:.45; filter:grayscale(1); }
.message-deleted-label { font-size:12px; color:#a4abb3; font-style:italic; margin-top:5px; }
#messageActionText { width:100%; resize:vertical; min-height:140px; font:inherit; padding:10px; border:1px solid #d9e2eb; border-radius:9px; }
.folder-dragging { opacity:.5; }
.unfiled-drop-target { padding:10px 12px; border-radius:8px; min-height:36px; }
.unfiled-drop-target.drop-target { background:#e5f2ff; outline:2px dashed #328ff0; }
.personal-contact-search { margin:0 0 12px; }

#personalVkSection button { border:0; border-radius:9px; padding:10px 14px; background:#328ff0; color:white; font:inherit; cursor:pointer; }
#personalVkSection button:disabled { background:#eef2f6; color:#8c9bab; cursor:default; }
#personalVkSection #personalVkLogin { background:#e1efff; color:#196bb9; }
#personalVkQrImage { display:block; max-width:100%; height:auto; margin:12px auto; }
#personalVkFilterCount{font-size:12px;color:#718096;white-space:nowrap}#personalVkChatList label[hidden]{display:none}
.provider-avatar-vk { background:#0077ff url("vk.svg") center/cover no-repeat; }

.attachment-cache-removed{display:flex;flex-direction:column;align-items:flex-start;gap:7px;padding:10px;border:1px solid #d9e3eb;border-radius:8px;color:#778695;font-size:13px}.attachment-cache-removed .attachment-file{display:flex;flex-direction:column;align-items:flex-start;gap:4px;padding:0;background:transparent}.attachment-cache-removed button{border:0;border-radius:7px;padding:7px 11px;background:#e2efff;color:#1675c5;cursor:pointer}.attachment-cache-removed button:disabled{opacity:.5;cursor:wait}.attachment-restore-error{color:#ad4747;white-space:normal;overflow-wrap:anywhere}
