/* ==========================================================================
   X MESSENGER: PURE OLED BLACK THEME & TELEGRAM DESKTOP SETTINGS SYSTEM
   ========================================================================== */

:root {
  /* Complete Pure Black / OLED Midnight Palette */
  --bg-app: #08090B;               /* Истинно глубокий темный фон */
  --bg-sidebar: #0D0E11;           /* Сайдбар */
  --bg-chat: #08090B;              /* Основной чат */
  --bg-chat-header: #0D0E11;       /* Шапка чата */
  --bg-input: #141519;             /* Поле ввода */
  --bg-hover: #17181E;             /* Наведение */
  --bg-active: #20222A;            /* Выбранный элемент */
  --bg-modal: #0E0F13;             /* Модальные окна */
  --bg-section: #121318;           /* Секции настроек */
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-focus: rgba(88, 101, 242, 0.6);
  
  /* Brand Accents */
  --brand-blurple: #5865F2;        /* Фирменный Blurple */
  --brand-blurple-hover: #4752C4;
  --bubble-outgoing: #5865F2;      /* Исходящие бабблы */
  --bubble-incoming: #131418;      /* Входящие бабблы */
  --bubble-incoming-border: rgba(255, 255, 255, 0.08);

  /* Telegram UI Metrics */
  --tg-blue: #2AABEE;
  --tg-check: #A5B3FF;
  
  /* Text Shades */
  --text-primary: #FFFFFF;
  --text-normal: #D8DAE0;
  --text-muted: #7E828D;
  --text-dim: #545761;

  /* Status Colors */
  --status-online: #23A55A;
  --status-idle: #F0B232;
  --status-dnd: #F23F43;

  /* Elevation */
  --shadow-bubble: 0 2px 6px rgba(0, 0, 0, 0.5);
  --shadow-drawer: -6px 0 28px rgba(0, 0, 0, 0.7);
  --shadow-dropdown: 0 8px 28px rgba(0, 0, 0, 0.65);
}

body.theme-graphite {
  --bg-app: #14161a;
  --bg-sidebar: #1b1d22;
  --bg-chat: #14161a;
  --bg-chat-header: #1b1d22;
  --bg-input: #21242b;
  --bg-hover: #282c34;
  --bg-active: #323742;
  --bg-modal: #1b1d22;
  --bg-section: #21242b;
  --bubble-incoming: #21242b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-normal);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Vector Icons System */
.ui-icon {
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

/* Telegram Master Grid Layout (Left: 340px, Right: 1fr) */
.telegram-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: 100vh;
  width: 100vw;
  background-color: var(--bg-app);
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   LEFT PANEL: CHATS LIST & SEARCH
   ========================================================================== */
.chat-list-panel {
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
}

.panel-header {
  height: 56px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-sidebar);
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.icon-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.search-input-wrapper {
  flex: 1;
  background-color: var(--bg-input);
  border-radius: 20px;
  height: 38px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 10px;
  border: 1px solid var(--border-subtle);
  transition: border-color 0.2s, background-color 0.2s;
}

.search-input-wrapper:focus-within {
  border-color: var(--brand-blurple);
  background-color: #050608;
}

.search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input-wrapper input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13.5px;
  width: 100%;
}

.search-input-wrapper input::placeholder {
  color: var(--text-muted);
}

.clear-search-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
}

/* Telegram Folder Pills Bar */
.chat-folders-bar {
  display: flex;
  padding: 0 12px 8px 12px;
  gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.folder-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.folder-tab:hover {
  background-color: var(--bg-hover);
  color: var(--text-normal);
}

.folder-tab.active {
  background-color: var(--bg-active);
  color: var(--text-primary);
}

/* Chats Stream */
.chats-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  position: relative;
}

.chat-item:hover {
  background-color: var(--bg-hover);
}

.chat-item.active {
  background-color: var(--brand-blurple);
}

.chat-avatar-box {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 18px;
}

.saved-avatar {
  background: linear-gradient(135deg, #5865F2, #2AABEE);
  color: white;
}

.channel-avatar {
  background: #1C1E24;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.chat-item.active .channel-avatar {
  background: rgba(255, 255, 255, 0.2);
  border-color: transparent;
}

.chat-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.chat-item-title {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item.active .chat-item-title {
  color: #FFFFFF;
}

.chat-item-time {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.chat-item.active .chat-item-time {
  color: rgba(255, 255, 255, 0.85);
}

.chat-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.chat-item.active .chat-item-preview {
  color: rgba(255, 255, 255, 0.85);
}

.unread-count {
  background-color: var(--status-dnd);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  flex-shrink: 0;
}

.chat-item.active .unread-count {
  background-color: white;
  color: var(--brand-blurple);
}

/* Floating Action Button (FAB) */
.new-chat-fab {
  position: absolute;
  bottom: 46px;
  right: 18px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--brand-blurple);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(88, 101, 242, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s;
  z-index: 10;
}

.new-chat-fab:hover {
  transform: scale(1.08);
  background-color: var(--brand-blurple-hover);
}

/* Bottom Connection Bar */
.network-status-bar {
  padding: 9px 14px;
  background-color: var(--bg-app);
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s;
}

.network-status-bar:hover {
  background-color: var(--bg-hover);
}

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

.status-indicator-dot.online {
  background-color: var(--status-online);
  box-shadow: 0 0 8px var(--status-online);
}

/* ==========================================================================
   RIGHT/MAIN CONVERSATION PANEL
   ========================================================================== */
.conversation-panel {
  background-color: var(--bg-chat);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.conversation-header {
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-chat-header);
  z-index: 5;
}

.header-profile-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background-color 0.15s;
}

.header-profile-meta:hover {
  background-color: var(--bg-hover);
}

.header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5865F2, #2AABEE);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.header-titles {
  display: flex;
  flex-direction: column;
}

.header-chat-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-chat-status {
  font-size: 12px;
  color: var(--text-muted);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Dropdown Menu */
.dropdown-wrapper {
  position: relative;
}

.context-dropdown-menu {
  position: absolute;
  top: 42px;
  right: 0;
  width: 220px;
  background-color: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 6px;
  box-shadow: var(--shadow-dropdown);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-item {
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text-normal);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background-color 0.15s;
}

.menu-item-icon {
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--text-muted);
  flex-shrink: 0;
}

.menu-item:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

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

.menu-item.danger {
  color: var(--status-dnd);
}

.menu-item.danger .menu-item-icon {
  color: var(--status-dnd);
}

.menu-item.danger:hover {
  background-color: rgba(242, 63, 67, 0.15);
}

.menu-separator {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 4px 0;
}

/* In-Chat Search Bar Overlay */
.inchat-search-bar {
  background-color: var(--bg-sidebar);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 6;
  animation: slideDown 0.15s ease;
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

.inchat-search-bar input {
  flex: 1;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px 12px;
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
}

.search-counter {
  font-size: 12px;
  color: var(--text-muted);
}

.close-inchat-search {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}

/* Messages Stream */
.bubbles-stream {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.date-pill {
  align-self: center;
  background-color: rgba(20, 21, 26, 0.85);
  border: 1px solid var(--border-subtle);
  padding: 4px 14px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Telegram Message Bubble Architecture */
.bubble-row {
  display: flex;
  width: 100%;
  animation: bubblePop 0.15s ease-out;
  position: relative;
}

.bubble-row:hover .bubble-actions {
  display: flex;
}

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

.bubble-row.outgoing {
  justify-content: flex-end;
}

.bubble-row.incoming {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 68%;
  min-width: 90px;
  padding: 8px 12px 6px 12px;
  position: relative;
  box-shadow: var(--shadow-bubble);
  word-break: break-word;
  user-select: text;
}

.bubble-row.outgoing .message-bubble {
  background-color: var(--bubble-outgoing);
  color: #FFFFFF;
  border-radius: 16px 16px 4px 16px;
}

.bubble-row.incoming .message-bubble {
  background-color: var(--bubble-incoming);
  color: var(--text-primary);
  border: 1px solid var(--bubble-incoming-border);
  border-radius: 16px 16px 16px 4px;
}

.bubble-sender-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--tg-blue);
  margin-bottom: 3px;
}

.bubble-text {
  font-size: 14px;
  line-height: 1.45;
  display: inline;
}

.bubble-image-preview {
  max-width: 100%;
  max-height: 280px;
  border-radius: 10px;
  margin-top: 4px;
  display: block;
  object-fit: cover;
}

.bubble-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  float: right;
  margin-left: 10px;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1;
}

.bubble-row.outgoing .bubble-meta {
  color: var(--tg-check);
}

.bubble-row.incoming .bubble-meta {
  color: var(--text-muted);
}

.check-icon {
  width: 14px;
  height: 14px;
}

.bubble-actions {
  display: none;
  position: absolute;
  top: -10px;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 3px 6px;
  gap: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.bubble-row.outgoing .bubble-actions {
  right: 12px;
}

.bubble-row.incoming .bubble-actions {
  left: 12px;
}

.bubble-act-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: 4px;
}

.bubble-act-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

/* Voice Message Bubble */
.voice-bubble-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}

.voice-play-trigger {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.15);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s;
}

.voice-play-trigger:hover {
  transform: scale(1.08);
}

.voice-waveform-strip {
  display: flex;
  align-items: center;
  gap: 2.5px;
  height: 22px;
  flex: 1;
}

.voice-waveform-strip span {
  width: 2.5px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 2px;
}

.voice-bubble-wrapper.playing .voice-waveform-strip span {
  animation: wavePulse 0.8s infinite alternate;
}

@keyframes wavePulse {
  from { transform: scaleY(0.4); }
  to { transform: scaleY(1); }
}

/* Voice Recording Bar */
.voice-recording-overlay-bar {
  background-color: var(--bg-sidebar);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  animation: slideUp 0.15s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.voice-recording-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.recording-red-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--status-dnd);
  animation: blinkRed 1s infinite;
}

@keyframes blinkRed {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.85); }
}

.recording-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.recording-tip {
  font-size: 13px;
  color: var(--text-muted);
}

.voice-recording-actions {
  display: flex;
  gap: 12px;
}

.btn-cancel-voice {
  background: none;
  border: none;
  color: var(--status-dnd);
  font-weight: 600;
  cursor: pointer;
}

.btn-send-voice {
  background-color: var(--brand-blurple);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

/* Telegram Bottom Input Pill */
.conversation-input-bar {
  padding: 0 24px 20px 24px;
  position: relative;
}

.input-container-pill {
  max-width: 760px;
  margin: 0 auto;
  background-color: var(--bg-input);
  border-radius: 16px;
  display: flex;
  align-items: center;
  padding: 6px 12px;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
}

.tool-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
  flex-shrink: 0;
}

.tool-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-hover);
}

#messageTextInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14.5px;
  resize: none;
  max-height: 120px;
  padding: 6px 0;
  font-family: inherit;
  user-select: text;
}

#messageTextInput::placeholder {
  color: var(--text-muted);
}

.emoji-wrapper {
  position: relative;
}

.emoji-picker-box {
  position: absolute;
  bottom: 46px;
  right: 0;
  width: 280px;
  background-color: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px;
  box-shadow: var(--shadow-dropdown);
  z-index: 50;
}

.emoji-tabs {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.emojis-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.emoji-choice-btn {
  background: none;
  border: none;
  font-size: 20px;
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.1s, transform 0.1s;
}

.emoji-choice-btn:hover {
  background-color: var(--bg-hover);
  transform: scale(1.2);
}

.send-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--brand-blurple);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background-color 0.15s;
  flex-shrink: 0;
}

.send-action-btn:hover {
  background-color: var(--brand-blurple-hover);
  transform: scale(1.05);
}

/* ==========================================================================
   RIGHT SLIDE-IN CHAT INFO DRAWER
   ========================================================================== */
.chat-info-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-drawer);
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.chat-info-drawer.open {
  transform: translateX(0);
}

.drawer-profile-header {
  background: linear-gradient(135deg, #2AABEE, #1a8cc7);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.drawer-header-actions {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
}

.drawer-edit-btn, .close-drawer-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  opacity: 0.8;
}

.drawer-edit-btn:hover, .close-drawer-btn:hover {
  opacity: 1;
}

.drawer-large-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  margin-bottom: 12px;
  font-size: 32px;
  font-weight: bold;
}

#drawerTitle {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

#drawerSubtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  gap: 6px;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
}
.status-online .online-dot {
  background-color: var(--status-online);
}

.drawer-body {
  padding: 24px 16px;
  overflow-y: auto;
  flex: 1;
}

.drawer-details-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background-color: var(--bg-app);
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.detail-val {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.detail-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

.drawer-actions-section {
  margin-top: 24px;
}

.drawer-action-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.drawer-action-btn.danger {
  background-color: rgba(242, 63, 67, 0.12);
  color: var(--status-dnd);
}

.drawer-action-btn.danger:hover {
  background-color: rgba(242, 63, 67, 0.2);
}

/* ==========================================================================
   HAMBURGER SIDE DRAWER
   ========================================================================== */
.hamburger-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 100;
}

.hamburger-menu-pane {
  width: 290px;
  height: 100vh;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-drawer);
  animation: slideInLeft 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

.hamburger-user-header {
  padding: 22px 18px 16px 18px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.hamburger-header-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.user-avatar-header {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4A56E2, #7289DA);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 22px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.user-avatar-header:hover {
  transform: scale(1.03);
}

.hamburger-theme-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.18s, color 0.18s, transform 0.15s;
}

.hamburger-theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFD166;
  transform: rotate(15deg);
}

.hamburger-theme-toggle-btn:active {
  transform: scale(0.92);
}

.user-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-header-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-header-info h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  line-height: 1.25;
}

.user-header-info p#profileDisplayHandle {
  font-size: 13.5px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.2;
}

.hamburger-account-arrow-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s, background-color 0.15s, transform 0.25s ease;
}

.hamburger-account-arrow-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.08);
}

.hamburger-account-arrow-btn.collapsed svg {
  transform: rotate(180deg);
}

/* ==========================================================================
   НОВОЕ ОКНО СО 2-ГО ФОТО (ACCOUNTS / SESSIONS CARD IN PURE OLED PALETTE)
   ========================================================================== */
.hamburger-accounts-window {
  margin: 10px 10px 6px 10px;
  background-color: #0e0f13;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.hamburger-accounts-window.collapsed {
  display: none;
}

.accounts-window-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 180px;
  overflow-y: auto;
}

.account-item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  background-color: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.account-item-card:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.account-item-card.active {
  background-color: rgba(88, 101, 242, 0.12);
  border: 1px solid rgba(88, 101, 242, 0.35);
}

.account-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4A56E2, #7289DA);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.account-item-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.account-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-item-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-item-badge {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-add-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--brand-blurple);
  font-size: 13.5px;
  font-weight: 600;
  margin-top: 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.account-add-row:hover {
  background-color: rgba(88, 101, 242, 0.12);
  color: #7289DA;
}

.account-add-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(88, 101, 242, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--brand-blurple);
}

.hamburger-nav-list {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
}

.hamburger-item {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 44px;
  padding: 0 14px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-normal);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.hamburger-item:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.hamburger-item:active {
  background-color: var(--bg-active);
}

.hamb-icon-svg {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color 0.15s ease, transform 0.15s ease;
}

.hamburger-item:hover .hamb-icon-svg {
  color: var(--text-primary);
  transform: scale(1.05);
}

.hamburger-divider {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 6px 10px;
}

.hamburger-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}

/* ==========================================================================
   AUTHENTIC TELEGRAM DESKTOP SETTINGS MODAL WINDOW
   ========================================================================== */
.tg-settings-window {
  width: 450px;
  height: 620px;
  max-height: 90vh;
  background-color: var(--bg-modal);
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScale 0.18s ease-out;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.tg-settings-header {
  height: 54px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-sidebar);
}

.tg-header-back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: background-color 0.15s;
}

.tg-header-back-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.tg-settings-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

/* Settings Viewport & Slide Pages */
.tg-settings-viewport {
  flex: 1;
  overflow-y: auto;
  position: relative;
  background-color: var(--bg-app);
}

.settings-page {
  display: none;
  padding: 16px;
  animation: fadeInPage 0.15s ease-out;
}

.settings-page.active {
  display: block;
}

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

/* Profile Summary Card */
.tg-profile-summary-card {
  background-color: var(--bg-section);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  margin-bottom: 16px;
  transition: background-color 0.15s;
}

.tg-profile-summary-card:hover {
  background-color: var(--bg-hover);
}

.tg-card-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--brand-blurple);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  flex-shrink: 0;
}

.tg-card-info {
  flex: 1;
  min-width: 0;
}

.tg-card-info h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.tg-card-email {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.tg-card-username {
  font-size: 12px;
  color: var(--tg-blue);
  font-family: 'JetBrains Mono', monospace;
}

.tg-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Telegram Menu Group Rows */
.tg-menu-group {
  background-color: var(--bg-section);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tg-menu-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background-color 0.15s;
}

.tg-menu-row:last-child {
  border-bottom: none;
}

.tg-menu-row:hover {
  background-color: var(--bg-hover);
}

.tg-menu-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.tg-menu-row:hover .tg-menu-icon {
  color: var(--text-primary);
}

.tg-star-icon {
  color: #F1C40F !important;
}

.tg-menu-label {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-normal);
}

.tg-menu-value {
  font-size: 13px;
  color: var(--text-muted);
  margin-right: 6px;
}

.tg-settings-footer-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 0 10px 0;
}

.tg-footer-link {
  font-size: 12.5px;
  color: var(--brand-blurple);
  cursor: pointer;
}

.tg-footer-link:hover {
  text-decoration: underline;
}

/* Subpage Form Styles */
.tg-category-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  margin: 16px 0 8px 4px;
}

.tg-category-title:first-child {
  margin-top: 0;
}

.tg-section-box {
  background-color: var(--bg-section);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  padding: 14px 16px;
}

.tg-field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.tg-text-input {
  width: 100%;
  height: 40px;
  background-color: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.tg-text-input:focus {
  border-color: var(--brand-blurple);
}

.tg-textarea-input {
  width: 100%;
  background-color: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  resize: none;
}

.tg-textarea-input:focus {
  border-color: var(--brand-blurple);
}

.tg-prefix-input-wrap {
  display: flex;
  align-items: center;
  background-color: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
}

.tg-prefix-input-wrap:focus-within {
  border-color: var(--brand-blurple);
}

.tg-input-prefix {
  padding-left: 12px;
  color: var(--text-muted);
  font-weight: 700;
}

.tg-prefix-input-wrap .tg-text-input {
  border: none;
  background: transparent;
}

.tg-input-hint {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.tg-save-action-btn {
  width: 100%;
  margin-top: 20px;
  padding: 12px;
  background-color: var(--brand-blurple);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s;
}

.tg-save-action-btn:hover {
  background-color: var(--brand-blurple-hover);
}

/* Telegram Switch Toggles */
.tg-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.tg-toggle-row:last-child {
  border-bottom: none;
}

.tg-toggle-row p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.tg-sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 13.5px;
  font-weight: 500;
}

.tg-sub-row:last-child {
  border-bottom: none;
}

.tg-sub-value {
  color: var(--text-muted);
  font-size: 13px;
}

.tg-switch {
  appearance: none;
  width: 40px;
  height: 22px;
  background-color: #262832;
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  outline: none;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.tg-switch::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: white;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
}

.tg-switch:checked {
  background-color: var(--brand-blurple);
}

.tg-switch:checked::before {
  transform: translateX(18px);
}

.tg-radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
}

/* Theme choices */
.theme-palette-choices {
  display: flex;
  gap: 12px;
}

.theme-chip {
  flex: 1;
  background-color: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.theme-chip.active {
  border-color: var(--brand-blurple);
  background-color: rgba(88, 101, 242, 0.1);
}

.chip-preview {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.chip-preview.oled { background-color: #08090B; }
.chip-preview.graphite { background-color: #212328; }
.chip-preview.blurple { background-color: #5865F2; }

/* Folders list in settings */
.tg-page-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.tg-folder-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.tg-folder-item-row:last-child {
  border-bottom: none;
}

.tg-tag-pill {
  font-size: 11px;
  font-weight: 700;
  background-color: var(--bg-app);
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--text-muted);
}

.tg-tag-pill.active {
  color: var(--status-online);
}

/* Premium Hero Card */
.premium-hero-card {
  background: linear-gradient(135deg, #1C1528, #0E0F14);
  border: 1px solid rgba(241, 196, 15, 0.3);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}

.premium-star-badge {
  width: 50px;
  height: 50px;
  margin: 0 auto 12px auto;
  border-radius: 50%;
  background: #F1C40F;
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
}

.premium-hero-card h2 {
  font-size: 18px;
  color: #FFFFFF;
}

.premium-hero-card p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ==========================================================================
   CALL OVERLAY & MODALS
   ========================================================================== */
.call-overlay-screen {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.call-box {
  background-color: var(--bg-modal);
  width: 360px;
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
}

.call-avatar-pulse-container {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 16px auto;
}

.call-avatar-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5865F2, #2AABEE);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  position: relative;
  z-index: 2;
}

.pulse-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--status-online);
  animation: ringExpand 2s infinite ease-out;
}

@keyframes ringExpand {
  0% { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

.call-timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--status-online);
  margin-top: 4px;
}

.call-control-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 28px;
}

.call-btn-circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background-color: var(--bg-hover);
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.call-btn-circle:hover {
  transform: scale(1.1);
}

.call-btn-circle.muted {
  background-color: var(--status-dnd);
}

.call-btn-circle.end-call {
  background-color: var(--status-dnd);
  width: auto;
  border-radius: 24px;
  padding: 0 20px;
  font-size: 13.5px;
  font-weight: 700;
  gap: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-window {
  width: 440px;
  background-color: var(--bg-modal);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
  border: 1px solid var(--border-subtle);
}

.modal-header {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
}

.modal-body {
  padding: 18px 20px;
}

.modal-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.modal-input {
  width: 100%;
  height: 40px;
  background-color: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.modal-input:focus {
  border-color: var(--brand-blurple);
}

.chat-type-selector {
  display: flex;
  gap: 10px;
}

.radio-chip {
  flex: 1;
  padding: 10px;
  background-color: var(--bg-app);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-subtle);
}

.radio-chip:has(input:checked) {
  border-color: var(--brand-blurple);
  color: var(--text-primary);
  background-color: rgba(88, 101, 242, 0.12);
}

.modal-footer {
  padding: 14px 20px;
  background-color: var(--bg-app);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn {
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

.btn-secondary {
  background: none;
  color: var(--text-normal);
}

.btn-secondary:hover {
  text-decoration: underline;
}

.btn-primary {
  background-color: var(--brand-blurple);
  color: white;
}

.btn-primary:hover {
  background-color: var(--brand-blurple-hover);
}
.message-media {
  border-radius: 10px;
  overflow: hidden;
}
.message-image {
  max-width: 240px;
}
.message-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}
