/* =============================================
   Chat middle
   ============================================= */
   .chat-middle {
	padding: 0 !important;
	display: flex !important;
	flex-direction: column !important;
	overflow: hidden !important;
	position: relative;
	/* Фон чата — на НЕпрокручиваемом контейнере (подложка), а не на самой ленте .chat-messages.
	   Раньше фон-картинка висела на скроллере: браузер перерисовывал ленту при каждом скроле и
	   слои рассинхронивались (бирка с номером файла «отставала»). Теперь фон рисуется один раз,
	   лента прокручивается прозрачно поверх — скролл легче и без рывков. Тайл бесшовный, так что
	   визуально всё как было. */
	background-image: url('/assets/chat-backgr-07-03.png');
	background-repeat: repeat;
	background-size: 400px;
  }
  
  .chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 12px 12px 8px;
	display: flex;
	flex-direction: column;
	gap: 1px;
	/* Фон перенесён на .chat-middle (подложку) — здесь лента прозрачная, чтобы скроллер не
	   таскал/не перерисовывал фон-картинку. */
	background: transparent;
	overflow-anchor: none;
  }
  
  /* =============================================
	 Date separator
	 ============================================= */
  .msg-date-sep {
	align-self: center;
	font-size: 11px;
	font-weight: 600;
	color: var(--color-text-muted);
	padding: 8px 12px;
	letter-spacing: .03em;
	user-select: none;
  }

  /* Плавающая бирка с датой при скролле (Telegram-style): по центру сверху, гаснет в покое. */
  .chat-date-float {
	position: absolute;
	top: 10px;
	left: 50%;
	transform: translateX(-50%) translateY(-6px);
	z-index: 5;
	padding: 4px 12px;
	border-radius: 12px;
	background: rgba(10,14,30,.72);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .02em;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transition: opacity .2s ease, transform .2s ease;
  }
  .chat-date-float--visible { opacity: 1; transform: translateX(-50%) translateY(0); }
  
  /* =============================================
	 Message
	 ============================================= */
  .msg {
	display: flex;
	flex-direction: column;
	max-width: 81%;
	margin-bottom: 2px;
  }
  
  .msg--mine   { align-self: flex-end;   align-items: flex-end; }
  .msg--theirs { align-self: flex-start; align-items: flex-start; }
  .msg--tail   { margin-bottom: 6px; }
  
  .msg__author {
	font-size: 13px;
	font-weight: 600;
	color: var(--color-primary);
	padding: 10px 4px 2px;
	user-select: none;
  }
  
  /* Bubble */
  .msg__bubble {
	position: relative;
	padding: 10px 15px 7px;
	border-radius: 14px;
	overflow-wrap: break-word;
	word-wrap: break-word;
	max-width: 100%;
	box-shadow: 0px 12px 25px -20px rgba(0, 0, 0, .4);
  }
  
  .msg--mine .msg__bubble {
	background: #e3ebfb;
	color: var(--color-text);
	border: 1px solid #dfe4ed;
	border-bottom-right-radius: 4px;
  }
  
  .msg--theirs .msg__bubble {
	background: var(--color-surface);
	color: var(--color-text);
	border: 1px solid #e9ebef;
	border-bottom-left-radius: 4px;
  }
  
  .msg--mine.msg--grouped .msg__bubble   { border-top-right-radius: 4px; }
  .msg--theirs.msg--grouped .msg__bubble { border-top-left-radius: 4px; }

  /* Сообщение менеджера в канале — светло-жёлтый баббл (и у своих, и у чужих) */
  .msg--from-manager .msg__bubble {
	background: #fefbe8;
	border-color: #f6eebf;
	color: var(--color-text);
  }

  /* Звезда перед именем менеджера (в шапке имени над сообщением) */
  .msg__author-star {
	display: inline-flex;
	position: relative;
	top: 1px;
	width: 11px;
	height: 11px;
	margin-right: 4px;
	color: #f59e0b;
	flex-shrink: 0;
  }
  .msg__author-star svg { width: 100%; height: 100%; fill: #f59e0b; stroke: #f59e0b; }
  
  /* Pending (отправляется) */
  .msg--pending .msg__bubble { opacity: .65; }

  /* Bubble с аудиофайлами — чуть шире */
  .msg__bubble--wide { min-width: 300px; }
  
  .msg__body {
	font-size: 15px;
	line-height: 1.45;
	white-space: pre-wrap;
	word-break: break-word;
	margin-bottom: 3px;
  }
  
  /* Meta row */
  .msg__meta {
	display: flex;
	align-items: center;
	gap: 4px;
  }
  
  /* Единый порядок для всех: время → галочка (как в разметке). */
  .msg--mine .msg__meta   { justify-content: flex-end; }
  .msg--theirs .msg__meta { justify-content: flex-end; }
  .msg__meta              { white-space: nowrap; flex-shrink: 0; }
  
  .msg__time {
	font-size: 10px;
	opacity: .55;
	white-space: nowrap;
	user-select: none;
  }
  
  .msg__edited {
	font-size: 10px;
	opacity: .5;
	white-space: nowrap;
  }
  
  /* Статус доставки */
  .msg__status {
	display: inline-flex;
	align-items: center;
	color: #999;
	flex-shrink: 0;
  }
  .msg__status svg { width: 13px; height: 13px; }

  /* Прочитано — синий цвет, hover показывает tooltip с читателями */
  .msg__status--read {
	color: var(--color-primary);
	cursor: help;
  }

  /* Галка на чужих сообщениях — всегда серая, tooltip при наведении */
  .msg__status--theirs {
	cursor: help;
  }

  /* Footer сообщения: реакции слева, время справа */
  .msg__footer {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 4px;
	min-height: 18px;
  }

  /* Реакции в теле сообщения */
  .msg__reactions {
	display: flex;
	flex-wrap: wrap;
	gap: 3px;
	flex: 1;
  }
  .msg__reaction {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	font-size: 16px;
	line-height: 1;
	padding: 3px 6px;
	border-radius: 10px;
	background: rgba(0,0,0,0.06);
	border: 2px solid transparent;
	cursor: pointer;
	transition: background .1s, border-color .1s;
  }
  .msg__reaction:hover { background: rgba(0,0,0,0.12); }
  .msg__reaction--mine {
	background: rgba(10,23,131,0.08);
	border-color: var(--color-primary);
  }
  .msg__reaction-count {
	font-size: 11px;
	font-weight: 600;
	color: var(--color-text-muted);
  }

  /* Emoji-бар в контекст-меню */
  .msg-ctx-reactions {
	display: grid;
	grid-template-columns: repeat(5, 32px);
	gap: 2px;
	padding: 6px 8px;
	margin-bottom: 4px;
	border-bottom: 1px solid var(--color-border);
  }
  .msg-ctx-reaction {
	font-size: 16px;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	cursor: pointer;
	background: none;
	border: none;
	transition: background .1s;
  }
  .msg-ctx-reaction:hover     { background: rgba(0,0,0,0.08); }
  .msg-ctx-reaction--active   { background: rgba(10,23,131,0.12); }

  /* Tooltip со списком "кто прочитал" — на десктопе */
  .msg__reads-tooltip {
	position: fixed;
	z-index: 10000;
	background: #1a1c22;
	color: #fff;
	padding: 8px 12px;
	border-radius: 6px;
	font-size: 12px;
	line-height: 1.4;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
	pointer-events: none;
	max-width: 320px;
	min-width: 200px;
  }
  .msg__reads-tooltip-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 16px;
	padding: 3px 0;
  }
  .msg__reads-tooltip-name {
	font-weight: 500;
	color: #fff;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
  }
  .msg__reads-tooltip-time {
	color: #9ca3af;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	flex-shrink: 0;
  }
  
  /* =============================================
	 Load more
	 ============================================= */
  .chat-load-more {
	align-self: center;
	font-size: 12px;
	color: var(--color-text-muted);
	padding: 8px;
	user-select: none;
  }

  .chat-jump-indicator {
	align-self: center;
	font-size: 12px;
	color: var(--color-text-muted);
	padding: 8px;
	user-select: none;
	animation: chat-jump-pulse 1s ease-in-out infinite;
  }
  @keyframes chat-jump-pulse {
	0%, 100% { opacity: 1; }
	50%       { opacity: 0.4; }
  }
  
  /* =============================================
	 Context menu
	 ============================================= */
  .msg-ctx-menu {
	position: fixed;
	z-index: 600;
	min-width: 160px;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-md);
	padding: 4px;
	user-select: none;
  }
  
  .msg-ctx-menu__item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 9px 14px;
	border: none;
	border-radius: var(--radius-sm);
	background: transparent;
	font-family: var(--font);
	font-size: 13px;
	color: var(--color-text);
	cursor: pointer;
	text-align: left;
	transition: background var(--transition);
  }
  .msg-ctx-menu__item:hover { background: rgba(0,0,0,.05); }
  .msg-ctx-menu__item svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--color-text-muted); }
  .msg-ctx-menu__item--danger { color: var(--color-red); }
  .msg-ctx-menu__item--danger svg { color: currentColor; }
  .msg-ctx-menu__item--danger:hover { background: color-mix(in srgb, var(--color-red) 8%, transparent); }
  
  /* =============================================
	 Col2 bottom — input
	 ============================================= */
  #col2-bottom.chat-bottom {
	padding: 8px 12px;
	border-top: 1px solid var(--color-border);
	display: flex;
	flex-direction: column;
	gap: 5px;
	position: relative;
  }
  
  #col2-bottom.is-empty {
	border-top: none;
	padding: 0;
  }
  
  /* hidden override — display:flex перебивает атрибут hidden */
  .chat-edit-bar[hidden] { display: none !important; }

  /* Edit bar */
  .chat-edit-bar {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 5px 10px;
	background: color-mix(in srgb, var(--color-primary) 6%, var(--color-surface));
	border-radius: var(--radius-sm);
	border-left: 3px solid var(--color-primary);
  }
  
  .chat-edit-bar__label {
	font-size: 11px;
	font-weight: 700;
	color: var(--color-primary);
	white-space: nowrap;
  }
  
  .chat-edit-bar__text {
	flex: 1;
	font-size: 12px;
	color: var(--color-text-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
  }
  
  .chat-edit-bar__close {
	width: 22px !important;
	height: 22px !important;
	padding: 3px !important;
	flex-shrink: 0;
  }
  .chat-edit-bar__close svg { width: 14px; height: 14px; }
  
  /* Input row */
  .chat-input-wrap {
	display: flex;
	align-items: flex-end;
	gap: 8px;
  }
  
  /* Обёртка поля ввода — чтобы крестик очистки лежал ПОВЕРХ текстового поля справа */
  .chat-input-field { position: relative; flex: 1; display: flex; }

  .chat-input {
	flex: 1;
	border: 1.5px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: 8px 30px 8px 12px;   /* правый отступ — под крестик очистки / кнопку «развернуть» */
	font-family: var(--font);
	font-size: 14px;
	color: var(--color-text);
	background: var(--color-surface-2);
	outline: none;
	resize: none;
	min-height: 38px;
	max-height: 120px;
	line-height: 1.45;
	transition: border-color var(--transition), background var(--transition);
  }
  .chat-input:focus { border-color: #b5becb; background: var(--color-surface); }
  .chat-input:disabled { opacity: .5; cursor: progress; }
  .chat-input::placeholder { color: var(--color-text-muted); }

  /* ── Дописывание слов (L1): строка бирок-подсказок над полем ──────── */
  .wsug-strip {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 2px 2px 6px;
    scrollbar-width: none;
  }
  .wsug-strip[hidden] { display: none; }
  .wsug-strip::-webkit-scrollbar { display: none; }
  /* Подсказка-клавиша «Tab» перед бирками — «настоящая» физическая клавиша:
     объём за счёт утолщённого нижнего края + тень снизу + светлый блик сверху. */
  .wsug-tabkey {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    align-self: center;
    padding: 5px 9px 3px;
    border: 1px solid var(--color-border);
    border-bottom-width: 3px;
    border-radius: 7px;
    background: linear-gradient(180deg,
      color-mix(in srgb, var(--color-surface) 92%, #fff) 0%,
      var(--color-surface-2) 100%);
    box-shadow: 0 2px 2px rgba(0, 0, 0, .14), inset 0 1px 0 rgba(255, 255, 255, .55);
    color: var(--color-text-muted);
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    user-select: none;
    pointer-events: none;
    white-space: nowrap;
  }
  .wsug-tabkey svg { width: 14px; height: 14px; }
  .wsug-chip {
    flex: 0 0 auto;
    padding: 4px 12px;
    border: none;
    border-radius: 999px;
    background: var(--color-surface-2);
    color: var(--color-text);
    font-family: var(--font);
    font-size: 13px;
    line-height: 1.3;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--transition);
  }
  /* Бирка-фраза — шире обычной, длинную обрезаем многоточием. */
  .wsug-chip--phrase {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .wsug-chip:hover { background: rgba(59, 130, 246, .12); }
  /* Выделение активной бирки (Tab/стрелки) — светло-синяя заливка, без бордера. */
  .wsug-chip--active {
    outline: none;
    background: rgba(59, 130, 246, .22);
  }
  
  .chat-send-btn {
	flex-shrink: 0;
	width: 38px !important;
	height: 38px !important;
  }
  .chat-send-btn svg { width: 16px; height: 16px; }

  /* Крестик очистки — поверх поля ввода справа-снизу; просто крестик, без подложки */
  .chat-clear-btn {
	position: absolute;
	right: 8px;
	bottom: 9px;
	width: 20px;
	height: 20px;
	padding: 0;
	border: none;
	background: none;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--color-text-muted);
	cursor: pointer;
  }
  .chat-clear-btn svg { width: 15px; height: 15px; }
  .chat-clear-btn:hover { color: var(--color-text); background: none; }

  /* Кнопка «развернуть в многострочный редактор» — правый ВЕРХНИЙ угол поля, в правом
     отступе (padding-right 34px) поверх текста. Видна при 3+ строках (toggle из JS). */
  .chat-expand-btn {
	position: absolute;
	right: 8px;
	top: 8px;
	width: 30px;
	height: 30px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba(120, 130, 145, .10);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--color-text-muted);
	cursor: pointer;
	transition: background var(--transition), color var(--transition);
  }
  .chat-expand-btn[hidden] { display: none; }
  .chat-expand-btn svg { width: 17px; height: 17px; }
  .chat-expand-btn:hover { color: var(--color-text); background: rgba(120, 130, 145, .18); }
  
  /* =============================================
	 Voice badge (в chat-header)
	 ============================================= */
  .chat-header__members-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
  }
  
  .voice-badge {
	position: absolute;
	top: -3px;
	right: -3px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	background: var(--color-green);
	color: #fff;
	font-size: 9px;
	font-weight: 700;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	z-index: 1;
  }
/* =============================================
   Message formatting
   ============================================= */

/* Ссылка — ОТДЕЛЬНОЙ строкой-плашкой (десктоп и мобилка): крупная зона попадания пальцем,
   длинный адрес переносится на несколько строк (без обрезки). Прилегающие
   пробелы/перенос вокруг ссылки убирает _formatBody, чтобы pre-wrap не давал пустых строк. */
.msg__link {
  position: relative;
  display: block;
  max-width: 100%;
  box-sizing: border-box;
  margin: 4px 0;
  padding: 4px 8px 4px 26px;
  border-radius: var(--radius-sm);
  background: rgba(10, 23, 131, .06);
  color: var(--color-primary);
  text-decoration: none;
  line-height: 1.35;
  white-space: normal;           /* многострочная: длинный адрес переносится, а не обрезается */
  overflow-wrap: anywhere;
  word-break: break-all;
  -webkit-touch-callout: none;   /* iOS: без системного превью ссылки на долгое нажатие */
}
.msg__link::before {
  content: '';
  position: absolute;
  left: 8px; top: 7px;           /* у первой строки (ссылка может быть в несколько строк) */
  width: 13px; height: 13px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E") center / contain no-repeat;
}
.msg__link:hover { background: rgba(10, 23, 131, .1); }

/* Inline code `...` */
.msg__code-inline {
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  background: rgba(0,0,0,.08);
  border-radius: 4px;
  padding: 1px 5px;
  cursor: pointer;
  user-select: text;
  transition: background var(--transition);
  white-space: pre-wrap;
  word-break: break-word;
}
.msg__code-inline:hover  { background: rgba(0,0,0,.14); }
.msg__code-inline--copied { background: rgba(22,163,74,.2) !important; }

/* Code block ```...``` */
.msg__pre {
  margin: 5px 0 2px;
  padding: 10px 12px;
  background: rgba(0,0,0,.06);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0,0,0,.08);
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
  word-break: normal;
  cursor: pointer;
  position: relative;
}
.msg__pre code {
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
}
.msg__pre:hover::after {
  content: 'копировать';
  position: absolute;
  top: 5px;
  right: 8px;
  font-size: 10px;
  font-family: var(--font);
  color: var(--color-text-muted);
}
.msg__pre--copied::after {
  content: 'скопировано' !important;
  color: var(--color-green) !important;
}
/* =============================================
   Reply quote (внутри пузыря)
   ============================================= */
.msg__reply-quote {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px 8px;
  margin-bottom: 6px;
  border-left: 3px solid var(--color-primary);
  border-radius: 2px 6px 6px 2px;
  background: rgba(0,0,0,.06);
  cursor: pointer;
  transition: background var(--transition);
  overflow: hidden;
}
.msg__reply-quote:hover { background: rgba(0,0,0,.11); }

.msg__reply-author {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg__reply-text {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Подсветка при переходе к оригиналу */
.msg--highlight .msg__bubble {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  transition: outline 0s;
}

/* =============================================
   Reply bar (над полем ввода)
   ============================================= */
.chat-reply-bar[hidden] { display: none !important; }

.chat-reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: color-mix(in srgb, var(--color-primary) 6%, var(--color-surface));
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-primary);
}

/* Плашка персонального лимита места (над полем ввода): мягкая (≥90%) — жёлтая, жёсткая (исчерпан) — красная. */
.chat-quota-bar[hidden] { display: none !important; }
.chat-quota-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: #fff8dc;
  border-radius: var(--radius-sm);
  border-left: 3px solid #e6c200;
}
.chat-quota-bar--hard {
  background: color-mix(in srgb, var(--color-red) 9%, var(--color-surface));
  border-left-color: var(--color-red);
}
.chat-quota-bar__text { flex: 1; min-width: 0; font-size: 13px; line-height: 1.35; color: var(--color-text); }
.chat-quota-bar__btn.btn { flex-shrink: 0; background: #9a7a00; border-color: #9a7a00; color: #fff8dc; }   /* как «Переслать сюда» */
.chat-quota-bar__btn.btn:hover { background: #806500; border-color: #806500; }
.chat-quota-bar--hard .chat-quota-bar__btn.btn { background: var(--color-red); border-color: var(--color-red); color: #fff; }
.chat-quota-bar--hard .chat-quota-bar__btn.btn:hover { background: color-mix(in srgb, var(--color-red) 85%, #000); border-color: color-mix(in srgb, var(--color-red) 85%, #000); }

/* Бар пересылки над композером — светло-жёлтый */
.chat-forward-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: #fff8dc;
  border-radius: var(--radius-sm);
  border-left: 3px solid #e6c200;
}
.chat-forward-bar[hidden] { display: none !important; }
.chat-forward-bar__label {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: #6b5600;
}
/* Кнопки в тон жёлтой плашке, а не синие */
.chat-forward-bar__close.btn {
  flex-shrink: 0;
  color: #9a7a00;
}
.chat-forward-bar__close.btn:hover { color: #6b5600; background: rgba(230,194,0,.18); }
.chat-forward-bar__go.btn {
  flex-shrink: 0;
  background: #9a7a00;
  border-color: #9a7a00;
  color: #fff8dc;
}
.chat-forward-bar__go.btn:hover { background: #806500; border-color: #806500; }

/* Плашка «Копия» у пересланного сообщения */
.msg__copy-label {
  font-size: 11px;
  font-style: italic;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

/* Плашка «Файл недоступен» — файл сообщения удалён (напр. из «Моих файлов») */
.msg__file-gone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: 13px;
  font-style: italic;
}
.msg__file-gone svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .6; }

.chat-reply-bar__icon {
  display: flex;
  color: var(--color-primary);
  flex-shrink: 0;
}
.chat-reply-bar__icon svg { width: 14px; height: 14px; }

.chat-reply-bar__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.chat-reply-bar__author {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-reply-bar__text {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-reply-bar__close {
  width: 22px !important;
  height: 22px !important;
  padding: 3px !important;
  flex-shrink: 0;
}
.chat-reply-bar__close svg { width: 14px; height: 14px; }

/* =============================================
   New messages divider
   ============================================= */
.msg-new-sep {
  align-self: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
  border: 1px solid color-mix(in srgb, var(--color-primary) 20%, transparent);
  padding: 4px 16px;
  border-radius: 99px;
  margin: 8px 0;
  user-select: none;
  letter-spacing: .02em;
  transition: opacity 500ms ease, transform 400ms ease, margin 400ms ease, padding 400ms ease;
}
.msg-new-sep--fade {
  opacity: 0;
  transform: scaleY(0);
  margin: 0;
  padding: 0;
}
/* =============================================
   Scroll to bottom button
   ============================================= */
.chat-scroll-btn[hidden] { display: none !important; }

.chat-scroll-btn {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  transition: transform var(--transition), box-shadow var(--transition);
  z-index: 10;
}
.chat-scroll-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(10,23,131,.18);
}
.chat-scroll-btn svg { width: 16px; height: 16px; }

/* =============================================
   Attach button
   ============================================= */
.chat-attach-btn {
  flex-shrink: 0;
  color: var(--color-text-muted);
}
.chat-attach-btn:hover { color: var(--color-primary); }
.chat-attach-btn svg { width: 18px; height: 18px; }

/* =============================================
   File tray (pending uploads)
   ============================================= */
.chat-file-tray[hidden] { display: none !important; }

.chat-file-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0 2px;
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px 4px 8px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  max-width: 220px;
  position: relative;
  transition: opacity var(--transition);
}

.file-chip--uploading { opacity: .7; }
.file-chip--error     { border-color: var(--color-red); background: color-mix(in srgb, var(--color-red) 6%, var(--color-surface)); }

.file-chip__ext {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
  border-radius: 3px;
  padding: 1px 4px;
  flex-shrink: 0;
  letter-spacing: .03em;
}

.file-chip__name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text);
}

.file-chip__size {
  font-size: 11px;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.file-chip__remove {
  width: 18px !important;
  height: 18px !important;
  padding: 2px !important;
  border-radius: 3px !important;
  flex-shrink: 0;
  color: var(--color-text-muted);
}
.file-chip__remove:hover { color: var(--color-red); background: color-mix(in srgb, var(--color-red) 8%, transparent) !important; }
.file-chip__remove svg { width: 11px; height: 11px; }

.file-chip__progress {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--color-border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  overflow: hidden;
}
.file-chip__progress span {
  display: block;
  height: 100%;
  background: var(--color-primary);
  transition: width 200ms ease;
}

/* =============================================
   Drop overlay
   ============================================= */
.chat-drop-overlay {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--color-primary) 8%, var(--color-surface));
  border: 2px dashed var(--color-primary);
  border-radius: var(--radius-md);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.chat-drop-overlay__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--color-primary);
  font-size: 15px;
  font-weight: 600;
}

.chat-drop-overlay__inner svg { width: 36px; height: 36px; opacity: .7; }

/* =============================================
   File bricks (в сообщениях)
   ============================================= */
.msg__files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.file-brick {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
  max-width: 175px;
  transition: background var(--transition);
  position: relative;
  text-decoration: none;
  /* Приклеиваем бирку с номером к слою плитки: плитка вместе с абсолютной биркой становятся
     ОДНИМ композитным слоем и двигаются синхронно при скроле (бирка не «отстаёт»). translateZ(0)
     — нулевой сдвиг, только триггер композитинга: layout не меняется, ничего не смещается. */
  transform: translateZ(0);
}

.file-brick:hover { background: var(--color-surface-2); }

.msg--mine .file-brick {
  background: var(--color-surface);
  border-color: var(--color-border);
}
.msg--mine .file-brick:hover { background: var(--color-surface-2); }

.file-brick--pending {
  opacity: .55;
  cursor: default;
}

.file-brick__icon {
  position: relative;
  flex-shrink: 0;
  color: var(--color-primary);
  display: flex;
  align-items: center;
}
.file-brick__icon svg { width: 26px; height: 26px; }

/* Бирка с номером файла */
.file-brick__no {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 10px;
  font-weight: 700;
  background: rgba(0,0,0,.5);
  color: #fff;
  border-radius: var(--radius-sm) 0 var(--radius-sm) 0;
  padding: 2px 6px;
  z-index: 2;
  line-height: 1.4;
}

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

.file-brick__name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text);
}
.msg--mine .file-brick__name { color: var(--color-text); }

.file-brick__meta {
  display: flex;
  align-items: center;
  gap: 5px;
}

.file-brick__ext {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  border-radius: 3px;
  padding: 0 4px;
  letter-spacing: .03em;
}

.file-brick__size {
  font-size: 11px;
  color: var(--color-text-muted);
}

/* .file-brick__dl убран по дизайну */

/* =============================================
   File brick — image preview (в сообщениях)
   ============================================= */
.file-brick--image {
  flex-direction: column;
  align-items: flex-start;
  padding: 0;
  overflow: hidden;
  max-width: 140px;
  width: 140px;
  gap: 0;
}

.file-brick__image {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.file-brick__image-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  width: 100%;
  background: var(--color-surface);
}

.file-brick--image .file-brick__name {
  flex: 1;
  font-size: 10px;
}

/* Бирка поверх картинки — не override position:absolute из .file-brick__no */
.file-brick--image .file-brick__no {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
}

/* =============================================
   File brick — трей (pending uploads)
   ============================================= */
.file-brick--tray {
  max-width: 200px;
  min-width: 150px;
  flex-direction: column;
  align-items: flex-start;
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.file-brick__img-preview {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.file-brick--tray .file-brick__info {
  padding: 5px 8px;
  width: 100%;
}

.file-brick--tray > .file-brick__icon {
  padding: 10px 8px 2px;
  color: var(--color-primary);
}

.file-brick--tray .file-brick__remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px !important;
  height: 20px !important;
  padding: 3px !important;
  background: rgba(255,255,255,.85) !important;
  border-radius: 50% !important;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

/* Для трея с картинкой — кнопка удаления поверх превью */
.file-brick--tray:has(.file-brick__img-preview) {
  position: relative;
}

/* Мобилка: превью картинок в 2 раза меньше — и в чате (отправленные),
   и в трее над полем ввода (неотправленные). Только картинки. */
@media (max-width: 768px) {
  .file-brick--image {
    width: 70px;
    max-width: 70px;
  }
  .file-brick__image { height: 55px; }

  .file-brick--tray:has(.file-brick__img-preview) {
    max-width: 100px;
    min-width: 75px;
  }
  .file-brick__img-preview { height: 45px; }
}

/* Прогресс-бар для трея */
.file-brick__progress-bar {
  width: 100%;
  height: 3px;
  background: var(--color-border);
  overflow: hidden;
}
.file-brick__progress-bar span {
  display: block;
  height: 100%;
  background: var(--color-primary);
  transition: width 200ms ease;
}

/* Трей — контейнер */
.chat-file-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0 2px;
}

/* =============================================
   File brick — error state
   ============================================= */
.file-brick--error {
  border-color: var(--color-red) !important;
  background: color-mix(in srgb, var(--color-red) 8%, var(--color-surface)) !important;
}

.file-brick__error-msg {
  font-size: 11px;
  color: var(--color-red);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =============================================
   Markdown в сообщениях
   ============================================= */

/* Заголовки */
.md-h  { font-weight: 700; line-height: 1.3; margin: 4px 0 2px; }
.md-h1 { font-size: 1.25em; }
.md-h2 { font-size: 1.1em; }
.md-h3 { font-size: 1em; text-decoration: underline; text-underline-offset: 3px; }

/* Жирный и курсив */
.md-bold   { font-weight: 700; }
.md-em     { font-style: italic; }
.md-strike { text-decoration: line-through; opacity: .75; }
.md-mark   { border-radius: 3px; padding: 0 3px; }

/* Цитата */
.md-quote {
  border-left: 3px solid var(--color-primary);
  padding: 2px 10px;
  margin: 3px 0;
  opacity: .8;
  border-radius: 0 4px 4px 0;
}

/* Маркированный список */
.md-ul {
  margin: 3px 0 3px 18px;
  padding: 0;
  list-style: disc;
}
.md-ul li { margin: 1px 0; }

/* =============================================
   Image Viewer Popup
   ============================================= */
.iv-overlay {
  position: fixed;
  inset: 0;
  z-index: 9700;   /* выше попапа видео-библиотеки (9000) и прочих модалок — просмотр видео/картинок поверх всего */
  background: rgba(0,0,0,.88);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}
.iv-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

/* Toolbar */
.iv-status-bar {
  height: env(safe-area-inset-top);
  background: #0a1783;
  flex-shrink: 0;
}
html.capacitor-native .iv-status-bar {
  height: var(--safe-top, env(safe-area-inset-top));
}
.iv-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(0,0,0,.45);
  flex-shrink: 0;
  z-index: 2;
}

.iv-toolbar__name {
  flex: 1;
  font-size: 13px;
  color: rgba(255,255,255,.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font);
}

.iv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.1);
  color: #fff;
  cursor: pointer;
  transition: background 150ms;
  flex-shrink: 0;
  text-decoration: none;
}
.iv-btn:hover { background: rgba(255,255,255,.22); }
.iv-btn svg   { width: 18px; height: 18px; }

/* Stage — центрирует wrap */
.iv-stage {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: grab;
}
.iv-stage:active { cursor: grabbing; }

/* Transform container */
.iv-wrap {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  will-change: transform;
  cursor: grab;
  user-select: none;
}
.iv-wrap:active { cursor: grabbing; }

/* Image */
.iv-img {
  display: block;
  max-width: none;
  max-height: none;
  pointer-events: none;
  user-select: none;
  border-radius: 2px;
  transition: opacity 200ms ease;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
}

/* Video (встроенный просмотрщик видео — переиспользует .iv-overlay/.iv-stage/.iv-wrap) */
.vv-video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  pointer-events: none;   /* по умолчанию не ловим тапы — иначе скрытый оверлей блокирует центр экрана */
  user-select: none;
  border-radius: 2px;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  background: #000;
  outline: none;
}
/* Контролы кликабельны только пока просмотрщик открыт */
.iv-overlay--visible .vv-video { pointer-events: auto; }

/* Hint */
.iv-hint {
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,.3);
  padding: 8px;
  flex-shrink: 0;
  font-family: var(--font);
  letter-spacing: .03em;
}

@media (max-width: 768px) {
  .iv-hint { display: none; }
}

/* =============================================
   System messages (missed/declined calls)
   ============================================= */
.msg-system {
  align-self: center;
  margin: 4px 0;
  user-select: none;
}

.msg-system__inner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: color-mix(in srgb, var(--color-red, #e11d48) 8%, var(--color-surface));
  border: 1px solid color-mix(in srgb, var(--color-red, #e11d48) 20%, transparent);
  border-radius: 99px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.msg-system__icon {
  display: flex;
  align-items: center;
  color: var(--color-red, #e11d48);
  flex-shrink: 0;
}
.msg-system__icon svg { width: 13px; height: 13px; }

.msg-system__text { color: var(--color-text); font-weight: 500; }

.msg-system__time {
  font-size: 10px;
  opacity: .5;
  white-space: nowrap;
}

/* Удалённое сообщение — нейтральный серый бабл (не красный, как у звонков) */
.msg-system--deleted .msg-system__inner {
  background: color-mix(in srgb, var(--color-text-muted) 8%, var(--color-surface));
  border-color: var(--color-border);
}
.msg-system--deleted .msg-system__icon { color: var(--color-text-muted); }
.msg-system--deleted .msg-system__text { color: var(--color-text-muted); font-weight: 400; }
.msg__reply-text--deleted { font-style: italic; color: var(--color-text-muted); }

/* Подключение/отключение в звонке — без бабла и обводки, приглушённый серый
   (чуть светлее обычного muted), чтобы не отвлекать от нормальных сообщений */
.msg-system--call .msg-system__inner {
  background: transparent;
  border-color: transparent;
}
.msg-system--call .msg-system__text { color: color-mix(in srgb, var(--color-text-muted) 80%, transparent); font-weight: 400; }
/* Иконка: подключился — зелёная, отключился — красная */
.msg-system--call-in  .msg-system__icon { color: var(--color-green, #22c55e); }
.msg-system--call-out .msg-system__icon { color: var(--color-red, #e11d48); }

/* =============================================
   Viewer modal (мобилка)
   ============================================= */
.viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #1a1b26;
  display: flex;
  flex-direction: column;
}
.viewer-modal__status-bar {
  height: env(safe-area-inset-top);
  background: #0a1783;
  flex-shrink: 0;
}
html.capacitor-native .viewer-modal__status-bar {
  height: var(--safe-top, env(safe-area-inset-top));
}

.viewer-modal__frame {
  flex: 1;
  border: none;
  width: 100%;
  height: 100%;
}
/* ── Плашка завершённого звонка ────────────────────────────────────── */
.chat-ended-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  user-select: none;
}

/* Заглушка вместо сообщений для голос-гостя (Инк.2) */
.chat-guest-stub {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  text-align: center;
}
.chat-guest-stub__text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-muted);
  max-width: 320px;
}

/* =============================================
   Voice recorder bar
   ============================================= */
.voice-rec-bar[hidden] { display: none; }
.voice-rec-bar {
  flex: 1;
  align-self: stretch;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 0 0;
}

/* Доп. отступы в рекбаре */
.vr-mic-icon { margin-left: 6px; }
.vr-pause    { margin-right: 6px; }

/* Кнопка отправки в режиме записи — красная */
#btnSend.vr-mic-active {
  background: var(--color-red) !important;
  color: #fff !important;
}
/* Фаза инициализации — кнопка увеличивается */
#btnSend.vr-mic-scaling {
  transform: scale(2);
  transition: transform 0.15s ease-out;
}
/* Фаза записи — кнопка возвращается к нормальному размеру */
#btnSend.vr-mic-active {
  transform: scale(1);
  transition: transform 0.15s ease-out;
}

/* Первые 1 сек после начала записи — серая, некликабельная */
#btnSend.vr-mic-blocked {
  background: var(--color-text-muted) !important;
  pointer-events: none;
}

/* Пока грузятся вложения — кнопка отправки серая/неактивная НА ВИД, но кликабельна:
   по клику показываем предупреждение (реальную блокировку делает _sendMessage). */
#btnSend.btn--send-waiting {
  background: var(--color-text-muted) !important;
  opacity: .6;
  cursor: default;
}

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


/* Animated wave bars */
.vr-wave-anim {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  flex-shrink: 0;
}

.vr-wave-anim span {
  width: 3px;
  background: var(--color-red);
  border-radius: 2px;
  animation: vr-wave 0.7s ease-in-out infinite;
}

.vr-wave-anim span:nth-child(1) { height: 55%; animation-delay: 0s; }
.vr-wave-anim span:nth-child(2) { height: 100%; animation-delay: 0.12s; }
.vr-wave-anim span:nth-child(3) { height: 40%; animation-delay: 0.24s; }
.vr-wave-anim span:nth-child(4) { height: 80%; animation-delay: 0.36s; }
.vr-wave-anim span:nth-child(5) { height: 55%; animation-delay: 0.48s; }

@keyframes vr-wave {
  0%, 100% { transform: scaleY(0.4); }
  50%       { transform: scaleY(1); }
}

.vr--paused .vr-wave-anim span,
.vr--initializing .vr-wave-anim span { animation-play-state: paused; opacity: 0.4; }
.vr--paused .vr-mic-icon,
.vr--initializing .vr-mic-icon { opacity: 0.4; }
.vr--paused .vr-timer,
.vr--initializing .vr-timer { color: var(--color-text-muted); }

.vr-timer {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-red);
  font-variant-numeric: tabular-nums;
  min-width: 44px;
}


.vr-label {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.vr-mic-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--color-red);
}
.vr-mic-icon svg { width: 18px; height: 18px; }

/* Спиннер на кнопке отправки во время инициализации */
.vr-spinner {
  display: block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: vr-spin 0.75s linear infinite;
}
@keyframes vr-spin {
  to { transform: rotate(360deg); }
}

/* =============================================
   Voice player (inside message bubble)
   ============================================= */
.msg__voice-wrap {
  padding: 2px 0;
}

.voice-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
  min-width: 260px;
  max-width: 420px;
}

.vp-play {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50% !important;
  background: var(--color-primary) !important;
  color: #fff !important;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0 !important;
}

.vp-play svg { width: 20px; height: 20px; }

.vp-play:disabled {
  opacity: 0.45;
  cursor: default;
}


.vp-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vp-progress {
  height: 12px;
  background: #9aa3b2;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
  overflow: hidden;
}

.vp-progress__fill {
  height: 100%;
  width: 0%;
  background: var(--color-primary);
  border-radius: 2px;
  transition: width 0.1s linear, background 0.2s;
}

.vp-play--playing {
  background: #e8820c !important;
}
.vp-progress--playing {
  background: #f5c990;
}
.vp-progress--playing .vp-progress__fill {
  background: #e8820c;
}

.vp-times {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}

.vp-speed {
  flex-shrink: 0;
  background: none;
  border: 1px solid rgba(0,0,0,0.25);
  border-radius: 4px;
  padding: 3px 0;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text);
  line-height: 1;
  width: 34px;
  text-align: center;
  visibility: hidden;
}
.vp-speed:hover { background: rgba(0,0,0,0.06); }

.vp-download {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50% !important;
  background: transparent !important;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0 !important;
  color: var(--color-text-muted);
  transition: background 0.15s, color 0.15s;
}
.vp-download svg { width: 16px; height: 16px; }
.vp-download:hover {
  background: rgba(0,0,0,0.08) !important;
  color: var(--color-text);
}

/* Кнопка меню (три точки): серая иконка без фона; при наведении — синяя, тоже без фона */
.vp-menu {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: transparent !important;
  border: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0 !important;
  color: var(--color-text-muted);
  transition: color 0.15s;
}
.vp-menu svg { width: 18px; height: 18px; }
.vp-menu:hover      { background: transparent !important; color: var(--color-primary); }

/* Пункт меню в состоянии «идёт распознавание» */
.audio-menu__item:disabled { cursor: default; color: var(--color-text-muted); opacity: 0.7; }
.audio-menu__item:disabled:hover { background: transparent; }


/* Меню долгого нажатия по ссылке (мобилка): «Открыть» / «Копировать» */
.link-ctx-menu {
  position: fixed;
  z-index: 9500;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 4px;
  min-width: 150px;
  display: flex;
  flex-direction: column;
}
.link-ctx-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: transparent;
  text-align: left;
  padding: 11px 12px;
  font-size: 14px;
  color: var(--color-text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
}
.link-ctx-menu__item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--color-text-muted); }
.link-ctx-menu__item:active,
.link-ctx-menu__item:hover { background: rgba(0,0,0,.06); }

/* Кнопка-иконка меню композера (между полем и «Отправить») */
.chat-compose-menu-btn {
  flex-shrink: 0;
  width: 38px !important;
  height: 38px !important;
  border-radius: 50%;
  align-self: flex-end;
  color: var(--color-text-muted);
}
.chat-compose-menu-btn svg { width: 18px; height: 18px; }
.chat-compose-menu-btn:hover { color: var(--color-primary); }

/* Выпадающее меню композера */
.compose-menu {
  position: fixed;
  z-index: 9500;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 4px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
}
.compose-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: transparent;
  text-align: left;
  padding: 11px 12px;
  font-size: 14px;
  color: var(--color-text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
}
.compose-menu__item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--color-text-muted); }
.compose-menu__item:active,
.compose-menu__item:hover { background: rgba(0,0,0,.06); }

/* Попап многострочного текста */
/* Стандартный оверлей как у попапа будильника (.alarm-overlay). Учитываем safe-area
   (статус-бар/навигация на мобилке) — иначе блок подлазит под панель андроида. */
.ml-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9600;
  display: flex;
  align-items: stretch;   /* блок тянется на всю доступную высоту (минус паддинги ниже) */
  justify-content: center;
  background: rgba(10, 14, 30, .92);
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
/* Белый блок на всю доступную высоту (растягивается оверлеем, не залезает под панели) */
.ml-popup {
  width: 640px;
  max-width: 100%;
  min-height: 0;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 14px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: alarm-modal-in 180ms ease;   /* та же анимация появления, что у будильника */
}
.ml-popup__head { display: flex; align-items: center; justify-content: space-between; }
.ml-popup__title { font-size: 16px; font-weight: 600; color: var(--color-text); }
.ml-popup__input {
  flex: 1;                 /* поле ввода — на всю высоту блока */
  width: 100%;
  resize: none;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-surface-2);
  outline: none;
  line-height: 1.5;
}
.ml-popup__input:focus { border-color: #b5becb; background: var(--color-surface); }
.ml-popup__actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ── Скелетон-разрыв при переходе к сообщению (промежуток между окном и живым низом) ── */
.chat-gap-skel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 18px 16px;
}
.chat-gap-skel__row {
  height: 42px;
  width: 62%;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(0,0,0,.05) 25%, rgba(0,0,0,.09) 37%, rgba(0,0,0,.05) 63%);
  background-size: 400% 100%;
  animation: chat-gap-shimmer 1.4s ease infinite;
}
.chat-gap-skel__row:nth-child(even) { width: 46%; align-self: flex-end; }
@keyframes chat-gap-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ── Поиск по сообщениям (4-й слой col-1) ─────────────────────────────── */
/* Сам слой (#col1-list-search он же .col1-list) НЕ скроллится и без внешнего паддинга —
   иначе получаются два вложенных скролл-контейнера и listener подгрузки (на .col1-search__results)
   не срабатывает, т.к. скроллит внешний .col1-list. Скроллит только список результатов. */
#col1-middle #col1-list-search { padding: 0; overflow: hidden; }
.col1-search {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
/* Метка «искать в чате» над полем */
/* Плашка выбранного чата — тот же визуал, что у плашки редактирования сообщения
   в чате (.chat-edit-bar): подложка, левая полоса-акцент, label цветом акцента. */
.col1-search__scope {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 20px 0;
  padding: 5px 10px;
  background: color-mix(in srgb, var(--color-primary) 6%, var(--color-surface));
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-primary);
}
.col1-search__scope[hidden] { display: none; }
.col1-search__scope-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
  flex-shrink: 0;
}
.col1-search__scope-text {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.col1-search__scope-x {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 3px;
  line-height: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.col1-search__scope-x:hover { background: rgba(0,0,0,.08); color: var(--color-text); }
.col1-search__scope-x svg { width: 14px; height: 14px; }

.col1-search__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 18px 20px 8px;   /* слева/справа 20 (как контакты); верх 18 = как зазор над полем в контактах (12+6) */
  flex-shrink: 0;
}
/* Когда метка чата показана — уменьшаем верхний отступ поля (зазор уже дал .col1-search__scope) */
.col1-search__scope:not([hidden]) + .col1-search__bar { padding-top: 8px; }
/* Как поле контактов: бордер на обёртке, инпут без бордера, крестик — flex-элемент
   (центрируется по вертикали самой обёрткой, без абсолютного позиционирования). */
.col1-search__field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: 0 8px 0 10px;
}
.col1-search__field:focus-within { border-color: #b5becb; }
.col1-search__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  padding: 8px 0;
  font-size: 14px;
  font-family: var(--font);
  color: var(--color-text);
}
.col1-search__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  line-height: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  flex-shrink: 0;
}
.col1-search__clear:hover { background: rgba(0,0,0,.08); color: var(--color-text); }
.col1-search__clear[hidden] { display: none; }
.col1-search__clear svg { width: 14px; height: 14px; }
.col1-search__go {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms, color 150ms;
}
.col1-search__go:hover { background: rgba(0,0,0,.1); color: var(--color-text); }
.col1-search__go svg { width: 18px; height: 18px; }
/* overflow-x:hidden — страховка: длинный URL/имя файла в результате не должен раздвигать
   контейнер и давать горизонтальный скролл всему приложению. */
.col1-search__results { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; padding: 4px 8px; }
.col1-search__hint { text-align: center; color: var(--color-text-muted); padding: 32px 16px; font-size: 14px; }

/* Элемент результата — по стилю как кнопка чата (.chat-item) */
.search-result {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 12px 15px;
  margin-bottom: 5px;        /* отступ между результатами */
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  transition: background var(--transition);
}
.search-result:nth-child(even) { background: rgba(0,0,0,.03); }   /* полосатость: чётные — лёгкая серость */
.search-result:hover { background: rgba(0,0,0,.06); }             /* hover сильнее полосы — идёт позже, перекрывает */
.search-result.active { background: rgba(10,23,131,.08); }        /* нажатый — голубинка, как активный чат */
.search-result__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.search-result__chat {
  flex: 1;
  min-width: 0;               /* чтобы многоточие работало и имя не раздвигало строку */
  font-size: 14px;            /* как названия чатов в списке (.chat-item__name) */
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result__date { font-size: 11px; color: var(--color-text-muted); flex-shrink: 0; }
.search-result__snippet {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;   /* длинные URL/слова переносятся, а не вылезают за край */
  word-break: break-word;
}
.search-result__snippet b { color: var(--color-primary, #0a1783); font-weight: 700; }
.search-result__file { color: var(--color-primary, #5b8cff); overflow-wrap: anywhere; }
.search-result__author { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }

/* ── Видео-библиотека (попап как у будильника, но на всю высоту и шире) ── */
.vlib-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: stretch;    /* модалка тянется на всю доступную высоту */
  justify-content: center;
  background: rgba(10, 14, 30, .92);
  /* Без backdrop-filter: blur — фон и так почти непрозрачный (.92), а блюр форсил дорогую
     перерисовку размытого слоя на каждом hover внутри модалки → тормозило наведение на кнопки. */
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
.vlib-modal {
  width: 690px;
  max-width: 100%;
  min-height: 0;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: alarm-modal-in 180ms ease;
}
.vlib-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px 12px 18px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.vlib-modal__title { font-size: 16px; font-weight: 600; color: var(--color-text); }
.vlib-tabs { flex-shrink: 0; padding: 8px 12px; gap: 6px; justify-content: flex-start; }
.vlib-tabs .tab-bar__btn { flex: 0 0 auto; padding-left: 12px; padding-right: 12px; }
.vlib-modal__body {
  flex: 1;
  overflow-y: auto;         /* скролл списка */
  padding: 8px 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.vlib-empty { text-align: center; color: var(--color-text-muted); padding: 40px 16px; font-size: 14px; }

.vlib-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-md);
}
.vlib-item:hover { background: rgba(127,127,127,.08); }
.vlib-item__name {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: inherit;
}
.vlib-item__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vlib-item__name:hover .vlib-item__title { color: var(--color-primary, #5b8cff); }
.vlib-item__meta { font-size: 12px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }

.vlib-item__actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.vlib-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 150ms, color 150ms;
}
.vlib-btn:hover { background: rgba(127,127,127,.16); color: var(--color-text); }
.vlib-btn svg { width: 18px; height: 18px; }

/* Двухшаговое удаление: корзина → (клик) галка → (клик) удаление. Всё в одной кнопке. */
.vlib-del__ico, .vlib-del__ok { display: inline-flex; align-items: center; justify-content: center; }
.vlib-del__ok { display: none; }
.vlib-del--confirm { background: var(--color-red, #e5484d); color: #fff; }
.vlib-del--confirm:hover { background: var(--color-red, #e5484d); color: #fff; }
.vlib-del--confirm .vlib-del__ico { display: none; }
.vlib-del--confirm .vlib-del__ok { display: inline-flex; }

/* ── Попап «Адресаты» (получатели сообщения + прочтение) ──────────────── */
.recipients-popup-overlay {
    position: fixed; inset: 0; z-index: 9000;
    background: rgba(10, 14, 30, .92);   /* наш стандартный фон попапов (как будильник/звонок) */
    display: flex; align-items: center; justify-content: center;
    /* Учитываем safe-area (статусбар Android/notch) — как в ml-popup, иначе высокий попап лезет под панель */
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
.recipients-popup {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    width: 340px; max-width: 100%; max-height: 100%; min-height: 0;   /* 100% = высота оверлея минус safe-area паддинги */
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: var(--shadow-md);
    animation: alarm-modal-in 180ms ease;
}
.recipients-popup__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--color-border);
}
.recipients-popup__title { font-weight: 600; font-size: 15px; }
.recipients-popup__list { overflow-y: auto; padding: 6px 8px; }
.recipients-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 8px; border-radius: var(--radius-sm);
}
.recipients-row:hover { background: rgba(0,0,0,.04); }
.recipients-row__name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recipients-row__meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.recipients-row__time { font-size: 12px; color: var(--color-text-muted); }
/* галка: серая = не прочитано, синяя = прочитано */
.recipients-check { display: inline-flex; width: 16px; height: 16px; color: #c7cedb; }  /* светло-серая = не прочитано */
.recipients-check--read { color: var(--color-primary); }
.recipients-check svg { width: 16px; height: 16px; }
.recipients-row__reaction { font-size: 15px; line-height: 1; }

/* ── Попап «Добавить тему» (темы в группах) ─────────────────────────────── */
/* Единый стиль оверлея как у .alarm-overlay (rgba(10,14,30,.92)). */
.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 30, .92);
  padding: 16px;
}
.popup-card {
  width: 340px;
  max-width: 100%;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: alarm-modal-in 180ms ease;
}
.popup-card__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}
.popup-card__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Страница «Обращения» в кол-2 (без кол-3; call-requests-page.js) ── */
/* Ширина — как у кол-2 при открытой кол-3: вычитаем её ширину (--req-col3-w ставит JS). */
.req-page { max-width: calc(100% - var(--req-col3-w, 280px)); padding: 8px 0 48px; }
@media (max-width: 768px) { .req-page { max-width: none; } }
.call-req-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 12px 10px; }
/* Селект сортировки в шапке кол-2 — рядом с заголовком, слева (как «Добавить» у будильников). */
.chat-header--requests .chat-header__name { flex: 0 0 auto; }
.chat-header--requests .call-req-sort { margin-left: 18px; }
/* Кнопки шапки обращений («Архивировать все» / «Скопировать») — лёгкая рамка, чтобы читались как кнопки. */
.call-req-btn { background: none; border: 1px solid rgba(10,23,131,.22); cursor: pointer; color: var(--color-primary); font-family: var(--font); font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 6px; transition: background .15s, border-color .15s; }
.call-req-btn:hover { background: rgba(10,23,131,.08); border-color: rgba(10,23,131,.4); }
.call-req-btn:disabled { opacity: .5; cursor: default; }
.call-req-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; cursor: pointer; }
.call-req-item:hover { background: rgba(0,0,0,.03); }
/* Слот галки = ширине аватарки обычного звонка (38px), чтобы названия/данные не съезжали
   по вертикали. Саму кнопку не увеличиваем — центрируем в слоте. */
.call-req-avatar { flex: 0 0 38px; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.call-req-check { width: 26px; height: 26px; padding: 5px; border-radius: 50%; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background var(--transition); }
.call-req-check__state, .call-req-check__x { width: 100%; height: 100%; display: flex; }
.call-req-check svg { width: 100%; height: 100%; display: block; }
.call-req-check__x { display: none; color: var(--color-red); }
/* не обработан (0): фиолетовый круг + иконка пропущенного, размер как у аватарки звонка (38px) */
.call-req-check--s0 { width: 38px; height: 38px; padding: 10px; background: #8b5cf6; color: #fff; }
/* обработан (1): зелёный круг + галка */
.call-req-check--s1 { background: var(--color-green); color: #fff; }
/* при наведении на кнопку (любой статус): красный крест «в архив» */
.call-req-check:hover { background: rgba(205,45,75,.14); }
.call-req-check:hover .call-req-check__state { display: none; }
.call-req-check:hover .call-req-check__x { display: flex; }
/* Десктоп: крест появляется при наведении на ВСЮ строку обращения — подсказка, что
   галку/фиолетовую кнопку можно нажать «в архив». (На тач-устройствах hover не триггерится.) */
@media (hover: hover) and (pointer: fine) {
  .call-req-item:hover .call-req-check { background: rgba(205,45,75,.14); }
  .call-req-item:hover .call-req-check__state { display: none; }
  .call-req-item:hover .call-req-check__x { display: flex; }
}
.call-req-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }
.call-req-urg { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding: 2px 6px; border-radius: 999px; white-space: nowrap; }
.call-req-urg--low      { background: #e4e7ee; color: #3a3f4a; }
.call-req-urg--medium   { background: #ffe6a8; color: #6b4a00; }
.call-req-urg--urgent   { background: var(--color-red); color: #fff; }
.call-req-urg--extreme  { background: #1e1e1e; color: #fff; }
.call-req-urg--reminder { background: #17b8cf; color: #fff; }
.call-req-desc { display: block; font-size: 13px; color: var(--color-text); margin-top: 5px; margin-bottom: 3px; padding: 3px 7px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); white-space: normal; overflow-wrap: anywhere; }

/* «Архивировать все» — под списком обращений */

/* ── «Мои файлы»: вкладки «Картинки» (сетка квадратных превью) и «Файлы» (список) ── */
.vlib-total {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 2px 8px 8px; font-size: 12px; color: var(--color-text-muted); font-variant-numeric: tabular-nums;
}
.vlib-sort {
  margin-left: auto;
  padding: 4px 8px; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text); font-family: var(--font); font-size: 12px; cursor: pointer;
}
.vlib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
  padding: 0 4px;
}
.vlib-tile { position: relative; min-width: 0; border-radius: var(--radius-md); overflow: hidden; }
.vlib-tile__img {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: none;
  border-radius: 0;
  overflow: hidden;
  background: var(--color-bg);
  cursor: zoom-in;
}
.vlib-tile__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vlib-tile__ext {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  background: hsl(var(--ext-h, 230) 70% 92%); color: hsl(var(--ext-h, 230) 60% 30%);
}
.vlib-tile__img--noimg img { display: none; }
.vlib-tile__img--noimg .vlib-tile__ext { display: flex; }
/* Кнопки — поверх картинки внизу, на градиентной полупрозрачной подложке (не сливаются с фото).
   Десктоп: появляются при наведении (и остаются, пока взведено подтверждение удаления).
   Тач (нет hover): видны всегда, иначе до них не добраться. */
.vlib-tile__bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 18px 3px 3px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, .62));
  pointer-events: none;
}
.vlib-tile__bar .vlib-btn { width: 26px; height: 26px; color: #fff; pointer-events: auto; }
.vlib-tile__bar .vlib-btn:hover { background: rgba(255, 255, 255, .22); color: #fff; }
.vlib-tile__bar .vlib-btn:disabled { opacity: .4; background: none; }
.vlib-tile__bar .vlib-btn svg { width: 15px; height: 15px; }
@media (hover: hover) and (pointer: fine) {
  .vlib-tile__bar { opacity: 0; transition: opacity 150ms; }
  .vlib-tile:hover .vlib-tile__bar,
  .vlib-tile:focus-within .vlib-tile__bar,
  .vlib-tile:has(.vlib-del--confirm) .vlib-tile__bar { opacity: 1; }
}
.vlib-flist { display: flex; flex-direction: column; gap: 2px; }
.vlib-fitem__name { cursor: default; }
.vlib-fext {
  flex-shrink: 0;
  min-width: 38px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  background: hsl(var(--ext-h, 230) 70% 92%);   /* оттенок — из хэша расширения (screen-rec.js) */
  color: hsl(var(--ext-h, 230) 60% 30%);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}
.vlib-btn:disabled { opacity: .35; cursor: default; background: none; }
.vlib-more { flex-shrink: 0; }
.vlib-more .vlib-empty { padding: 14px 16px; }
