/* Zirconix Message — корпоративная тема, переменные в духе admin/style.css
   По умолчанию (:root) — светлая тема: светлый сайдбар и тёмный текст на нём. */

:root {
  color-scheme: light;
  --zm-bg-page: #f5f5f5;
  --zm-bg-surface: #ffffff;
  --zm-bg-surface-alt: #fafafa;
  --zm-bg-elevated: #ffffff;
  --zm-bg-hover: #e8f1fc;
  --zm-bg-subtle: #f3f6fa;
  --zm-text: #1f1f1f;
  --zm-text-muted: #6b7280;
  --zm-border: #e5e7eb;
  --zm-border-strong: #d1d5db;
  --zm-accent: #1677ff;
  --zm-accent-hover: #0958d9;
  --zm-on-accent: #ffffff;
  /* Кристалл: как user-panel topbar (--brand-primary) */
  --zm-brand-gem: #3a7afe;
  /* Светлый сайдбар (читаемый текст и хром) */
  --zm-sidebar: #e4e7ec;
  --zm-sidebar-alt: #d8dce4;
  --zm-sidebar-text: #475569;
  --zm-sidebar-text-active: #0f172a;
  --zm-sidebar-hover: #cbd5e1;
  --zm-sidebar-border: rgba(15, 23, 42, 0.12);
  --zm-sidebar-input-bg: #ffffff;
  --zm-sidebar-well: rgba(15, 23, 42, 0.06);
  --zm-sidebar-well-strong: rgba(15, 23, 42, 0.1);
  --zm-sidebar-section-bg: transparent;
  --zm-sidebar-section-toggle-bg: transparent;
  --zm-sidebar-nested-topic-bg: transparent;
  --zm-sidebar-topic-active-bg: rgba(15, 23, 42, 0.05);
  --zm-sidebar-topic-active-ring: transparent;
  --zm-sidebar-topic-nest-active-bg: rgba(15, 23, 42, 0.05);
  --zm-sidebar-topic-nest-active-ring: transparent;
  --zm-sidebar-group-focus-ring: rgba(15, 23, 42, 0.2);
  /* Выбранная группа — холодная полоса к янтарной полосе активного топика */
  --zm-sidebar-group-focus-bg: rgba(13, 116, 110, 0.09);
  --zm-sidebar-group-focus-bar: #0f766e;
  --zm-sidebar-active-bar: #ca8a04;
  --zm-system-bg: #f0f7ff;
  --zm-system-border: #91d5ff;
  --zm-system-text: #0958d9;
  --zm-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  --zm-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  /* Строгий корпоративный: меньше скругление карточек и контролов */
  --zm-radius: 6px;
  --zm-radius-sm: 4px;
  --zm-radius-xs: 2px;
  --zm-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --zm-header-h: 52px;
  --zm-input-h: 44px;
  --zm-safe-bottom: env(safe-area-inset-bottom, 0px);
  --zm-chat-font-scale: 1;
  /* Шкала оверлеев (см. UI_TECH_DEBT.md): выше число — ближе к пользователю */
  --zm-z-theme-float: 50;
  --zm-z-composer-picker: 50;
  --zm-z-ctx-menu: 4000;
  --zm-z-modal: 9990;
  --zm-z-lightbox: 10000;
  --zm-z-modal-confirm: 10060;
}

[data-theme="dark"] {
  color-scheme: dark;
  --zm-brand-gem: #3a7afe;
  --zm-bg-page: #121212;
  --zm-bg-surface: #1c1c1c;
  --zm-bg-surface-alt: #232323;
  --zm-bg-elevated: #262626;
  --zm-bg-hover: #2a2a2a;
  --zm-bg-subtle: #171717;
  --zm-text: #e5e7eb;
  --zm-text-muted: #a0a0a0;
  --zm-border: rgba(255, 255, 255, 0.1);
  --zm-border-strong: rgba(255, 255, 255, 0.16);
  --zm-accent: #3a7afe;
  --zm-accent-hover: #6aa9ff;
  --zm-on-accent: #ffffff;
  --zm-sidebar: #161616;
  --zm-sidebar-alt: #1b1b1b;
  --zm-sidebar-text: #cfcfcf;
  --zm-sidebar-text-active: #f0f0f0;
  --zm-sidebar-hover: #262626;
  --zm-sidebar-border: rgba(255, 255, 255, 0.1);
  --zm-sidebar-input-bg: rgba(0, 0, 0, 0.35);
  --zm-sidebar-well: rgba(0, 0, 0, 0.2);
  --zm-sidebar-well-strong: rgba(0, 0, 0, 0.26);
  --zm-sidebar-section-bg: transparent;
  --zm-sidebar-section-toggle-bg: transparent;
  --zm-sidebar-nested-topic-bg: transparent;
  --zm-sidebar-topic-active-bg: rgba(255, 255, 255, 0.05);
  --zm-sidebar-topic-active-ring: transparent;
  --zm-sidebar-topic-nest-active-bg: rgba(255, 255, 255, 0.05);
  --zm-sidebar-topic-nest-active-ring: transparent;
  --zm-sidebar-group-focus-ring: rgba(255, 255, 255, 0.2);
  --zm-sidebar-group-focus-bg: rgba(45, 212, 191, 0.1);
  --zm-sidebar-group-focus-bar: #2dd4bf;
  --zm-sidebar-active-bar: #fbbf24;
  --zm-system-bg: #0f2744;
  --zm-system-border: rgba(106, 169, 255, 0.35);
  --zm-system-text: #93c5fd;
  --zm-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --zm-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--zm-font);
  background: var(--zm-bg-page);
  color: var(--zm-text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.app-root {
  min-height: 100%;
  min-height: 100dvh;
}

/* Фиксированная вёрстка чата только когда смонтирован shell (не ломать страницу входа). */
.app-root:has(> .shell) {
  height: 100dvh;
  height: 100svh;
  max-height: 100dvh;
  max-height: 100svh;
  overflow: hidden;
}

/* ----- Shell ----- */

.shell {
  display: flex;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  margin: 0 auto;
  background: var(--zm-bg-page);
}

.sidebar {
  width: 100%;
  max-width: 380px;
  flex-shrink: 0;
  background: var(--zm-sidebar);
  color: var(--zm-sidebar-text);
  border-right: 1px solid var(--zm-sidebar-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  /* Список групп/топиков и превью — тот же масштаб, что и в треде (кнопка A±). */
  font-size: calc(1rem * var(--zm-chat-font-scale, 1));
}

.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  min-height: var(--zm-header-h);
  background: var(--zm-sidebar);
  border-bottom: 1px solid var(--zm-sidebar-border);
  flex-shrink: 0;
}

.sidebar__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: inherit;
}

.sidebar__footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

.brand {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

/* Логотип: user-panel.css — .logo-block, .logo-icon, .logo-text, @keyframes fadeIn */
.zm-brand.logo-block {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--zm-brand-gem);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

.logo-icon__svg {
  display: block;
  width: 26px;
  height: 26px;
}

.zm-brand__words {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.22;
}

.zm-brand .logo-text.zm-brand__zirconix {
  font-size: 0.95em;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--zm-sidebar-text-active);
}

.zm-brand__message {
  font-size: 0.75em;
  font-weight: 500;
  color: var(--zm-sidebar-text);
  opacity: 0.92;
  letter-spacing: 0.02em;
}

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

.zm-unread-mail-btn {
  position: relative;
}

.zm-unread-mail-btn__at,
.zm-unread-mail-btn__badge {
  position: absolute;
  top: -5px;
  box-sizing: border-box;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--zm-accent);
  color: var(--zm-on-accent);
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1rem;
  text-align: center;
  border: 2px solid var(--zm-sidebar);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.zm-unread-mail-btn__at {
  left: -5px;
  font-weight: 800;
}

.zm-unread-mail-btn__badge {
  right: -5px;
}

.main .zm-unread-mail-btn__at,
.main .zm-unread-mail-btn__badge {
  border-color: var(--zm-bg-elevated);
}

.zm-unread-mail-btn__at[hidden],
.zm-unread-mail-btn__badge[hidden] {
  display: none !important;
}

.composer-error {
  padding: 6px 0 0;
  font-size: 0.85rem;
  color: var(--zm-system-text);
}

.icon-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--zm-sidebar-text-active);
  width: 40px;
  height: 40px;
  border-radius: var(--zm-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--zm-sidebar-hover);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--zm-accent);
  outline-offset: 2px;
}

.sidebar__search {
  padding: 10px 12px;
}

.sidebar__quick-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 4px;
}

.sidebar .sidebar-quick-btn {
  flex-shrink: 0;
  border-color: var(--zm-sidebar-border);
  background: var(--zm-sidebar);
  color: var(--zm-sidebar-text);
  box-shadow: none;
}

.sidebar .sidebar-quick-btn:hover:not(:disabled) {
  background: var(--zm-sidebar-hover);
  color: var(--zm-sidebar-text-active);
  border-color: var(--zm-sidebar-border);
}

@media (min-width: 900px) {
  #btn-quick-group-settings {
    display: none !important;
  }
}

.sidebar__search input {
  width: 100%;
  height: var(--zm-input-h);
  border-radius: var(--zm-radius-sm);
  border: 1px solid var(--zm-sidebar-border);
  background: var(--zm-sidebar-input-bg);
  color: var(--zm-sidebar-text-active);
  padding: 0 12px;
  font-size: 0.9em;
}

.sidebar__search input:focus {
  outline: 2px solid var(--zm-accent);
  outline-offset: 0;
  border-color: var(--zm-accent);
}

.sidebar__search input::placeholder {
  color: var(--zm-sidebar-text);
  opacity: 0.75;
}

.topic-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 0 12px;
  -webkit-overflow-scrolling: touch;
}

.topic-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 8px 10px;
  margin: 0;
  border-radius: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid transparent;
}

.topic-item:hover {
  background: var(--zm-sidebar-hover);
}

.topic-item:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--zm-accent);
}

.topic-item--active {
  background: var(--zm-sidebar-topic-active-bg);
  box-shadow: inset 6px 0 0 0 var(--zm-sidebar-active-bar);
  padding-left: 10px;
}

.topic-item--active:hover {
  filter: none;
}

.sidebar-hint {
  padding: 14px 12px;
  font-size: 0.8em;
  line-height: 1.35;
  color: var(--zm-sidebar-text);
  opacity: 0.85;
}

.search-hit-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 8px 10px;
  border-radius: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
}

.search-hit-item:hover {
  background: var(--zm-sidebar-hover);
}

.search-hit-item--active {
  background: var(--zm-sidebar-topic-active-bg);
  border-left: none;
  box-shadow: inset 6px 0 0 0 var(--zm-sidebar-active-bar);
  padding-left: 10px;
}

.search-hit-item__kind {
  font-size: 0.62em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--zm-sidebar-text);
  opacity: 0.72;
}

.search-hit-item__topic {
  font-size: 0.82em;
  font-weight: 600;
  color: var(--zm-sidebar-text-active);
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-hit-item__meta {
  font-size: 0.7em;
  color: var(--zm-sidebar-text);
  opacity: 0.75;
}

.search-hit-item__snippet {
  font-size: 0.75em;
  color: var(--zm-sidebar-text);
  opacity: 0.92;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.topic-item__title {
  font-size: 0.9em;
  font-weight: 600;
  color: var(--zm-sidebar-text-active);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topic-item__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.topic-item__title-row .topic-item__title {
  flex: 1;
  min-width: 0;
}

.topic-item__badge {
  flex-shrink: 0;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 6px;
  border-radius: var(--zm-radius-xs);
  background: transparent;
  border: 1px solid var(--zm-sidebar-border);
  color: var(--zm-sidebar-text-active);
  font-size: 0.65em;
  font-weight: 600;
  line-height: 1.25rem;
  text-align: center;
}

.sidebar-unread-badge {
  display: inline-block;
  margin-left: 6px;
  min-width: 1.1rem;
  padding: 1px 6px;
  border-radius: var(--zm-radius-xs);
  background: transparent;
  border: 1px solid var(--zm-sidebar-border);
  color: var(--zm-sidebar-text-active);
  font-size: 0.62em;
  font-weight: 600;
  vertical-align: middle;
}

/* Иначе display:inline-block перебивает UA [hidden] — остаётся пустая синяя полоска */
.sidebar-unread-badge[hidden] {
  display: none !important;
}

.topic-item__preview {
  font-size: 0.78em;
  color: var(--zm-sidebar-text);
  opacity: 0.9;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.topic-item__meta {
  font-size: 0.7em;
  color: var(--zm-sidebar-text);
  opacity: 0.65;
}

.topic-item--nested {
  margin-left: 0;
  padding-left: 14px;
  border-left: 1px solid var(--zm-sidebar-border);
  border-radius: 0;
}

.topic-item--nested.topic-item--active {
  border-left: none;
  box-shadow: inset 6px 0 0 0 var(--zm-sidebar-active-bar);
  padding-left: 10px;
}

.topic-item--manual-nest.topic-item--nested {
  margin-left: 0;
  margin-top: 0;
  width: 100%;
  max-width: 100%;
  padding: 8px 10px 8px 14px;
  border-left: 1px solid var(--zm-sidebar-border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.topic-item--manual-nest.topic-item--active {
  background: var(--zm-sidebar-topic-nest-active-bg);
  border-left: none;
  box-shadow: inset 6px 0 0 0 var(--zm-sidebar-active-bar);
  padding-left: 10px;
}

.topic-item--manual-nest.topic-item--active:hover {
  filter: none;
}

.topic-item--manual-nest .topic-item__title {
  font-size: 0.85em;
}

.topic-item--manual-nest .topic-item__preview {
  font-size: 0.74em;
}

.clinic-group {
  margin-bottom: 10px;
}

.clinic-group:last-child {
  margin-bottom: 0;
}

/* Раздел клиники / ручного верхнего уровня: без карточки и без линий между заголовками */
.sidebar-section {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  padding: 0 0 12px;
  border-radius: 0;
  border: none;
  background: transparent;
  overflow: visible;
}

.sidebar-section__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  margin: 0;
  border: none;
  border-bottom: none;
  border-radius: 0;
  background: var(--zm-sidebar-section-toggle-bg);
  color: var(--zm-sidebar-text-active);
  cursor: pointer;
  font: inherit;
  transition: background 0.15s ease;
}

.sidebar-section__toggle:hover {
  background: var(--zm-sidebar-hover);
}

.sidebar-section__toggle:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--zm-accent);
}

.sidebar-section__chevron {
  display: block;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
  flex-shrink: 0;
  opacity: 0.72;
  margin-top: 1px;
  transition: transform 0.2s ease;
}

.sidebar-section[data-expanded='true'] .sidebar-section__chevron {
  transform: rotate(135deg);
}

.sidebar-section__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.sidebar-section__label-text {
  font-size: 0.73em;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--zm-sidebar-text);
  opacity: 0.9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-section__groups {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 2px;
  padding-left: 14px;
  margin: 4px 0 0;
  margin-left: 8px;
  border-left: 1px solid var(--zm-sidebar-border);
}

/* display:flex на контейнере перебивает UA [hidden] — без !important сворачивание раздела не работает */
.sidebar-section__groups[hidden] {
  display: none !important;
}

.sidebar-section__groups > .clinic-group {
  margin-bottom: 0;
}

/* Вложенный блок группы под разделом: без второй карточки */
.clinic-group--manual {
  padding: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  min-width: 0;
  overflow: visible;
}

.clinic-group--manual.clinic-group--focused {
  box-shadow: inset 6px 0 0 0 var(--zm-sidebar-group-focus-bar);
  background: var(--zm-sidebar-group-focus-bg);
}

.clinic-group__head--split {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  gap: 0;
}

.clinic-group--manual .clinic-group__chevron-btn,
.clinic-group--manual .clinic-group__label-hit {
  border-radius: 0;
}

.clinic-group__chevron-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--zm-sidebar-text-active);
  cursor: pointer;
  font: inherit;
  transition: background 0.15s ease;
}

.clinic-group__chevron-btn:hover {
  background: var(--zm-sidebar-hover);
}

.clinic-group__chevron-btn:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--zm-accent);
}

.clinic-group__label-hit {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 6px 8px 6px 0;
  border: none;
  background: transparent;
  color: var(--zm-sidebar-text-active);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background 0.15s ease;
}

.clinic-group__label-hit:hover {
  background: var(--zm-sidebar-hover);
}

.clinic-group__label-hit:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--zm-accent);
}

.clinic-group--manual .clinic-group__body {
  padding: 0;
  padding-left: 34px;
  min-width: 0;
  overflow: hidden;
}

.sidebar .clinic-group__gear {
  flex-shrink: 0;
  width: var(--zm-input-h);
  height: var(--zm-input-h);
  align-self: center;
}

.clinic-group__headrow {
  display: flex;
  align-items: stretch;
  gap: 6px;
  width: 100%;
}

.clinic-group__headrow .clinic-group__label-hit {
  flex: 1;
  min-width: 0;
}

.clinic-group__admin-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 2px 0 4px;
}

@media (min-width: 400px) {
  .clinic-group__admin-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
}

.clinic-group__action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  margin: 0;
  border-radius: var(--zm-radius-sm);
  border: 1px solid var(--zm-border);
  background: transparent;
  color: var(--zm-text);
  font: inherit;
  font-size: 0.68em;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}

.clinic-group__action-btn:hover {
  background: var(--zm-sidebar-hover);
}

.clinic-group__action-btn:focus-visible {
  outline: 2px solid var(--zm-accent);
  outline-offset: 2px;
}

.clinic-group__action-btn--danger {
  border-color: rgba(198, 40, 40, 0.45);
  color: #c62828;
}

.clinic-group__action-btn--danger:hover {
  background: rgba(198, 40, 40, 0.08);
}

[data-theme="dark"] .clinic-group__action-btn--danger {
  color: #ff8a80;
  border-color: rgba(255, 138, 128, 0.45);
}



.clinic-group__chevron {
  display: block;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
  flex-shrink: 0;
  opacity: 0.72;
  margin: 0;
  transition: transform 0.2s ease;
}

.clinic-group[data-expanded="true"] .clinic-group__chevron {
  transform: rotate(135deg);
}

.clinic-group__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.clinic-group__label-hit .clinic-group__label-row {
  width: 100%;
}

.clinic-group__label {
  flex: 1;
  min-width: 0;
  font-size: 0.78em;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.01em;
  color: var(--zm-sidebar-text-active);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clinic-group__badge {
  flex-shrink: 0;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 6px;
  border-radius: var(--zm-radius-xs);
  background: transparent;
  border: 1px solid var(--zm-sidebar-border);
  color: var(--zm-sidebar-text-active);
  font-size: 0.62em;
  font-weight: 600;
  line-height: 1.15rem;
  text-align: center;
}

.clinic-group__body {
  padding: 2px 0 4px 0;
}

.sidebar-round-btn {
  width: var(--zm-input-h);
  height: var(--zm-input-h);
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--zm-sidebar-border);
  background: var(--zm-sidebar-well);
  color: var(--zm-sidebar-text-active);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-round-btn:hover {
  background: var(--zm-sidebar-hover);
  color: var(--zm-sidebar-text-active);
}

.sidebar-round-btn:focus-visible {
  outline: 2px solid var(--zm-accent);
  outline-offset: 2px;
}

.sidebar-round-btn__icon {
  width: 22px;
  height: 22px;
  display: block;
  pointer-events: none;
}

/* Круг: левая половина — меньше шрифт, правая — больше (только desktop, см. media ниже). */
.sidebar-font-scale-btn {
  width: var(--zm-input-h);
  height: var(--zm-input-h);
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  border: 1px solid var(--zm-sidebar-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  background: var(--zm-sidebar-well);
}

.sidebar-font-scale-btn__half {
  flex: 1 1 50%;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--zm-sidebar-text-active);
  background: var(--zm-sidebar-well);
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-font-scale-btn__half--dec {
  border-right: 1px solid var(--zm-sidebar-border);
  background: color-mix(in srgb, var(--zm-sidebar-well) 88%, var(--zm-sidebar-hover));
}

.sidebar-font-scale-btn__half--inc {
  background: color-mix(in srgb, var(--zm-sidebar-well) 72%, var(--zm-sidebar-hover));
}

.sidebar-font-scale-btn__half:hover:not(:disabled) {
  background: var(--zm-sidebar-hover);
  color: var(--zm-sidebar-text-active);
}

.sidebar-font-scale-btn__half:focus-visible {
  outline: 2px solid var(--zm-accent);
  outline-offset: -2px;
  z-index: 1;
}

.sidebar-font-scale-btn__half:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.sidebar-font-scale-btn__glyph {
  font-family: var(--zm-font);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.sidebar-font-scale-btn__glyph--sm {
  font-size: 0.62rem;
}

.sidebar-font-scale-btn__glyph--lg {
  font-size: 0.88rem;
}

.sidebar-theme-toggle {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 0;
}

.sidebar-theme-toggle:focus-visible {
  outline: 2px solid var(--zm-accent);
  outline-offset: 3px;
  border-radius: 999px;
}

.sidebar-theme-toggle__track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 54px;
  height: 32px;
  padding: 0 7px;
  box-sizing: border-box;
  border-radius: 999px;
  background: var(--zm-sidebar-well-strong);
  border: 1px solid var(--zm-sidebar-border);
}

.sidebar-theme-toggle__icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--zm-sidebar-text-active);
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.sidebar-theme-toggle__icon--sun {
  opacity: 0.95;
}

.sidebar-theme-toggle__icon--moon {
  opacity: 0.42;
}

.sidebar-theme-toggle[aria-checked="true"] .sidebar-theme-toggle__icon--sun {
  opacity: 0.38;
}

.sidebar-theme-toggle[aria-checked="true"] .sidebar-theme-toggle__icon--moon {
  opacity: 1;
  color: var(--zm-sidebar-text-active);
}

.sidebar-theme-toggle__knob {
  position: absolute;
  left: 4px;
  top: 50%;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  border-radius: 50%;
  background: var(--zm-sidebar-text-active);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
  z-index: 1;
}

.sidebar-theme-toggle[aria-checked="true"] .sidebar-theme-toggle__knob {
  transform: translateX(22px);
}

/* Main pane */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--zm-bg-surface);
}

.main__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  min-height: var(--zm-header-h);
  flex-shrink: 0;
  border-bottom: 1px solid var(--zm-border);
  background: var(--zm-bg-elevated);
}

.main .icon-btn {
  color: var(--zm-text);
  border: 1px solid var(--zm-border);
  background: var(--zm-bg-surface);
}

.main__header .composer-round-btn.main__header__gear,
.main__header .composer-round-btn.main__header__invite,
.main__header .composer-round-btn.main__header__extras,
.main__header .composer-round-btn.main__header__search,
.main__header .composer-round-btn.main__header__back,
.main__header .composer-round-btn.main__header__unread-mail {
  width: var(--zm-input-h);
  height: var(--zm-input-h);
}

/* Конверт в шапке чата — только мобильный тред; на десктопе — в сайдбаре / при свёрнутом сайдбаре */
.main__header .composer-round-btn.main__header__unread-mail {
  display: none !important;
}

.main .icon-btn:hover {
  background: var(--zm-bg-hover);
}

.main__header__title {
  flex: 1;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.28;
}

.main__header__title-stack {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
}

.main__header__title-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.main__header__title-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
}

.main__header__title-topic {
  min-width: 0;
  max-width: 100%;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1.28;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main__header__title-context {
  min-width: 0;
  max-width: 100%;
  font-size: 0.75em;
  font-weight: 500;
  line-height: 1.25;
  color: var(--zm-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main__header__title-context[hidden] {
  display: none !important;
}

.main__header__typing {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--zm-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.main__header__topic-kind {
  flex-shrink: 0;
  align-self: center;
  margin: 0;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 6px;
  letter-spacing: 0.04em;
}

.main__header__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.main__header .main__header__gear {
  flex-shrink: 0;
}

.main__header .main__header__extras {
  flex-shrink: 0;
}

.main__header .main__header__extras.main__header__extras--active,
.main__header .main__header__search.main__header__search--active {
  background: var(--zm-accent);
  border-color: var(--zm-accent);
  color: #fff;
}

.main__header--topic-search-open {
  flex-wrap: wrap;
}

.thread-header-search {
  display: none;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.main__header--topic-search-open .thread-header-search {
  display: flex;
}

.thread-header-search__input {
  flex: 1;
  min-width: 0;
  height: var(--zm-input-h);
  border-radius: var(--zm-radius-sm);
  border: 1px solid var(--zm-border);
  background: var(--zm-bg-surface);
  color: var(--zm-text);
  padding: 0 12px;
  font-size: 0.9rem;
}

.thread-header-search__input:focus {
  outline: 2px solid var(--zm-accent);
  outline-offset: 0;
  border-color: var(--zm-accent);
}

.thread-header-search__input::placeholder {
  color: var(--zm-text-muted);
}

.thread-header-search__status {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--zm-text-muted);
  white-space: nowrap;
}

.thread-header-search__status[hidden] {
  display: none !important;
}

.thread-header-search .composer-round-btn.thread-header-search__nav,
.thread-header-search .composer-round-btn.thread-header-search__close {
  flex-shrink: 0;
}

.main__header .main__header__back {
  flex-shrink: 0;
}

.pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--zm-radius-sm);
  border: 1px solid var(--zm-border);
  color: var(--zm-text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pill--kind-doctor-clinic {
  background: rgba(234, 88, 12, 0.14);
  border-color: #ea580c;
  color: #c2410c;
}

[data-theme="dark"] .pill--kind-doctor-clinic {
  background: rgba(234, 88, 12, 0.22);
  border-color: #fb923c;
  color: #fdba74;
}

.pill--kind-other-0 {
  background: rgba(147, 51, 234, 0.12);
  border-color: #9333ea;
  color: #6b21a8;
}

[data-theme="dark"] .pill--kind-other-0 {
  background: rgba(168, 85, 247, 0.2);
  border-color: #c084fc;
  color: #e9d5ff;
}

.pill--kind-other-1 {
  background: rgba(13, 148, 136, 0.12);
  border-color: #0d9488;
  color: #0f766e;
}

[data-theme="dark"] .pill--kind-other-1 {
  background: rgba(45, 212, 191, 0.16);
  border-color: #2dd4bf;
  color: #99f6e4;
}

.pill--kind-other-2 {
  background: rgba(22, 163, 74, 0.12);
  border-color: #16a34a;
  color: #15803d;
}

[data-theme="dark"] .pill--kind-other-2 {
  background: rgba(74, 222, 128, 0.16);
  border-color: #4ade80;
  color: #bbf7d0;
}

.pill--kind-other-3 {
  background: rgba(225, 29, 72, 0.1);
  border-color: #e11d48;
  color: #be123c;
}

[data-theme="dark"] .pill--kind-other-3 {
  background: rgba(251, 113, 133, 0.18);
  border-color: #fb7185;
  color: #fecdd3;
}

.pill--kind-other-4 {
  background: rgba(2, 132, 199, 0.12);
  border-color: #0284c7;
  color: #0369a1;
}

[data-theme="dark"] .pill--kind-other-4 {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  color: #bae6fd;
}

.pill--kind-other-5 {
  background: rgba(124, 58, 237, 0.1);
  border-color: #7c3aed;
  color: #5b21b6;
}

[data-theme="dark"] .pill--kind-other-5 {
  background: rgba(167, 139, 250, 0.2);
  border-color: #a78bfa;
  color: #ddd6fe;
}

.pill[hidden] {
  display: none !important;
}

.thread-pane {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.topic-extras-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--zm-bg-surface-alt);
}

.topic-extras-pane[hidden] {
  display: none !important;
}

.topic-extras-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--zm-border);
  background: var(--zm-bg-surface);
  flex-shrink: 0;
}

.topic-extras-tab {
  border: 1px solid var(--zm-border);
  background: var(--zm-bg-subtle);
  color: var(--zm-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.topic-extras-tab:hover {
  background: var(--zm-bg-hover);
  color: var(--zm-text);
}

.topic-extras-tab--active {
  background: var(--zm-accent);
  border-color: var(--zm-accent);
  color: #fff;
}

.topic-photos-toolbar,
.topic-tags-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 8px 14px 10px;
  border-bottom: 1px solid var(--zm-border);
  background: var(--zm-bg-surface);
  flex-shrink: 0;
}

.topic-photos-toolbar[hidden],
.topic-tags-toolbar[hidden],
.topic-tags-search-bar[hidden] {
  display: none !important;
}

.topic-extras-pane--tags #topic-photos-toolbar {
  display: none !important;
}

.topic-extras-pane--photos #topic-tags-toolbar,
.topic-extras-pane--photos #topic-tags-search-bar {
  display: none !important;
}

.topic-tags-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 10px;
  border-bottom: 1px solid var(--zm-border);
  background: var(--zm-bg-surface);
  flex-shrink: 0;
}

.topic-tags-search-bar__input {
  flex: 1;
  min-width: 0;
  height: var(--zm-input-h);
  padding: 0 12px;
  border-radius: var(--zm-radius-sm);
  border: 1px solid var(--zm-border);
  background: var(--zm-bg);
  color: var(--zm-text);
  font: inherit;
  font-size: 0.9rem;
}

.topic-tags-search-bar__input:focus {
  outline: 2px solid color-mix(in srgb, var(--zm-accent, #2563eb) 35%, transparent);
  outline-offset: 1px;
}

.topic-tags-search-bar__close {
  width: var(--zm-input-h);
  height: var(--zm-input-h);
  flex-shrink: 0;
}

.topic-tags-tool {
  width: var(--zm-input-h);
  height: var(--zm-input-h);
  flex-shrink: 0;
}

.topic-tags-tool[aria-pressed='true'] {
  background: var(--zm-accent);
  border-color: var(--zm-accent);
  color: #fff;
}

.topic-photos-tool {
  width: var(--zm-input-h);
  height: var(--zm-input-h);
  flex-shrink: 0;
}

.topic-photos-tool--active {
  background: var(--zm-accent);
  border-color: var(--zm-accent);
  color: #fff;
}

.topic-photos-tool--danger:not(:disabled) {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.45);
}

.topic-photos-tool:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.topic-extras-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
  -webkit-overflow-scrolling: touch;
}

.topic-tags-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.topic-tags-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--zm-border);
  background: var(--zm-bg-surface);
  color: var(--zm-text);
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
}

.topic-tags-chip:hover {
  background: var(--zm-bg-hover);
}

.topic-tags-chip--active {
  border-color: var(--zm-accent, #2563eb);
  background: color-mix(in srgb, var(--zm-accent, #2563eb) 12%, var(--zm-bg-surface));
}

.topic-tags-chip__cnt {
  font-size: 0.75rem;
  color: var(--zm-text-muted);
}

.topic-tags-hint {
  margin-top: 8px;
}

.topic-tags-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.topic-tags-feed__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--zm-radius-sm);
  border: 1px solid var(--zm-border);
  background: var(--zm-bg-surface);
  color: var(--zm-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.topic-tags-feed__item:hover {
  background: var(--zm-bg-hover);
}

.topic-tags-feed__meta {
  font-size: 0.78rem;
  color: var(--zm-text-muted);
}

.topic-tags-feed__chat {
  font-weight: 600;
  color: var(--zm-text);
}

.topic-tags-feed__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.topic-tags-feed__tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--zm-accent, #2563eb);
}

.topic-tags-feed__body {
  font-size: 0.9rem;
  line-height: 1.35;
  word-break: break-word;
}

.topic-tags-feed__more {
  padding: 10px 0 4px;
  text-align: center;
}

.topic-photos-gallery {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.topic-photos-section__title {
  margin: 0 0 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--zm-text-muted);
}

.topic-photos-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  align-items: stretch;
}

@media (min-width: 600px) {
  .topic-photos-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .topic-photos-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.topic-photos-grid__cell {
  position: relative;
  min-width: 0;
  border-radius: var(--zm-radius-xs);
}

.topic-photos-grid__pick {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 3;
}

.topic-photos-grid__pick::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 4px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
  opacity: 0;
}

.topic-extras-body--select .topic-photos-grid__pick {
  display: block;
}

.topic-extras-body--select .topic-photos-grid__cell:not(.topic-photos-grid__cell--picked) .topic-photos-grid__link {
  opacity: 0.72;
  filter: saturate(0.85);
}

.topic-photos-grid__cell--picked::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: var(--zm-radius-xs);
  pointer-events: none;
  box-shadow: inset 0 0 0 3px var(--zm-accent);
  background: color-mix(in srgb, var(--zm-accent) 22%, transparent);
}

.topic-photos-grid__cell--picked .topic-photos-grid__link {
  border-color: var(--zm-accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--zm-accent) 55%, transparent);
  opacity: 1 !important;
  filter: none !important;
}

.topic-photos-grid__cell--picked .topic-photos-grid__pick {
  background: var(--zm-accent);
  border-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.topic-photos-grid__cell--picked .topic-photos-grid__pick::after {
  opacity: 1;
}

.topic-photos-grid__removed {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--zm-radius-xs);
  border: 1px dashed var(--zm-border-strong);
  background: var(--zm-bg-subtle);
  color: var(--zm-text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  padding: 6px;
  box-sizing: border-box;
}

.topic-photos-grid .topic-photos-grid__link {
  display: block;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  max-width: none;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--zm-radius-xs);
  border: 1px solid var(--zm-border);
  flex: none;
}

.topic-photos-grid .topic-photos-grid__link img {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: none;
  aspect-ratio: unset;
  object-fit: cover;
  vertical-align: top;
  background: var(--zm-bg-surface);
}

.shell--topic-extras .thread-jump-down,
.shell--topic-extras .thread-jump-mentions,
.shell--topic-extras footer.composer,
.shell--topic-extras footer.composer-selection {
  display: none !important;
}

/* Десктоп: в медиа скрываем ленту; на мобильном — оверлей поверх ленты (см. @media ниже). */
@media (min-width: 900px) {
  .shell--topic-extras .thread {
    display: none !important;
  }
}

.thread {
  font-size: calc(1rem * var(--zm-chat-font-scale, 1));
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-anchor: auto;
  padding: 16px 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  background: var(--zm-bg-surface-alt);
  -webkit-overflow-scrolling: touch;
}

.thread-jump-down {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 6;
  width: var(--zm-input-h, 44px);
  height: var(--zm-input-h, 44px);
  padding: 0;
  border: 1px solid var(--zm-border-strong);
  border-radius: 50%;
  background: var(--zm-bg-elevated);
  color: var(--zm-accent);
  box-shadow: var(--zm-shadow);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.thread-jump-down:hover {
  background: var(--zm-bg-hover);
  border-color: var(--zm-accent);
}

.thread-jump-down:focus-visible {
  outline: 2px solid var(--zm-accent);
  outline-offset: 2px;
}

.thread-jump-down[hidden] {
  display: none !important;
}

.thread-jump-down__icon {
  width: 22px;
  height: 22px;
  pointer-events: none;
}

.thread-jump-mentions {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 6;
  width: var(--zm-input-h, 44px);
  height: var(--zm-input-h, 44px);
  padding: 0;
  border: 1px solid var(--zm-border-strong);
  border-radius: 50%;
  background: var(--zm-bg-elevated);
  color: var(--zm-accent);
  box-shadow: var(--zm-shadow);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.thread-jump-mentions:hover {
  background: var(--zm-bg-hover);
  border-color: var(--zm-accent);
}

.thread-jump-mentions:focus-visible {
  outline: 2px solid var(--zm-accent);
  outline-offset: 2px;
}

.thread-jump-mentions[hidden] {
  display: none !important;
}

.thread-jump-mentions__glyph {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.thread-jump-mentions__count {
  position: absolute;
  top: -5px;
  right: -5px;
  box-sizing: border-box;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--zm-accent);
  color: var(--zm-on-accent);
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1rem;
  text-align: center;
  border: 2px solid var(--zm-bg-surface-alt);
  pointer-events: none;
}

.bubble--mention-focus {
  outline: 2px solid var(--zm-accent);
  outline-offset: 2px;
  border-radius: var(--zm-radius-sm);
}

.thread-jump-down__count {
  position: absolute;
  top: -5px;
  right: -5px;
  box-sizing: border-box;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--zm-accent);
  color: var(--zm-on-accent);
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1rem;
  text-align: center;
  border: 2px solid var(--zm-bg-elevated);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.bubble-shell--unread-anchor .bubble {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--zm-accent) 42%, transparent);
}

.bubble-shell {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
}

.bubble-shell:not(.bubble-shell--system):not(.bubble-shell--own) {
  align-self: flex-start;
}

.bubble-shell--own {
  align-self: flex-end;
  flex-direction: row-reverse;
}

/* Режим выбора сообщений */
.thread--selection-mode .bubble__reply-fab {
  opacity: 0 !important;
  pointer-events: none !important;
}

.bubble-select-check {
  position: relative;
  flex-shrink: 0;
  width: var(--zm-input-h, 44px);
  height: var(--zm-input-h, 44px);
  margin-bottom: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  align-self: flex-end;
}

.bubble-select-check[hidden] {
  display: none !important;
}

.bubble-select-check__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.bubble-select-check__ring {
  box-sizing: border-box;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--zm-border-strong);
  background: var(--zm-bg-elevated);
  display: block;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.bubble-select-check__input:checked + .bubble-select-check__ring {
  border-color: var(--zm-accent);
  background: var(--zm-accent);
  box-shadow: inset 0 0 0 3px var(--zm-bg-elevated);
}

.bubble-shell--selected .bubble {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--zm-accent) 35%, transparent);
}

@media (max-width: 899px) {
  .shell--msg-selection footer.composer {
    display: none !important;
  }
}

.composer-selection {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--zm-border);
  background: var(--zm-bg-elevated);
  min-height: var(--zm-input-h, 44px);
}

.composer-selection[hidden] {
  display: none !important;
}

.composer-selection .bubble-edit__icon-btn {
  flex-shrink: 0;
}

.composer-selection__count {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  color: var(--zm-text-muted);
  text-align: center;
}

.composer-selection__actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer-round-btn--danger {
  border-color: #b91c1c;
  background: #dc2626;
  color: #fff;
  box-shadow: var(--zm-shadow);
}

.composer-round-btn--danger:hover:not(:disabled) {
  border-color: #991b1b;
  background: #b91c1c;
  color: #fff;
}

.composer-round-btn--danger:focus-visible {
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

.composer-round-btn--danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

[data-theme="dark"] .composer-round-btn--danger {
  border-color: #f87171;
  background: #dc2626;
  color: #fff;
}

[data-theme="dark"] .composer-round-btn--danger:hover:not(:disabled) {
  background: #ef4444;
}

.bubble-shell--system {
  flex-direction: column;
  align-items: flex-start;
  width: auto;
  max-width: 100%;
}

.bubble-shell--system .bubble {
  width: fit-content;
  max-width: min(480px, 100%);
}

.bubble {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: min(720px, 100%);
  min-width: 0;
  box-sizing: border-box;
  vertical-align: top;
  position: relative;
  padding: 10px 12px;
  border-radius: var(--zm-radius);
  background: var(--zm-bg-elevated);
  border: 1px solid var(--zm-border);
  box-shadow: var(--zm-shadow);
}

.bubble--own {
  align-items: flex-end;
  background: var(--zm-bg-hover);
  border-color: var(--zm-border-strong);
}

.bubble__reply-fab {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  margin-bottom: 2px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--zm-border-strong);
  background: var(--zm-bg-elevated);
  color: var(--zm-accent);
  cursor: pointer;
  box-shadow: var(--zm-shadow);
  opacity: 0;
  transition: opacity 0.16s ease, background 0.12s ease, border-color 0.12s ease;
  pointer-events: none;
}

/*
 * Кружок Reply показывает только строка под курсором (класс .bubble-shell--reply-hot через JS — см. bindThreadBubbleActions).
 * Иначе :hover может «липнуть», а @media (hover: none) на ноутбуке с тачём давал все кружки сразу.
 */
@media (min-width: 900px) {
  .bubble-shell--reply-hot .bubble__reply-fab {
    opacity: 1;
    pointer-events: auto;
  }

  .bubble-shell .bubble__reply-fab:focus-visible {
    opacity: 1;
    pointer-events: auto;
  }

  .bubble-shell--reply-hot .bubble__reply-fab:hover {
    background: var(--zm-bg-hover);
    border-color: var(--zm-accent);
  }
}

/* Во время инлайн-редактирования кружок не нужен и не должен «висеть». */
.bubble-shell:has(.bubble--editing) .bubble__reply-fab {
  opacity: 0 !important;
  pointer-events: none !important;
}

@media (max-width: 899px) {
  .bubble__reply-fab {
    display: none !important;
  }

  /* Меньше конфликтов с долгим нажатием и вызовом меню ОС. */
  .bubble-shell .bubble {
    -webkit-touch-callout: none;
  }
}

.bubble__reply-fab__icon {
  width: 18px;
  height: 18px;
}

.zm-bubble-ctx[hidden] {
  display: none !important;
}

.zm-bubble-ctx {
  position: fixed;
  z-index: var(--zm-z-ctx-menu);
  min-width: 168px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--zm-border);
  background: var(--zm-bg-elevated);
  box-shadow: var(--zm-shadow);
}

.zm-bubble-ctx__btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--zm-text);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.zm-bubble-ctx__btn:hover,
.zm-bubble-ctx__btn:focus-visible {
  background: var(--zm-bg-hover);
  outline: none;
}

.zm-bubble-ctx__btn--danger {
  color: #b91c1c;
}

.zm-bubble-ctx__btn--danger:hover,
.zm-bubble-ctx__btn--danger:focus-visible {
  background: rgba(239, 68, 68, 0.14);
}

[data-theme="dark"] .zm-bubble-ctx__btn--danger {
  color: #fca5a5;
}

[data-theme="dark"] .zm-bubble-ctx__btn--danger:hover,
[data-theme="dark"] .zm-bubble-ctx__btn--danger:focus-visible {
  background: rgba(248, 113, 113, 0.16);
}

.bubble--system {
  display: block;
  width: fit-content;
  max-width: min(480px, 100%);
  background: var(--zm-system-bg);
  border-color: var(--zm-system-border);
  color: var(--zm-system-text);
  font-size: 0.88em;
  line-height: 1.35;
}

.zm-order-status-msg {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zm-order-status-msg__row {
  display: block;
  line-height: 1.45;
}

.zm-order-status-msg__label {
  display: inline;
  color: var(--zm-muted);
}

.zm-order-status-msg__label strong {
  font-weight: 700;
  color: var(--zm-text);
}

.zm-order-status-msg__value {
  display: inline;
  min-width: 0;
  word-break: break-word;
}

.zm-order-status-msg__status {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.zm-order-status-msg__arrow {
  opacity: 0.75;
  font-weight: 600;
}

.zm-status-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.82em;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bubble--system .bubble__body {
  white-space: normal;
}

.bubble--search-focus {
  outline: 2px solid var(--zm-accent);
  outline-offset: 2px;
  transition: outline-color 0.2s ease;
}

.bubble__search-mark {
  background: rgba(250, 204, 21, 0.55);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

[data-theme="dark"] .bubble__search-mark {
  background: rgba(234, 179, 8, 0.42);
}

.search-hit-item__mark {
  background: rgba(250, 204, 21, 0.45);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

[data-theme="dark"] .search-hit-item__mark {
  background: rgba(234, 179, 8, 0.35);
}



.bubble__reply-preview {
  width: 100%;
  margin: 0 0 8px;
  padding: 8px 10px;
  text-align: left;
  border: 1px solid var(--zm-border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.04);
  cursor: pointer;
  font: inherit;
  box-sizing: border-box;
}

[data-theme="dark"] .bubble__reply-preview {
  background: rgba(255, 255, 255, 0.05);
}

.bubble__reply-preview__who {
  display: block;
  font-size: 0.72em;
  font-weight: 600;
  color: var(--zm-text-muted);
  margin-bottom: 2px;
}

.bubble__reply-preview__snippet {
  display: block;
  font-size: 0.8em;
  color: var(--zm-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bubble__reply-preview__snippet--quoted-removed {
  font-style: italic;
  color: var(--zm-text-muted);
  opacity: 0.92;
}

.bubble__edited {
  font-size: 0.62rem;
  font-style: italic;
  opacity: 0.8;
}

.bubble--editing {
  width: min(720px, 100%);
}

.bubble-edit__ta {
  width: 100%;
  box-sizing: border-box;
  min-height: 4.8rem;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--zm-border);
  background: var(--zm-bg);
  color: var(--zm-text);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
}

.bubble-edit__foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

/* Круглые подтверждение/отмена: тот же размер, что composer-round-btn (отправить). */
.bubble-edit__icon-btn {
  flex-shrink: 0;
  width: var(--zm-input-h);
  height: var(--zm-input-h);
  padding: 0;
  border-radius: 50%;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.1s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .bubble-edit__icon-btn {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.bubble-edit__icon-btn:focus-visible {
  outline: 2px solid var(--zm-accent);
  outline-offset: 2px;
}

.bubble-edit__icon-btn:active {
  transform: scale(0.96);
}

/* Мягкий «стоп»: пастельно-розовый фон и приглушённый красный контур иконки */
.bubble-edit__icon-btn--cancel {
  background: rgba(239, 68, 68, 0.16);
  color: #c43c3c;
  border-color: rgba(239, 68, 68, 0.35);
}

.bubble-edit__icon-btn--cancel:hover {
  background: rgba(239, 68, 68, 0.26);
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.5);
}

[data-theme="dark"] .bubble-edit__icon-btn--cancel {
  background: rgba(248, 113, 113, 0.14);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.32);
}

[data-theme="dark"] .bubble-edit__icon-btn--cancel:hover {
  background: rgba(248, 113, 113, 0.24);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.45);
}

/* Мягкое подтверждение: пастельный мятный фон и зелёная иконка */
.bubble-edit__icon-btn--save {
  background: rgba(34, 197, 94, 0.16);
  color: #1d8847;
  border-color: rgba(34, 197, 94, 0.35);
}

.bubble-edit__icon-btn--save:hover {
  background: rgba(34, 197, 94, 0.26);
  color: #166534;
  border-color: rgba(34, 197, 94, 0.5);
}

.bubble-edit__icon-btn--save:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

[data-theme="dark"] .bubble-edit__icon-btn--save {
  background: rgba(74, 222, 128, 0.12);
  color: #86efac;
  border-color: rgba(74, 222, 128, 0.3);
}

[data-theme="dark"] .bubble-edit__icon-btn--save:hover {
  background: rgba(74, 222, 128, 0.22);
  color: #bbf7d0;
  border-color: rgba(74, 222, 128, 0.42);
}

.bubble-edit__icon-svg {
  width: 20px;
  height: 20px;
  display: block;
  pointer-events: none;
}

.composer-reply-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  margin-bottom: 4px;
  border-radius: 8px;
  border: 1px solid var(--zm-border);
  background: rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}

/* display:flex перебивает UA [hidden] — после отправки оставалась пустая полоска баннера ответа. */
.composer-reply-banner[hidden] {
  display: none !important;
}

[data-theme="dark"] .composer-reply-banner {
  background: rgba(255, 255, 255, 0.05);
}

.composer-reply-banner__label {
  color: var(--zm-text-muted);
  font-size: 0.75rem;
  margin-right: 4px;
}

.composer-reply-banner__text {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  line-height: 1.3;
}

.composer-reply-banner__text strong {
  font-weight: 600;
}

.composer-reply-banner__cancel {
  flex-shrink: 0;
  align-self: center;
}

.composer-notify-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 8px;
  border: 1px solid rgba(58, 122, 254, 0.35);
  background: rgba(58, 122, 254, 0.08);
  box-sizing: border-box;
}

.composer-notify-banner[hidden] {
  display: none !important;
}

[data-theme="dark"] .composer-notify-banner {
  background: rgba(58, 122, 254, 0.12);
  border-color: rgba(96, 165, 250, 0.35);
}

.composer-notify-banner__text {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--zm-text);
}

.composer-notify-banner__btn {
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: var(--brand-primary, #3a7afe);
}

.composer-notify-banner__btn:hover {
  filter: brightness(1.05);
}

.composer-notify-banner__btn[hidden] {
  display: none !important;
}

.composer-notify-banner__dismiss {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--zm-text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}

.composer-notify-banner__dismiss:hover {
  color: var(--zm-text);
}

.pwa-install-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 10px 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(34, 139, 87, 0.35);
  background: rgba(34, 139, 87, 0.08);
  box-sizing: border-box;
}

.pwa-install-banner[hidden] {
  display: none !important;
}

[data-theme="dark"] .pwa-install-banner {
  background: rgba(34, 139, 87, 0.12);
  border-color: rgba(74, 222, 128, 0.35);
}

.pwa-install-banner__text {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--zm-text);
}

.pwa-install-banner__btn {
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: #228b57;
}

.pwa-install-banner__btn:hover {
  filter: brightness(1.05);
}

.pwa-install-banner__btn[hidden] {
  display: none !important;
}

.pwa-install-banner__dismiss {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--zm-text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}

.pwa-install-banner__dismiss:hover {
  color: var(--zm-text);
}

.bubble__meta {
  font-size: 0.72em;
  color: var(--zm-text-muted);
  margin-bottom: 6px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
}

.bubble--own .bubble__meta {
  justify-content: flex-end;
}

.bubble__read-mark {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
  color: var(--zm-text-muted);
  opacity: 0.72;
}

.bubble__read-mark--read {
  color: #1d8847;
  opacity: 1;
}

[data-theme='dark'] .bubble__read-mark--read {
  color: #86efac;
}

.bubble__read-mark__svg {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
}

.bubble__body {
  font-size: 0.92em;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
}

.bubble__body:empty {
  display: none;
}

.composer {
  flex-shrink: 0;
  border-top: 1px solid var(--zm-border);
  padding: 8px 12px calc(10px + var(--zm-safe-bottom));
  background: var(--zm-bg-elevated);
  font-size: calc(1rem * var(--zm-chat-font-scale, 1));
}

.composer__toolbar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 0;
  width: 100%;
}

.composer-send-toggle-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.composer-send-toggle__opt {
  font-size: 0.78rem;
  color: var(--zm-text-muted);
  transition: color 0.15s ease, font-weight 0.15s ease;
  min-width: 0;
}

.composer-send-toggle__opt--left {
  text-align: left;
}

.composer-send-toggle__opt--right {
  text-align: left;
}

.composer-send-toggle-group:not(.composer-send-toggle-group--ctrl) .composer-send-toggle__opt--left {
  color: var(--zm-text);
  font-weight: 600;
}

.composer-send-toggle-group--ctrl .composer-send-toggle__opt--right {
  color: var(--zm-text);
  font-weight: 600;
}

.composer-send-toggle {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 0;
}

.composer-send-toggle:focus-visible {
  outline: 2px solid var(--zm-accent);
  outline-offset: 3px;
  border-radius: 999px;
}

.composer-send-toggle__track {
  display: block;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--zm-border-strong);
  position: relative;
  transition: background 0.2s ease;
}

.composer-send-toggle[aria-checked="true"] .composer-send-toggle__track {
  background: var(--zm-accent);
}

.composer-send-toggle__knob {
  position: absolute;
  width: 22px;
  height: 22px;
  top: 2px;
  left: 2px;
  border-radius: 50%;
  background: var(--zm-bg-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}

.composer-send-toggle[aria-checked="true"] .composer-send-toggle__knob {
  transform: translateX(18px);
}

.composer-send-mode__hint {
  font-size: 0.72rem;
  color: var(--zm-text-muted);
  opacity: 0.9;
  width: 100%;
  max-width: 100%;
  text-align: left;
  line-height: 1.35;
  margin-bottom: 14px;
}

.composer__row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  resize: vertical;
  border-radius: var(--zm-radius-sm);
  border: 1px solid var(--zm-border);
  padding: 10px 12px;
  font: inherit;
  font-size: 1em;
  background: var(--zm-bg-surface);
  color: var(--zm-text);
}

.composer textarea:focus {
  outline: 2px solid var(--zm-accent);
  outline-offset: 0;
  border-color: var(--zm-accent);
}

.btn-primary {
  height: var(--zm-input-h);
  padding: 0 18px;
  border: none;
  border-radius: var(--zm-radius-sm);
  background: var(--zm-accent);
  color: var(--zm-on-accent);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--zm-accent-hover);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-ghost {
  height: var(--zm-input-h);
  padding: 0 14px;
  border-radius: var(--zm-radius-sm);
  border: 1px solid var(--zm-border);
  background: transparent;
  color: var(--zm-text);
  cursor: pointer;
  font-weight: 500;
}

.empty-state {
  flex: 1;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: var(--zm-text-muted);
  font-size: 0.95rem;
  text-align: center;
}

/* Login */

.login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(24px + var(--zm-safe-bottom));
}

.login__card {
  width: 100%;
  max-width: 420px;
  background: var(--zm-bg-elevated);
  border: 1px solid var(--zm-border);
  border-radius: var(--zm-radius);
  box-shadow: var(--zm-shadow-lg);
  padding: 28px 24px;
}

.login__card .zm-brand {
  margin: 0 0 20px;
  align-self: stretch;
}

.login__card .zm-brand .logo-text.zm-brand__zirconix {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--zm-text);
  letter-spacing: 0.3px;
}

.login__card .zm-brand__message {
  font-size: 0.75rem;
  color: var(--zm-text-muted);
  font-weight: 500;
  opacity: 1;
}

.login__card .logo-icon {
  color: var(--zm-brand-gem);
}

.login__card .logo-icon__svg {
  width: 30px;
  height: 30px;
}

.login__card p {
  margin: 0 0 20px;
  color: var(--zm-text-muted);
  font-size: 0.9rem;
}

.login__row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login__row label {
  font-size: 0.8rem;
  color: var(--zm-text-muted);
}

.login__row select {
  height: var(--zm-input-h);
  border-radius: var(--zm-radius-sm);
  border: 1px solid var(--zm-border);
  padding: 0 10px;
  font: inherit;
  background: var(--zm-bg-surface);
  color: var(--zm-text);
}

.login__section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--zm-border);
}

.login__lead {
  margin: 0 0 10px;
  font-size: 0.92rem;
  color: var(--zm-text-muted);
}

.login__banner {
  color: var(--zm-system-text);
  background: var(--zm-system-bg);
  border: 1px solid var(--zm-system-border);
  padding: 8px 10px;
  border-radius: var(--zm-radius-sm);
  font-size: 0.88rem;
  margin: 10px 0;
}

.login__oidc-btn {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
  padding: 10px 14px;
  border-radius: var(--zm-radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid var(--zm-border-strong);
  background: var(--zm-bg-subtle);
  color: var(--zm-text);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.login__oidc-btn:hover {
  background: var(--zm-bg-hover);
  border-color: var(--zm-text-muted);
  color: var(--zm-text);
}

.login__hint--warn {
  color: var(--zm-system-text);
}

.login__actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.login__hint {
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--zm-text-muted);
}

/* Mobile single-column navigation */

@media (max-width: 899px) {
  /* Свернуть сайдбар и панель в main — только ≥900px. */
  .sidebar-font-scale-btn,
  .sidebar-collapse-btn,
  .main__collapsed-sidebar-tools,
  .main__collapsed-sidebar-tools[hidden],
  #btn-sidebar-expand,
  .main__sidebar-expand {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .shell--thread .main__header .composer-round-btn.main__header__unread-mail {
    display: inline-flex !important;
  }

  /* «Свернуть» и «Выйти» — только в сайдбаре (список чатов), не в шапке переписки */
  .main__header [data-action="logout"],
  .main__header .sidebar-collapse-btn,
  .main__header .sidebar-round-btn,
  .main__header .sidebar__footer-logout {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .shell--thread .sidebar__footer,
  .shell--thread .sidebar__footer-logout,
  .shell--thread .sidebar-collapse-btn {
    display: none !important;
  }

  .shell--list .sidebar__footer {
    display: flex;
  }

  /* Без скролла всей страницы: на Android 100dvh часто выше видимой области. */
  body:has(> .app-root > .shell) {
    overflow: hidden;
    overscroll-behavior: none;
    position: fixed;
    width: 100%;
    height: 100%;
  }

  .shell {
    position: relative;
    max-width: none;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
  }

  .sidebar,
  .main {
    position: fixed;
    left: 0;
    right: 0;
    top: env(safe-area-inset-top, 0px);
    bottom: env(safe-area-inset-bottom, 0px);
    width: 100%;
    max-width: none;
    height: auto;
    max-height: none;
    box-sizing: border-box;
    overflow: hidden;
    transition: transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
  }

  .sidebar {
    z-index: 2;
    transform: translate3d(0, 0, 0);
    display: flex !important;
    visibility: visible !important;
    pointer-events: auto;
    border-right: none;
    min-height: 0;
  }

  .main {
    z-index: 3;
    display: flex !important;
    flex-direction: column;
    min-height: 0;
    transform: translate3d(100%, 0, 0);
    pointer-events: none;
  }

  .shell--thread .main .thread-pane {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .shell--thread .main .thread {
    min-height: 0;
  }

  /* Медиа/теги — полноэкранный оверлей над лентой (пустой галереи тоже): свайп сдвигает pane, под ним чат. */
  .shell--thread.shell--topic-extras .thread-pane {
    position: relative;
    overflow: hidden;
  }

  .shell--thread.shell--topic-extras .thread {
    display: flex !important;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    flex: none !important;
    min-height: 0;
    z-index: 1;
    pointer-events: none;
  }

  .shell--thread.shell--topic-extras .topic-extras-pane {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    flex: none !important;
    min-height: 0;
    z-index: 2;
    /* pan-y только на body — иначе iOS edge-back на пустой галерее. */
    touch-action: none;
    overscroll-behavior-x: none;
  }

  .shell--thread.shell--topic-extras .topic-extras-body {
    touch-action: pan-y;
    overscroll-behavior-x: none;
  }

  .shell--thread .main .composer,
  .shell--thread .main .composer-selection {
    flex-shrink: 0;
  }

  .composer textarea {
    resize: none;
  }

  .shell--list .sidebar {
    transform: translate3d(0, 0, 0);
    pointer-events: auto;
  }

  .shell--list .main {
    transform: translate3d(100%, 0, 0);
    pointer-events: none;
  }

  .shell--thread .sidebar {
    transform: translate3d(-100%, 0, 0);
    pointer-events: none;
  }

  .shell--thread .main {
    transform: translate3d(0, 0, 0);
    pointer-events: auto;
  }

  /* Жест «назад»: панели следуют за пальцем, без CSS-transition до отпускания. */
  .shell--back-swipe .sidebar,
  .shell--back-swipe .main {
    transition: none !important;
  }

  /* Пока жест «назад» — не перехватывать ввод в композере и поиске. */
  .shell--nav-swipe-drag input,
  .shell--nav-swipe-drag textarea,
  .shell--nav-swipe-drag select,
  .shell--nav-swipe-drag .composer,
  .shell--nav-swipe-drag .composer-selection,
  .shell--nav-swipe-drag .thread-header-search {
    pointer-events: none !important;
  }

  /* Жест закрытия медиа: сдвигается только pane, лента остаётся под ним. */
  .shell--extras-back-swipe .topic-extras-pane {
    will-change: transform;
    transition: none !important;
  }

  .shell--extras-back-swipe:not(.shell--topic-extras) .topic-extras-pane {
    display: none !important;
    pointer-events: none !important;
    transform: none !important;
  }

  @media (prefers-reduced-motion: reduce) {
    .sidebar,
    .main {
      transition: none;
    }
  }

  /* Шапка чата: заголовок на всю ширину, кнопки — отдельной строкой под ним */
  .shell--thread .main__header {
    display: grid;
    grid-template-columns: var(--zm-input-h) minmax(0, 1fr);
    column-gap: 10px;
    row-gap: 6px;
    align-items: start;
    min-height: auto;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .shell--thread .main__header__back {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
  }

  .shell--thread .main__header__title {
    grid-column: 2;
    grid-row: 1;
    display: block;
    width: 100%;
    min-width: 0;
    line-height: 1.35;
  }

  .shell--thread .main__header__meta {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    padding-left: 0;
    min-height: 0;
    width: 100%;
  }

  .shell--thread .main__header__meta:not(:has(.composer-round-btn:not([hidden]))) {
    display: none;
  }

  .shell--thread .main__header--topic-search-open .thread-header-search {
    grid-column: 1 / -1;
    grid-row: 3;
    padding-top: 2px;
  }

  /* Название слева (перенос на всю ширину блока), плашка справа; «печатает…» — под строкой. */
  .shell--thread .main__header__title-stack {
    flex: none;
    width: 100%;
  }

  .shell--thread .main__header__title-row {
    align-items: flex-start;
    gap: 8px;
  }

  .shell--thread .main__header__title-text {
    flex: 1 1 auto;
    min-width: 0;
    gap: 2px;
  }

  .shell--thread .main__header__title-topic {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.35;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
  }

  .shell--thread .main__header__title-context {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .shell--thread .main__header__topic-kind {
    flex: 0 0 auto;
    align-self: flex-start;
    margin: 0;
  }

  .shell--thread .main__header__typing {
    display: block;
    min-width: 0;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
  }
}

@media (min-width: 900px) {
  .main__header .composer-round-btn.main__header__back {
    display: none;
  }

  .main__header .composer-round-btn.main__header__unread-mail {
    display: none !important;
  }

  .main__header__title {
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.28;
  }

  .main__header__title-row {
    align-items: center;
  }

  .main__header__topic-kind {
    display: inline-flex;
    align-self: center;
    margin: 0;
    max-width: none;
  }

  .main__header__title-stack {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
  }

  .main__header__title-text {
    flex: 1;
    min-width: 0;
  }

  .shell {
    max-width: 1440px;
    height: 100dvh;
    max-height: 100dvh;
    border-left: 1px solid var(--zm-border);
    border-right: 1px solid var(--zm-border);
  }

  .shell .sidebar {
    overflow: hidden;
    transition:
      max-width 0.22s ease,
      opacity 0.18s ease,
      padding 0.18s ease;
  }

  .shell.shell--sidebar-collapsed .sidebar {
    flex-shrink: 1;
    max-width: 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    padding-left: 0;
    padding-right: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    border-right: none;
  }

  .main__collapsed-sidebar-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }

  .main__collapsed-sidebar-tools[hidden] {
    display: none !important;
  }

}

@media (prefers-reduced-motion: reduce) {
  @media (min-width: 900px) {
    .shell .sidebar {
      transition: none;
    }
  }
}

/* Theme toggle in login top-right fixed */
.theme-float {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: var(--zm-z-theme-float);
}

.login-theme-toggle {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 0;
}

.login-theme-toggle:focus-visible {
  outline: 2px solid var(--zm-accent);
  outline-offset: 3px;
  border-radius: 999px;
}

.login-theme-toggle__track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 54px;
  height: 32px;
  padding: 0 7px;
  box-sizing: border-box;
  border-radius: 999px;
  background: var(--zm-bg-elevated);
  border: 1px solid var(--zm-border-strong);
  box-shadow: var(--zm-shadow);
}

.login-theme-toggle__icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--zm-text-muted);
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.login-theme-toggle__icon--sun {
  opacity: 0.95;
}

.login-theme-toggle__icon--moon {
  opacity: 0.42;
}

.login-theme-toggle[aria-checked='true'] .login-theme-toggle__icon--sun {
  opacity: 0.38;
}

.login-theme-toggle[aria-checked='true'] .login-theme-toggle__icon--moon {
  opacity: 1;
  color: var(--zm-text);
}

.login-theme-toggle__knob {
  position: absolute;
  left: 4px;
  top: 50%;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  border-radius: 50%;
  background: var(--zm-bg-surface);
  border: 1px solid var(--zm-border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
  z-index: 1;
}

[data-theme="dark"] .login-theme-toggle__knob {
  background: var(--zm-bg-surface-alt);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.login-theme-toggle[aria-checked='true'] .login-theme-toggle__knob {
  transform: translateX(22px);
}

/* ----- Вложения в сообщениях ----- */

.composer__row--input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.composer__row--input textarea {
  flex: 1;
  min-width: 0;
}

/* Круглые действия композера: нейтральный серый, в духе корпоративного UI */
.composer-round-btn {
  flex-shrink: 0;
  width: var(--zm-input-h);
  height: var(--zm-input-h);
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--zm-border-strong);
  background: var(--zm-bg-surface);
  color: var(--zm-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--zm-shadow);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.composer-round-btn:hover:not(:disabled) {
  background: var(--zm-bg-hover);
  color: var(--zm-text);
  border-color: var(--zm-border-strong);
}

.composer-round-btn:focus-visible {
  outline: 2px solid var(--zm-accent);
  outline-offset: 2px;
}

.composer-round-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.composer-round-btn__icon {
  width: 22px;
  height: 22px;
  display: block;
  pointer-events: none;
}

.composer-attach-btn {
  flex-shrink: 0;
}

/* iOS Safari: меньше задержки тапа; кнопка «Отправить» не должна забирать фокус (см. bindComposerSendButton). */
.composer-send-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.composer-staged-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.composer-staged-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: var(--zm-radius-sm);
  background: var(--zm-bg-subtle);
  border: 1px solid var(--zm-border);
  font-size: 12px;
}

.composer-staged-file:has(.composer-staged-file__preview) {
  flex-direction: column;
  align-items: flex-start;
}

.composer-staged-file__preview {
  display: block;
  width: 120px;
  max-height: 72px;
  object-fit: cover;
  border-radius: var(--zm-radius-xs);
  background: #0f172a;
}

.composer-staged-file__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.composer-staged-file__size {
  color: var(--zm-text-muted);
  flex-shrink: 0;
}

.composer-staged-file__rm {
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
}

.composer-upload-label {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--zm-text-muted);
}

.composer-upload-bar {
  width: 100%;
  height: 6px;
  margin-top: 4px;
  border-radius: var(--zm-radius-xs);
  overflow: hidden;
}

.bubble__attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  min-width: 0;
  box-sizing: border-box;
}

.bubble--system .bubble__attachments {
  width: 100%;
}

.bubble:not(.bubble--own) .bubble__attachments {
  justify-content: center;
}

.bubble--own .bubble__attachments {
  justify-content: flex-end;
}

.bubble__att-thumb {
  display: block;
  border-radius: var(--zm-radius-sm);
  overflow: hidden;
  border: 1px solid var(--zm-border);
  max-width: 220px;
  width: max-content;
  flex: 0 0 auto;
}

.bubble__att-thumb img {
  display: block;
  width: 220px;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  height: auto;
  object-fit: contain;
  vertical-align: middle;
  background: var(--zm-bg-surface);
}

.bubble__att-thumb--video {
  position: relative;
  background: #0f172a;
  max-width: 280px;
  width: max-content;
}

[data-theme='dark'] .bubble__att-thumb--video {
  background: #0a0a0a;
}

.bubble__att-video {
  display: block;
  width: 280px;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  vertical-align: middle;
  pointer-events: none;
  background: #0f172a;
}

.bubble__att-play {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.85);
  pointer-events: none;
}

.bubble__att-play::after {
  content: '';
  position: absolute;
  left: 54%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 9px 0 9px 14px;
  border-color: transparent transparent transparent #fff;
}

.bubble__att-video-label {
  display: block;
  padding: 4px 8px 6px;
  font-size: 0.72rem;
  line-height: 1.2;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
  box-sizing: border-box;
  pointer-events: none;
}

.bubble__att-link {
  font-size: 13px;
  color: var(--zm-accent);
  text-decoration: none;
  word-break: break-word;
}

.bubble__att-link:hover {
  text-decoration: underline;
}

.bubble__att-meta {
  color: var(--zm-text-muted);
}

/* Просмотр вложения-изображения (лайтбокс): крестик в потоке внутри safe-area, без absolute от края viewport */

body.zm-lightbox-open {
  overflow: hidden;
  touch-action: none;
}

.zm-lightbox {
  position: fixed;
  z-index: var(--zm-z-lightbox);
  inset: 0;
  box-sizing: border-box;
  width: 100%;
  max-width: 100vw;
  height: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
  display: flex;
  flex-direction: column;
  /* Единственный отступ от системных зон (вырез, home indicator) — без второго safe-area на кнопке */
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
  background: rgba(0, 0, 0, 0.88);
  cursor: default;
}

.zm-lightbox[hidden] {
  display: none !important;
}

.zm-lightbox__toolbar {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 6px;
  box-sizing: border-box;
}

.zm-lightbox__counter {
  margin-right: auto;
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  letter-spacing: 0.02em;
  user-select: none;
}

.zm-lightbox__counter[hidden] {
  display: none !important;
}

.zm-lightbox__stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px 16px;
  box-sizing: border-box;
  cursor: default;
  touch-action: none;
  overflow: hidden;
}

.zm-lightbox__zoom-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  max-height: min(78vh, calc(100dvh - 120px));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.zm-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.zm-lightbox__nav[hidden] {
  display: none !important;
}

.zm-lightbox__nav-icon {
  width: 26px;
  height: 26px;
  pointer-events: none;
}

.zm-lightbox__nav:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.55);
}

.zm-lightbox__nav:focus-visible {
  outline: 2px solid var(--zm-accent);
  outline-offset: 2px;
}

.zm-lightbox__nav--prev {
  left: max(8px, env(safe-area-inset-left, 0px));
}

.zm-lightbox__nav--next {
  right: max(8px, env(safe-area-inset-right, 0px));
}

@media (min-width: 900px) {
  .zm-lightbox--gallery .zm-lightbox__nav:not([hidden]) {
    display: inline-flex;
  }
}

.zm-lightbox__close {
  width: 40px;
  height: 40px;
  padding: 0;
  flex-shrink: 0;
  border-radius: var(--zm-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zm-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.14);
}

.zm-lightbox__img {
  max-width: 100%;
  max-height: min(78vh, calc(100dvh - 120px));
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--zm-radius);
  box-shadow: var(--zm-shadow-lg);
  cursor: zoom-in;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
  will-change: transform;
}

.zm-lightbox__video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--zm-radius);
  box-shadow: var(--zm-shadow-lg);
  cursor: default;
}

.zm-lightbox__video {
  background: #000;
  max-height: min(72vh, calc(100dvh - 120px));
}

.zm-lightbox__img[hidden],
.zm-lightbox__video[hidden],
.zm-lightbox__collage[hidden] {
  display: none !important;
}

.zm-lightbox__collage {
  display: grid;
  gap: 8px;
  width: min(96vw, 1100px);
  max-height: min(78vh, calc(100dvh - 120px));
  max-width: 100%;
  box-sizing: border-box;
}

.zm-lightbox__collage--n2 {
  grid-template-columns: 1fr 1fr;
}

.zm-lightbox__collage--n3 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.zm-lightbox__collage--n3 .zm-lightbox__collage-cell:first-child {
  grid-row: span 2;
}

.zm-lightbox__collage--n4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.zm-lightbox__collage-cell {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--zm-radius-sm);
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.zm-lightbox__collage-cell img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: min(38vh, 360px);
  object-fit: contain;
  background: #0a0a0a;
}

.zm-lightbox--collage .zm-lightbox__nav {
  display: none !important;
}

.bubble__photo-removed {
  margin: 8px 0 0;
  font-style: italic;
  color: var(--zm-text-muted);
  font-size: 0.9em;
}

/* Модалка создания группы (без prompt/alert) */

body.zm-modal-open {
  overflow: hidden;
}

.zm-modal {
  position: fixed;
  z-index: var(--zm-z-modal);
  inset: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
}

.zm-modal[hidden] {
  display: none !important;
}

/* Подтверждение выше любой другой .zm-modal и лайтбокса (не зависит от порядка appendChild). */
#zm-confirm-modal.zm-modal {
  z-index: var(--zm-z-modal-confirm);
}

.zm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.zm-modal__panel {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  overflow: auto;
  box-sizing: border-box;
  padding: 20px 20px 18px;
  border-radius: var(--zm-radius);
  border: 1px solid var(--zm-border);
  background: var(--zm-bg-surface);
  box-shadow: var(--zm-shadow-lg);
}

.zm-modal__title {
  margin: 0 0 14px;
  font-size: 1.15rem;
  font-weight: 600;
}

.zm-modal__label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.88rem;
  color: var(--zm-text-muted);
}

.zm-modal__input {
  width: 100%;
  box-sizing: border-box;
  height: var(--zm-input-h);
  padding: 0 12px;
  border-radius: var(--zm-radius-sm);
  border: 1px solid var(--zm-border);
  font: inherit;
  background: var(--zm-bg-surface);
  color: var(--zm-text);
}

.zm-modal__input:focus {
  outline: 2px solid var(--zm-accent);
  outline-offset: 0;
  border-color: var(--zm-accent);
}

.zm-modal__error {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: #c62828;
}

[data-theme="dark"] .zm-modal__error {
  color: #ff8a80;
}

.zm-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* display:flex перебивает сворачивание по [hidden] — остаются видны и текст, и кружки. */
#zm-confirm-modal .zm-modal__actions[hidden] {
  display: none !important;
}

.zm-modal__panel--confirm-compact .zm-modal__title {
  margin-bottom: 6px;
}

.zm-modal__actions--confirm-icons {
  margin-top: 12px;
}

.zm-modal__hint.zm-modal__hint--inline {
  margin-bottom: 8px;
  font-size: 0.87rem;
}

.zm-modal__target-group {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--zm-radius-sm);
  border: 1px solid var(--zm-border);
  background: var(--zm-bg-subtle);
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--zm-text);
}

.zm-modal__btn-danger {
  background: #c62828;
  color: #fff;
}

.zm-modal__btn-danger:hover {
  background: #b71c1c;
}

.zm-modal__btn-danger:disabled {
  opacity: 0.55;
}

[data-theme="dark"] .zm-modal__btn-danger {
  background: #e57373;
  color: #1a1a1a;
}

[data-theme="dark"] .zm-modal__btn-danger:hover {
  background: #ef9a9a;
}

.zm-modal__select {
  width: 100%;
  height: var(--zm-input-h);
  margin-bottom: 4px;
  border-radius: var(--zm-radius-sm);
  border: 1px solid var(--zm-border);
  background: var(--zm-bg-surface);
  color: var(--zm-text);
  padding: 0 12px;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.zm-settings-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--zm-border);
}

.zm-settings-block:first-of-type {
  margin-top: 12px;
  padding-top: 4px;
  border-top: none;
}

.zm-settings-block__title {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--zm-text-muted);
}

.zm-settings-block__hint {
  margin: 0 0 10px;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--zm-text-muted);
}

.zm-settings-block__body--stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.zm-settings-block__body--stack .zm-modal__label {
  margin-bottom: 0;
}

.zm-rename-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.zm-rename-row__input {
  flex: 1;
  min-width: 0;
}

/* Строка названия топика/группы в модалке настроек: текст / инпут + круглый карандаш/дискета */
.zm-settings-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  min-width: 0;
}

.zm-settings-title-text {
  flex: 1;
  min-width: 0;
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--zm-text);
  line-height: 1.4;
  word-break: break-word;
}

.zm-settings-edit-input.zm-modal__input {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
  box-sizing: border-box;
}

.zm-settings-title-row .zm-settings-rename-btn {
  flex-shrink: 0;
}

.zm-settings-block .zm-modal__settings-btn.zm-btn-neon {
  width: 100%;
}

.zm-modal__settings-btn--last {
  margin-top: 14px;
}

.zm-settings-delete-zone {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--zm-border);
}

.zm-settings-block--nested {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--zm-border);
}

.zm-group-members-list {
  max-height: min(260px, 42vh);
  overflow-y: auto;
}

.zm-group-members-list__empty,
.zm-group-members-list .sidebar-hint {
  padding: 4px 0;
  margin: 0;
}

.zm-group-member-row {
  padding: 5px 0;
}

.zm-group-member-row__info {
  flex: 1;
  min-width: 0;
}

.zm-group-member-row__name {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--zm-text);
  line-height: 1.3;
  word-break: break-word;
}

.zm-group-member-row__meta-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  min-width: 0;
}

.zm-group-member-row__meta {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  color: var(--zm-text-muted);
  line-height: 1.25;
  word-break: break-word;
}

.zm-group-member-row__remove {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  font-size: 0.8rem;
  padding: 0;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: #c62828;
  cursor: pointer;
  line-height: 1;
}

.zm-group-member-row__remove:hover {
  color: #b71c1c;
  background: rgba(198, 40, 40, 0.08);
}

.zm-group-member-row__remove:focus-visible {
  outline: 2px solid var(--zm-focus-ring, #3a7afe);
  outline-offset: 1px;
}

.zm-group-member-row__remove-icon {
  display: block;
  width: 100%;
  height: 100%;
}

[data-theme='dark'] .zm-group-member-row__remove {
  color: #ef9a9a;
}

[data-theme='dark'] .zm-group-member-row__remove:hover {
  color: #ffcdd2;
  background: rgba(239, 154, 154, 0.12);
}

.zm-group-members-status {
  margin-top: 8px;
}

/* Аватары групп (сайдбар и редактор в настройках) */
.group-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(127, 127, 127, 0.12);
  border: 1px solid var(--zm-sidebar-border, rgba(127, 127, 127, 0.25));
  vertical-align: middle;
}

.group-avatar--sidebar {
  width: 28px;
  height: 28px;
}

.group-avatar--settings {
  width: 72px;
  height: 72px;
  border-color: var(--zm-border);
  background: rgba(127, 127, 127, 0.08);
}

.group-avatar__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--av-x, 50%) var(--av-y, 50%);
  transform: scale(var(--av-scale, 1));
  transform-origin: var(--av-x, 50%) var(--av-y, 50%);
  pointer-events: none;
  user-select: none;
}

.group-avatar--placeholder .group-avatar__ph-icon {
  display: block;
  width: 55%;
  height: 55%;
  border-radius: 50%;
  background: rgba(127, 127, 127, 0.22);
}

.zm-group-avatar-editor {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 8px;
}

.zm-group-avatar-editor__frame-wrap {
  position: relative;
  flex-shrink: 0;
  width: 72px;
  height: 72px;
}

.zm-group-avatar-editor__frame {
  cursor: grab;
  touch-action: none;
}

.zm-group-avatar-editor__frame:active {
  cursor: grabbing;
}

.zm-group-avatar-chip {
  position: absolute;
  z-index: 2;
  box-sizing: border-box;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  margin: 0;
  border-radius: 999px;
  border: 2px solid var(--zm-bg-elevated, var(--zm-sidebar));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
}

.zm-group-avatar-chip__icon {
  display: block;
  width: 0.72rem;
  height: 0.72rem;
}

.zm-group-avatar-chip--add {
  left: -4px;
  bottom: -4px;
  background: var(--zm-accent, #3a7afe);
  color: var(--zm-on-accent, #fff);
}

.zm-group-avatar-chip--add:hover {
  filter: brightness(1.06);
}

.zm-group-avatar-chip--remove {
  right: -4px;
  bottom: -4px;
  background: #c62828;
  color: #fff;
}

.zm-group-avatar-chip--remove:hover {
  filter: brightness(1.08);
}

.zm-group-avatar-chip--remove[hidden] {
  display: none !important;
}

.zm-group-avatar-chip:focus-visible {
  outline: 2px solid var(--zm-focus-ring, #3a7afe);
  outline-offset: 1px;
}

[data-theme='dark'] .zm-group-avatar-chip--remove {
  background: #e53935;
}

.zm-group-avatar-editor__controls {
  flex: 1;
  min-width: 0;
}

.zm-group-avatar-editor__zoom-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--zm-text);
  margin-bottom: 8px;
}

.zm-group-avatar-editor__zoom-label input[type='range'] {
  width: 100%;
  max-width: 220px;
}

.zm-group-avatar-settings .zm-settings-block__hint {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--zm-text-muted);
  line-height: 1.35;
}

#zm-group-avatar-editor-placeholder {
  display: block;
  width: 42%;
  height: 42%;
  border-radius: 50%;
  background: rgba(127, 127, 127, 0.2);
}

#zm-group-avatar-editor-placeholder[hidden] {
  display: none;
}

/* Меню пользователя (аватар в шапке сайдбара, панели как в Telegram) */
.user-menu {
  position: fixed;
  z-index: 1200;
  width: 260px;
  max-width: calc(100vw - 16px);
  border-radius: var(--zm-radius-sm);
  border: 1px solid var(--zm-border);
  background: var(--zm-bg-surface);
  box-shadow: var(--zm-shadow-lg, 0 12px 40px rgba(0, 0, 0, 0.16));
  overflow: hidden;
}

.user-menu[hidden] {
  display: none;
}

.user-menu__stack {
  display: flex;
  width: 200%;
  transition: transform 0.22s ease;
  will-change: transform;
}

.user-menu__stack[data-panel='root'] {
  transform: translateX(0);
}

.user-menu__stack[data-panel='sessions'] {
  transform: translateX(-50%);
}

.user-menu__panel {
  flex: 0 0 50%;
  box-sizing: border-box;
  max-height: min(420px, calc(100vh - 80px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--zm-bg-surface);
}

.user-menu__head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 12px 14px 8px;
}

.user-menu__head-text {
  min-width: 0;
  text-align: left;
}

.user-menu__name {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  text-align: left;
}

.user-menu__row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 8px 14px;
  font-size: 0.9rem;
}

.user-menu__row--theme {
  gap: 10px;
}

.user-menu__row--theme .user-menu-theme-toggle {
  margin-left: auto;
}

.user-menu__row-icon,
.user-menu__item-icon,
.user-menu__item-chevron,
.user-menu__subhead-icon,
.user-session-row__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--zm-text-muted);
}

.user-menu__icon {
  width: 18px;
  height: 18px;
  display: block;
}

.user-menu__item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 14px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--zm-text);
  cursor: pointer;
  white-space: nowrap;
}

.user-menu__item-label {
  min-width: 0;
  flex: 0 1 auto;
}

.user-menu__item-chevron {
  margin-left: auto;
  color: var(--zm-text-muted);
}

.user-menu__item-chevron .user-menu__icon {
  width: 16px;
  height: 16px;
  opacity: 0.72;
}

.user-menu__item-icon .user-menu__icon {
  opacity: 0.88;
}

.user-menu__item--danger .user-menu__item-icon {
  color: inherit;
}

.user-menu__item--danger .user-menu__item-icon .user-menu__icon {
  opacity: 0.92;
}

.user-menu__item:hover {
  background: rgba(127, 127, 127, 0.08);
}

.user-menu__item--danger {
  color: #be123c;
}

.user-menu__subhead {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  flex-shrink: 0;
}

.user-menu__subhead-title {
  font-weight: 600;
  font-size: 0.92rem;
  text-align: left;
}

.user-session-row__icon {
  align-self: flex-start;
  margin-top: 2px;
}

.user-menu__back {
  flex-shrink: 0;
}

.user-menu__sessions {
  overflow-y: auto;
  padding: 4px 0 8px;
  flex: 1;
  min-height: 0;
  text-align: left;
}

.user-menu__sessions .sidebar-hint {
  text-align: left;
  padding-left: 14px;
  padding-right: 14px;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(127, 127, 127, 0.12);
  border: 1px solid var(--zm-sidebar-border, rgba(127, 127, 127, 0.25));
  flex-shrink: 0;
  box-sizing: border-box;
}

.user-avatar--btn {
  width: 36px;
  height: 36px;
}

.user-avatar--menu {
  width: 44px;
  height: 44px;
}

.user-avatar--initials {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--zm-text);
  letter-spacing: 0.02em;
}

.user-avatar__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-menu-trigger {
  padding: 0;
  overflow: hidden;
}

.user-menu-trigger .user-avatar {
  width: 100%;
  height: 100%;
  border: none;
}

.user-session-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
}

.user-session-row--current {
  background: rgba(127, 127, 127, 0.06);
}

.user-session-row__body {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.user-session-row__title {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
}

.user-session-row__meta {
  font-size: 0.78rem;
  color: var(--zm-muted, rgba(127, 127, 127, 0.85));
  margin-top: 4px;
  line-height: 1.4;
  text-align: left;
  word-break: break-word;
}

.user-session-row__end {
  flex-shrink: 0;
  align-self: center;
  margin-left: auto;
}

.user-session-row__badge {
  display: inline;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--zm-accent);
}

[data-theme='dark'] .user-menu {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

[data-theme='dark'] .user-menu__item--danger {
  color: #fb7185;
}

/* Модалка настроек группы: кнопки в стиле плашек типа (приглушённый неон) */
.zm-modal__panel--settings {
  display: flex;
  flex-direction: column;
}

.zm-modal__settings-group {
  margin: 0 0 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--zm-text);
}

.zm-modal__settings-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

.zm-modal__settings-actions .zm-btn-neon,
.zm-modal__settings-btn.zm-btn-neon {
  width: 100%;
}

.zm-modal__actions--settings-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--zm-border);
  justify-content: flex-end;
}

.zm-btn-neon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 12px 16px;
  border-radius: var(--zm-radius-sm);
  border: 1px solid var(--zm-neon-border, var(--zm-border));
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  background: var(--zm-neon-bg, transparent);
  color: var(--zm-neon-fg, var(--zm-text));
  box-shadow: 0 0 10px var(--zm-neon-glow, transparent);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease,
    transform 0.05s ease;
}

.zm-btn-neon:active:not(:disabled) {
  transform: scale(0.99);
}

/* Жёлтый — как тёплая плашка, без кричащего градиента */
.zm-btn-neon--yellow {
  --zm-neon-bg: rgba(234, 179, 8, 0.12);
  --zm-neon-fg: #92400e;
  --zm-neon-border: rgba(217, 119, 6, 0.45);
  --zm-neon-glow: rgba(234, 179, 8, 0.2);
}

.zm-btn-neon--yellow:hover:not(:disabled) {
  --zm-neon-bg: rgba(234, 179, 8, 0.2);
  --zm-neon-glow: rgba(234, 179, 8, 0.28);
}

/* Красный — приглушённый, как pill--kind-other-3 */
.zm-btn-neon--danger {
  --zm-neon-bg: rgba(225, 29, 72, 0.1);
  --zm-neon-fg: #9f1239;
  --zm-neon-border: rgba(225, 29, 72, 0.4);
  --zm-neon-glow: rgba(244, 63, 94, 0.18);
}

.zm-btn-neon--danger:hover:not(:disabled) {
  --zm-neon-bg: rgba(225, 29, 72, 0.16);
  --zm-neon-glow: rgba(244, 63, 94, 0.26);
}

/* Зелёный — создание топика / группы */
.zm-btn-neon--green {
  --zm-neon-bg: rgba(22, 163, 74, 0.12);
  --zm-neon-fg: #15803d;
  --zm-neon-border: rgba(22, 163, 74, 0.42);
  --zm-neon-glow: rgba(74, 222, 128, 0.2);
}

.zm-btn-neon--green:hover:not(:disabled) {
  --zm-neon-bg: rgba(22, 163, 74, 0.2);
  --zm-neon-glow: rgba(74, 222, 128, 0.28);
}

.zm-btn-neon--sm {
  padding: 10px 14px;
  font-size: 0.82rem;
}

.zm-btn-neon:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  filter: none;
}

[data-theme="dark"] .zm-btn-neon--yellow {
  --zm-neon-bg: rgba(250, 204, 21, 0.12);
  --zm-neon-fg: #fde68a;
  --zm-neon-border: rgba(251, 191, 36, 0.35);
  --zm-neon-glow: rgba(250, 204, 21, 0.15);
}

[data-theme="dark"] .zm-btn-neon--danger {
  --zm-neon-bg: rgba(251, 113, 133, 0.12);
  --zm-neon-fg: #fecdd3;
  --zm-neon-border: rgba(251, 113, 133, 0.38);
  --zm-neon-glow: rgba(251, 113, 133, 0.16);
}

[data-theme="dark"] .zm-btn-neon--green {
  --zm-neon-bg: rgba(74, 222, 128, 0.1);
  --zm-neon-fg: #bbf7d0;
  --zm-neon-border: rgba(74, 222, 128, 0.35);
  --zm-neon-glow: rgba(74, 222, 128, 0.14);
}

/* Упоминания @, приглашения, бейдж «@» у непрочитанных */
.msg-mention {
  color: var(--zm-accent, #2563eb);
  font-weight: 600;
}

.topic-item__badge-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.topic-item__at-icon {
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
  opacity: 0.9;
}

.clinic-group__badge-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.clinic-group__at-icon {
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1;
  opacity: 0.9;
}

.composer-input-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

.composer-input-wrap textarea {
  width: 100%;
}

.zm-mention-picker {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: var(--zm-z-composer-picker);
  max-height: 200px;
  overflow: auto;
  border-radius: var(--zm-radius-sm);
  border: 1px solid var(--zm-border);
  background: var(--zm-bg-surface);
  box-shadow: var(--zm-shadow);
  padding: 4px 0;
}

.zm-mention-picker__btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--zm-text);
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.zm-mention-picker__btn:hover {
  background: var(--zm-bg-hover);
}

.zm-mention-picker__login {
  font-weight: 600;
}

.zm-mention-picker__hint {
  font-size: 0.78rem;
  color: var(--zm-text-muted);
}

.zm-hashtag-picker {
  bottom: calc(100% + 6px);
}

.bubble__body .msg-hashtag,
.bubble__text .msg-hashtag {
  display: inline;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  color: var(--zm-accent, #2563eb);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.bubble__body .msg-hashtag:hover,
.bubble__text .msg-hashtag:hover {
  text-decoration: underline;
}

.zm-invite-modal__panel {
  width: min(480px, calc(100vw - 32px));
}

.zm-invite-modal__head {
  margin-bottom: 10px;
}

.zm-invite-modal__title.zm-modal__title {
  margin-bottom: 0;
}

.zm-invite-modal .zm-invite-modal__panel #zm-invite-search.zm-modal__input {
  margin-bottom: 0;
  border-bottom-width: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.zm-invite-modal .zm-invite-modal__panel #zm-invite-search.zm-modal__input:focus {
  border-bottom-width: 0;
}

.zm-invite-modal__toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.zm-invite-confirm-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.zm-invite-results {
  margin-top: 0;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--zm-border);
  border-top-width: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-radius: 0;
  border-bottom-left-radius: var(--zm-radius-sm);
  border-bottom-right-radius: var(--zm-radius-sm);
  background: var(--zm-bg-elevated);
}

.zm-invite-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid var(--zm-border);
  background: transparent;
  color: var(--zm-text);
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.zm-invite-row:last-child {
  border-bottom: none;
}

.zm-invite-row:hover {
  background: var(--zm-bg-hover);
}

.zm-invite-row--picked {
  background: rgba(33, 150, 243, 0.12);
}

[data-theme='dark'] .zm-invite-row--picked {
  background: rgba(100, 181, 246, 0.12);
}

.zm-invite-row:focus-visible {
  outline: 2px solid var(--zm-accent);
  outline-offset: -2px;
}

.zm-invite-row__name {
  font-weight: 600;
}

.zm-invite-row__meta {
  font-size: 0.8rem;
  color: var(--zm-text-muted);
}
