/* Leo Mini App — VKUI vkIOSDark (@vkontakte/vkui-tokens)
   Figma: https://www.figma.com/community/file/842773796460998995 */

html.tg-dark,
html.vkui--vkIOS--dark {
  color-scheme: dark;
}

:root {
  --font: var(--vkui--font_family_base, -apple-system, system-ui, "Helvetica Neue", Roboto, sans-serif);
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
  /* Названия и заголовки заметок, транскрипций и саммари (шрифт грузится из Google Fonts в index.html). */
  --font-heading: "Unbounded", var(--vkui--font_family_base, -apple-system, system-ui, "Helvetica Neue", Roboto, sans-serif);

  --bg: var(--vkui--color_background);
  --surface: var(--vkui--color_background_content);
  --surface-elevated: var(--vkui--color_background_secondary);
  --surface-muted: rgba(255, 255, 255, 0.04);
  --text: var(--vkui--color_text_primary);
  --text-secondary: var(--vkui--color_text_secondary);
  --text-tertiary: var(--vkui--color_text_tertiary);
  --text-faint: var(--vkui--color_text_tertiary);
  --border: var(--vkui--color_separator_primary);
  --border-strong: var(--vkui--color_stroke_primary);

  --accent: var(--vkui--color_icon_accent);
  --accent-pressed: var(--vkui--color_background_accent--active);
  --accent-muted: rgba(82, 158, 244, 0.16);
  --accent-subtle: rgba(82, 158, 244, 0.1);
  --accent-border: rgba(82, 158, 244, 0.28);
  /* Цитаты в заметке: голубой текст и полоса вместо серого. */
  --quote-text: #8ec5ff;
  --quote-border: rgba(82, 158, 244, 0.7);
  --purple: #7b68ee;

  --danger: var(--vkui--color_background_negative);
  --danger-muted: var(--vkui--color_background_negative_tint);
  --success: var(--vkui--color_background_positive);
  --success-muted: rgba(75, 179, 75, 0.16);
  --violet-muted: rgba(139, 92, 246, 0.2);
  --violet-text: #a78bfa;
  --emerald-muted: rgba(75, 179, 75, 0.18);
  --emerald-text: #6ee7b7;
  --on-accent: #ffffff;
  --on-danger: #ffffff;

  /* Общая палитра (сведена из ~300 литералов): тёмные значения; светлые — в html[data-theme="light"]. */
  --text-strong: #ffffff;
  --text-soft: #c4c6c9;
  --text-subtle: #909499;
  --surface-raised: #2c2c2e;
  --surface-hover: #36363a;
  /* Плашка недели над календарём — в палитре карточек: фон карточки, выбранный день, кнопка ☰. */
  --cal-strip-bg: var(--surface);
  --cal-strip-sel: var(--surface-raised);
  --cal-strip-btn: var(--surface-hover);
  --accent-soft: #8ec5ff;
  --slate: #9eaddb;
  --violet: #8b5cf6;
  --violet-soft: #c4b5fd;
  --danger-text: #f87171;
  --warning: #f0b44c;
  --warning-text: #f6d08a;
  /* Нейтральные подложки и рамки: белый с прозрачностью на тёмном, чёрный — на светлом. */
  --overlay-1: rgba(255, 255, 255, 0.04);
  --overlay-2: rgba(255, 255, 255, 0.06);
  --overlay-3: rgba(255, 255, 255, 0.08);
  --overlay-4: rgba(255, 255, 255, 0.1);
  --overlay-5: rgba(255, 255, 255, 0.12);
  --overlay-6: rgba(255, 255, 255, 0.16);
  --overlay-7: rgba(255, 255, 255, 0.24);
  /* Цвет теней: на тёмном — чёрный, на светлом — мягче (тени в стилях берут от него долю). */
  --shadow-color: #000000;
  /* Выбранный сегмент на серой подложке переключателя. */
  --seg-active: var(--overlay-5);
  /* Точки анимации «Лео думает» — цвет кольца логотипа Орбиты. */
  --orbit-dot: #a5a8ff;

  --radius-xs: var(--vkui--size_border_radius--regular, 10px);
  --radius-sm: var(--vkui--size_border_radius--regular, 10px);
  --radius-md: var(--vkui--size_border_radius_paper--regular, 12px);
  --radius-lg: var(--vkui--size_border_radius_paper--regular, 12px);
  --radius-card: var(--vkui--size_border_radius_paper--regular, 12px);
  --radius-xl: var(--vkui--size_border_radius_promo--regular, 20px);
  --radius-full: 999px;

  /* Единые контролы карточек задач: кнопки, поля, чипы (см. «Единые контролы» в конце файла). */
  --ui-h: 44px;            /* кнопки и поля в формах, окнах, разборах */
  --ui-h-sm: 36px;         /* внутри небольших карточек: «Фокус», чат */
  --ui-r: 10px;            /* скругление кнопок и полей */
  --ui-card-r: 16px;       /* карточки */
  --ui-chip-h: 28px;
  --ui-font: 0.9rem;
  --ui-font-sm: 0.82rem;
  --ui-field-bg: var(--surface-elevated);
  --ui-field-border: var(--border-strong, var(--border));
  --ui-btn-bg: var(--surface-elevated);
  --ui-btn-bg-hover: #34343a;
  --ui-due-bg: rgba(245, 158, 11, 0.14);
  --ui-due-fg: #fbbf24;
  --ui-due-border: rgba(245, 158, 11, 0.35);

  --shadow-sm: var(--vkui--elevation1, none);
  --shadow-md: var(--vkui--elevation3, 0 8px 32px rgba(0, 0, 0, 0.45));
  --shadow-card: var(--vkui--elevation2, none);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  --page-x: 1rem;
  --tabbar-h: 3.5rem;
  --tabbar-pad: 0.5rem;
  --tabbar-surface: var(--surface);
  /* On Android, system navigation can overlay the webview bottom.
     Telegram exposes safe/content insets via JS → CSS vars. */
  --tabbar-safe: max(
    env(safe-area-inset-bottom, 0px),
    var(--tg-safe-area-inset-bottom, 0px),
    var(--tg-content-safe-area-inset-bottom, 0px),
    var(--tg-viewport-bottom-overlay, 0px),
    var(--vv-bottom-overlay, 0px),
    var(--tg-android-nav-inset, 0px)
  );
  --tabbar-offset: var(--tabbar-safe);
  --tabbar-stack: calc(var(--tabbar-h) + var(--tabbar-offset));
  --page-bottom: var(--tabbar-stack);
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-content-safe-area-inset-top, 0px));
  --max-w: 26rem;

  /* legacy aliases (app.js / Telegram init) */
  --page-bg: var(--bg);
  --app-bg: var(--bg);
  --app-text: var(--text);
  --app-hint: var(--text-secondary);
  --app-surface: var(--surface);
  --app-surface-2: var(--surface-muted);
  --app-section: var(--surface);
  --app-accent: var(--accent);
  --app-button: var(--accent);
  --app-button-text: #fff;
  --app-border: var(--border);
  --app-border-strong: var(--border-strong);
  --app-danger: var(--danger);
  --app-success: var(--success);
  --app-shadow: var(--shadow-md);
  --app-shadow-sm: var(--shadow-sm);
  --tg-blue: var(--accent);
  --tg-blue-dark: var(--accent-pressed);
  --text-primary: var(--text);
  --text-muted: var(--text-secondary);
  --space-page: var(--page-x);
  --space-block: var(--space-6);
  --tabbar-gap: 1.5rem;

  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Светлая тема (theme.js ставит html[data-theme]). Те же токены, другие значения:
   цвета VKUI, которые использует приложение, и свои токены из :root. */
html[data-theme="light"] {
  color-scheme: light;

  --vkui--color_background: #ebedf0;
  --vkui--color_background_content: #ffffff;
  --vkui--color_background_content_alpha: rgba(255, 255, 255, 0.8);
  --vkui--color_background_secondary: #f2f3f5;
  --vkui--color_background_secondary_alpha: rgba(0, 28, 61, 0.05);
  --vkui--color_background_accent: #2688eb;
  --vkui--color_background_accent--active: #1f74c9;
  --vkui--color_background_positive: #4bb34b;
  --vkui--color_background_negative: #e64646;
  --vkui--color_background_negative_tint: #faebeb;
  --vkui--color_text_primary: #000000;
  --vkui--color_text_secondary: #6d7885;
  --vkui--color_text_tertiary: #99a2ad;
  --vkui--color_text_accent: #2688eb;
  --vkui--color_text_negative: #e64646;
  --vkui--color_text_contrast: #ffffff;
  --vkui--color_icon_accent: #2688eb;
  --vkui--color_icon_negative: #e64646;
  --vkui--color_separator_primary: #dce1e6;
  --vkui--color_stroke_primary: #b8c1cc;
  --vkui--elevation1: 0 0 2px rgba(0, 0, 0, 0.06), 0 2px 2px rgba(0, 0, 0, 0.06);
  --vkui--elevation2: 0 4px 8px rgba(0, 0, 0, 0.06), 0 0 4px rgba(0, 0, 0, 0.06);
  --vkui--elevation3: 0 0 2px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.1);

  --surface-muted: rgba(0, 0, 0, 0.03);
  --accent-pressed: #1f74c9;
  --accent-muted: rgba(38, 136, 235, 0.12);
  --accent-subtle: rgba(38, 136, 235, 0.08);
  --accent-border: rgba(38, 136, 235, 0.3);
  --quote-text: #1f6fc4;
  --quote-border: rgba(38, 136, 235, 0.6);
  --danger-muted: #faebeb;
  --success-muted: rgba(75, 179, 75, 0.14);
  --violet-muted: rgba(139, 92, 246, 0.12);
  --violet-text: #6d4ad8;
  --emerald-muted: rgba(75, 179, 75, 0.14);
  --emerald-text: #13865c;
  --ui-btn-bg-hover: #e4e7eb;
  --ui-due-bg: rgba(245, 158, 11, 0.14);
  --ui-due-fg: #b45309;
  --ui-due-border: rgba(245, 158, 11, 0.4);

  --text-strong: #000000;
  --text-soft: #3c4047;
  --text-subtle: #535b66;
  --surface-raised: #e9ebee;
  --surface-hover: #dfe2e6;
  --accent-soft: #1f6fc4;
  --slate: #5a6b9a;
  --violet: #7c4ddb;
  --violet-soft: #5b3cc4;
  --danger-text: #c93636;
  --warning: #c27c0e;
  --warning-text: #8a5a00;
  --overlay-1: rgba(0, 0, 0, 0.03);
  --overlay-2: rgba(0, 0, 0, 0.045);
  --overlay-3: rgba(0, 0, 0, 0.06);
  --overlay-4: rgba(0, 0, 0, 0.075);
  --overlay-5: rgba(0, 0, 0, 0.09);
  --overlay-6: rgba(0, 0, 0, 0.12);
  --overlay-7: rgba(0, 0, 0, 0.18);
  --shadow-color: rgba(15, 23, 42, 0.35);
  --seg-active: var(--surface);
  --orbit-dot: #5b5ee8;
}

/* Плавная смена темы по выбору пользователя (класс держится ~0.25 с). */
html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, fill 0.2s ease !important;
}

html.tg-miniapp-fullscreen {
  --tabbar-offset: var(--tabbar-safe);
  --tabbar-stack: calc(var(--tabbar-h) + var(--tabbar-offset));
  --page-bottom: var(--tabbar-stack);
}

html.tg-android:not(.app-standalone) {
  --tg-android-nav-inset: 88px;
}

html.app-standalone {
  --tg-android-nav-inset: 0px;
  /* PWA: trust the browser safe-area; ignore Telegram/webview overlay fallbacks. */
  --tabbar-safe: max(
    env(safe-area-inset-bottom, 0px),
    var(--tg-safe-area-inset-bottom, 0px)
  );
  --tabbar-offset: var(--tabbar-safe);
  --tabbar-stack: calc(var(--tabbar-h) + var(--tabbar-offset));
  --page-bottom: var(--tabbar-stack);
}

/* Always keep tab bar above system UI:
   move the whole bar up, not only its padding. */
.tabbar {
  padding-bottom: 0;
  min-height: var(--tabbar-h);
}

html.tg-miniapp-fullscreen .gpt-sheet-toolbar {
  padding-top: calc(var(--space-3) + var(--tg-content-safe-area-inset-top, env(safe-area-inset-top, 0px)));
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom);
}

.hidden {
  display: none !important;
}

html.boot-open-app #gate {
  display: none !important;
}

html.boot-open-app #app.hidden {
  display: flex !important;
}

/* ——— Gate ——— */
.gate {
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--space-8) var(--page-x);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate-card {
  width: 100%;
  max-width: 22rem;
  margin: 0 auto;
  padding: var(--space-6);
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--surface);
  overflow: hidden;
}

.gate-title {
  margin: 0 0 var(--space-4);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gate-text {
  margin: 0 auto var(--space-4);
  max-width: 22rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-secondary);
  text-align: center;
}

.gate-alt {
  margin-top: var(--space-6);
  font-size: 0.875rem;
}

.gate-telegram-login {
  display: flex;
  justify-content: center;
  min-height: 3rem;
  margin: var(--space-5) 0;
}

.gate-login-status {
  margin: var(--space-3) 0 0;
}

.gate-login-btn {
  width: 100%;
  max-width: 16rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.gate-login-btn::before {
  content: "";
  width: 1.25rem;
  height: 1.25rem;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'%3E%3Cpath fill='%23fff' d='M120 0C53.7 0 0 53.7 0 120s53.7 120 120 120 120-53.7 120-120S186.3 0 120 0zm52.4 65.2l-19.2 90.4c-1.4 6.1-4.8 7.6-9.7 4.7l-27-19.9-13 12.5c-1.4 1.4-2.6 2.6-5.3 2.6l1.9-27.1 50.1-45.2c2.2-1.9-.5-3-3.4-1.1l-61.9 39-26.7-8.3c-5.8-1.8-5.9-5.8 1.2-8.6l104.2-40.2c4.8-1.8 9 1.1 7.4 8.2z'/%3E%3C/svg%3E");
}

.gate-code-login {
  margin: var(--space-4) 0 0;
  text-align: center;
}

.gate-code-hint {
  margin: 0 0 var(--space-3);
  line-height: 1.45;
}

.gate-code-hint code {
  font-size: 0.9em;
}

.gate-code-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
  max-width: 16rem;
  margin: 0 auto;
}

.gate-code-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  background: var(--bg, var(--surface));
  color: var(--text);
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.gate-code-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.gate-code-submit {
  width: 100%;
}

/* Вход и подтверждение почты: почта → код из письма */
.gate-email-login {
  margin: var(--space-4) 0 0;
}

.gate-email-input {
  letter-spacing: normal;
  text-transform: none;
  text-align: left;
}

.gate-email-sent {
  margin: 0 0 var(--space-2);
  line-height: 1.45;
}

.gate-email-link {
  background: none;
  border: 0;
  padding: var(--space-1) 0;
  color: var(--accent);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.gate-email-link:disabled {
  color: var(--text-secondary);
  cursor: default;
}

/* «Другой способ»: Telegram и код из бота — для тех, кто ещё не подтвердил почту */
.gate-other {
  margin: var(--space-6) 0 0;
}

.gate-other-toggle {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  list-style: none;
}

.gate-other-toggle::-webkit-details-marker {
  display: none;
}

.gate-other-toggle::after {
  content: " ›";
  display: inline-block;
  transition: transform 0.15s ease;
}

.gate-other[open] .gate-other-toggle::after {
  transform: rotate(90deg);
}

.gate-other-note {
  margin: var(--space-3) auto 0;
  max-width: 18rem;
  line-height: 1.45;
}

.gate-other .gate-telegram-login {
  margin: var(--space-4) 0;
}

.email-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  overflow-y: auto;
  background: var(--bg);
}

.gate-dev-hint {
  margin-top: var(--space-5);
  max-width: 26rem;
  font-size: 0.8125rem;
  text-align: left;
}

.gate-dev-hint code {
  font-size: 0.78em;
  word-break: break-all;
}

/* ——— Layout ——— */
.app {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: var(--max-w);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  overflow-x: clip;
}

.app.app--immersive .tabbar-wrap,
.app.app--immersive .tabbar-backdrop {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app.app--immersive .main-scroll {
  overflow: hidden;
  padding-bottom: calc(var(--space-4) + var(--tabbar-safe));
}

.main-scroll {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-top) + var(--space-4)) var(--page-x) var(--page-bottom);
}

/* Pull-to-refresh (mobile) */
.ptr-indicator {
  position: sticky;
  top: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  height: 0;
  margin: 0 calc(-1 * var(--page-x));
  overflow: hidden;
  pointer-events: none;
  color: var(--text-secondary);
}
.ptr-indicator.is-visible,
.ptr-indicator.is-refreshing {
  display: flex;
}
.ptr-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--overlay-6);
  border-top-color: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  will-change: transform;
}
.ptr-indicator.is-refreshing .ptr-spinner {
  animation: ptr-spin 0.7s linear infinite;
}
@keyframes ptr-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (min-width: 960px) {
  .ptr-indicator {
    display: none !important;
  }
}

.main-scroll.panels-stage {
  position: relative;
}

.panels-stage--animating {
  overflow: hidden;
  touch-action: pan-y;
}

@media (prefers-reduced-motion: no-preference) {
  .panels-stage--animating > .panel.panel--out,
  .panels-stage--animating > .panel.panel--in {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1;
    min-height: 100%;
    margin: 0;
    padding: calc(var(--safe-top) + var(--space-4)) var(--page-x) var(--page-bottom);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg);
    transition:
      transform 0.28s cubic-bezier(0.32, 0.72, 0, 1),
      opacity 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform, opacity;
  }

  .panels-stage--animating > .panel.panel--in.panel--in-active {
    z-index: 2;
  }

  .panel.panel--in.panel--in-from-right {
    transform: translateX(100%);
    opacity: 0.94;
  }

  .panel.panel--in.panel--in-from-left {
    transform: translateX(-30%);
    opacity: 0.94;
  }

  .panel.panel--in.panel--in-active {
    transform: translateX(0);
    opacity: 1;
  }

  .panels-stage--animating > .panel.panel--out {
    transform: translateX(0);
    opacity: 1;
  }

  .panels-stage--animating > .panel.panel--out.panel--out-active.panel--out-left {
    transform: translateX(-30%);
    opacity: 0;
  }

  .panels-stage--animating > .panel.panel--out.panel--out-active.panel--out-right {
    transform: translateX(100%);
    opacity: 0;
  }

  .panel.panel--out.panel--out-active {
    pointer-events: none;
  }

  #notes-detail:not(.hidden).motion-enter,
  #digest-detail:not(.hidden).motion-enter,
  #profile-payment:not(.hidden).motion-enter,
  #profile-expenses:not(.hidden).motion-enter,
  #profile-booking:not(.hidden).motion-enter,
  #profile-contacts:not(.hidden).motion-enter,
  #profile-calendars:not(.hidden).motion-enter,
  #profile-zoom:not(.hidden).motion-enter,
  #profile-telemost:not(.hidden).motion-enter,
  #profile-yandex-disk:not(.hidden).motion-enter,
  #profile-bitrix:not(.hidden).motion-enter,
  #profile-knowledge-base:not(.hidden).motion-enter,
  #profile-agents:not(.hidden).motion-enter,
  #profile-chats:not(.hidden).motion-enter,
  #profile-voice:not(.hidden).motion-enter {
    animation: leo-screen-enter 0.3s cubic-bezier(0.32, 0.72, 0, 1) both;
  }
}

@keyframes leo-screen-enter {
  from {
    transform: translateX(16px);
    opacity: 0.96;
  }

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

.panel {
  display: block;
}

/* ——— Typography ——— */
.screen-title {
  margin: 0 0 var(--space-1);
  font-size: var(--vkui--font_title2--font_size--regular, 20px);
  font-weight: var(--vkui--font_title2--font_weight--regular, 500);
  line-height: var(--vkui--font_title2--line_height--regular, 24px);
  letter-spacing: -0.02em;
}

.screen-title-sm {
  font-size: var(--vkui--font_headline1--font_size--regular, 16px);
  line-height: var(--vkui--font_headline1--line_height--regular, 20px);
}

.lead {
  margin: 0 0 var(--space-5);
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.lead-tight {
  margin-bottom: var(--space-4);
}

.muted {
  color: var(--text-secondary);
}

.small {
  font-size: 0.8125rem;
}

.error {
  margin: var(--space-2) 0 0;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--danger);
}

.billing-msg {
  margin: var(--space-2) 0 0;
  color: var(--success);
}

.pre-wrap {
  white-space: pre-wrap;
  word-break: break-word;
}

/* ——— Sections ——— */
.section {
  margin-bottom: var(--space-6);
}

.section:last-child {
  margin-bottom: 0;
}

.section-head {
  margin: 0 0 var(--space-3);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.section-head-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding: 0 var(--space-1);
}

.calendars-meetings-block {
  margin-bottom: 1.25rem;
}

.subsection-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.section-head-row--compact {
  margin-bottom: 0.65rem;
}

.item-title-link {
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
}

.item-title-link:active {
  opacity: 0.75;
}

.meetings-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.meetings-head-tools {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-2);
}

.section-head-row--meetings {
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  margin-bottom: 0;
  padding: 0;
}

@media (min-width: 960px) {
  .section-head-row--meetings {
    flex: 0 1 auto;
    width: auto;
  }
}

.section-head-center {
  display: flex;
  flex: 1;
  gap: var(--space-2);
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.section-head-center .section-head-inline {
  flex: 0 1 auto;
  margin: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
}

.section-icon svg {
  width: 1rem;
  height: 1rem;
}

.section-head-inline {
  flex: 1;
  margin: 0;
  font-size: var(--vkui--font_headline2--font_size--regular, 15px);
  font-weight: var(--vkui--font_headline2--font_weight--regular, 500);
  line-height: var(--vkui--font_headline2--line_height--regular, 20px);
  letter-spacing: -0.01em;
  color: var(--text);
}

.pill-badge {
  display: none;
}

.stack,
.meetings-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.empty-hint {
  padding: var(--space-6) var(--space-4);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md, 12px);
  font-size: 0.875rem;
  text-align: center;
  color: var(--text-tertiary);
  background: var(--surface-muted);
}

/* Пустой экран с примерами и кнопкой (emptyStateHtml) */
.empty-hint.empty-state {
  display: grid;
  justify-items: center;
  gap: 0.4rem;
}

.empty-state-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.empty-state-text {
  margin: 0;
  max-width: 24rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.empty-state .pf-btn {
  width: auto;
  margin-top: 0.5rem;
  padding: 0.55rem 1.25rem;
}

/* ——— Hero / summary ——— */
.hero-card,
.stat-banner {
  position: relative;
  margin: var(--space-4) 0 var(--space-5);
  padding: var(--space-5);
  overflow: hidden;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg, 12px);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent) 20%, transparent) 0%,
    color-mix(in srgb, var(--accent) 6%, transparent) 60%,
    var(--surface) 100%
  );
  box-shadow: none;
}

.hero-card::before {
  content: "";
  position: absolute;
  top: -2rem;
  right: -2rem;
  width: 8rem;
  height: 8rem;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--violet) 10%, transparent);
  filter: blur(24px);
  pointer-events: none;
}

.hero-inner,
.stat-banner-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.hero-kicker,
.stat-banner-label {
  position: relative;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: capitalize;
}

.hero-title,
.stat-banner-value {
  position: relative;
  margin: 0.2rem 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}

.hero-stats {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  padding: 0;
  border: none;
}

.hero-stat {
  display: flex;
  flex-direction: row;
  gap: var(--space-2);
  align-items: center;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: default;
}

button.hero-stat {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button.hero-stat:active {
  opacity: 0.72;
}

.hero-stat-label {
  display: none;
}

.hero-stat-value {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.hero-stat::after {
  margin-left: 0.35rem;
  font-size: 0.875rem;
  font-weight: 450;
  color: var(--text-tertiary);
}

.hero-stat--posted::before {
  content: "";
  display: inline-block;
  width: 0.8125rem;
  height: 0.8125rem;
  margin-right: 0.15rem;
  background: var(--accent);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M9 11l3 3L22 4'/%3E%3Cpath d='M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11'/%3E%3C/svg%3E") center/contain no-repeat;
}

.hero-stat--meetings::before {
  content: "";
  display: inline-block;
  width: 0.8125rem;
  height: 0.8125rem;
  margin-right: 0.15rem;
  background: var(--purple);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") center/contain no-repeat;
}

.hero-stat--posted::after {
  content: "поставлено";
}

.hero-stat--meetings::after {
  content: "встречи";
}

.stat-banner {
  margin-left: var(--page-x);
  margin-right: var(--page-x);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, transparent) 0%, transparent 70%);
  border-color: var(--accent-border);
}

.stat-banner-value {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
}

/* ——— Cards ——— */
.reminder-card,
.meeting-card,
.note-card,
.content-card,
.item-card {
  min-width: 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-card, 12px);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.reminder-card.done {
  opacity: 0.55;
}

.reminder-card {
  position: relative;
  padding-top: var(--space-3);
  padding-right: calc(var(--space-4) + 2rem);
}

.reminder-card-edit-btn {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  z-index: 2;
}

.reminder-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.reminder-check {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.125rem;
  padding: 0;
  border: 2px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.reminder-check:hover {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.reminder-check.on {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.reminder-text {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.reminder-text.line-through {
  text-decoration: line-through;
}

.reminder-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.time-pill {
  display: none;
}

.reminder-meta .muted.small {
  color: var(--text-tertiary);
}

.reminder-actions .btn.ghost {
  padding: var(--space-1) var(--space-2);
  border: none;
  color: color-mix(in srgb, var(--accent) 70%, transparent);
  background: transparent;
}

.reminder-actions .btn.ghost:hover {
  color: var(--accent);
  background: var(--accent-subtle);
}

.reminder-actions,
.meeting-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* Meetings timeline */
.meeting-row {
  display: flex;
  gap: var(--space-3);
  align-items: stretch;
}

.meeting-time-col {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  align-items: center;
  width: 2.75rem;
  padding-top: var(--space-1);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  color: var(--accent);
}

.meeting-time-end {
  font-size: 0.75rem;
  color: var(--text-faint);
}

.meeting-dot {
  width: 0.5rem;
  height: 0.5rem;
  margin: var(--space-2) auto 0;
  border-radius: var(--radius-full);
  background: var(--accent);
}

.meeting-line {
  width: 1px;
  height: 1rem;
  margin: var(--space-1) auto;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
}

.meeting-now {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0.2rem 0;
}

.meeting-now-time {
  flex-shrink: 0;
  width: 2.75rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  color: var(--danger);
}

.meeting-now-line {
  position: relative;
  flex: 1;
  height: 2px;
  border-radius: 1px;
  background: var(--danger);
}

.meeting-now-line::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: var(--radius-full);
  background: var(--danger);
  transform: translate(-10%, -50%);
}

.meetings-stack--timeline {
  gap: 0;
}

.day-timeline-connect {
  margin: 0 0 var(--space-3);
  padding: var(--space-4);
}

.day-timeline-band {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 var(--space-3);
}

.day-timeline-band-label {
  margin: 0.15rem 0 0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.day-timeline-band-item {
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  background: var(--accent-subtle);
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.day-timeline-band-item--reminder {
  border-color: color-mix(in srgb, var(--warning) 40%, transparent);
  border-left-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 14%, transparent);
}

.day-timeline-band-item--task {
  border-color: color-mix(in srgb, var(--success) 45%, transparent);
  border-left-color: var(--success);
  background: var(--success-muted);
}

.day-timeline-band-item--pending {
  border-color: var(--overlay-4);
  border-left-color: color-mix(in srgb, var(--text-subtle) 55%, transparent);
  color: var(--text-tertiary);
  background-color: var(--overlay-1);
  background-image: repeating-linear-gradient(
    -45deg,
    var(--overlay-2) 0 1px,
    transparent 1px 7px
  );
}

.day-timeline-band-item.has-entry-color {
  border-color: color-mix(in srgb, var(--entry-color) 45%, transparent);
  border-left-color: var(--entry-color);
  background: color-mix(in srgb, var(--entry-color) 22%, transparent);
  background-image: none;
  color: var(--text);
}

.day-timeline {
  --day-hour-h: 56px;
  --day-gutter: 2.75rem;
  position: relative;
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.day-timeline-gutter {
  position: relative;
  flex: 0 0 var(--day-gutter);
  width: var(--day-gutter);
}

.day-timeline-label {
  position: absolute;
  right: 0.4rem;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text-faint);
  pointer-events: none;
}

.day-timeline-label:first-child {
  transform: translateY(0);
}

.day-timeline-label:last-child {
  transform: translateY(-100%);
}

.day-timeline-canvas {
  position: relative;
  flex: 1;
  min-width: 0;
  border-left: 1px solid var(--border);
}

.day-timeline-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
  pointer-events: none;
}

.day-timeline-hour-line--half {
  background: transparent;
  background-image: linear-gradient(
    to right,
    color-mix(in srgb, var(--text-subtle) 28%, transparent) 40%,
    transparent 0
  );
  background-size: 8px 1px;
  background-repeat: repeat-x;
  opacity: 0.7;
}

.day-timeline-item {
  position: absolute;
  z-index: 1;
  box-sizing: border-box;
  padding: 1px 3px 1px 4px;
  overflow: hidden;
}

.day-timeline-item.is-past {
  opacity: 0.55;
}

.day-timeline-item--reminder {
  z-index: 2;
}

.day-timeline-item--task {
  z-index: 2;
}

.cal-entry--interactive {
  touch-action: none;
}

.cal-entry--interactive.is-dragging,
.cal-entry--interactive.is-resizing {
  z-index: 8;
  opacity: 0.95;
}

.cal-entry--interactive.is-dragging {
  cursor: grabbing;
}

.cal-entry--interactive.is-resizing {
  cursor: ns-resize;
}

.cal-resize-handle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 10px;
  z-index: 5;
  cursor: ns-resize;
  touch-action: none;
}

.cal-resize-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 22px;
  height: 3px;
  margin-left: -11px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.cal-entry--interactive:hover .cal-resize-handle::after,
.cal-entry--interactive.is-resizing .cal-resize-handle::after {
  opacity: 0.55;
}

html.cal-gesture-active,
html.cal-gesture-active body {
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

html.cal-gesture-active .main-scroll,
html.cal-gesture-active .meetings-week-scroll {
  overflow: hidden !important;
  touch-action: none !important;
  overscroll-behavior: none;
}

.meetings-month-cell.is-drop-target {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.meeting-card-wrap--timeline {
  height: 100%;
  min-width: 0;
}

.meeting-card--task,
.meeting-card--timeline.meeting-card--task {
  background: var(--success-muted);
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
  box-shadow: inset 3px 0 0 var(--success);
}

.meeting-card--timeline {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 4px 6px 4px 8px;
  overflow: hidden;
  border-left: 3px solid var(--accent);
  box-shadow: none;
  cursor: pointer;
}

.meeting-card--timeline.meeting-card--task {
  border-left-color: var(--success);
  background: var(--success-muted);
  box-shadow: none;
}

.meeting-card--timeline.has-entry-color,
.meeting-card--timeline.meeting-card--task.has-entry-color {
  border-left-color: var(--entry-color);
  background: color-mix(in srgb, var(--entry-color) 20%, transparent);
  box-shadow: inset 3px 0 0 var(--entry-color);
}

.meeting-card--timeline.has-entry-color .meeting-card-join-btn {
  color: var(--entry-color);
  background: color-mix(in srgb, var(--entry-color) 18%, transparent);
}

.meeting-card--timeline-pending {
  border-color: var(--overlay-3);
  border-left-color: color-mix(in srgb, var(--text-subtle) 55%, transparent);
  color: var(--text-secondary);
  background-color: var(--overlay-1);
  background-image: repeating-linear-gradient(
    -45deg,
    var(--overlay-2) 0 1px,
    transparent 1px 7px
  );
}

.meeting-card--timeline-pending .item-title,
.meeting-card--timeline-pending .day-timeline-event-meta {
  color: var(--text-tertiary);
}

.meeting-card--timeline-pending .meeting-card-join-btn {
  opacity: 0.6;
}

.meeting-card--timeline .meeting-card-top {
  margin-bottom: 0;
  gap: 4px;
}

.meeting-card--timeline .meeting-card-edit-btn {
  width: 28px;
  height: 28px;
}

.meeting-card--timeline .meeting-card-join-btn {
  color: var(--accent);
  background: var(--accent-subtle);
}

.meeting-card--timeline .meeting-card-edit-btn svg {
  width: 14px;
  height: 14px;
}

.meeting-card--timeline .meeting-card-top-left .item-title {
  flex: 1;
  min-width: 0;
}

.meeting-card--timeline.meeting-card--compact {
  padding-top: 4px;
  padding-bottom: 4px;
}

.meeting-card--timeline .item-title {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
}

.meeting-card--timeline .meeting-card-avatars .note-member-avatar {
  width: 1.25rem;
  height: 1.25rem;
  font-size: 0.55rem;
}

.day-timeline-event-meta {
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-faint);
}

.meeting-card--timeline .btn.join {
  height: 28px;
  min-height: 28px;
  margin-top: 4px;
  font-size: 0.6875rem;
}

.meeting-card--timeline .meeting-rsvp {
  margin-top: 4px;
  gap: 4px;
}

.meeting-card--timeline .meeting-rsvp-btn {
  height: 26px;
  min-height: 26px;
  font-size: 0.625rem;
}

.meeting-card-text {
  display: flex;
  flex: 1;
  align-items: baseline;
  gap: 0.35em;
  min-width: 0;
}

.meeting-card--timeline-inline-time .meeting-card-text {
  flex-wrap: nowrap;
}

.meeting-card--timeline-inline-time .item-title {
  flex: 0 1 auto;
  min-width: 0;
  display: block;
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  -webkit-box-orient: unset;
}

.meeting-card--timeline-inline-time .day-timeline-event-meta {
  display: block;
  flex: 0 0 auto;
  margin-top: 0;
  white-space: nowrap;
}

/* Короткие, но не крошечные: название + время столбиком (как в дневном виде). */
.meeting-card--timeline-short:not(.meeting-card--timeline-inline-time) {
  justify-content: flex-start;
  gap: 1px;
}

.meeting-card--timeline-short:not(.meeting-card--timeline-inline-time) .meeting-card-top {
  flex: 0 1 auto;
  min-height: 0;
  align-items: flex-start;
}

.meeting-card--timeline-short:not(.meeting-card--timeline-inline-time) .item-title {
  display: block;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  -webkit-box-orient: unset;
}

.meeting-card--timeline-short:not(.meeting-card--timeline-inline-time) .day-timeline-event-meta {
  display: block;
  margin-top: 0;
}

.day-timeline-reminder {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0 8px;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
  border-radius: 8px;
  border-left: 3px solid var(--warning);
  background: color-mix(in srgb, var(--warning) 16%, transparent);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: grab;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.day-timeline-reminder:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--warning) 55%, transparent);
}

.day-timeline-reminder-task {
  min-width: 0;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-timeline-now {
  position: absolute;
  left: calc(-1 * var(--day-gutter));
  right: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  pointer-events: none;
  transform: translateY(-50%);
}

.day-timeline-now-time {
  flex-shrink: 0;
  width: var(--day-gutter);
  padding-right: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
  text-align: right;
  color: var(--danger);
  background: var(--surface);
}

.day-timeline-now-line {
  position: relative;
  flex: 1;
  height: 2px;
  border-radius: 1px;
  background: var(--danger);
}

.day-timeline-now-line::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: var(--radius-full);
  background: var(--danger);
  transform: translate(-35%, -50%);
}

.meeting-row.is-past {
  opacity: 0.55;
}

.meetings-day-title {
  display: none;
  margin: 0 0 var(--space-3);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
}

.meetings-day--next {
  display: none;
}

.meeting-card-wrap {
  flex: 1;
  min-width: 0;
}

.meeting-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.meeting-card--compact {
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.meeting-card--compact .meeting-card-top {
  margin-bottom: 0;
}

.meeting-card--compact .item-title {
  margin-bottom: 0;
}

.meeting-card--compact .btn.join,
.meeting-card--compact .meeting-rsvp {
  margin-top: var(--space-2);
}

.meeting-card.meeting-card--timeline.meeting-card--compact {
  padding: 2px 6px 2px 8px;
  justify-content: center;
}

.meeting-card.meeting-card--timeline.meeting-card--timeline-short,
.meeting-card.meeting-card--timeline.meeting-card--timeline-tiny {
  padding-top: 0;
  padding-bottom: 0;
}

.meeting-card--timeline-short .meeting-card-top,
.meeting-card--timeline-tiny .meeting-card-top {
  flex: 1;
  min-height: 0;
  align-items: center;
}

.meeting-card--timeline-short .item-title,
.meeting-card--timeline-tiny .item-title {
  display: block;
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  -webkit-box-orient: unset;
}

.meeting-card--timeline-short .meeting-card-join-btn,
.meeting-card--timeline-tiny .meeting-card-join-btn {
  width: 22px;
  height: 22px;
}

.meeting-card-top-left {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.meeting-card-top .meeting-kind-badge {
  margin-bottom: 0;
}

.meeting-card-edit-btn {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  color: var(--text);
  background: var(--vkui--color_background_secondary_alpha, var(--surface-muted));
  cursor: pointer;
}

.meeting-card-edit-btn:active {
  opacity: 0.85;
  transform: scale(0.98);
}

.meeting-card-avatars {
  display: flex;
  flex-shrink: 0;
  align-items: center;
}

.meeting-card-top-left .meeting-card-avatars {
  margin-top: 0;
}

.meeting-card-avatars .note-member-avatar {
  width: 1.75rem;
  height: 1.75rem;
  margin-left: -0.45rem;
  font-size: 0.62rem;
}

.meeting-card-avatars .note-member-avatar:first-child {
  margin-left: 0;
}

.item-title {
  margin-bottom: var(--space-1);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ——— Buttons ——— */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.625rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.12s ease;
}

.btn:active {
  transform: scale(0.98);
}

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

.btn.primary,
.pay-submit-btn {
  color: var(--on-accent);
  background: var(--accent);
}

.btn.primary:active,
.pay-submit-btn:active {
  background: var(--accent-pressed);
}

.btn.ghost,
.btn-sm.ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border-strong);
}

.btn.join {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 40px;
  min-height: 40px;
  margin-top: var(--space-2);
  padding: 0 0.65rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-subtle);
}

.btn.join:hover {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.meeting-rsvp {
  display: flex;
  gap: 6px;
  margin-top: var(--space-2);
}

.meeting-rsvp-btn {
  flex: 1;
  min-width: 0;
  height: 40px;
  min-height: 40px;
  padding: 0 4px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.15;
  cursor: pointer;
}

.meeting-rsvp-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.meeting-rsvp-btn.rsvp-no {
  color: var(--danger);
  background: var(--danger-muted);
}

.meeting-rsvp-btn.rsvp-maybe {
  color: var(--text);
  background: var(--vkui--color_background_secondary_alpha, var(--surface-muted));
}

.meeting-rsvp-btn.rsvp-yes {
  color: var(--accent);
  background: var(--accent-subtle);
}

.event-sheet-rsvp-group {
  padding: 0.65rem 0.9rem 0.75rem;
}

.meeting-rsvp-btn.is-current {
  box-shadow: inset 0 0 0 2px currentColor;
}

.event-sheet-rsvp-group .event-sheet-row-label {
  display: block;
  margin-bottom: 8px;
}

.event-sheet-rsvp-group .meeting-rsvp {
  margin-top: 0;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  border-radius: var(--radius-xs);
}

.btn.danger {
  color: var(--danger);
  background: var(--danger-muted);
  border: 1px solid color-mix(in srgb, var(--danger) 20%, transparent);
}

.btn-text {
  padding: var(--space-2) var(--space-1);
  border: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  background: none;
  cursor: pointer;
}

.btn-block {
  width: 100%;
  margin-top: var(--space-4);
}

.cal-nav-btn {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1.55rem;
  font-weight: 500;
  line-height: 1;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.cal-nav-btn:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.cal-nav-btn:active {
  background: var(--surface-muted);
}

.meetings-today-btn {
  flex-shrink: 0;
  margin: 0;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--accent);
  background: var(--accent-muted);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.meetings-today-btn:hover,
.meetings-today-btn:active {
  border-color: var(--accent-border);
  color: var(--text);
}

.meetings-today-btn.hidden {
  display: none;
}

.meetings-skeleton {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.15rem 0 0.35rem;
  min-height: 12rem;
}

.meetings-skeleton-row {
  height: 2.4rem;
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    var(--surface-muted) 0%,
    color-mix(in srgb, var(--surface) 55%, var(--surface-muted)) 45%,
    var(--surface-muted) 100%
  );
  background-size: 220% 100%;
  animation: meetings-skeleton-shimmer 1.15s ease-in-out infinite;
}

.meetings-skeleton-row--tall {
  height: 3.6rem;
}

.meetings-skeleton-row:nth-child(2) {
  animation-delay: 0.08s;
}

.meetings-skeleton-row:nth-child(3) {
  animation-delay: 0.16s;
}

.meetings-skeleton-row:nth-child(4) {
  animation-delay: 0.24s;
}

.meetings-skeleton-row:nth-child(5) {
  animation-delay: 0.32s;
}

@keyframes meetings-skeleton-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .meetings-skeleton-row {
    animation: none;
  }
}

.meetings-view-wrap {
  position: relative;
  flex-shrink: 0;
}

.meetings-view-btn {
  font-size: 0;
}

.meetings-view-btn svg {
  display: block;
  width: 20px;
  height: 20px;
}

.meetings-view-btn[aria-expanded="true"] {
  color: var(--text);
  background: var(--surface-muted);
}

.meetings-view-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: auto;
  z-index: 40;
  min-width: 10.5rem;
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 8px 24px color-mix(in srgb, var(--shadow-color) 28%, transparent));
}

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

.meetings-view-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: none;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.meetings-view-menu-item:hover,
.meetings-view-menu-item:focus-visible {
  background: var(--surface-muted);
}

.meetings-view-menu-item.is-active::after {
  content: "";
  width: 0.45rem;
  height: 0.8rem;
  margin-left: 0.75rem;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg) translateY(-1px);
}

.meetings-week,
.meetings-month {
  min-width: 0;
}

.meetings-week.hidden,
.meetings-month.hidden {
  display: none !important;
}

.meetings-week-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.meetings-week-grid {
  min-width: 100%;
}

.meetings-week-head,
.meetings-week-allday,
.meetings-week-body {
  display: grid;
  grid-template-columns: 2.6rem repeat(7, minmax(72px, 1fr));
  min-width: calc(2.6rem + 7 * 72px);
}

.meetings-week-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
}

.meetings-week-dow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0 0.45rem;
  border-bottom: 1px solid var(--border);
}

.meetings-week-dow-name {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: var(--text-tertiary);
}

.meetings-week-dow-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.meetings-week-dow.is-today .meetings-week-dow-name {
  color: var(--accent);
}

.meetings-week-dow.is-today .meetings-week-dow-num {
  color: var(--on-accent);
  background: var(--accent);
}

.meetings-week-allday {
  border-bottom: 1px solid var(--border);
  min-height: 1.6rem;
}

.meetings-week-allday-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 0.2rem 0.15rem 0.3rem;
  border-left: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}

.meetings-week-chip,
.meetings-month-chip {
  display: block;
  overflow: hidden;
  width: 100%;
  margin: 0;
  padding: 0.12rem 0.28rem;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.meetings-week-chip--task,
.meetings-month-chip--task {
  background: var(--success);
}

.meetings-week-chip--pending,
.meetings-month-chip--pending {
  background: color-mix(in srgb, var(--accent) 55%, var(--surface-muted));
}

.meetings-week-chip.has-entry-color,
.meetings-month-chip.has-entry-color {
  background: var(--entry-color);
}

.meetings-week-body {
  position: relative;
  align-items: stretch;
}

.meetings-week-gutter {
  position: relative;
}

.meetings-week-hour {
  height: var(--week-hour-h, 48px);
  padding-right: 0.3rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1;
  text-align: right;
  transform: translateY(-0.35rem);
}

.meetings-week-cols {
  display: contents;
}

.meetings-week-col {
  position: relative;
  border-left: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent calc(var(--week-hour-h, 48px) - 1px),
    color-mix(in srgb, var(--border) 70%, transparent) calc(var(--week-hour-h, 48px) - 1px),
    color-mix(in srgb, var(--border) 70%, transparent) var(--week-hour-h, 48px)
  );
}

.meetings-week-event {
  position: absolute;
  z-index: 1;
  box-sizing: border-box;
  overflow: hidden;
  padding: 1px 2px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.meetings-week-event .meeting-card-wrap--timeline,
.meetings-week-event .day-timeline-reminder {
  height: 100%;
  min-width: 0;
}

.meetings-week-event .meeting-card--timeline .item-title {
  font-size: 0.6875rem;
}

.meetings-week-event .day-timeline-event-meta {
  font-size: 0.625rem;
}

.meetings-week-event--task {
  z-index: 2;
}

.meetings-week-event--reminder,
.meetings-month-chip--reminder {
  z-index: 2;
}

.meetings-month-chip--reminder {
  background: color-mix(in srgb, var(--warning) 85%, var(--surface));
  color: #1a1408;
}

.meetings-week-now {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  height: 2px;
  background: var(--accent);
  pointer-events: none;
}

.meetings-week-now::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.meetings-month-wd {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-bottom: 0.2rem;
}

.meetings-month-wd span {
  padding: 0.35rem 0;
  color: var(--text-tertiary);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: lowercase;
}

.meetings-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.meetings-month-cell {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-height: 6.4rem;
  padding: 0.3rem 0.28rem 0.4rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.meetings-month-cell--out {
  color: var(--text-tertiary);
  background: color-mix(in srgb, var(--surface-muted) 55%, transparent);
}

.meetings-month-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.meetings-month-cell.is-today .meetings-month-num {
  background: var(--accent);
  color: var(--on-accent);
}

.meetings-month-more {
  padding: 0 0.1rem;
  color: var(--text-tertiary);
  font-size: 0.6875rem;
  font-weight: 600;
}

@media (max-width: 959px) {
  .meetings-month-cell {
    min-height: 5.4rem;
    padding: 0.2rem 0.12rem 0.28rem;
  }

  .meetings-month-chip {
    font-size: 0.625rem;
    padding: 0.08rem 0.18rem;
  }
}

/* ——— Tab bar (Figma: нижняя панель на всю ширину) ——— */
.tabbar-backdrop {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 29;
  height: var(--tabbar-stack);
  background: var(--tabbar-surface);
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.tabbar-wrap {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-bottom: var(--tabbar-offset, 0px);
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  background: var(--tabbar-surface);
}

.tabbar {
  pointer-events: auto;
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: var(--tabbar-h);
  padding: 0;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: var(--tabbar-surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

.tabbar-btn {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-width: 0;
  padding: 0.55rem 0.25rem;
  border: none;
  border-radius: 0;
  font-family: inherit;
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-tertiary);
  background: transparent;
  cursor: pointer;
  transition: color 0.15s ease;
}

.tabbar-btn.active {
  color: var(--accent);
  background: transparent;
}

.tabbar-icon {
  display: flex;
  flex-shrink: 0;
  line-height: 0;
}

.tabbar-icon svg {
  width: 1.3rem;
  height: 1.3rem;
}

.tabbar-label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-brand {
  display: none;
}

.sidebar-logo {
  display: none;
}

.sidebar-head {
  display: none;
}

.sidebar-toggle {
  display: none;
}

.sidebar-tree-toggle,
.sidebar-tree {
  display: none !important;
}

.sidebar-nav-group,
.sidebar-nav-row {
  display: contents;
}

/* ——— Notes / Сохранённое ——— */
.notes-header {
  padding: var(--space-1) 0 var(--space-3);
}

.saved-intro {
  margin: var(--space-2) 0 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.notes-subtabs-row {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
  margin: 0 0 var(--space-5);
  padding-top: var(--space-1);
}

html.tg-miniapp-fullscreen #panel-notes:not(.hidden) .notes-subtabs-row {
  padding-top: calc((var(--tg-content-safe-area-inset-top, 0px) + 44px) / 3);
}

.knowledge-list-head {
  margin: 0 0 var(--space-4);
  padding-top: var(--space-1);
}

.knowledge-list-head .lead {
  margin-bottom: 0;
}

html.tg-miniapp-fullscreen #panel-knowledge:not(.hidden) .knowledge-list-head {
  padding-top: calc((var(--tg-content-safe-area-inset-top, 0px) + 44px) / 3);
}

.notes-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
  min-width: 0;
}

.subtab-bar {
  display: flex;
  flex: 1;
  min-width: 0;
  width: 100%;
  gap: var(--space-1);
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--surface);
  overflow: hidden;
}

.subtab-btn {
  flex: 1 1 auto;
  padding: 0.5rem 0.55rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.subtab-btn.active {
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: var(--shadow-sm);
}

.notes-fab {
  position: fixed;
  right: max(var(--space-4), calc((100vw - var(--max-w)) / 2 + var(--space-4)));
  bottom: calc(var(--tabbar-stack) + var(--space-4));
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-full);
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--shadow-color) 28%, transparent), 0 2px 6px color-mix(in srgb, var(--accent) 35%, transparent);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.notes-fab svg {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}

.notes-fab:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--shadow-color) 32%, transparent), 0 3px 8px color-mix(in srgb, var(--accent) 40%, transparent);
}

.notes-fab:active {
  transform: scale(0.96);
}

.notes-fab.hidden {
  display: none !important;
}

.transcription-upload-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.transcription-upload-hint {
  margin: 0;
  line-height: 1.45;
}

.transcription-upload-file-pick {
  display: block;
  margin: 0;
  cursor: pointer;
}

.transcription-upload-pick-btn {
  width: 100%;
  pointer-events: none;
}

.transcription-upload-filename {
  margin: 0;
  word-break: break-all;
}

.transcription-upload-mode {
  margin: var(--space-1) 0 0;
  padding: 0;
  border: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.transcription-upload-mode .field-label {
  margin-bottom: var(--space-1);
}

.transcription-upload-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  background: var(--surface);
  cursor: pointer;
}

.transcription-upload-option.is-selected,
.transcription-upload-option:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.transcription-upload-option input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.transcription-upload-option span {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.transcription-upload-option strong {
  font-weight: 600;
  font-size: 0.9375rem;
}

.transcription-upload-status {
  margin: 0;
}

.transcription-upload-submit {
  width: 100%;
  margin-top: var(--space-1);
}

.transcription-upload-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.actual-create-menu {
  position: fixed;
  right: max(var(--space-4), calc((100vw - var(--max-w)) / 2 + var(--space-4)));
  bottom: calc(var(--tabbar-stack) + var(--space-4) + 3.75rem);
  z-index: 36;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: min(13rem, calc(100vw - 2rem));
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
}

.actual-create-menu-btn {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  background: var(--surface-muted);
  cursor: pointer;
}

.actual-create-menu-btn:active {
  transform: scale(0.99);
  background: var(--accent-subtle);
}

.notes-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 2.5rem;
}

.notes-search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  color: var(--text-secondary);
  background: var(--surface);
  cursor: pointer;
}

.notes-search-toggle:hover,
.notes-search-wrap--open .notes-search-toggle,
.notes-search-toggle[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-subtle);
}

.notes-search-input {
  width: 0;
  min-width: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
}

.notes-search-input::-webkit-search-decoration,
.notes-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.notes-search-field {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  width: 0;
  opacity: 0;
  pointer-events: none;
}

.notes-search-wrap--open {
  flex: 1 1 auto;
  min-width: 0;
}

.notes-search-wrap--open .notes-search-field {
  width: auto;
  margin-left: 0.25rem;
  opacity: 1;
  pointer-events: auto;
}

.notes-search-wrap--open .notes-search-input {
  flex: 1;
  width: auto;
  min-width: 6rem;
  padding: 0.625rem 2.5rem 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  opacity: 1;
  pointer-events: auto;
}

.notes-search-tag-btn {
  display: none;
}

.notes-search-wrap--open .notes-search-tag-btn {
  display: flex;
}

#knowledge-root .notes-search-wrap {
  flex: 1 1 auto;
  width: 100%;
}

#knowledge-search-input {
  flex: 1;
  width: auto;
  min-width: 0;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  opacity: 1;
  pointer-events: auto;
}

.notes-project-chips {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: var(--space-1);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}

.notes-project-chips::-webkit-scrollbar {
  display: none;
}

.notes-search-wrap--open + .notes-project-chips {
  flex: 0 1 42%;
}

.notes-project-chip {
  flex-shrink: 0;
}

.tag-chip.notes-project-chip {
  box-sizing: border-box;
  height: 2.5rem;
  padding: 0 0.875rem;
  border-radius: var(--radius-md, 12px);
  font-size: 0.8125rem;
  line-height: 1;
}

.notes-project-manage {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md, 12px);
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
}

.notes-project-manage:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-subtle);
}

.notes-search-tag-btn {
  position: absolute;
  right: 0.375rem;
  top: 50%;
  transform: translateY(-50%);
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  z-index: 1;
}

.notes-search-tag-btn:hover,
.notes-search-tag-btn[aria-expanded="true"] {
  color: var(--accent);
  background: var(--accent-subtle);
}

.notes-search-tag-badge {
  position: absolute;
  top: 0.125rem;
  right: 0.125rem;
  min-width: 0.875rem;
  height: 0.875rem;
  padding: 0 0.2rem;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 0.875rem;
  text-align: center;
  color: var(--on-accent);
  background: var(--accent);
}

.notes-tag-filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 30;
  max-height: 14rem;
  overflow: auto;
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 8px 24px color-mix(in srgb, var(--shadow-color) 20%, transparent));
}

.notes-tag-filter-menu.hidden {
  display: none !important;
}

.notes-tag-filter-menu-empty {
  margin: 0;
  padding: 0.5rem 0.625rem;
  font-family: inherit;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.notes-tag-filter-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  text-align: left;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.notes-tag-filter-menu-item-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-tag-filter-menu-item:hover {
  background: var(--accent-subtle);
}

.notes-tag-filter-menu-item--active {
  color: var(--accent);
  font-weight: 600;
}

.notes-tag-filter-menu-item-check {
  flex-shrink: 0;
  margin-left: 0.5rem;
  font-size: 0.75rem;
  color: var(--accent);
}

.notes-tag-filter-menu-foot {
  margin-top: var(--space-1);
  padding-top: var(--space-1);
  border-top: 1px solid var(--border);
}

.notes-tag-filter-menu-manage {
  display: block;
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: left;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
}

.notes-search-input:focus {
  outline: none;
  border-color: var(--accent-border);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-secondary);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.tag-chip--filter.tag-chip--active {
  color: var(--on-accent);
  border-color: var(--accent);
  background: var(--accent);
}

.tag-chip--hashtag {
  color: var(--accent);
  cursor: pointer;
}

.tag-chip--hashtag::before {
  content: "#";
  font-weight: 700;
  opacity: 0.75;
}

.tag-chip--project {
  cursor: default;
}

.tag-chip--card.tag-chip--hashtag {
  cursor: pointer;
}

.note-task-slash-suggest,
.note-ref-plus-suggest,
.note-hashtag-suggest {
  position: fixed;
  z-index: 520;
  min-width: 10rem;
  max-width: 16rem;
  max-height: 12rem;
  overflow: auto;
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 8px 24px color-mix(in srgb, var(--shadow-color) 20%, transparent));
}

/* «+» в заметке: поле поиска с чипом типа + пункты (типы, затем найденное). */
.note-ref-plus-suggest {
  display: flex;
  flex-direction: column;
  width: min(20rem, calc(100vw - 16px));
  max-width: none;
  max-height: min(20rem, 50dvh);
  overflow: hidden;
  padding: 0;
}

.note-ref-plus-suggest.hidden {
  display: none;
}

.note-ref-suggest-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  min-height: 2.5rem;
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.note-ref-suggest-search-icon,
.note-ref-suggest-icon {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.note-ref-suggest-search-icon svg,
.note-ref-suggest-icon svg,
.note-ref-suggest-kind-chip svg {
  display: block;
  width: 1rem;
  height: 1rem;
}

.note-ref-suggest-kind-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  padding: 0.15rem 0.4rem 0.15rem 0.45rem;
  border: none;
  border-radius: 999px;
  background: var(--accent-subtle);
  color: var(--accent);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}

.note-ref-suggest-kind-chip svg:last-child {
  width: 0.8rem;
  height: 0.8rem;
  opacity: 0.7;
}

.note-ref-suggest-query {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.note-ref-suggest-query.is-placeholder {
  color: var(--text-secondary);
}

.note-ref-suggest-list {
  overflow: auto;
  padding: var(--space-1);
}

.note-ref-suggest-empty {
  padding: 0.75rem 0.85rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.note-ref-suggest-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  text-align: left;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.note-ref-suggest-item.is-active,
.note-ref-suggest-item:hover {
  background: var(--accent-subtle);
}

.note-ref-suggest-item.is-active .note-ref-suggest-icon,
.note-ref-suggest-item:hover .note-ref-suggest-icon {
  color: var(--accent);
}

.note-ref-suggest-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

/* Строка «Заметки» в карточке задачи / напоминания / контакта. */
.event-sheet-row.note-backlinks-row {
  align-items: flex-start;
}

.note-backlinks-row .event-sheet-row-label {
  flex-shrink: 0;
  padding-top: 0.2rem;
}

.note-backlinks-row.hidden {
  display: none;
}

.note-backlinks {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
  min-width: 0;
}

.contact-detail-backlinks {
  display: flex;
  margin: 0.25rem 0 0.75rem;
}

.contact-detail-backlinks .note-backlinks {
  justify-content: flex-start;
}

.contact-detail-backlinks .event-sheet-row-label {
  display: none;
}

.note-backlink-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
  padding: 0.2rem 0.6rem 0.2rem 0.45rem;
  border: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--vkui--color_text_accent, var(--accent));
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}

.note-backlink-chip svg {
  flex-shrink: 0;
  width: 0.95rem;
  height: 0.95rem;
}

.note-backlink-chip span {
  min-width: 0;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-ref-suggest-label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-ref-suggest-hint {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.note-hashtag-suggest-item {
  display: block;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  text-align: left;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.note-hashtag-suggest-item.is-active,
.note-hashtag-suggest-item:hover {
  background: var(--accent-subtle);
  color: var(--accent);
}

.ProseMirror .note-hashtag {
  color: var(--accent);
  font-weight: 600;
}

.tag-chip--picker {
  padding-right: 0.375rem;
}

.tag-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  font-size: 0.875rem;
  line-height: 1;
  color: inherit;
  background: transparent;
  cursor: pointer;
  opacity: 0.75;
}

.tag-chip-remove:hover {
  opacity: 1;
}

.note-card-tags,
.journal-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

.note-card-tags--head {
  margin-top: 0;
  margin-bottom: var(--space-2);
}

.note-card-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: var(--accent);
  pointer-events: none;
}

.tag-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding: 0 var(--page-x);
}

.tag-picker-add-wrap {
  position: relative;
}

.tag-picker-add-btn {
  padding: 0.3125rem 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
}

.tag-picker-add-btn-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.tag-picker-add-btn-icon {
  flex-shrink: 0;
}

.tag-picker-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  min-width: 10rem;
  max-width: 16rem;
  max-height: 12rem;
  overflow: auto;
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 8px 24px color-mix(in srgb, var(--shadow-color) 20%, transparent));
}

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

.tag-picker-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8125rem;
  text-align: left;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.tag-picker-menu-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-picker-menu-check {
  flex-shrink: 0;
  margin-left: auto;
  width: 1rem;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  text-align: center;
}

.tag-picker-menu-item--selected {
  background: var(--accent-subtle);
}

.tag-picker-menu-item--create {
  margin-top: var(--space-1);
  border-top: 1px solid var(--border);
  border-radius: 0;
  color: var(--accent);
  font-weight: 600;
}

.tag-picker--dropdown {
  justify-content: center;
  flex-wrap: nowrap;
  margin-bottom: 0;
}

.tag-picker-trigger--selected {
  border-style: solid;
  color: var(--text);
}

.tag-picker-trigger-label {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-picker-more {
  flex-shrink: 0;
  margin-left: 0.125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.tag-picker-chevron {
  flex-shrink: 0;
  margin-left: 0.125rem;
  opacity: 0.72;
}

.tag-picker-menu-item:hover {
  background: var(--accent-subtle);
}

.tag-picker-menu-empty {
  margin: 0;
  padding: 0.5rem 0;
  font-family: inherit;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.modal-header-btn--placeholder {
  grid-column: 3;
  justify-self: end;
  visibility: hidden;
  pointer-events: none;
}

.tags-manage-sheet {
  max-height: min(85vh, 85dvh);
}

.tags-manage-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-height: 10rem;
}

.tags-manage-list {
  flex: 1;
  min-height: 0;
  max-height: min(40vh, 20rem);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.tags-manage-row {
  display: grid;
  grid-template-columns: 1fr 5.5rem;
  gap: var(--space-2);
  align-items: center;
}

.tags-manage-row-input,
.tags-manage-new-input {
  height: 40px;
  min-height: 40px;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1.25;
}

.tags-manage-row-del,
.tags-manage-create-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 5.5rem;
  min-width: 5.5rem;
  height: 40px;
  min-height: 40px;
  padding: 0 0.5rem;
  white-space: nowrap;
}

.tags-manage-row-del {
  flex-shrink: 0;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--vkui--color_text_negative, var(--danger));
  background: transparent;
  cursor: pointer;
}

.tags-manage-row-del:active {
  opacity: 0.75;
}

.tags-manage-create {
  display: grid;
  grid-template-columns: 1fr 5.5rem;
  gap: var(--space-2);
  align-items: center;
  flex-shrink: 0;
}

.tags-manage-create-btn {
  flex-shrink: 0;
  line-height: 1;
  font-size: 0.875rem;
}

.note-format-toolbar {
  display: none;
}

.note-rich-editor {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.note-rich-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-bottom: 0;
}

.note-editor-toolbar-wrap {
  position: relative;
  flex-shrink: 0;
  padding: var(--space-2) var(--note-editor-pad-x, 16px);
  background: var(--vkui--color_background, var(--bg));
  border-bottom: 1px solid var(--vkui--color_separator_primary, var(--border));
}

.note-editor-toolbar-wrap--bottom {
  position: relative;
  z-index: 30;
  flex-shrink: 0;
  margin: 0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  border-bottom: none;
  border-top: 1px solid var(--overlay-3);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-sizing: border-box;
  overflow: visible;
}

html.note-editor-kb-open .note-editor-toolbar-wrap--bottom {
  padding-bottom: 10px;
}

.note-editor-toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.note-tg-btn--gpt {
  flex-shrink: 0;
  background: var(--overlay-3);
  touch-action: manipulation;
}

.note-tg-btn--gpt.hidden {
  display: none;
}

.note-editor-format-toolbar-host {
  flex: 1;
  min-width: 0;
}

.note-editor-format-toolbar-host .note-rich-editor-toolbar {
  margin-bottom: 0;
}

.note-editor-toolbar-wrap.hidden,
#note-editor-overlay .note-editor-toolbar-wrap.is-composer-hidden {
  display: none !important;
}

/* ——— Telegram-style bottom note toolbar ——— */
.note-tg-toolbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  flex-wrap: nowrap;
}

.note-tg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  color: var(--text-strong);
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.note-tg-btn svg {
  display: block;
}

.note-tg-btn--undo {
  flex-shrink: 0;
  background: var(--overlay-3);
}

.note-tg-btn--active,
.note-tg-btn--menu-open {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.note-tg-btn--disabled,
.note-tg-btn:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.note-tg-capsule {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 4px;
  border-radius: 999px;
  background: var(--overlay-3);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.note-tg-capsule::-webkit-scrollbar {
  display: none;
}

.note-tg-capsule.hidden {
  display: none !important;
}

.note-tg-menu {
  position: absolute;
  left: 52px;
  bottom: calc(100% + 10px);
  z-index: 40;
  min-width: 220px;
  max-width: min(280px, calc(100vw - 32px));
  padding: 6px;
  border-radius: 16px;
  background: var(--surface-raised);
  box-shadow: 0 12px 40px color-mix(in srgb, var(--shadow-color) 45%, transparent);
}

.note-tg-menu[data-menu-panel="list"],
.note-tg-menu[data-menu-panel="heading"],
.note-tg-menu[data-menu-panel="list-sel"] {
  left: auto;
  right: 12px;
}

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

.note-tg-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.2;
  color: var(--text-strong);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.note-tg-menu-item svg {
  flex-shrink: 0;
  opacity: 0.9;
}

.note-tg-menu-item--active {
  background: var(--overlay-3);
}

.note-tg-menu-item--active::after {
  content: "";
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.note-tg-file-input,
.note-tg-file-input-host {
  position: fixed;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0.01;
  border: 0;
  overflow: hidden;
  z-index: -1;
  /* Не display:none / visibility:hidden — iOS тогда не открывает picker */
}

.note-tg-menu-item--attach {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.note-editor-image-wrap {
  position: relative;
  display: block;
  max-width: 100%;
  width: 100%;
  margin: 0.75rem 0;
  line-height: 0;
}

.note-editor-image-wrap .note-editor-image {
  margin: 0;
  width: 100%;
}

.note-editor-image-wrap.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 12px;
}

.note-editor-image-wrap.is-resizing {
  user-select: none;
}

.note-editor-image-resize {
  position: absolute;
  top: 50%;
  right: -6px;
  width: 14px;
  height: 28px;
  margin-top: -14px;
  border-radius: 999px;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px color-mix(in srgb, var(--shadow-color) 25%, transparent);
  cursor: ew-resize;
  touch-action: none;
  opacity: 0;
  pointer-events: none;
}

.note-editor-image-wrap.is-selected .note-editor-image-resize,
.note-editor-image-wrap.is-resizing .note-editor-image-resize {
  opacity: 1;
  pointer-events: auto;
}

.note-editor-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0.75rem 0;
  border-radius: 12px;
}

.note-editor-table {
  width: 100%;
  margin: 0.75rem 0;
  border-collapse: collapse;
  table-layout: fixed;
}

.note-editor-table td,
.note-editor-table th {
  min-width: 2.5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--overlay-6);
  vertical-align: top;
  word-break: break-word;
}

.note-editor-table th {
  font-weight: 600;
  background: var(--overlay-2);
}

.note-table-manage-wrap {
  position: relative;
  margin: 1.35rem 0 0.75rem;
  padding: 0;
  max-width: 100%;
  overflow: visible;
  pointer-events: none;
}

.note-table-manage-wrap.is-managing {
  /* Место сверху под ручки колонок и кнопку управления. */
  padding: 28px 0 10px;
}

.note-table-manage-scroll {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
}

.note-table-manage-wrap .note-editor-table {
  margin: 0;
  width: 100%;
}

.note-table-manage-toggle,
.note-table-handle {
  position: absolute;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--overlay-6);
  border-radius: 999px;
  color: var(--text-secondary);
  background: var(--vkui--color_background_secondary, var(--surface));
  box-shadow: 0 1px 6px color-mix(in srgb, var(--shadow-color) 28%, transparent);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
}

.note-table-manage-toggle {
  top: 0;
  left: 0;
  transform: translateY(-100%);
  margin-top: -4px;
}

.note-table-manage-wrap.is-managing .note-table-manage-toggle {
  top: 2px;
  left: 0;
  transform: translateY(0);
  margin-top: 0;
}

.note-table-manage-toggle.is-active,
.note-table-handle.is-dragging {
  color: var(--on-accent);
  border-color: var(--accent);
  background: var(--accent);
}

.note-table-handle--resize-row svg {
  transform: rotate(90deg);
}

.note-table-handle--trash {
  color: var(--vkui--color_text_negative, var(--danger));
}

.note-table-handle--add {
  color: var(--accent);
}

.note-table-manage-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  z-index: 2;
  overflow: visible;
  pointer-events: none;
}

.note-table-manage-overlay .note-table-handle {
  pointer-events: auto;
}

.note-table-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.note-table-confirm-modal {
  width: min(100%, 22rem);
  padding: 1.25rem 1.1rem 1rem;
  border-radius: var(--radius-lg, 16px);
  background: var(--surface);
  box-shadow: 0 12px 40px color-mix(in srgb, var(--shadow-color) 28%, transparent);
}

.note-table-confirm-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--text);
}

.note-table-confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.note-editor-table tr[data-row-height] > th,
.note-editor-table tr[data-row-height] > td {
  height: inherit;
  min-height: inherit;
  box-sizing: border-box;
}

.note-rich-toolbar-btn {
  min-width: 2rem;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--surface);
  cursor: pointer;
}

.note-rich-toolbar-btn--active {
  color: var(--on-accent);
  border-color: var(--accent);
  background: var(--accent);
}

.note-rich-toolbar-btn--disabled,
.note-rich-toolbar-btn:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.note-rich-editor-surface {
  flex: 0 1 auto;
  min-height: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.note-editor-fallback {
  min-height: 12rem;
  padding: 0.25rem 0 2rem;
  -webkit-user-select: text;
  user-select: text;
}

.note-rich-editor-body,
.note-rich-editor-body.ProseMirror,
.note-rich-editor-body:focus,
.note-rich-editor-body.ProseMirror-focused,
.note-rich-editor-body:focus-visible {
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

.note-rich-editor-body p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  height: 0;
  pointer-events: none;
  color: var(--vkui--color_text_tertiary, var(--text-tertiary));
}

.note-rich-editor-body h1,
.note-rich-editor-body h2,
.note-rich-editor-body h3,
.note-rich-editor-body h4 {
  margin: 0.75rem 0 0.375rem;
  font-weight: 700;
  line-height: 1.3;
}

.note-rich-editor-body a[href] {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.note-rich-editor-body blockquote {
  margin: 0.375rem 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--quote-border);
  color: var(--quote-text);
}

.note-rich-editor-body ul[data-type="taskList"],
.note-rich-editor-body ul.note-task-list {
  list-style: none;
  padding-left: 0;
  margin: 0.375rem 0;
}

.note-rich-editor-body ul[data-type="taskList"] > li,
.note-rich-editor-body ul.note-task-list > li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  list-style: none;
  margin: 0.25rem 0;
}

.note-rich-editor-body ul[data-type="taskList"] > li::marker,
.note-rich-editor-body ul.note-task-list > li::marker {
  content: "";
}

.note-rich-editor-body ul[data-type="taskList"] li > label,
.note-rich-editor-body ul.note-task-list li > label {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: flex-start;
  margin: 0;
}

/* TipTap рисует пустой span-стилизатор чекбокса — скрываем, используем native input */
.note-rich-editor-body ul[data-type="taskList"] li > label > span,
.note-rich-editor-body ul.note-task-list li > label > span {
  display: none;
}

.note-rich-editor-body ul[data-type="taskList"] li > label input[type="checkbox"],
.note-rich-editor-body ul.note-task-list li > label input[type="checkbox"] {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin: 0.15rem 0 0;
  accent-color: var(--accent);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.note-rich-editor-body ul[data-type="taskList"] li > div,
.note-rich-editor-body ul.note-task-list li > div {
  flex: 1 1 auto;
  min-width: 0;
}

.note-rich-editor-body ul[data-type="taskList"] li > div > p,
.note-rich-editor-body ul.note-task-list li > div > p,
.note-rich-editor-body ul[data-type="taskList"] li > p,
.note-rich-editor-body ul.note-task-list li > p {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.note-rich-editor-body ul[data-type="taskList"] li[data-checked="true"] > div,
.note-rich-editor-body ul.note-task-list li[data-checked="true"] > div,
.note-rich-editor-body ul[data-type="taskList"] li[data-checked="true"] > div p,
.note-rich-editor-body ul.note-task-list li[data-checked="true"] > div p,
.note-rich-editor-body ul[data-type="taskList"] li[data-checked="true"] > p,
.note-rich-editor-body ul.note-task-list li[data-checked="true"] > p {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

.note-format-btn {
  min-width: 2rem;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--surface);
  cursor: pointer;
}

.note-format-btn em {
  font-style: italic;
  font-weight: 600;
}

.note-format-btn s {
  text-decoration: line-through;
  font-weight: 600;
}

.note-format-btn:active {
  background: var(--accent-subtle);
  border-color: var(--accent-border);
}

.note-task-list {
  margin: 0.5rem 0;
  padding: 0;
  list-style: none;
}

.journal-summary-html ul.note-task-list,
.note-body-html ul.note-task-list {
  margin-left: 0;
  padding-left: 0;
}

.note-task {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.375rem 0;
  list-style: none;
}

.note-task > label {
  display: contents;
}

.note-task input[type="checkbox"] {
  flex: 0 0 auto;
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin: 0.125rem 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.note-task input[type="checkbox"][disabled] {
  cursor: default;
  pointer-events: none;
}

.note-task-text {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.45;
}

.note-task-text > p {
  margin: 0;
  display: inline;
}

.note-task--checked .note-task-text {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

.note-body-html s,
.note-body-html del,
.note-body-html strike {
  text-decoration: line-through;
}

.notes-pane--stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.note-card {
  position: relative;
  padding-left: var(--space-4);
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.note-card:hover {
  border-color: var(--accent-border);
}

.note-card::before {
  display: none;
}

html.note-editor-open,
html.note-editor-open body {
  overflow: hidden !important;
  overscroll-behavior: none;
}

html.note-editor-open .main-scroll {
  overflow: hidden !important;
  touch-action: none;
  pointer-events: none;
}

html.note-editor-open #note-editor-overlay {
  background: var(--vkui--color_background, var(--bg));
  touch-action: pan-y;
  overflow: hidden;
}

/* Непрозрачный фон на весь оверлей — щель над клавиатурой не показывает список заметок */
#note-editor-overlay:not(.hidden) {
  background: var(--vkui--color_background, var(--bg));
}

#note-editor-overlay.note-editor-overlay--fullscreen {
  overscroll-behavior: none;
}

.note-card-actions {
  position: absolute;
  top: calc((0.9375rem * 1.35 - 2rem) / 2);
  right: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  max-width: calc(100% - 0.75rem);
}

.note-card-actions .note-card-avatars {
  padding-top: 0;
  margin-right: 0.05rem;
}

.note-card-inner {
  position: relative;
  padding-left: var(--space-1);
  padding-right: 2.75rem;
}

.note-card-inner:has(.note-card-share-btn),
.note-card-inner:has(.note-card-pin) {
  padding-right: 4.5rem;
}

.note-card-inner:has(.note-card-actions .note-card-avatars) {
  padding-right: 6.5rem;
}

.note-card-inner:has(.note-card-actions .note-card-avatars):has(.note-card-share-btn),
.note-card-inner:has(.note-card-actions .note-card-avatars):has(.note-card-pin) {
  padding-right: 8.25rem;
}

.note-card-inner:has(.note-card-actions .note-card-avatars):has(.note-card-pin):has(.note-card-share-btn) {
  padding-right: 10rem;
}

.note-card-menu-wrap {
  position: relative;
}

.note-card-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
}

.note-card-share-btn {
  color: var(--accent);
}

.note-card-menu-btn:active,
.note-card-menu-btn[aria-expanded="true"] {
  background: var(--surface-muted);
  color: var(--text);
}

.note-card-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 40;
  min-width: 11.5rem;
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 8px 24px color-mix(in srgb, var(--shadow-color) 28%, transparent));
}

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

.note-card-menu-item {
  display: block;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: none;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}

.note-card-menu-item:active,
.note-card-menu-item:hover {
  background: var(--surface-muted);
}

.note-card-menu-item--danger {
  color: var(--danger-text);
}

.note-card--pinned {
  border-color: var(--accent-border, var(--border));
}

@media (max-width: 959px) {
  #note-editor-overlay .note-rich-editor-body,
  #note-editor-overlay .ProseMirror {
    overflow: visible;
  }
}

.note-card-action-btn {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
}

.note-card-action-btn:active {
  background: var(--surface-muted);
}

.note-editor-pad--related-links {
  flex-shrink: 0;
  padding: 0 var(--note-editor-pad-x, 16px) var(--space-2);
}

.journal-related-link-btn {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.35;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.journal-related-link-btn:active {
  opacity: 0.75;
}

.note-card-excerpt {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

.note-card-excerpt--secondary {
  display: -webkit-box;
  margin-top: var(--space-2);
  overflow: hidden;
  font-size: 0.8125rem;
  font-weight: 450;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  word-break: break-word;
}

.note-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-3);
}

.note-badge-todoist {
  display: inline-block;
  margin-bottom: var(--space-2);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-xs);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--danger-text);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.meeting-kind-badge {
  display: inline-block;
  margin-bottom: var(--space-2);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-xs);
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-subtle);
}

.gpt-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: 0.4rem 0.65rem;
  border: 1px solid color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-subtle);
  cursor: pointer;
  transition: background 0.15s ease;
}

.gpt-chip:active,
.gpt-chip:hover {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}

.gpt-chip--wide {
  justify-content: center;
  width: 100%;
}

.content-card {
  cursor: pointer;
}

.content-card-head {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.content-card-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text-secondary);
  background: var(--surface-muted);
}

.content-card-icon--transcript {
  color: var(--violet-text);
  background: var(--violet-muted);
}

.content-card-icon--summary {
  color: var(--emerald-text);
  background: var(--emerald-muted);
}

.journal-card-body {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.journal-card-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.journal-title-row {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
}

.journal-title-row .item-title {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.journal-chev,
.journal-chev-foot,
.chevron {
  flex-shrink: 0;
  font-size: 1.125rem;
  line-height: 1.2;
  color: var(--text-tertiary);
}

.journal-meta-row {
  margin-top: var(--space-1);
}

.journal-snippet {
  display: -webkit-box;
  margin: var(--space-2) 0 0;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.journal-gpt-wrap {
  margin-top: var(--space-3);
}

/* Detail — полноэкранный слой поверх списка */
.notes-detail {
  display: none;
  flex-direction: column;
  min-height: 0;
}

#notes-detail:not(.hidden),
#digest-detail:not(.hidden) {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-top: var(--safe-top);
  padding-bottom: var(--tabbar-safe);
  background: var(--bg);
}

.notes-detail-sticky {
  position: sticky;
  top: 0;
  z-index: 2;
  flex-shrink: 0;
  padding: var(--space-2) var(--page-x) 0;
  background: var(--bg);
}

.notes-detail.hidden,
#notes-root.hidden,
#digest-root.hidden {
  display: none !important;
}

.detail-toolbar {
  display: grid;
  grid-template-columns: minmax(4.5rem, auto) 1fr minmax(2.5rem, auto);
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 0;
  padding: var(--space-2) 0 var(--space-3);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.detail-toolbar--subscreen {
  margin-bottom: 0;
  border-bottom: none;
}

#notes-detail.notes-detail--native-back .detail-toolbar,
#profile-payment.profile-subscreen--native-back .detail-toolbar,
#profile-expenses.profile-subscreen--native-back .detail-toolbar,
#profile-booking.profile-subscreen--native-back .detail-toolbar,
#profile-contacts.profile-subscreen--native-back .detail-toolbar,
#profile-calendars.profile-subscreen--native-back .detail-toolbar,
#profile-zoom.profile-subscreen--native-back .detail-toolbar,
#profile-telemost.profile-subscreen--native-back .detail-toolbar,
#profile-yandex-disk.profile-subscreen--native-back .detail-toolbar,
#profile-bitrix.profile-subscreen--native-back .detail-toolbar,
#profile-knowledge-base.profile-subscreen--native-back .detail-toolbar,
#profile-agents.profile-subscreen--native-back .detail-toolbar,
#profile-chats.profile-subscreen--native-back .detail-toolbar,
#profile-voice.profile-subscreen--native-back .detail-toolbar {
  grid-template-columns: 1fr auto;
}

#notes-detail.notes-detail--native-back #notes-detail-back,
#profile-payment.profile-subscreen--native-back #profile-payment-back,
#profile-contacts.profile-subscreen--native-back #profile-contacts-back,
#profile-calendars.profile-subscreen--native-back #profile-calendars-back,
#profile-expenses.profile-subscreen--native-back #profile-expenses-back,
#profile-booking.profile-subscreen--native-back #profile-booking-back,
#profile-zoom.profile-subscreen--native-back #profile-zoom-back,
#profile-telemost.profile-subscreen--native-back #profile-telemost-back,
#profile-yandex-disk.profile-subscreen--native-back #profile-yandex-disk-back,
#profile-bitrix.profile-subscreen--native-back #profile-bitrix-back,
#profile-knowledge-base.profile-subscreen--native-back #profile-knowledge-base-back,
#profile-agents.profile-subscreen--native-back #profile-agents-back,
#profile-chats.profile-subscreen--native-back #profile-chats-back,
#profile-voice.profile-subscreen--native-back #profile-voice-back {
  display: none !important;
}

#notes-detail.notes-detail--native-back #notes-detail-title,
#profile-payment.profile-subscreen--native-back .detail-title,
#profile-contacts.profile-subscreen--native-back .detail-title,
#profile-calendars.profile-subscreen--native-back .detail-title,
#profile-expenses.profile-subscreen--native-back .detail-title,
#profile-booking.profile-subscreen--native-back .detail-title,
#profile-zoom.profile-subscreen--native-back .detail-title,
#profile-telemost.profile-subscreen--native-back .detail-title,
#profile-yandex-disk.profile-subscreen--native-back .detail-title,
#profile-bitrix.profile-subscreen--native-back .detail-title,
#profile-knowledge-base.profile-subscreen--native-back .detail-title,
#profile-agents.profile-subscreen--native-back .detail-title,
#profile-chats.profile-subscreen--native-back .detail-title,
#profile-voice.profile-subscreen--native-back .detail-title {
  grid-column: 1;
  justify-self: start;
  text-align: left;
}

.detail-title {
  grid-column: 2;
  min-width: 0;
  overflow: hidden;
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.detail-title.detail-title--wrap {
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: left;
  max-height: 4.5em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

#notes-detail-back {
  grid-column: 1;
  justify-self: start;
}

.detail-toolbar-trail {
  display: flex;
  grid-column: 3;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  width: 2.5rem;
}

.detail-toolbar-spacer {
  flex-shrink: 0;
  width: 3.5rem;
}

.detail-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-3) var(--page-x) calc(var(--space-8) + var(--tabbar-safe));
}

.btn-icon-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--danger);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
}

.notes-detail-footer {
  flex-shrink: 0;
  padding: var(--space-3) var(--page-x) calc(var(--space-3) + var(--tabbar-safe));
  border-top: 1px solid var(--border);
  background: var(--vkui--color_background_content_alpha);
  backdrop-filter: blur(var(--vkui--blur_m, 12px));
  -webkit-backdrop-filter: blur(var(--vkui--blur_m, 12px));
}

.note-detail-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.note-fabric-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.note-fabric-input {
  width: 100%;
  min-height: 2.5rem;
  padding: var(--space-4);
  border: none;
  font-family: inherit;
  font-size: 0.9375rem;
  resize: vertical;
  background: var(--surface);
}

.note-fabric-input--title {
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.note-fabric-input--body {
  font-size: 0.875rem;
  line-height: 1.5;
}

.note-fabric-input:focus {
  outline: none;
  background: var(--accent-subtle);
}

#notes-detail.notes-detail--note-editor:not(.hidden) {
  max-width: none;
  padding-top: 0;
  padding-bottom: 0;
}

.notes-detail.notes-detail--note-editor {
  --note-editor-pad-x: 16px;
  --note-editor-pad-y: 16px;
}

.notes-detail.notes-detail--note-editor .detail-toolbar {
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  padding: var(--note-editor-pad-y) var(--note-editor-pad-x) 0;
  border-bottom: none;
}

#notes-detail.notes-detail--note-editor.notes-detail--native-back .detail-toolbar {
  display: none !important;
}

#notes-detail.notes-detail--note-editor.notes-detail--native-back .notes-detail-save-float:not(.hidden) {
  position: fixed;
  top: 8px;
  right: max(12px, env(safe-area-inset-right, 0px));
  z-index: 300;
}

#notes-detail.notes-detail--note-editor.notes-detail--native-back .notes-detail-sticky {
  padding-top: 0;
}

#notes-detail.notes-detail--note-editor.notes-detail--native-back .note-editor-toolbar-wrap:not(.hidden) {
  padding-top: 10px;
  padding-right: var(--note-editor-pad-x, 16px);
}

.notes-detail.notes-detail--note-editor #notes-detail-back,
.notes-detail.notes-detail--note-editor #notes-detail-back.note-editor-back {
  min-height: var(--vkui--size_button_medium_height--regular, 36px);
  padding: 0 var(--vkui--size_arrow_padding--regular, 12px) 0 0;
  border: none;
  font-family: var(
    --vkui--font_text--font_family--regular,
    -apple-system,
    system-ui,
    "Helvetica Neue",
    Roboto,
    sans-serif
  );
  font-size: var(--vkui--font_text--font_size--regular, 16px);
  font-weight: var(--vkui--font_text--font_weight--regular, 400);
  line-height: var(--vkui--font_text--line_height--regular, 20px);
  color: var(--vkui--color_text_accent);
  background: transparent;
}

.notes-detail.notes-detail--note-editor .detail-toolbar-trail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  grid-column: 3;
  width: auto;
}

.notes-detail.notes-detail--note-editor .btn-icon-tile {
  width: var(--vkui--size_button_medium_height--regular, 36px);
  height: var(--vkui--size_button_medium_height--regular, 36px);
  border-radius: var(--vkui--size_border_radius--regular, 10px);
  color: var(--vkui--color_icon_negative, var(--danger));
  background: var(--vkui--color_background_secondary_alpha, var(--surface-muted));
  border-color: transparent;
}

.notes-detail.notes-detail--note-editor .note-editor-header-save,
.notes-detail-save-float {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  color: var(--vkui--color_text_contrast);
  background: var(--vkui--color_background_accent);
  cursor: pointer;
}

.notes-detail.notes-detail--note-editor .note-editor-header-save svg,
.notes-detail-save-float svg {
  stroke: var(--vkui--color_text_contrast);
}

.notes-detail.notes-detail--note-editor .note-editor-header-save:active,
.notes-detail-save-float:active {
  background: var(--vkui--color_background_accent--active);
  transform: scale(0.98);
}

.notes-detail.notes-detail--note-editor .notes-detail-sticky {
  position: relative;
  flex-shrink: 0;
  padding: var(--safe-top) 0 0;
  background: var(--vkui--color_background, var(--bg));
}

#notes-detail.notes-detail--note-editor:not(.notes-detail--native-back) .notes-detail-save-float:not(.hidden) {
  position: absolute;
  top: var(--note-editor-pad-y, 16px);
  right: var(--note-editor-pad-x, 16px);
  z-index: 5;
}

.note-editor-pad {
  box-sizing: border-box;
  padding-left: var(--note-editor-pad-x);
  padding-right: var(--note-editor-pad-x);
}

.note-editor-pad--title {
  padding-top: var(--note-editor-pad-y);
  padding-bottom: var(--note-editor-pad-y);
  border-bottom: 1px solid var(--vkui--color_separator_primary, var(--border));
}

.note-editor-pad--tags {
  position: relative;
  padding-top: 12px;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--vkui--color_separator_primary, var(--border));
}

.note-more-wrap {
  position: absolute;
  top: 0;
  bottom: 0;
  right: var(--note-editor-pad-x, 1rem);
  z-index: 2;
  display: flex;
  align-items: center;
}

.note-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
}

.note-more-btn:hover,
.note-more-btn[aria-expanded="true"] {
  color: var(--text);
  background: var(--accent-subtle);
}

.note-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  min-width: 12.5rem;
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 8px 24px color-mix(in srgb, var(--shadow-color) 20%, transparent));
}

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

.note-more-menu-item {
  display: block;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.note-more-menu-item:hover {
  background: var(--accent-subtle);
}

.note-more-menu-item:disabled,
.note-more-menu-item.is-busy {
  opacity: 0.55;
  cursor: default;
}

.note-more-menu-item--danger {
  color: var(--vkui--color_text_negative, var(--danger));
}

.note-more-menu-item--danger:hover {
  background: var(--danger-muted);
}

/* Группы меню «⋯»: стрелка вправо, число в связке, строка «назад» в подменю. */
.note-more-menu-group,
.note-more-menu-back {
  display: flex;
  align-items: center;
  gap: 8px;
}
.note-more-menu-group .note-more-menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-more-menu-group > svg { flex: none; color: var(--text-secondary); }
.note-more-menu-group--bundle > svg:first-child { color: var(--accent); }
.note-more-menu-count { flex: none; font-size: 0.8125rem; color: var(--text-secondary); }
.note-more-menu-back { font-weight: 600; color: var(--text-secondary); }
.note-more-menu-back > svg { flex: none; }
.note-more-menu-sep { height: 1px; margin: 4px 6px; background: var(--border); }
.note-more-menu { max-width: min(21rem, calc(100vw - 16px)); }
.note-more-menu-item .note-more-menu-label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.note-paei-status {
  margin: 0 0 0.7rem;
  padding: 0.55rem 0.65rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--accent-subtle);
  color: var(--text);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.note-paei-progress-label {
  display: block;
}

.note-paei-progress-track {
  display: block;
  height: 4px;
  margin-top: 0.45rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--overlay-5);
}

.note-paei-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.35s ease;
}

.note-paei-status.hidden {
  display: none;
}

.note-share-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 460;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.45);
}

.note-share-sheet-overlay.hidden {
  display: none !important;
}

.note-share-sheet {
  width: min(22rem, 100%);
  max-height: min(86vh, 40rem);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1.1rem 1.15rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 8px 24px color-mix(in srgb, var(--shadow-color) 28%, transparent));
}

.note-share-sheet-title {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 650;
}

.note-share-option {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 0 0 0.65rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}

.note-share-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.note-share-option input {
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

.note-share-option strong {
  display: block;
  font-size: 0.9375rem;
}

.note-share-option small {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  line-height: 1.35;
}

.note-card-title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.note-card-title-row .note-card-excerpt {
  flex: 1;
  min-width: 0;
}

.note-card-avatars {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  padding-top: 0.05rem;
}

.note-card-avatars .note-member-avatar {
  margin-left: -0.4rem;
}

.note-card-avatars .note-member-avatar:first-child {
  margin-left: 0;
}

.note-member-avatar {
  --note-member-color: #529ef4;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  overflow: hidden;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--note-member-color);
  color: var(--on-accent);
  font-size: 0.55rem;
  font-weight: 700;
  line-height: 1;
}

.note-member-avatar.is-online {
  box-shadow: 0 0 0 2px var(--note-member-color);
}

.note-member-avatar img {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.note-member-avatar img.has-photo {
  display: block;
}

.note-member-avatar img.has-photo + .note-member-avatar-fallback {
  display: none;
}

.note-member-avatar-more {
  background: var(--overlay-5);
  color: var(--text-secondary);
  font-size: 0.6rem;
}

.note-editor-members {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.35rem 0 0;
}

.note-editor-members.hidden {
  display: none;
}

.note-editor-members-people {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
}

.note-editor-member-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.3;
}

.note-editor-members-live {
  margin: 0;
  color: var(--accent);
  font-size: 0.75rem;
}

.note-collab-cursors {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: visible;
  pointer-events: none;
}

.note-collab-caret {
  position: absolute;
  width: 2px;
  border-radius: 1px;
  pointer-events: none;
}

.note-collab-caret-label {
  position: absolute;
  top: -1.15rem;
  left: 0;
  padding: 0.08rem 0.28rem;
  border-radius: 4px;
  color: var(--on-accent);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.note-share-sheet {
  max-height: min(88dvh, 40rem);
  overflow: auto;
}

.note-share-section-label {
  margin: 0.15rem 0 0.45rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.note-share-members-block {
  margin: 0 0 0.85rem;
}

.note-share-members-block.hidden,
.note-share-sheets-block.hidden {
  display: none;
}

.note-share-sheets-block {
  margin: 0 0 0.85rem;
}

.note-share-sheets-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.note-share-members-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0 0 0.55rem;
}

.note-share-member-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.note-share-member-copy {
  flex: 1;
  min-width: 0;
}

.note-share-member-copy strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
}

.note-share-member-copy small {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.note-share-member-remove {
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  color: var(--text-secondary);
  background: transparent;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.note-share-member-add {
  position: relative;
}

.note-share-members-hint {
  margin: 0.45rem 0 0;
}

.note-share-sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.85rem;
}

.note-comments {
  margin: 0;
  padding: 0 0 1.5rem;
}

.note-comments-rail {
  min-width: 0;
  margin-top: 1rem;
}

.note-comments-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.note-comments-form.hidden {
  display: none;
}

.note-comment-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.note-editor-pad--body .note-rich-editor,
.note-editor-pad--body .note-rich-editor-surface,
.note-editor-pad--body .note-rich-editor-body {
  position: relative;
  z-index: 1;
}

.note-comment-overlay-hl {
  position: absolute;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-radius: 2px;
  pointer-events: none;
}

.note-comment-overlay-hl.is-active {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
}

.note-comment-overlay-bar {
  position: absolute;
  width: 3px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--accent) 72%, transparent);
  pointer-events: none;
}

.note-comment-overlay-bar.is-active {
  background: var(--accent);
}

.note-comment-bubble-wrap {
  position: fixed;
  z-index: 320;
  display: flex;
  align-items: center;
  gap: 6px;
}

.note-comment-bubble-wrap .note-comment-bubble {
  position: relative;
}

.note-comment-bubble {
  position: fixed;
  z-index: 320;
  box-sizing: border-box;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--shadow-color) 35%, transparent);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.note-comment-bubble svg {
  display: block;
  pointer-events: none;
}

.note-comment-bubble--task {
  background: var(--success);
}

.note-task-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  margin: 0 0.12em;
  padding: 0 0.45em;
  border-radius: 999px;
  background: var(--success-muted);
  color: var(--success);
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  vertical-align: baseline;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.note-task-chip-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
}

.note-task-chip-icon:empty {
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 11l3 3L22 4'/%3E%3Cpath d='M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 11l3 3L22 4'/%3E%3Cpath d='M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.note-task-chip-icon svg {
  display: block;
  width: 1em;
  height: 1em;
}

.note-task-chip-label {
  font: inherit;
  font-weight: inherit;
}

/* Задача во внешнем трекере (Битрикс24…): синий, «Б24 ·», длинное название — многоточием. */
.note-task-chip--ext {
  max-width: min(100%, 28em);
  background: var(--accent-muted);
  color: var(--accent);
  vertical-align: bottom;
}

/* ProseMirror ставит white-space: normal нередактируемым узлам — чипу нужна одна строка. */
.note-task-chip--ext,
.ProseMirror .note-task-chip--ext,
.note-task-chip--ext .note-task-chip-label {
  white-space: nowrap;
}

.note-task-chip--ext .note-task-chip-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-task-chip-provider {
  flex-shrink: 0;
  font-weight: 600;
}

.note-ref-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  margin: 0 0.12em;
  padding: 0 0.45em;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--vkui--color_text_accent, var(--accent));
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  vertical-align: baseline;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.note-ref-chip-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
}

.note-ref-chip-icon svg {
  display: block;
  width: 1em;
  height: 1em;
}

.note-ref-chip-label {
  font: inherit;
  font-weight: inherit;
  max-width: 14em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-comment-sheet {
  position: fixed;
  inset: 0;
  z-index: 420;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.note-comment-sheet.hidden {
  display: none !important;
}

.note-comment-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.note-comment-sheet-panel {
  position: relative;
  z-index: 1;
  max-height: min(72dvh, 32rem);
  overflow: auto;
  padding: 0.5rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  border-radius: 16px 16px 0 0;
  background: var(--vkui--color_background_content);
  box-shadow: 0 -12px 40px color-mix(in srgb, var(--shadow-color) 40%, transparent);
}

.note-comment-sheet-handle {
  width: 36px;
  height: 4px;
  margin: 0.35rem auto 0.65rem;
  border-radius: 99px;
  background: var(--overlay-7);
}

.note-comment-sheet-close {
  display: block;
  width: 100%;
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 10px;
  color: var(--text);
  background: var(--overlay-3);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.note-comment-sheet-card {
  margin: 0;
}

@media (min-width: 960px) {
  .note-comment-sheet {
    display: none !important;
  }
}

.note-comment.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.share-comment-quote {
  margin: 0 0 0.45rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-style: italic;
}

.share-comments-form-actions {
  display: flex;
  gap: 0.4rem;
}

.note-comments-list.is-anchored {
  display: block;
  position: relative;
  gap: 0;
}

.note-comments-list.is-anchored .note-comment {
  position: absolute;
  left: 0;
  right: 0;
}

@media (min-width: 960px) {
  .note-comments-rail {
    flex: 0 0 17rem;
    width: 17rem;
    margin-top: 0;
    padding-left: 0.85rem;
    border-left: 1px solid var(--border);
    position: relative;
    align-self: stretch;
    overflow: visible;
  }
}

.note-comments-rail.hidden {
  display: none;
}

.note-comments-title {
  margin: 0 0 0.75rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.note-comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.note-comments-empty {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.note-comment {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--overlay-1);
}

.note-comment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.35rem;
}

.note-comment-head strong {
  font-size: 0.875rem;
}

.note-comment-head time {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.note-comment-body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.note-comment-delete {
  margin-top: 0.45rem;
  padding: 0;
  border: none;
  color: var(--text-secondary);
  background: none;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.note-paie-thread {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 0;
}

.note-discussion-compose.note-paie-thread {
  position: relative;
  z-index: 41;
  flex-shrink: 0;
  padding: 0 16px calc(12px + env(safe-area-inset-bottom, 0px));
}

.note-discussion-compose .note-paie-reply-form {
  position: relative;
  bottom: auto;
  z-index: 1;
  margin-top: 0;
  gap: 16px;
}

@media (max-width: 959px) {
  .note-paie-msg,
  .note-paie-group,
  .note-paei-status {
    border-radius: 0;
  }

  .note-paie-nested,
  .note-paie-comment-form {
    margin-left: 0;
  }

  .note-comment.note-paie-msg {
    padding-left: var(--note-editor-pad-x, 16px);
    padding-right: var(--note-editor-pad-x, 16px);
  }

  .note-discussion-compose .note-paie-reply-form {
    margin-left: 0;
    margin-right: 0;
    bottom: auto;
  }
}

.note-paie-thread-title {
  margin: 0 0 0.85rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.note-paie-thread-list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.note-paie-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.note-paie-msg.is-chair {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.note-paie-msg.is-chair .note-comment-body {
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}

.note-paie-msg.is-reply {
  background: var(--overlay-1);
}

.note-paie-nested {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-left: 0.85rem;
}

.note-paie-msg-actions {
  display: flex;
  gap: 0.75rem;
}

.note-paie-comment-btn {
  padding: 0;
  border: none;
  color: var(--vkui--color_text_accent, var(--accent));
  background: none;
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}

.note-paie-comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-left: 0.85rem;
}

.note-paie-comment-form.hidden {
  display: none;
}

.note-paie-reply-form {
  --note-composer-border: #6b6b6b;
  --note-composer-accent: #9eaddb;
  --note-composer-muted: #909090;
  --note-composer-ink: #19191a;
  box-sizing: border-box;
  position: sticky;
  bottom: 8px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 0.9rem;
  padding: 20px 24px;
  border: 1px solid var(--note-composer-border);
  border-radius: 32px;
  background: var(--vkui--color_background_content);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--shadow-color) 6%, transparent);
}

.note-paie-reply-form .note-paie-reply-quote {
  margin: 0;
  align-self: stretch;
}

.note-paie-reply-target {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin: 0 0 -12px;
  padding: 0 2px;
}

.note-paie-reply-target.hidden {
  display: none;
}

.note-paie-reply-target-bar {
  flex: 0 0 3px;
  width: 3px;
  border-radius: 3px;
  background: var(--note-composer-accent);
}

.note-paie-reply-target-copy {
  min-width: 0;
  flex: 1;
}

.note-paie-reply-target-who,
.note-paie-reply-target-quote {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-paie-reply-target-who {
  color: var(--note-composer-accent);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.note-paie-reply-target-quote {
  color: var(--note-composer-muted);
  font-size: 13px;
  line-height: 1.3;
}

.note-paie-reply-target-clear {
  flex: 0 0 auto;
  align-self: center;
  margin: 0;
  padding: 0 4px;
  border: none;
  color: var(--note-composer-muted);
  background: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.note-paie-group.is-reply-target .note-paie-msg.is-chair {
  box-shadow: inset 3px 0 0 var(--note-composer-accent, var(--accent));
}

.note-paie-kb-wrap {
  position: relative;
  flex-shrink: 0;
}

.note-paie-kb-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 100px;
  color: var(--note-composer-muted);
  background: var(--note-composer-border);
  cursor: pointer;
}

.note-paie-kb-toggle svg {
  display: block;
  width: 20px;
  height: 20px;
}

.note-paie-kb-toggle.is-on {
  color: var(--note-composer-ink);
  background: var(--note-composer-accent);
}

.note-paie-kb-toggle-dot {
  display: none;
}

.note-paie-reply-form.is-comment-mode .note-paie-kb-wrap,
.note-paie-reply-form.is-comment-mode .note-paie-kb-toggle,
.note-paie-reply-form.is-comment-mode [data-plus-action="note"],
.note-paie-reply-form.is-comment-mode [data-plus-action="transcription"],
.note-paie-reply-form.is-comment-mode [data-plus-action="summary"] {
  display: none;
}

.note-paie-composer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.note-paie-composer-row .note-paie-composer-input {
  flex: 1;
  min-width: 0;
}

.note-paie-attach {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 100px;
  color: var(--note-composer-ink); /* как у «GPT ⌃» рядом */
  background: var(--note-composer-border);
  cursor: pointer;
}

.note-paie-attach:hover,
.note-paie-attach:focus-visible,
.note-paie-attach.is-open {
  color: var(--note-composer-ink);
  filter: brightness(1.12);
}

.note-paie-plus-chat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.note-paie-plus-chat-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.note-paie-plus-empty {
  margin: 8px 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.note-paie-attach:disabled {
  opacity: 0.55;
  cursor: default;
}

.note-paie-attach svg {
  display: block;
}

.note-paie-attach.is-open {
  color: var(--note-composer-ink);
}

.note-paie-plus-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 0 0 12px;
  border-radius: 0;
  background: transparent;
}

.note-paie-plus-menu.hidden {
  display: none;
}

.note-paie-plus-page {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  min-height: 0;
}

.note-paie-plus-page[data-plus-page="notes"] {
  max-height: min(52vh, 420px);
}

.note-paie-plus-page.hidden {
  display: none;
}

.note-paie-plus-back {
  align-self: flex-start;
  margin: 0;
  padding: 6px 10px;
  border: none;
  border-radius: 10px;
  color: var(--note-composer-muted);
  background: transparent;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.note-paie-plus-back:hover,
.note-paie-plus-back:focus-visible {
  color: var(--note-composer-ink);
  background: var(--overlay-2);
}

.note-paie-plus-search {
  width: 100%;
  margin: 0 0 4px;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  color: inherit;
  background: var(--overlay-2);
  font: inherit;
  font-size: 16px;
}

.note-paie-plus-search:focus {
  outline: none;
}

.note-paie-plus-project-chips,
.note-pane-switch-project-chips,
.note-picker-project-chips {
  box-sizing: border-box;
  width: 100%;
  flex: 0 0 auto;
  min-height: calc(2.5rem + 4px);
  margin: 0 0 6px;
  padding: 2px 2px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}

.note-paie-plus-project-chips.hidden,
.note-pane-switch-project-chips.hidden,
.note-picker-project-chips.hidden {
  display: none;
}

.note-picker-project-chips .notes-project-chip,
.note-picker-project-chips .tag-chip.notes-project-chip {
  flex-shrink: 0;
  height: 2.5rem;
}

.note-paie-plus-notes {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  max-height: min(240px, 36vh);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.note-paie-plus-note {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.note-paie-plus-note-project {
  flex-shrink: 0;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--note-composer-muted);
  font-size: 12px;
}

.note-paie-reply-form.is-drop-attach {
  outline: 2px dashed var(--note-composer-accent);
  outline-offset: 2px;
}

.note-paie-attach-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.note-paie-attach-preview.hidden {
  display: none;
}

.note-paie-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px 4px 4px;
  border-radius: 12px;
  background: var(--overlay-3);
}

.note-paie-attach-chip.is-image {
  padding-left: 4px;
}

.note-paie-attach-chip.is-note {
  padding-left: 10px;
}

.note-paie-attach-chip img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 8px;
}

.note-paie-attach-chip-name {
  overflow: hidden;
  max-width: 9rem;
  color: var(--text);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-paie-attach-chip-remove {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  color: var(--note-composer-muted);
  background: transparent;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.note-discuss-attach-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.note-discuss-bubble > .note-discuss-attach-list:first-child {
  margin-top: 0;
}

.note-discuss-attach-img {
  display: block;
  max-width: 100%;
  max-height: 16rem;
  border-radius: 12px;
  object-fit: contain;
  background: var(--overlay-1);
}

.note-discuss-attach-img-btn {
  display: block;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  max-width: 100%;
  text-align: left;
}

.note-discuss-attach-img-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 12px;
}

.note-discuss-attach-file {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: inherit;
  background: var(--overlay-2);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}

.discuss-media-viewer {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

.discuss-media-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
}

.discuss-media-viewer-sheet {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.discuss-media-viewer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--overlay-3);
}

.discuss-media-viewer-title {
  flex: 1;
  margin: 0;
  min-width: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--on-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discuss-media-viewer-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.discuss-media-viewer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: var(--on-accent);
  background: var(--overlay-3);
  cursor: pointer;
}

.discuss-media-viewer-btn:hover,
.discuss-media-viewer-btn:focus-visible {
  background: var(--overlay-6);
}

.discuss-media-viewer-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  overflow: auto;
}

.discuss-media-viewer-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  background: var(--overlay-1);
}

.discuss-media-viewer-frame {
  width: 100%;
  height: 100%;
  min-height: 60vh;
  border: 0;
  border-radius: 8px;
  background: var(--bg);
}

.discuss-media-viewer-hint {
  margin: 0;
  padding: 24px;
  color: var(--text);
  text-align: center;
  font-size: 0.95rem;
}

.note-paie-composer-input,
.note-paie-reply-form .note-comments-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  max-height: 8.5rem;
  margin: 0;
  padding: 11px 0;
  border: none;
  border-radius: 0;
  color: var(--vkui--color_text_primary, var(--text));
  background: transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  line-height: 22px;
  resize: none;
  overflow-y: hidden;
}

.note-paie-composer-input.is-multiline,
.note-paie-reply-form .note-comments-input.is-multiline {
  padding-top: 10px;
  padding-bottom: 10px;
  min-height: 48px;
}

.note-paie-composer-input.is-overflowing,
.note-paie-reply-form .note-comments-input.is-overflowing {
  overflow-y: auto;
}

.note-paie-composer-input::placeholder,
.note-paie-reply-form .note-comments-input::placeholder {
  color: var(--note-composer-muted);
}

.note-paie-composer-input:focus,
.note-paie-reply-form .note-comments-input:focus {
  outline: none;
}

.note-paie-composer-input:disabled,
.note-paie-reply-form .note-comments-input:disabled {
  opacity: 0.6;
}

.note-paie-composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.note-paie-composer-left {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.note-paie-mode-switch {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 0;
  width: fit-content;
  padding: 4px;
  overflow: hidden;
  border: none;
  border-radius: 100px;
  background: var(--note-composer-border);
}

.note-paie-mode {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: none;
  border-radius: 100px;
  color: var(--note-composer-ink);
  background: transparent;
  font: inherit;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.19px;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
}

.note-paie-mode.is-active {
  color: var(--note-composer-ink);
  background: var(--note-composer-accent);
}

.note-paie-mode:disabled,
.note-paie-mode-compact:disabled,
.note-paie-model-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.note-paie-mode-compact,
.note-paie-model-btn {
  display: none;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 12px 15px;
  border: none;
  border-radius: 100px;
  font: inherit;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.19px;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
}

.note-paie-mode-compact {
  gap: 8px;
  color: var(--note-composer-ink);
  background: var(--note-composer-border);
}

.note-paie-model-btn {
  display: none;
  gap: 6px;
  color: var(--note-composer-muted);
  background: transparent;
}

.note-paie-reply-form.is-gpt-mode .note-paie-model-btn,
.note-paie-reply-form.is-paie-mode .note-paie-model-btn {
  display: inline-flex;
}

.note-paie-reply-form.is-gpt-mode #note-paie-reply-input,
.note-paie-reply-form.is-research-mode #note-paie-reply-input,
.note-paie-reply-form.is-comment-mode #note-paie-reply-input {
  display: none;
}

.note-paie-reply-form:not(.is-gpt-mode):not(.is-research-mode):not(.is-comment-mode) #note-paie-reply-editor {
  display: none;
}

.note-paie-composer-editor {
  position: relative;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-user-select: text;
  user-select: text;
}

.note-paie-composer-editor.is-empty::before {
  content: attr(data-placeholder);
  position: absolute;
  left: 0;
  right: 0;
  top: 11px;
  color: var(--note-composer-muted);
  pointer-events: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.note-paie-composer-editor.is-empty.is-multiline::before {
  top: 10px;
}

.note-paie-composer-editor.is-disabled {
  opacity: 0.6;
}

/* Чип шаблона доски («Гант по заметке») — Лео соберёт шаблон по листам заметки. */
.note-gpt-template-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  margin: 0 3px 0 1px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  vertical-align: middle;
}

.note-gpt-template-chip::before {
  content: "✦";
  font-size: 11px;
}

.note-discuss-sugg button.is-template {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent);
}

.note-gpt-quote-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  box-sizing: border-box;
  padding: 2px 8px;
  margin: 0 3px 0 1px;
  border: 1px solid color-mix(in srgb, var(--accent-soft) 28%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
  vertical-align: middle;
}

.note-discuss-mention {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  box-sizing: border-box;
  padding: 1px 7px;
  margin: 0 2px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent-soft);
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
  vertical-align: middle;
}

.note-discuss-mention-text {
  color: var(--accent-soft);
  font-weight: 600;
}

.note-discuss-mention-menu {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% + 6px);
  z-index: 40;
  max-height: 220px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--vkui--color_background_content);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--shadow-color) 35%, transparent);
}

.note-discuss-mention-menu.hidden {
  display: none;
}

.note-discuss-mention-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.note-discuss-mention-item:hover,
.note-discuss-mention-item:focus-visible {
  background: var(--overlay-2);
}

.note-discuss-mention-item-name {
  font-size: 0.9375rem;
  font-weight: 600;
}

.note-discuss-mention-item-handle {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.note-paie-mode-compact-label,
.note-paie-model-label {
  overflow: hidden;
  max-width: 9.5rem;
  text-overflow: ellipsis;
}

.note-paie-chevron,
.note-paie-send-icon {
  display: block;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.note-paie-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  padding: 0;
  overflow: hidden;
  border: none;
  border-radius: 100px;
  background: var(--note-composer-border);
  cursor: pointer;
}

.note-paie-send.is-ready:not(:disabled) {
  background: var(--note-composer-accent);
}

.note-paie-send:disabled {
  cursor: default;
  opacity: 0.7;
}

.note-paie-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 8;
  display: flex;
  flex-direction: column;
  min-width: 168px;
  max-width: min(280px, 80vw);
  max-height: 240px;
  overflow: hidden;
  padding: 6px;
  border: 1px solid var(--note-composer-border);
  border-radius: 16px;
  background: var(--vkui--color_background_content);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--shadow-color) 28%, transparent);
}

.note-paie-menu.hidden {
  display: none;
}

.note-paie-menu--models {
  min-width: 220px;
  max-height: 280px;
}

.note-paie-menu--kb {
  left: auto;
  right: 0;
  min-width: 240px;
  max-width: min(320px, 85vw);
  max-height: 360px;
}

.note-paie-menu-section {
  margin: 8px 8px 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.note-paie-menu-section:first-child {
  margin-top: 2px;
}

.note-paie-kb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.note-paie-kb-item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-paie-kb-item .svc-toggle {
  width: 2.4rem;
  height: 1.35rem;
  padding: 0.1rem;
}

.note-paie-kb-item .svc-toggle-knob {
  width: 1.1rem;
  height: 1.1rem;
}

.note-paie-kb-check {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--note-composer-muted);
  border-radius: 4px;
  background: transparent;
}

.note-paie-kb-check.is-on,
.note-paie-kb-check.is-mixed {
  border-color: var(--note-composer-accent);
  background: var(--note-composer-accent);
}

.note-paie-kb-check.is-on::after {
  content: "";
  display: block;
  box-sizing: border-box;
  width: 5px;
  height: 9px;
  margin-top: -1px;
  border: solid var(--surface);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.note-paie-kb-check.is-mixed::after {
  content: "";
  display: block;
  width: 8px;
  height: 2px;
  background: var(--surface);
}

.note-paie-kb-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.note-paie-kb-group-head {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.note-paie-kb-group-check {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 10px;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.note-paie-kb-group-check:hover,
.note-paie-kb-group-toggle:hover {
  background: color-mix(in srgb, var(--slate) 22%, transparent);
}

.note-paie-kb-group-toggle {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px 8px 4px;
  border: none;
  border-radius: 10px;
  color: inherit;
  background: transparent;
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.note-paie-kb-group-chevron {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--note-composer-muted);
  line-height: 0;
  transform: rotate(-90deg);
  transition: transform 0.15s ease;
}

.note-paie-kb-group-chevron svg {
  display: block;
}

.note-paie-kb-group.is-open .note-paie-kb-group-chevron {
  transform: none;
}

.note-paie-kb-group-body {
  display: flex;
  flex-direction: column;
  padding: 0 0 4px 10px;
}

.note-paie-model-search {
  width: 100%;
  margin: 0 0 4px;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  color: inherit;
  background: var(--overlay-2);
  font: inherit;
  font-size: 16px;
}

.note-paie-model-search:focus {
  outline: none;
}

.note-paie-menu-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.note-paie-menu-item {
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  color: inherit;
  background: transparent;
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.note-paie-menu-item.is-active,
.note-paie-menu-item:hover {
  background: color-mix(in srgb, var(--slate) 22%, transparent);
}

.note-paie-menu-empty {
  margin: 0;
  padding: 8px 12px;
  color: var(--note-composer-muted);
  font-size: 14px;
}

.note-discussion-overlay .note-paie-composer-left {
  gap: 4px;
}

.note-discussion-overlay .note-paie-mode-switch {
  display: none;
}

.note-discussion-overlay .note-paie-mode-compact {
  display: inline-flex;
}

.note-discussion-overlay .note-paie-mode-compact-label,
.note-discussion-overlay .note-paie-model-label {
  max-width: 6.5rem;
}

.note-discussion-overlay .note-paie-composer-input,
.note-discussion-overlay .note-paie-reply-form .note-comments-input {
  font-size: 16px;
}

@media (max-width: 959px) {
  .note-paie-composer-left {
    gap: 4px;
  }

  .note-paie-mode-switch {
    display: none;
  }

  .note-paie-mode-compact {
    display: inline-flex;
  }

  .note-paie-mode-compact-label,
  .note-paie-model-label {
    max-width: 4.75rem;
  }

  .note-paie-composer-input,
  .note-paie-reply-form .note-comments-input {
    font-size: 16px;
  }

  #note-editor-overlay .note-editor-toolbar-wrap:not(.is-format-active):not(.has-gpt-btn) {
    display: none !important;
  }

  #note-editor-overlay .note-editor-toolbar-wrap:not(.is-format-active).has-gpt-btn .note-editor-format-toolbar-host {
    display: none;
  }
}

.tabbar-btn--knowledge {
  display: none;
}

.note-paie-gpt-list,
.note-paie-user-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.note-paie-msg.is-gpt {
  background: var(--overlay-2);
}

.note-paie-reply-form.hidden {
  display: none;
}

.note-discussion-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
}

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

.note-pane-resizer,
.note-discuss-resizer {
  display: none;
}

@media (max-width: 959px) {
  html.note-discussion-open,
  html.note-discussion-open body {
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--bg);
  }

  html.note-discussion-open #note-editor-overlay,
  html.note-discussion-open .main-scroll,
  html.note-discussion-open .tabbar,
  html.note-discussion-open .app-sidebar {
    visibility: hidden !important;
    pointer-events: none !important;
  }

  html.note-discussion-open #note-editor-overlay {
    overflow: hidden !important;
  }

  html.note-discussion-open #note-editor-overlay .note-editor-sheet,
  html.note-discussion-open #note-editor-overlay .note-editor-modal-body,
  html.note-discussion-open #note-editor-overlay .note-editor-modal-content,
  html.note-discussion-open #note-editor-overlay .note-rich-editor-body,
  html.note-discussion-open #note-editor-overlay .ProseMirror {
    overflow: hidden !important;
    overscroll-behavior: none;
    touch-action: none;
  }

  .note-discussion-overlay {
    background: var(--bg);
  }

  .note-discussion-sheet {
    max-height: 100%;
    background: var(--bg);
  }
}

.note-discussion-sheet {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  max-width: var(--max-w, 720px);
  min-height: 0;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
}

.note-discussion-header {
  position: relative;
  z-index: 41;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.note-discussion-title {
  margin: 0;
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
}

.note-pane-switch-wrap {
  position: relative;
  grid-column: 2;
  display: flex;
  justify-content: center;
  min-width: 0;
  width: 100%;
}

#note-discussion-close {
  grid-column: 1;
  justify-self: start;
}

#note-discussion-title-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-pane-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px 8px;
  border: none;
  border-radius: 10px;
  color: inherit;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.note-pane-switch:hover,
.note-pane-switch.is-open {
  background: var(--overlay-2);
}

.note-pane-switch:disabled,
.note-pane-switch.note-pane-switch--plain {
  width: 100%;
  cursor: default;
  background: transparent;
}

.note-pane-switch:disabled .note-pane-switch-chevron,
.note-pane-switch.note-pane-switch--plain .note-pane-switch-chevron {
  display: none;
}

.note-pane-switch-chevron {
  display: block;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

.note-pane-switch-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  z-index: 50;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  max-width: min(320px, 85vw);
  max-height: min(440px, 70vh);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--shadow-color) 35%, transparent);
  transform: translateX(-50%);
}

.note-pane-switch-menu.note-pane-switch-menu--picker {
  min-width: min(340px, 92vw);
  max-height: min(420px, 70vh);
}

.note-pane-switch-menu.hidden {
  display: none;
}

.note-pane-switch-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  color: inherit;
  background: transparent;
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.note-pane-switch-item.is-active,
.note-pane-switch-item:hover {
  background: color-mix(in srgb, var(--slate) 22%, transparent);
}

.note-pane-switch-back {
  color: var(--text-secondary);
  font-size: 14px;
}

.note-pane-switch-search-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 6px;
  padding: 0 2px;
}

.note-pane-switch-search {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  color: inherit;
  background: var(--overlay-2);
  font: inherit;
  font-size: 15px;
}

.note-pane-switch-search:focus {
  outline: none;
}

.note-pane-switch-create {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 10px;
  color: inherit;
  background: var(--overlay-2);
  cursor: pointer;
}

.note-pane-switch-create:hover {
  background: color-mix(in srgb, var(--slate) 22%, transparent);
}

.note-pane-switch-note-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.note-pane-switch-note {
  display: flex;
  align-items: center;
  gap: 10px;
}

.note-pane-switch-note-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-pane-switch-note-project {
  flex-shrink: 0;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 12px;
}

.note-pane-switch-empty {
  margin: 8px 4px;
  color: var(--text-secondary);
  font-size: 13px;
}

.note-discussion-right-note-title-wrap {
  flex-shrink: 0;
  padding: 10px 14px 0;
}

.note-discussion-right-note-title {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  resize: none;
  color: inherit;
  background: transparent;
  font: inherit;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  outline: none;
}

.note-discussion-right-note-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

/* Ссылки в сообщениях людей в обсуждении. */
.note-discuss-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}

.note-discuss-msg.is-other .note-discuss-link {
  color: var(--accent);
}

/* Чаты заметки: кнопка справа в шапке обсуждения и её меню. */
.note-chats-wrap {
  position: relative;
  grid-column: 3;
  justify-self: end;
}

#note-discussion-new-ctx .note-chats-icon-menu,
#note-discussion-new-ctx.is-chats .note-chats-icon-reset {
  display: none;
}

#note-discussion-new-ctx.is-chats .note-chats-icon-menu {
  display: block;
}

/* Панель чатов выезжает справа во всю высоту экрана. */
.note-chats-backdrop {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.note-chats-backdrop.is-open {
  opacity: 1;
}

.note-chats-backdrop.hidden {
  display: none;
}

.note-pane-switch-menu.note-chats-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  z-index: 401;
  gap: 20px;
  width: min(360px, 88vw);
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px calc(16px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  border-width: 0 0 0 1px;
  border-radius: 16px 0 0 16px;
  box-shadow: -12px 0 32px color-mix(in srgb, var(--shadow-color) 40%, transparent);
  transform: translateX(100%);
  transition: transform 0.24s ease;
}

.note-pane-switch-menu.note-chats-menu.is-open {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .note-chats-backdrop,
  .note-pane-switch-menu.note-chats-menu {
    transition: none;
  }
}

.note-chats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 0 10px;
}

.note-chats-head-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.note-chats-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.note-chats-section-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 10px 8px;
}

.note-chats-group {
  display: flex;
  flex-direction: column;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--overlay-1);
}

.note-chats-group > .note-chats-item + .note-chats-item {
  position: relative;
}

.note-chats-group > .note-chats-item + .note-chats-item::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 40px;
  right: 12px;
  height: 1px;
  background: var(--border);
}

.note-chats-group > .note-chats-item.is-active::before,
.note-chats-group > .note-chats-item.is-active + .note-chats-item::before {
  display: none;
}

.note-chats-section-icon {
  display: inline-flex;
  margin-top: 2px;
  color: var(--text-secondary);
}

.note-chats-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.note-chats-section-hint,
.note-chats-empty {
  font-size: 12px;
  color: var(--text-secondary);
}

.note-chats-empty {
  margin: 8px 12px;
}

.note-chats-item-icon {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--text-secondary);
}

.note-chats-item.is-active .note-chats-item-icon {
  color: var(--accent);
}

.note-chats-access {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 12px;
  border-radius: 12px;
  background: var(--overlay-2);
}

.note-chats-access-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
}

.note-chats-access-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.note-chats-access-btn:hover {
  background: var(--overlay-2);
}

.note-chats-new {
  font-weight: 600;
  color: var(--accent);
}

.note-chats-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.note-chats-item-text {
  flex: 1 1 auto;
  min-width: 0;
}

.note-chats-item-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-chats-item-meta {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
}

#note-discussion-title.is-private-chat::before {
  content: "";
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  background: currentColor;
  opacity: 0.75;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
}

.note-chats-visibility-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: var(--overlay-2);
}

.note-chats-visibility-seg button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  appearance: none;
  padding: 6px 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.note-chats-visibility-seg button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--slate) 28%, transparent);
  font-weight: 600;
}

.note-chats-visibility-seg button:disabled {
  cursor: default;
  opacity: 0.6;
}

/* В «Комментариях» нет режимов ИИ — только текст. */
.note-paie-reply-form.is-comments-chat .note-paie-mode-switch,
.note-paie-reply-form.is-comments-chat .note-paie-mode-compact,
.note-paie-reply-form.is-comments-chat .note-paie-model-btn,
.note-paie-reply-form.is-comments-chat .note-paie-kb-wrap {
  display: none !important;
}

.note-pane-switch-sep {
  height: 1px;
  margin: 4px 8px;
  background: var(--border);
}

.note-pane-switch-label {
  margin: 6px 10px 2px;
  padding: 0;
  color: var(--text-subtle);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
  pointer-events: none;
  user-select: none;
}

#note-discussion-new-ctx {
  grid-column: 3;
  justify-self: end;
  border-radius: 50%;
  color: var(--text);
  background: var(--vkui--color_background_secondary_alpha, var(--surface-muted));
}

#note-discussion-new-ctx:active {
  opacity: 0.85;
  transform: scale(0.98);
}

#note-discussion-new-ctx:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.note-discussion-header-spacer {
  display: block;
  width: 36px;
  height: 36px;
}

.note-discussion-scroll {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 16px 16px 8px;
}

#note-discussion-overlay .note-paei-status {
  flex-shrink: 0;
  margin: 0;
  padding: 10px 16px 8px;
  border-top: 1px solid var(--border);
  border-radius: 0;
}

.note-discussion-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
  padding-bottom: 8px;
}

.note-discussion-sheet-pane {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.note-discussion-sheet-pane.hidden {
  display: none;
}

html.note-discussion-sheet-open .note-discussion-scroll {
  padding: 0;
  overflow: hidden;
}

html.note-discussion-sheet-open #note-discussion-messages {
  display: none;
}

html.note-discussion-sheet-open #note-discussion-new-ctx {
  visibility: hidden;
}

html.note-discussion-sheet-open #note-paie-thread,
html.note-discussion-sheet-open #note-editor-paei-status {
  display: none !important;
}

.note-discussion-sheet-toolbar {
  display: none;
  flex-shrink: 0;
  z-index: 30;
  min-height: 0;
  margin: 0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--overlay-3);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-sizing: border-box;
}

html.note-discussion-sheet-open #note-discussion-sheet-toolbar {
  display: block;
}

.note-discussion-sheet-toolbar .note-rich-editor-toolbar {
  position: static;
  margin-bottom: 0;
}

.note-discussion-sheet-host {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  padding: 16px 16px 12px;
}

.note-discussion-sheet-host:has(.note-web-canvas),
.note-discussion-sheet-host:has(.leo-board) {
  overflow: hidden;
  padding: 0;
}

.note-discussion-sheet-host .note-web-canvas {
  min-height: 100%;
}

.note-discussion-sheet-host .note-rich-editor,
.note-discussion-sheet-host .note-rich-editor-surface,
.note-discussion-sheet-host .note-rich-editor-body {
  min-height: 100%;
}

.note-discussion-empty {
  margin: 2rem 0 0;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.4;
  text-align: center;
}

.note-discuss-msg {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  min-width: 0;
  max-width: 92%;
  cursor: pointer;
}

.note-discuss-msg.is-user {
  align-self: flex-end;
  align-items: flex-end;
}

.note-discuss-msg.is-assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.note-discuss-msg.is-other {
  align-self: flex-start;
  align-items: flex-start;
}

.note-discuss-msg.is-pending,
.note-discuss-msg.is-optimistic {
  cursor: default;
}

.note-discuss-msg.is-ctx-stale {
  opacity: 0.48;
}

.note-discuss-ctx-cut {
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 12px;
  width: 100%;
  max-width: none;
  margin: 4px 0;
  color: var(--text-secondary);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.note-discuss-ctx-cut::before,
.note-discuss-ctx-cut::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.note-discuss-send-state {
  margin: 4px 4px 0;
  color: var(--text-secondary);
  font-size: 0.6875rem;
  line-height: 1.2;
}

.note-discuss-bubble--pending {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.note-discuss-pending-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Панель статуса Лео: строка «Лео думает…» с таймером; на долгой задаче — карточка с шагами. */
.leo-status {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.leo-status-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.leo-status-time {
  margin-left: auto;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.leo-status-stop {
  display: none;
  flex: none;
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--overlay-3);
  color: var(--text-soft);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.leo-status-stop:hover {
  background: var(--overlay-5);
  color: var(--text);
}

.leo-status.is-long {
  width: min(320px, 78vw);
  white-space: normal;
  border: 1px solid var(--border);
}

.leo-status.is-long .note-discuss-pending-label {
  color: var(--text);
  font-weight: 600;
}

.leo-status.is-long .leo-status-stop {
  display: inline-block;
}

.leo-status-steps:empty {
  display: none;
}

.leo-status-steps {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.leo-status-step {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-tertiary);
}

.leo-status-step.is-done {
  color: var(--text-secondary);
}

.leo-status-step.is-active {
  color: var(--text);
}

.leo-status-step-body {
  flex: 1;
  min-width: 0;
}

.leo-status-mark {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-top: 0;
  border-radius: 50%;
  font-size: 0.625rem;
}

.leo-status-step.is-done .leo-status-mark {
  background: color-mix(in srgb, var(--success) 18%, transparent);
  color: var(--emerald-text);
}

.leo-status-step.is-wait .leo-status-mark {
  border: 1.5px dashed var(--overlay-7);
}

.leo-status-bar {
  height: 4px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--overlay-3);
}

.leo-status-bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.6s ease;
}

.leo-status-meta {
  margin-top: 4px;
  overflow: hidden;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* «Точки по орбите»: три точки бегут по эллипсу, как спутники Орбиты. */
.leo-orbit {
  position: relative;
  flex: none;
  width: 30px;
  height: 16px;
}

.leo-orbit i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  margin: -2.5px;
  border-radius: 50%;
  background: var(--orbit-dot);
}

.leo-orbit--sm {
  transform: scale(0.62);
}

@supports (offset-path: path("M 0 0 L 1 1")) {
  .leo-orbit i {
    offset-path: path("M -13 0 A 13 6 0 1 0 13 0 A 13 6 0 1 0 -13 0");
    offset-rotate: 0deg;
    animation: leo-orbit-run 1.5s linear infinite;
  }
  .leo-orbit i:nth-child(2) {
    animation-delay: -0.5s;
    opacity: 0.7;
  }
  .leo-orbit i:nth-child(3) {
    animation-delay: -1s;
    opacity: 0.4;
  }
}

@supports not (offset-path: path("M 0 0 L 1 1")) {
  .leo-orbit i {
    animation: leo-orbit-bounce 1.1s ease-in-out infinite;
  }
  .leo-orbit i:nth-child(1) { margin-left: -11px; }
  .leo-orbit i:nth-child(3) { margin-left: 6px; }
  .leo-orbit i:nth-child(2) { animation-delay: 0.16s; }
  .leo-orbit i:nth-child(3) { animation-delay: 0.32s; }
}

@keyframes leo-orbit-run {
  from { offset-distance: 0%; }
  to { offset-distance: 100%; }
}

@keyframes leo-orbit-bounce {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .leo-orbit i {
    animation: none;
  }
}

/* Сообщение, чья тема показана в заметке (нажали на него), — без рамки: она выглядела странно. */
.note-discuss-msg.is-topic {
  outline: none;
}

.note-discuss-role {
  margin: 0 4px 6px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
}

.note-discuss-quote {
  margin: 0 0 6px;
  max-width: 100%;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-discuss-reply {
  display: flex;
  align-items: stretch;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.note-discuss-bubble .note-discuss-reply {
  margin: 0 0 8px;
}

.note-discuss-reply.is-nav {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.note-discuss-reply.is-nav:hover,
.note-discuss-reply.is-nav:active {
  filter: brightness(1.08);
}

.note-discuss-msg.is-user .note-discuss-reply {
  background: var(--overlay-6);
}

.note-discuss-reply-bar {
  flex: 0 0 3px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.note-discuss-msg.is-user .note-discuss-reply-bar {
  background: rgba(255, 255, 255, 0.75);
}

.note-discuss-reply-copy {
  min-width: 0;
  flex: 1;
}

.note-discuss-reply-who,
.note-discuss-reply-quote {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-discuss-reply-who {
  color: var(--accent);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.2;
}

.note-discuss-msg.is-user .note-discuss-reply-who {
  color: var(--on-accent);
}

.note-discuss-reply-quote {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.3;
}

.note-discuss-msg.is-user .note-discuss-reply-quote {
  color: var(--text-soft);
}

.note-discuss-bubble-body {
  min-width: 0;
}

.note-discuss-bubble {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.9375rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-user-select: text;
  user-select: text;
}

.note-discuss-msg.is-assistant .note-discuss-bubble,
.note-discuss-msg.is-other .note-discuss-bubble,
.note-discuss-msg.is-user .note-discuss-bubble {
  -webkit-touch-callout: none;
}

.note-discuss-bubble.journal-summary-html,
.note-discuss-bubble.note-body-html,
.note-discuss-bubble--md {
  padding: 14px 18px;
}

.note-discuss-msg.is-user .note-discuss-bubble {
  color: var(--on-accent);
  background: var(--accent);
  border-bottom-right-radius: 6px;
}

.note-discuss-msg.is-assistant .note-discuss-bubble {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}

.note-discuss-msg.is-other .note-discuss-bubble {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}

.note-discuss-bubble--md {
  white-space: normal;
}

.note-discuss-bubble--md > :first-child {
  margin-top: 0;
}

.note-discuss-bubble--md > :last-child {
  margin-bottom: 0;
}

.note-discuss-bubble a,
.gpt-bubble--md a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  word-break: break-word;
  pointer-events: auto;
  cursor: pointer;
}

.note-discuss-msg.is-assistant .note-discuss-bubble a,
.note-discuss-msg.is-other .note-discuss-bubble a,
.gpt-bubble--assistant a {
  color: var(--accent);
}

.note-discuss-msg.is-user .note-discuss-bubble a {
  color: inherit;
  text-decoration-color: var(--text-soft);
}

.note-discuss-bubble h1,
.note-discuss-bubble h2,
.note-discuss-bubble h3,
.note-discuss-bubble h4,
.note-discuss-bubble h5,
.note-discuss-bubble h6 {
  margin: 0.65em 0 0.3em;
  font-weight: 650;
  line-height: 1.35;
}

.note-discuss-bubble .note-table-scroll {
  max-width: 100%;
  margin: 0.5rem 0 0.35rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

.note-discuss-bubble--md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
  padding: 0.08em 0.35em;
  border-radius: 6px;
  background: var(--overlay-3);
}

.note-discuss-bubble--md pre {
  margin: 0.5rem 0;
  padding: 0.65rem 0.75rem;
  overflow-x: auto;
  border-radius: 10px;
  background: var(--overlay-2);
}

.note-discuss-bubble--md pre code {
  padding: 0;
  background: none;
  font-size: 0.8125rem;
}

.note-discuss-actions {
  position: relative;
  margin-top: 6px;
}

.note-discuss-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
}

.note-discuss-more:hover,
.note-discuss-more[aria-expanded="true"] {
  color: var(--text);
  background: var(--overlay-3);
}

.note-discuss-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 8;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--vkui--color_background_content);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--shadow-color) 32%, transparent);
}

.note-discuss-menu.is-placed {
  position: fixed;
  bottom: auto;
  right: auto;
  z-index: 360;
}

.note-discuss-msg.is-user .note-discuss-menu:not(.is-placed) {
  left: auto;
  right: 0;
}

.note-discuss-menu.hidden {
  display: none;
}

.note-discuss-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  color: inherit;
  background: transparent;
  font: inherit;
  font-size: 0.9375rem;
  text-align: left;
  cursor: pointer;
}

.note-discuss-menu-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
}

.note-discuss-menu-icon svg {
  display: block;
}

.note-discuss-menu-item:hover {
  background: color-mix(in srgb, var(--slate) 18%, transparent);
}

.note-discuss-menu-item--danger {
  color: var(--danger);
}

.note-discuss-menu-item--danger .note-discuss-menu-icon {
  color: var(--danger);
}

.note-discuss-selection {
  position: fixed;
  z-index: 340;
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 2px;
  border-radius: 999px;
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--shadow-color) 35%, transparent);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.note-discuss-selection-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  color: var(--text-strong);
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

.note-discuss-selection-btn:active {
  background: var(--overlay-6);
}

.note-discuss-selection .note-discuss-menu-icon {
  color: var(--text-strong);
}

.note-discuss-selection svg {
  display: block;
  pointer-events: none;
}

.note-discuss-sel-marks {
  position: fixed;
  inset: 0;
  z-index: 339;
  pointer-events: none;
}

.note-discuss-sel-mark {
  position: absolute;
  border-radius: 2px;
  background: color-mix(in srgb, var(--accent) 32%, transparent);
  pointer-events: none;
}

.note-discussion-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 8px 0 24px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: inherit;
  background: var(--surface);
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.note-discussion-card-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.note-discussion-card.has-discuss-unread .note-discussion-card-title::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: middle;
  background: var(--vkui--color_text_accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.note-discussion-card-meta {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.note-discussion-card-chevron {
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 1.25rem;
  line-height: 1;
}

.note-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 320;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--text-strong);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--shadow-color) 28%, transparent);
  font-size: 0.875rem;
  line-height: 1.35;
  text-align: center;
  transform: translateX(-50%);
}

.note-toast.hidden {
  display: none !important;
}

.note-toast--action {
  text-align: left;
}

.note-toast-copy {
  display: inline;
}

.note-toast-link {
  display: inline;
  margin: 0;
  padding: 0;
  border: none;
  color: var(--accent-soft);
  background: transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.note-card-discuss-unread {
  display: inline-block;
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  margin: 11px 2px 0 0;
  border-radius: 50%;
  background: var(--vkui--color_text_accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.note-card-discuss-unread--solo {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  margin: 0;
}

.note-card-inner:has(.note-card-discuss-unread--solo) {
  padding-right: 1.75rem;
}

.note-link-overlay {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

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

.note-link-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.note-link-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--max-w, 720px);
  max-height: min(80dvh, 640px);
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-radius: 20px 20px 0 0;
  background: var(--surface);
}

.note-link-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.note-link-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
}

.note-link-search {
  width: 100%;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: inherit;
  background: var(--bg);
  font: inherit;
  font-size: 16px;
}

.note-link-search:focus {
  outline: none;
}

.note-link-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.note-link-item {
  display: block;
  width: 100%;
  padding: 12px 4px;
  border: none;
  border-bottom: 1px solid var(--border);
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.note-link-item-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.note-link-item-preview {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-link-empty {
  margin: 1rem 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

@media (min-width: 640px) {
  .note-link-overlay {
    align-items: center;
  }

  .note-link-sheet {
    max-width: 440px;
    border-radius: 20px;
  }
}

.note-comments-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.note-comments-input {
  width: 100%;
  min-height: 4.5rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: inherit;
  background: var(--surface);
  font: inherit;
  resize: vertical;
}

.note-comments-form .btn {
  align-self: flex-start;
}

@media (min-width: 640px) {
  .note-share-sheet-overlay {
    align-items: center;
  }
}

.note-editor-pad--title-in-body {
  padding-top: var(--note-editor-pad-y);
  padding-bottom: var(--space-2);
}

.note-editor-sheets-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  min-width: 0;
}

.note-editor-sheets-bar:not(:has(.note-editor-toc-anchor)):has(> .note-editor-sheets.hidden) {
  display: none;
  margin-top: 0;
}

.note-editor-sheets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.note-editor-sheets.hidden {
  display: none;
}

.note-sheet-chip {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  background: transparent;
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
}

.note-sheet-chip.is-editing {
  max-width: min(320px, calc(100vw - 48px));
  gap: 4px;
  padding-right: 6px;
}

.note-sheet-chip-delete {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
}

.note-sheet-chip-delete:hover {
  color: var(--danger);
}

.note-sheet-chip-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-sheet-chip.is-active {
  color: var(--text);
  border-color: transparent;
  background: color-mix(in srgb, var(--slate) 22%, transparent);
}

.note-sheet-chip.is-web .note-sheet-chip-label::before {
  content: "▣ ";
  opacity: 0.7;
}

.note-sheet-chip.is-board .note-sheet-chip-label::before,
.note-share-sheet.is-v2 .ns-chip.is-board span::before {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 5px;
  vertical-align: -2px;
  background: currentColor;
  opacity: 0.75;
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%222.5%22%20y%3D%223.5%22%20width%3D%228%22%20height%3D%226%22%20rx%3D%221.5%22%2F%3E%3Crect%20x%3D%2213.5%22%20y%3D%2214.5%22%20width%3D%228%22%20height%3D%226%22%20rx%3D%221.5%22%2F%3E%3Cpath%20d%3D%22M10.5%206.5h3a2%202%200%200%201%202%202v6%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%222.5%22%20y%3D%223.5%22%20width%3D%228%22%20height%3D%226%22%20rx%3D%221.5%22%2F%3E%3Crect%20x%3D%2213.5%22%20y%3D%2214.5%22%20width%3D%228%22%20height%3D%226%22%20rx%3D%221.5%22%2F%3E%3Cpath%20d%3D%22M10.5%206.5h3a2%202%200%200%201%202%202v6%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
}

/* Макет — доска в режиме экранов: значок телефона */
.note-sheet-chip.is-board.is-design .note-sheet-chip-label::before,
.note-share-sheet.is-v2 .ns-chip.is-board.is-design span::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%226%22%20y%3D%222.5%22%20width%3D%2212%22%20height%3D%2219%22%20rx%3D%222.5%22%2F%3E%3Cpath%20d%3D%22M10.5%2018h3%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%226%22%20y%3D%222.5%22%20width%3D%2212%22%20height%3D%2219%22%20rx%3D%222.5%22%2F%3E%3Cpath%20d%3D%22M10.5%2018h3%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
}

/* Доска — во всю ширину заметки, без боковых полей: поля снимаем у контейнера (внутренние обёртки
   режут вылезающее), а заголовку, метке проекта и вкладкам листов возвращаем отступ. */
#note-editor-overlay.is-web-canvas-open .note-editor-modal-content:has(.note-editor-pad--body.is-board-mode) {
  padding-left: 0;
  padding-right: 0;
}

#note-editor-overlay.is-web-canvas-open .note-editor-modal-content:has(.note-editor-pad--body.is-board-mode) .note-editor-pad--title-in-body {
  padding-left: var(--note-editor-pad-x, 16px);
  padding-right: var(--note-editor-pad-x, 16px);
}

/* Холст (webapp/board.css) в редакторе заметки и в правой панели */
.note-editor-pad--body.is-board-mode > .note-web-canvas-host > .leo-board,
.note-discussion-sheet-host > .leo-board {
  flex: 1 1 auto;
  min-height: 0;
}

.note-web-canvas {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  background: var(--surface);
}

.note-web-canvas-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.note-web-canvas-insert-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}

.note-web-canvas-insert-bar[hidden] {
  display: none !important;
}

.note-web-canvas-insert-btn {
  font-size: 12px !important;
  padding: 4px 10px !important;
}

.note-web-canvas-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0 !important;
  line-height: 0;
}

.note-web-canvas-icon-btn svg {
  display: block;
  flex-shrink: 0;
}

.note-web-canvas-del-btn {
  margin-left: auto;
  color: var(--danger) !important;
  border-color: color-mix(in srgb, var(--danger) 35%, transparent) !important;
}

.note-web-canvas-pick-btn {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  cursor: pointer;
}

.note-web-canvas-pick-btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-muted);
}

.note-web-canvas-apply-btn[hidden] {
  display: none !important;
}

.note-web-canvas-apply-btn.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.note-web-canvas-apply-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.note-web-canvas.is-busy .note-web-canvas-frame {
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.note-web-canvas.is-editing .note-web-canvas-edit-btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

.note-web-canvas-frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  height: 100%;
  border: 0;
  background: #fff;
}

.note-editor-pad--body.is-web-canvas-mode .note-rich-editor-mount {
  display: none !important;
}

.note-editor-pad--body > .note-web-canvas-host {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.note-editor-pad--body.is-web-canvas-mode > .note-web-canvas-host {
  display: flex;
  flex-direction: column;
}

/* Fill the note editor viewport when a web-canvas sheet is open */
#note-editor-overlay.is-web-canvas-open .note-editor-modal-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding-bottom: 0;
}

#note-editor-overlay.is-web-canvas-open .note-editor-modal-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding-bottom: 0;
}

#note-editor-overlay.is-web-canvas-open .note-editor-modal-content .note-editor-page,
#note-editor-overlay.is-web-canvas-open .note-editor-doc-layout,
#note-editor-overlay.is-web-canvas-open .note-editor-main-column {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

#note-editor-overlay.is-web-canvas-open .note-editor-modal-content .note-editor-page,
#note-editor-overlay.is-web-canvas-open .note-editor-main-column {
  flex-direction: column;
}

#note-editor-overlay.is-web-canvas-open .note-editor-pad--body.is-web-canvas-mode {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  padding-bottom: 0;
  overflow: hidden;
}

#note-editor-overlay.is-web-canvas-open .note-editor-pad--body.is-web-canvas-mode > .note-web-canvas-host,
#note-editor-overlay.is-web-canvas-open .note-web-canvas,
#note-editor-overlay.is-web-canvas-open .note-web-canvas-frame {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

#note-editor-overlay.is-web-canvas-open .note-editor-pad--title-in-body {
  flex-shrink: 0;
}

.note-canvas-sel-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 0 8px;
}

.note-canvas-sel-chips:empty {
  display: none;
}

.note-canvas-sel-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--accent-border);
  background: var(--accent-subtle);
  color: var(--text);
  font-size: 12px;
  line-height: 1.3;
}

.note-canvas-sel-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-canvas-sel-chip button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}

.note-discuss-canvas-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
}

.note-discuss-canvas-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--accent-soft) 28%, transparent);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: inherit;
  font-size: 12px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-discuss-msg.is-user .note-discuss-canvas-chip {
  border-color: var(--overlay-7);
  background: var(--overlay-6);
  color: var(--on-accent);
}

.note-sheet-chip--add {
  color: var(--text-secondary);
  border-style: dashed;
}

.note-sheet-kind-menu {
  position: fixed;
  z-index: 1000;
  min-width: 11.5rem;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 8px 24px color-mix(in srgb, var(--shadow-color) 20%, transparent));
}

.note-sheet-kind-menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: none;
  border-radius: var(--radius-sm, 8px);
  font: inherit;
  text-align: left;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.note-sheet-kind-menu-item:hover {
  background: var(--accent-subtle);
}

.note-sheet-kind-menu-title {
  font-size: 0.875rem;
  font-weight: 500;
}

.note-sheet-kind-menu-hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* «Кто есть кто» — всплывающее окно в стиле «Не задача» / «Позже» (fstack-pop), на телефоне — шторка снизу */
.note-speaker-pop {
  position: fixed;
  z-index: 60;
  width: min(360px, calc(100vw - 16px));
  max-height: min(75vh, 560px);
  overflow-y: auto;
  padding: 6px;
  box-sizing: border-box;
  border: 1px solid var(--border-strong, var(--border));
  border-radius: 14px;
  background: var(--surface-elevated);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--shadow-color) 45%, transparent);
}
.note-speaker-pop.is-sheet {
  left: 8px;
  right: 8px;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  width: auto;
  max-height: 80vh;
  border-radius: var(--ui-card-r, 16px);
}
.note-speaker-pop-body.is-busy { opacity: 0.55; pointer-events: none; }
/* «Кто есть кто» в стиле окна задачи: шапка с круглыми кнопками, подписи групп, строки в сером блоке */
.note-speaker-pop { padding: 12px; }
.note-speaker-pop-head { display: flex; align-items: center; gap: 8px; padding: 0 0 6px; }
.note-speaker-pop-title { flex: 1 1 auto; min-width: 0; font-size: 1.0625rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-speaker-pop-x { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: none; border-radius: 50%; background: var(--overlay-3, var(--surface-muted)); color: var(--text-secondary); font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.note-speaker-pop-x:hover { color: var(--text); }
.note-speaker-pop-hint { padding: 0 2px 4px; font-size: 0.8125rem; line-height: 1.35; color: var(--text-tertiary, var(--text-secondary)); }
.note-speaker-pop-section { margin: 12px 0 6px; padding: 0 4px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-subtle, var(--text-tertiary)); }
.note-speaker-group { display: flex; flex-direction: column; margin-top: 8px; border-radius: 12px; background: var(--overlay-2, var(--surface-muted)); overflow: hidden; }
.note-speaker-pop-section + .note-speaker-group, .note-speaker-pop-section + .note-speaker-search { margin-top: 0; }
.note-speaker-opts > .note-speaker-group:first-child { margin-top: 0; }
.note-speaker-group > * + * { border-top: 1px solid var(--border); }
.note-speaker-person { align-items: center; padding: 10px 12px; border-radius: 0; background: transparent; }
.note-speaker-person:hover { background: var(--overlay-1, var(--surface-hover)); }
.note-speaker-person .meeting-attendee-suggest-copy { flex: 1 1 auto; min-width: 0; }
.note-speaker-person .meeting-attendee-suggest-meta { white-space: normal; }
.note-speaker-quote { display: block; margin-top: 2px; font-size: 0.8125rem; line-height: 1.35; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-speaker-guess { display: block; margin-top: 2px; font-size: 0.8125rem; color: var(--accent); }
.note-speaker-person.is-open .meeting-attendee-suggest-name { color: var(--text); }
.note-speaker-person.is-active { background: var(--accent-subtle); }
.note-speaker-person.is-quiet .meeting-attendee-suggest-name { color: var(--text-secondary); font-weight: 500; }
.note-speaker-trail { flex: 0 0 auto; color: var(--text-tertiary, var(--text-secondary)); font-size: 1.1rem; }
.note-speaker-trail.is-action, .note-speaker-person.is-guess .note-speaker-trail { min-height: 28px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-size: 0.8125rem; font-weight: 600; cursor: pointer; }
.note-speaker-icon { display: inline-flex; align-items: center; justify-content: center; background: var(--ui-btn-bg); color: var(--text-secondary); font-size: 1rem !important; }
.note-speaker-samples { margin-top: 0; }
.note-speaker-sample { display: flex; gap: 10px; align-items: baseline; padding: 9px 12px; font-size: 0.875rem; line-height: 1.45; color: var(--text); }
.note-speaker-t { flex: none; min-width: 38px; padding: 0; border: none; background: none; font: inherit; font-size: 0.8125rem; font-variant-numeric: tabular-nums; text-align: left; color: var(--accent); cursor: pointer; }
.note-speaker-t:hover { text-decoration: underline; }
.note-speaker-search { margin-bottom: 8px; }
.note-speaker-search input.field-input { width: 100%; box-sizing: border-box; }
.note-speaker-confirm { display: grid; gap: 10px; padding: 12px; font-size: 0.875rem; line-height: 1.4; }
.note-speaker-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 959px) {
  .note-speaker-search input.field-input { font-size: 16px; }
}

.note-sheet-chip--speakers.is-todo {
  border-color: var(--accent);
  color: var(--accent);
}

/* Справа от ряда листов, вне его прокрутки: «Кто есть кто» и «Текст / Диалог» (сегменты, как «Задача / Встреча») */
.note-editor-sheet-tools { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.note-editor-sheet-tools:empty { display: none; }
.note-editor-sheet-tools .note-transcript-view-switch { flex: 0 0 auto; display: inline-flex; margin: 0; padding: 2px; gap: 2px; }
.note-editor-sheet-tools .event-sheet-kind-btn { flex: 0 0 auto; min-height: 26px; padding: 0 10px; font-size: 0.8125rem; color: var(--text-subtle, var(--text-tertiary)); }
.note-editor-sheet-tools .event-sheet-kind-btn.is-active { color: var(--text); background: var(--seg-active, var(--surface)); }
/* Пустой лист: «Сделать: Доска · Макет · Презентация» — сменить тип, пока ничего не написано */
.sheet-kind-pick { display: inline-flex; align-items: center; gap: 2px; font-size: 0.8125rem; color: var(--text-tertiary); }
.sheet-kind-pick-label { padding-right: 4px; white-space: nowrap; }
.sheet-kind-pick-btn { flex: 0 0 auto; min-height: 26px; padding: 0 8px; border: none; border-radius: 6px; background: transparent; color: var(--text-secondary); font: inherit; cursor: pointer; white-space: nowrap; }
.sheet-kind-pick-btn:hover { color: var(--text); background: var(--surface-hover, var(--surface)); }
@media (max-width: 520px) { .sheet-kind-pick-label { display: none; } }

/* имя спикера в тексте транскрипта — нажимается */
.is-transcript-sheet .ProseMirror p > strong:first-child {
  cursor: pointer;
  border-bottom: 1px dashed var(--text-tertiary, var(--border));
}
@media (hover: hover) {
  .is-transcript-sheet .ProseMirror p > strong:first-child:hover { color: var(--accent); border-bottom-color: var(--accent); }
}

/* вид «Диалог»: редактор прячем, реплики — как в чате */
.note-editor-pad--body.is-transcript-dialog > .note-rich-editor-mount,
.note-editor-pad--body.is-transcript-dialog > .note-editor-fallback { display: none; }
.note-transcript-dialog { display: flex; flex-direction: column; gap: 6px; padding: 8px 0 24px; }
.note-transcript-dialog-tip { align-self: center; max-width: 34rem; margin-bottom: 6px; padding: 8px 12px; border-radius: var(--ui-r, 10px); background: var(--accent-subtle); color: var(--text-secondary); font-size: 0.8125rem; text-align: center; }
.ntd-row { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.ntd-row.is-cont { margin-top: -2px; }
.ntd-row.is-me { justify-content: flex-end; }
.ntd-avatar { width: 28px; height: 28px; flex: 0 0 28px; font-size: 0.65rem; }
.ntd-row.is-cont .ntd-avatar { visibility: hidden; }
.ntd-bubble { max-width: min(78%, 40rem); padding: 7px 12px 8px; border-radius: 16px 16px 16px 6px; background: var(--ui-btn-bg); color: var(--text); }
.ntd-row.is-me .ntd-bubble { border-radius: 16px 16px 6px 16px; background: var(--accent); color: var(--on-accent); }
.ntd-bubble p { margin: 0; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.ntd-bubble p + p { margin-top: 6px; }
.ntd-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.ntd-row.is-cont .ntd-meta .ntd-name { display: none; }
.ntd-name { padding: 0; border: 0; background: none; font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer; color: var(--ntd-c, var(--accent)); }
.ntd-time { font-size: 0.72rem; font-variant-numeric: tabular-nums; color: var(--text-tertiary, var(--text-secondary)); }
.ntd-row.is-me .ntd-name, .ntd-row.is-me .ntd-time { color: var(--text); }
.ntd-row[data-spk="0"] { --ntd-c: #6ea8fe; }
.ntd-row[data-spk="1"] { --ntd-c: #f0b44c; }
.ntd-row[data-spk="2"] { --ntd-c: #5fd08a; }
.ntd-row[data-spk="3"] { --ntd-c: #e879f9; }
.ntd-row[data-spk="4"] { --ntd-c: #fb923c; }
.ntd-row[data-spk="5"] { --ntd-c: #22d3ee; }

.note-sheet-chip--make-summary {
  max-width: none;
  color: var(--text);
  border-style: dashed;
}

.note-sheet-skeleton {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0 24px;
}

.note-sheet-skeleton-row {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--slate) 12%, transparent) 0%,
    color-mix(in srgb, var(--slate) 28%, transparent) 45%,
    color-mix(in srgb, var(--slate) 12%, transparent) 100%
  );
  background-size: 220% 100%;
  animation: meetings-skeleton-shimmer 1.15s ease-in-out infinite;
}

.note-sheet-skeleton-row--tall {
  height: 18px;
}

.note-sheet-chip-input {
  width: 140px;
  min-width: 72px;
  max-width: 280px;
  padding: 0;
  border: none;
  color: inherit;
  background: transparent;
  font: inherit;
  /* iOS zoom при focus, если font-size < 16px (chip = 13px) */
  font-size: 16px;
  line-height: 1.3;
  -webkit-text-size-adjust: 100%;
}

.note-sheet-chip-input:focus {
  outline: none;
}

.note-editor-pad--tags.tag-picker {
  margin-bottom: 0;
  padding-top: 12px;
  padding-left: var(--note-editor-pad-x);
  padding-right: var(--note-editor-pad-x);
  align-items: center;
  flex-wrap: wrap;
}

.note-editor-pad--tags.tag-picker .tag-picker-add-wrap {
  margin-top: 0;
  flex-shrink: 0;
  align-self: center;
}

.note-editor-pad--body {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  min-height: 0;
  padding-top: 0;
  padding-bottom: var(--note-editor-pad-y);
}

.note-editor-title {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  color: var(--vkui--color_text_primary, var(--text));
  background: transparent;
  resize: none;
  overflow-x: hidden;
  overflow-y: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
  field-sizing: content;
  letter-spacing: -0.01em;
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: text;
  user-select: text;
  touch-action: pan-y;
  font-family: var(
    --vkui--font_title1--font_family--regular,
    -apple-system,
    system-ui,
    "Helvetica Neue",
    Roboto,
    sans-serif
  );
  font-size: var(--vkui--font_title1--font_size--regular, 24px);
  font-weight: var(--vkui--font_title1--font_weight--regular, 600);
  line-height: var(--vkui--font_title1--line_height--regular, 28px);
}

/* Unbounded широкий: чуть меньше кегль и плотнее межбуквенное, чтобы название не разъезжалось. */
.note-editor-title {
  font-family: var(--font-heading);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.note-editor-title:focus {
  outline: none;
}

.note-editor-title::placeholder {
  color: var(--vkui--color_text_tertiary, var(--text-tertiary));
}

.notes-detail--note-editor .detail-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--vkui--color_background, var(--bg));
}

.note-editor-page {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.note-editor-body {
  flex: 1;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  padding: 0;
  border: none;
  outline: none;
  color: var(--vkui--color_text_primary, var(--text));
  background: var(--vkui--color_background, var(--bg));
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-text-size-adjust: 100%;
  font-family: var(
    --vkui--font_paragraph--font_family--regular,
    -apple-system,
    system-ui,
    "Helvetica Neue",
    Roboto,
    sans-serif
  );
  font-size: var(--vkui--font_paragraph--font_size--regular, 15px);
  font-weight: var(--vkui--font_paragraph--font_weight--regular, 400);
  line-height: var(--vkui--font_paragraph--line_height--regular, 20px);
  overflow-y: auto;
  -webkit-user-select: text;
  user-select: text;
}

.note-editor-body:focus {
  outline: none;
}

.note-editor-body.note-body-html h1,
.note-editor-body.note-body-html h2,
.note-editor-body.note-body-html h3,
.note-editor-body.note-body-html h4,
.note-editor-body.note-body-html h5,
.note-editor-body.note-body-html h6 {
  margin: 0.75rem 0 0.375rem;
  font-weight: 700;
  line-height: 1.3;
}

.note-editor-body.note-body-html blockquote {
  margin: 0.375rem 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--quote-border);
  color: var(--quote-text);
}

.note-editor-body.note-body-html p {
  margin: 0.375rem 0;
}

.note-editor-body.note-body-html ul {
  margin: 0.375rem 0;
  padding-left: 1.25rem;
}

.note-editor-body:empty::before {
  content: attr(data-placeholder);
  color: var(--vkui--color_text_tertiary, var(--text-tertiary));
  pointer-events: none;
}

.notes-detail--note-editor .notes-detail-footer {
  padding: var(--note-editor-pad-y) var(--note-editor-pad-x)
    calc(var(--note-editor-pad-y) + var(--tabbar-safe));
  border-top: 1px solid var(--vkui--color_separator_primary, var(--border));
  background: var(--vkui--color_background_content_alpha);
  backdrop-filter: blur(var(--vkui--blur_m, 16px));
  -webkit-backdrop-filter: blur(var(--vkui--blur_m, 16px));
}

.note-editor-footer-actions {
  display: flex;
  gap: 8px;
}

.note-editor-cancel-btn {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  height: var(--vkui--size_button_large_height--regular, 44px);
  min-height: var(--vkui--size_button_large_height--regular, 44px);
  padding: 0 var(--vkui--size_button_base_large_padding_horizontal--regular, 20px);
  border: 1px solid var(--vkui--color_separator_primary, var(--border));
  border-radius: var(--vkui--size_border_radius--regular, 10px);
  color: var(--vkui--color_text_primary, var(--text));
  background: var(--vkui--color_background_secondary_alpha, var(--surface-muted));
  cursor: pointer;
  font-family: var(
    --vkui--font_headline2--font_family--regular,
    -apple-system,
    system-ui,
    "Helvetica Neue",
    Roboto,
    sans-serif
  );
  font-size: var(--vkui--font_headline2--font_size--regular, 15px);
  font-weight: var(--vkui--font_headline2--font_weight--regular, 500);
  line-height: var(--vkui--font_headline2--line_height--regular, 20px);
  transition: background 0.15s ease, transform 0.12s ease;
}

.note-editor-cancel-btn:active {
  transform: scale(0.98);
}

.note-editor-save-btn {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  width: auto;
  height: var(--vkui--size_button_large_height--regular, 44px);
  min-height: var(--vkui--size_button_large_height--regular, 44px);
  padding: 0 var(--vkui--size_button_base_large_padding_horizontal--regular, 20px);
  border: none;
  border-radius: var(--vkui--size_border_radius--regular, 10px);
  color: var(--vkui--color_text_contrast);
  background: var(--vkui--color_background_accent);
  cursor: pointer;
  font-family: var(
    --vkui--font_headline2--font_family--regular,
    -apple-system,
    system-ui,
    "Helvetica Neue",
    Roboto,
    sans-serif
  );
  font-size: var(--vkui--font_headline2--font_size--regular, 15px);
  font-weight: var(--vkui--font_headline2--font_weight--regular, 500);
  line-height: var(--vkui--font_headline2--line_height--regular, 20px);
  letter-spacing: 0;
  transition: background 0.15s ease, transform 0.12s ease;
}

.note-editor-save-btn:active {
  background: var(--vkui--color_background_accent--active);
  transform: scale(0.98);
}

.btn-save-note,
.btn-todoist-sync {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md, 12px);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-subtle);
  cursor: pointer;
}

.btn-save-note:active,
.btn-todoist-sync:active {
  background: var(--accent-muted);
}

.journal-meta-bar {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-3);
}

.journal-transcript-card {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.journal-transcript-pre {
  margin: 0;
  font-family: inherit;
  font-size: 0.8125rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Саммари и ответы Лео — тем же текстом, что заметка (.note-editor-body):
   один абзац VKUI, те же отступы, списки, цитаты и таблицы. */
.journal-summary-html {
  font-family: var(
    --vkui--font_paragraph--font_family--regular,
    -apple-system,
    system-ui,
    "Helvetica Neue",
    Roboto,
    sans-serif
  );
  font-size: var(--vkui--font_paragraph--font_size--regular, 15px);
  font-weight: var(--vkui--font_paragraph--font_weight--regular, 400);
  line-height: var(--vkui--font_paragraph--line_height--regular, 20px);
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.journal-summary-html ul,
.journal-summary-html ol {
  margin: 0.375rem 0;
  padding-left: 1.25rem;
}

.journal-summary-html li > ul,
.journal-summary-html li > ol,
.note-discuss-bubble--md li > ul,
.note-discuss-bubble--md li > ol {
  margin-top: 0.2rem;
  margin-bottom: 0.2rem;
}

.journal-summary-html h1,
.journal-summary-html h2,
.journal-summary-html h3,
.journal-summary-html h4,
.journal-summary-html h5,
.journal-summary-html h6 {
  margin: 0.75rem 0 0.375rem;
  line-height: 1.3;
}

.journal-summary-html h1:first-child,
.journal-summary-html h2:first-child,
.journal-summary-html h3:first-child,
.journal-summary-html h4:first-child {
  margin-top: 0;
}

.journal-summary-html blockquote {
  margin: 0.375rem 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--quote-border);
  color: var(--quote-text);
}

.journal-summary-html p {
  margin: 0.375rem 0;
}

.journal-summary-html table {
  width: 100%;
  margin: 0.75rem 0;
  border-collapse: collapse;
}

.journal-summary-html th,
.journal-summary-html td {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.journal-summary-html th {
  font-weight: 600;
  background: var(--surface-muted);
}

.journal-summary-html u {
  text-decoration: underline;
}

.note-view-page {
  padding: 0 0 var(--space-2);
}

.note-body-html {
  padding: 0;
}

.note-discuss-bubble.note-body-html,
.note-discuss-bubble.journal-summary-html {
  padding: 14px 18px;
}

.journal-source-footer {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
}

.journal-source-link {
  color: var(--accent);
  text-decoration: none;
}

.journal-source-link:hover {
  text-decoration: underline;
}

/* ——— Profile ——— */
.profile-head {
  display: flex;
  gap: var(--space-4);
  align-items: center;
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--surface);
  overflow: hidden;
}

.avatar {
  position: relative;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  overflow: hidden;
  border-radius: var(--radius-full, 50%);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-muted);
  border: 1px solid var(--accent-border);
}

.avatar .avatar-img {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar .avatar-img.has-photo {
  display: block;
}

.avatar .avatar-img.has-photo + .avatar-fallback {
  display: none;
}

.avatar .avatar-fallback {
  position: relative;
  z-index: 1;
}

.profile-names h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.profile-names p {
  margin: var(--space-1) 0 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.tariff-card {
  position: relative;
  margin-bottom: var(--space-3);
  padding: var(--space-4);
  overflow: hidden;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg, 12px);
  color: var(--text);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent) 15%, transparent) 0%,
    color-mix(in srgb, var(--violet) 8%, transparent) 60%,
    transparent 100%
  );
  box-shadow: none;
}

.tariff-card::after {
  content: "";
  position: absolute;
  right: -1rem;
  bottom: -1rem;
  width: 7rem;
  height: 7rem;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--violet) 12%, transparent);
  filter: blur(20px);
  pointer-events: none;
}

.tariff-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tariff-name {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.tariff-pill {
  padding: 0.15rem 0.5rem;
  border: 1px solid color-mix(in srgb, var(--success) 18%, transparent);
  border-radius: var(--radius-full);
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--success);
  background: var(--success-muted);
}

.tariff-balance-label {
  margin: var(--space-5) 0 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.tariff-balance {
  margin: var(--space-1) 0 0;
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.tariff-pay {
  width: 100%;
  margin-top: var(--space-4);
  padding: 0.85rem var(--space-4);
  border: none;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  cursor: pointer;
}

.expenses-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  font-family: inherit;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  box-shadow: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.expenses-card:hover {
  border-color: var(--accent-border);
}

.tg-leo-card {
  flex-wrap: wrap;
  gap: var(--space-3);
  cursor: default;
}

.tg-leo-controls {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  width: 100%;
}

.tg-leo-model {
  flex: 1;
  min-width: 0;
}

.expenses-card-inner {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.expenses-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  color: var(--accent);
  background: var(--accent-muted);
}

.expenses-icon svg {
  width: 1.125rem;
  height: 1.125rem;
}

.expenses-label {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.expenses-total {
  margin: var(--space-1) 0 0;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.services-card {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.services-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.services-sub {
  margin: var(--space-1) 0 var(--space-4);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.svc-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) 0;
}

.svc-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--accent);
  background: var(--accent-subtle);
}

.svc-icon svg {
  width: 1.125rem;
  height: 1.125rem;
}

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

.svc-name {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.svc-desc {
  margin: var(--space-1) 0 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text-secondary);
}

.svc-desc--connected {
  font-weight: 500;
  color: var(--emerald-text);
}

.svc-actions {
  display: flex;
  flex-shrink: 0;
  flex-flow: row wrap;
  gap: var(--space-2);
  align-items: center;
  justify-content: flex-end;
  position: relative;
  z-index: 2;
}

.svc-actions [data-action] {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.svc-actions .btn {
  flex-shrink: 0;
  min-height: 2rem;
  white-space: nowrap;
}

.svc-actions .btn.primary:active {
  background: var(--accent-pressed);
}

#profile-kb-list .svc-row--kb {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
}

#profile-kb-list .svc-text {
  flex: none;
  width: 100%;
  min-width: 0;
}

#profile-kb-list .svc-desc {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  word-break: break-word;
}

#profile-kb-list .svc-actions {
  display: flex;
  flex-flow: row wrap;
  gap: var(--space-2);
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  max-width: none;
  margin: 0;
}

#profile-kb-list .svc-actions .btn {
  flex: 0 0 auto;
}

.svc-toggle {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  width: 2.75rem;
  height: 1.55rem;
  padding: 0.12rem;
  border: none;
  border-radius: var(--radius-full);
  background: var(--surface-muted);
  cursor: pointer;
}

.svc-toggle--on {
  background: var(--accent);
}

.svc-toggle-knob {
  display: block;
  width: 1.28rem;
  height: 1.28rem;
  margin-left: 0;
  border-radius: var(--radius-full);
  background: var(--on-accent);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--shadow-color) 35%, transparent);
  transition: margin-left 0.15s ease;
}

.svc-toggle--on .svc-toggle-knob {
  margin-left: auto;
}

.calendars-row {
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-2);
}

.calendars-setting-row {
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.calendars-notify-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: var(--space-3);
}

.calendars-notify-block > .svc-name {
  margin: 0;
}

.calendars-notify-block > .svc-desc {
  margin: 0 0 4px;
}

.calendars-notify-block .calendars-setting-row {
  margin-bottom: 0;
}

.calendars-row .svc-toggle {
  margin-left: auto;
}

.calendars-save-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 1.25rem;
  margin: 0 0 var(--space-2);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: opacity 0.2s ease;
}

.calendars-save-status::before {
  content: "";
  flex-shrink: 0;
  width: 0.875rem;
  height: 0.875rem;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: calendars-spin 0.65s linear infinite;
}

.calendars-save-status--done::before {
  border: none;
  width: 0.875rem;
  height: 0.875rem;
  background: var(--accent);
  animation: none;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M4.5 9 1.5 6l1-1 2 2 5-5 1 1z'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M4.5 9 1.5 6l1-1 2 2 5-5 1 1z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.calendars-save-status--done {
  color: var(--accent);
}

@keyframes calendars-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes svc-toggle-pending {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.08);
  }
}

.svc-toggle--pending {
  cursor: wait;
  animation: svc-toggle-pending 1.1s ease-in-out infinite;
}

.svc-toggle--pending .svc-toggle-knob {
  transition: margin-left 0.15s ease, transform 0.15s ease;
}

.calendars-row--pending .svc-name {
  opacity: 0.72;
  transition: opacity 0.2s ease;
}

.calendars-dot {
  flex-shrink: 0;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: var(--radius-full);
}

.svc-divider {
  height: 1px;
  margin: 0;
  background: var(--border);
}

.svc-divider--spaced {
  margin: var(--space-4) 0;
}

.contacts-card-sub {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.contacts-hint {
  margin: 0 0 var(--space-4);
}

.contacts-form-card {
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--surface);
  overflow: hidden;
}

.contacts-form-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.contacts-form-teams {
  margin-top: var(--space-1);
}

.contacts-form-teams-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 10rem;
  overflow-y: auto;
}

.contacts-form-team-option {
  margin: 0;
}

.contact-card-teams {
  margin: var(--space-2) 0 0;
}

/* FAB lives inside the fixed contacts subscreen (max-w / desktop pane),
   so viewport-based notes-fab `right` would land near center — pin to the pane. */
.contacts-fab,
.contacts-create-menu {
  right: var(--space-4);
  z-index: 45;
}

.contacts-create-menu {
  bottom: calc(var(--tabbar-stack) + var(--space-4) + 3.75rem);
}

.teams-manage-sheet {
  height: min(100vh, 100dvh);
  max-height: min(100vh, 100dvh);
  border-radius: var(--radius-lg, 16px) var(--radius-lg, 16px) 0 0;
}

.teams-manage-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex: 1;
  min-height: 0;
}

#teams-manage-list-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  flex: 1;
  min-height: 0;
}

#teams-manage-list-view.hidden {
  display: none !important;
}

.teams-manage-create {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  flex-shrink: 0;
}

.teams-manage-create .field-input {
  flex: 1;
  min-width: 0;
  width: auto;
}

.teams-manage-create .btn,
.teams-manage-add-row .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  height: auto;
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  flex-shrink: 0;
  box-sizing: border-box;
}

.teams-manage-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.teams-manage-card {
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--surface);
}

.teams-manage-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.teams-manage-card-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 650;
  min-width: 0;
  flex: 1;
}

.teams-manage-card-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.teams-manage-card-actions .btn-icon-tile {
  width: 2rem;
  height: 2rem;
}

.btn-icon-tile--neutral {
  color: var(--text-secondary);
}

.btn-icon-tile--neutral:hover {
  color: var(--text);
}

.teams-manage-meta-list {
  margin: 0 0 var(--space-2);
  padding-left: 1.1rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.teams-manage-meta-list:last-child {
  margin-bottom: 0;
}

.teams-manage-edit-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.teams-manage-edit-view.hidden {
  display: none !important;
}

.teams-manage-edit-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.teams-manage-edit-rows {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.teams-manage-edit-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--space-2);
  padding: 0;
  border: none;
  background: transparent;
}

.teams-manage-edit-row-label {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  background: var(--bg);
  font-size: 0.8125rem;
  line-height: 1.35;
  word-break: break-word;
}

.teams-manage-edit-row .btn-icon-tile {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
}

.teams-manage-add-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.teams-manage-add-row .field-input,
.teams-manage-add-row select.field-input {
  flex: 1;
  min-width: 0;
  width: auto;
}

.teams-manage-add-row select.field-input {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 2.5rem;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23898991' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 1rem;
}

.teams-manage-card .field-label {
  margin: var(--space-2) 0 var(--space-1);
}

.contacts-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.agents-list {
  margin-bottom: var(--space-4);
}

.agent-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--surface);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.agent-card-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.agent-card-meta {
  margin: var(--space-1) 0 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.agents-textarea {
  min-height: 6.5rem;
  resize: vertical;
}

.agents-textarea--rules {
  min-height: 4.5rem;
}

#modal-fields .event-sheet .field {
  margin-bottom: 0;
}

#modal-fields #agents-reset {
  width: 100%;
  margin-top: var(--space-1);
}

.field--check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.contact-card {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--surface);
  overflow: hidden;
}

.contact-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.contact-card-head > .note-member-avatar {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
  font-size: 0.8rem;
  border-width: 0;
}

.contact-card-body {
  min-width: 0;
  flex: 1 1 auto;
}

.contact-card-name {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.contact-card-meta {
  margin: var(--space-1) 0 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-secondary);
  word-break: break-word;
  white-space: pre-line;
}

.contact-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.team-picker-create {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  margin: 0 0 0.85rem;
}

.team-picker-create .field-input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

#team-picker-create {
  flex: 0 0 auto;
  min-height: 2.75rem;
}

#team-picker-error {
  margin: 0 0 0.65rem;
  font-size: 0.8125rem;
  color: var(--danger-text);
}

#team-picker-error.hidden {
  display: none !important;
}

.team-picker-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 16rem;
  overflow-y: auto;
}

.team-picker-empty {
  margin: 0 0 0.5rem;
}

.digest-chat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--overlay-2);
  cursor: pointer;
}

.digest-chat-title {
  flex: 1;
  font-size: 15px;
}

.profile-legal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  justify-content: center;
  margin-top: var(--space-6);
  padding: var(--space-4) var(--space-2) var(--space-2);
  text-align: center;
}

.profile-legal-link {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.profile-legal-sep {
  font-size: 0.75rem;
  color: var(--text-faint);
}

.zoom-recording-card {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.zoom-recording-topic {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.zoom-recording-meta {
  margin: var(--space-1) 0 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.zoom-recording-link {
  display: inline-block;
  margin-top: var(--space-3);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

/* Profile subscreens */
.profile-subscreen {
  display: none;
  flex-direction: column;
  min-height: 0;
}

.profile-subscreen.hidden,
#profile-main.hidden {
  display: none !important;
}

#panel-profile.panel:not(.hidden) {
  display: block;
}

#profile-payment:not(.hidden),
#profile-expenses:not(.hidden),
#profile-booking:not(.hidden),
#profile-contacts:not(.hidden),
#profile-calendars:not(.hidden),
#profile-zoom:not(.hidden),
#profile-telemost:not(.hidden),
#profile-yandex-disk:not(.hidden),
#profile-bitrix:not(.hidden),
#profile-knowledge-base:not(.hidden),
#profile-agents:not(.hidden),
#profile-chats:not(.hidden),
#profile-voice:not(.hidden) {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-top: var(--safe-top);
  padding-bottom: var(--tabbar-safe);
  background: var(--bg);
}

.subscreen-body {
  flex: 1;
  min-height: 0;
  padding: var(--space-2) var(--page-x) var(--space-6);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#profile-payment:not(.hidden) .detail-toolbar,
#profile-expenses:not(.hidden) .detail-toolbar,
#profile-booking:not(.hidden) .detail-toolbar,
#profile-contacts:not(.hidden) .detail-toolbar,
#profile-calendars:not(.hidden) .detail-toolbar,
#profile-zoom:not(.hidden) .detail-toolbar,
#profile-telemost:not(.hidden) .detail-toolbar,
#profile-yandex-disk:not(.hidden) .detail-toolbar,
#profile-bitrix:not(.hidden) .detail-toolbar,
#profile-knowledge-base:not(.hidden) .detail-toolbar,
#profile-agents:not(.hidden) .detail-toolbar,
#profile-chats:not(.hidden) .detail-toolbar,
#profile-voice:not(.hidden) .detail-toolbar {
  padding-right: var(--page-x);
  padding-left: var(--page-x);
}

.subscreen-body--payment,
#profile-booking .subscreen-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#profile-booking .subscreen-body {
  padding-bottom: var(--space-6);
}

.pay-footer {
  flex-shrink: 0;
  padding: var(--space-3) var(--page-x) calc(var(--space-3) + var(--tabbar-safe));
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.pay-section {
  margin-bottom: var(--space-5);
}

.booking-help p.muted.small + .field-label--caps,
.booking-help .field-label--caps + .muted.small {
  margin-top: var(--space-3);
}

.bitrix-steps {
  margin: var(--space-2) 0 var(--space-3);
  padding-left: 1.25rem;
}

.bitrix-steps li + li {
  margin-top: var(--space-2);
}

.booking-qr-wrap {
  margin: var(--space-3) 0;
  text-align: center;
}

.booking-qr-img {
  width: 100%;
  max-width: 280px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.field,
.modal-form .field {
  display: block;
  margin-bottom: var(--space-3);
}

.field-label {
  display: block;
  margin: var(--space-2) 0 var(--space-1);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.field-label--caps {
  margin: 0 0 var(--space-2);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.field-input,
.field-textarea,
.amount-custom-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.35;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s ease;
}

.field-input:focus,
.field-textarea:focus,
.amount-custom-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.field-textarea {
  min-height: 3rem;
  resize: vertical;
}

.rem-checklist-field {
  margin-bottom: var(--space-3);
}

.meeting-attendees-field {
  position: relative;
}

.meeting-attendee-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 0.25rem;
  margin: 0 0 0.5rem;
}

.meeting-attendee-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
  padding: 0.25rem 0.45rem 0.25rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-secondary);
  background: var(--surface);
}

.meeting-attendee-chip .note-member-avatar {
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
  font-size: 0.55rem;
}

.meeting-attendee-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meeting-attendee-chip-cal {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--success) 90%, transparent);
}

.meeting-attendee-chip-rsvp {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}
.meeting-attendee-chip-rsvp.rsvp-yes { color: color-mix(in srgb, var(--success) 95%, transparent); }
.meeting-attendee-chip-rsvp.rsvp-maybe { color: var(--text-secondary); }
.meeting-attendee-chip-rsvp.rsvp-no { color: var(--danger); }

.meeting-attendee-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: var(--text-tertiary);
  background: transparent;
  cursor: pointer;
}

.meeting-attendee-chip-remove:hover {
  color: var(--text);
  background: var(--overlay-2);
}

.meeting-attendee-add {
  position: relative;
}

.meeting-attendee-suggest {
  position: absolute;
  z-index: 8;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 12rem;
  overflow-y: auto;
  padding: 0.25rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--shadow-color) 28%, transparent);
}

.meeting-attendee-suggest.hidden {
  display: none;
}

/* Вынесен в body (floatSuggestMenu) — над модалками, не обрезается карточкой. */
.meeting-attendee-suggest.meeting-attendee-suggest--floating {
  position: fixed;
  z-index: 1000;
  right: auto;
  margin: 0;
}

.meeting-attendee-suggest-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 0;
  border-radius: 8px;
  text-align: left;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.meeting-attendee-suggest-item--with-avatar {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
}

.meeting-attendee-suggest-item--with-avatar .note-member-avatar {
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  font-size: 0.65rem;
}

.meeting-attendee-suggest-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.meeting-attendee-suggest-item:hover,
.meeting-attendee-suggest-item.is-active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.meeting-attendee-suggest-name {
  font-size: 0.875rem;
  font-weight: 600;
}

.meeting-attendee-suggest-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.event-sheet-meet-link-input {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.7rem 0.9rem 0.9rem;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.event-sheet-meet-link-input.hidden {
  display: none;
}

.meeting-avail {
  margin: 0.25rem 0 var(--space-3);
}

.meeting-avail-head {
  margin: 0 0 0.45rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.meeting-avail-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.meeting-avail-grid {
  min-width: 28rem;
}

.meeting-avail-hours {
  display: flex;
  margin: 0 0 0.35rem 5.5rem;
  color: var(--text-tertiary);
  font-size: 0.625rem;
  font-variant-numeric: tabular-nums;
}

.meeting-avail-hour {
  flex: 1;
  min-width: 0;
}

.meeting-avail-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.meeting-avail-label {
  flex-shrink: 0;
  width: 5.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

.meeting-avail-label.is-muted {
  color: var(--text-tertiary);
}

.meeting-avail-track {
  position: relative;
  flex: 1;
  height: 1.35rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  overflow: hidden;
}

.meeting-avail-busy {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 42%, transparent);
}

.meeting-avail-track--joint {
  background: var(--overlay-1);
  cursor: pointer;
}

.meeting-avail-free {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--success) 32%, transparent);
}

.meeting-avail-hint {
  margin: 0.4rem 0 0;
}

.meeting-avail.hidden {
  display: none;
}

.rem-checklist-host {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rem-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rem-checklist-item,
.rem-checklist-draft {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.15rem;
}

.rem-checklist-del {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.rem-checklist-del:active {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.rem-checklist-cb {
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--accent);
}

.rem-checklist-text {
  flex: 1;
  min-width: 0;
  font-size: 0.9375rem;
  line-height: 1.35;
  color: var(--text);
  overflow-wrap: anywhere;
}

.rem-checklist-item--done .rem-checklist-text {
  color: var(--text-secondary);
  text-decoration: line-through;
}

.rem-checklist-draft-input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0.55rem 0.75rem;
}

.rem-checklist-add {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  align-self: flex-start;
  margin: 0;
  padding: 0.2rem 0;
  min-height: auto;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.rem-checklist-add-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  color: var(--on-accent);
  background: var(--accent);
}

.rem-checklist-add:active .rem-checklist-add-icon {
  opacity: 0.9;
  transform: scale(0.96);
}

.rem-checklist-add.hidden {
  display: none !important;
}

.modal-link-action {
  margin-top: 0.65rem;
}

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

.event-sheet-title {
  width: 100%;
  margin: 0;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 14px;
  background: var(--surface-elevated);
  color: var(--text);
  font: inherit;
  font-size: 1.0625rem;
  line-height: 1.3;
}

.event-sheet-title::placeholder {
  color: var(--text-tertiary);
}

.event-sheet-title:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-border);
}

textarea.event-sheet-title--area {
  display: block;
  min-height: 3.25rem;
  resize: none;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.event-sheet-group {
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface-elevated);
}

.event-sheet-color-group {
  overflow: hidden;
}

.event-sheet-color-group.is-open {
  overflow: visible;
}

.event-sheet-color-group > .event-sheet-color-toggle {
  border-radius: 14px;
}

.event-sheet-color-group.is-open > .event-sheet-color-toggle {
  border-radius: 14px 14px 0 0;
}

.event-sheet-color-preview {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--swatch-color, var(--accent));
  box-shadow: inset 0 0 0 1px var(--overlay-6);
}

.event-sheet-color-preview--default {
  background:
    linear-gradient(135deg, transparent 46%, var(--text-tertiary) 46% 54%, transparent 54%),
    var(--surface-muted);
  box-shadow: inset 0 0 0 1px var(--border);
}

.event-sheet-color-menu {
  padding: 0.55rem 0.9rem 0.85rem;
  border-top: 0.5px solid var(--border);
  background: var(--surface-elevated);
  border-radius: 0 0 14px 14px;
}

.event-sheet-color-menu-hint {
  margin: 0 0 0.55rem;
}

.event-sheet-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.event-sheet-color-swatch {
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--swatch-color, var(--accent));
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--overlay-5);
}

.event-sheet-color-swatch--default {
  background:
    linear-gradient(135deg, transparent 46%, var(--text-tertiary) 46% 54%, transparent 54%),
    var(--surface-muted);
  box-shadow: inset 0 0 0 1px var(--border);
}

.event-sheet-color-swatch.is-selected {
  border-color: #fff;
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--swatch-color, var(--accent)) 70%, #fff),
    inset 0 0 0 1px color-mix(in srgb, var(--shadow-color) 20%, transparent);
}

.event-sheet-color-swatch--default.is-selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--text-secondary);
}

.event-sheet-group.meeting-attendees-field {
  overflow: visible;
}

.event-sheet-group.meeting-attendees-field > .event-sheet-row {
  border-radius: 14px;
}

.event-sheet-group.meeting-attendees-field:has(#m-ev-attendees-editor:not(.hidden)) > .event-sheet-row {
  border-radius: 14px 14px 0 0;
}

.event-sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0.45rem 0.9rem;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.event-sheet-row + .event-sheet-row,
.event-sheet-row + .event-sheet-attendees,
.event-sheet-row + .event-sheet-desc,
.event-sheet-row + .event-sheet-meet-link-input,
.event-sheet-attendees + .note-backlinks-row {
  border-top: 0.5px solid var(--border);
}

.event-sheet-row--nav {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.event-sheet-row--nav:active {
  background: var(--overlay-1);
}

.event-sheet-row-label,
.event-sheet-row .field-label {
  display: block;
  margin: 0;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text);
}

.event-sheet-row-value {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 1rem;
}

.event-sheet-chevron {
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.event-sheet-row--nav[aria-expanded="true"] .event-sheet-chevron {
  transform: rotate(180deg);
}

.event-sheet-color-toggle.event-sheet-row--nav .event-sheet-chevron {
  transform: rotate(-90deg);
  transition: transform 0.15s ease;
}

.event-sheet-color-toggle.event-sheet-row--nav[aria-expanded="true"] .event-sheet-chevron {
  transform: rotate(0deg);
}

.event-sheet-kind-switch {
  display: flex;
  gap: 4px;
  margin: 0 0 0.65rem;
  padding: 3px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--text-subtle) 22%, transparent);
}

.event-sheet-kind-btn {
  flex: 1 1 0;
  margin: 0;
  padding: 0.4rem 0.2rem;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.event-sheet-kind-btn.is-active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--shadow-color) 18%, transparent);
}

.event-sheet-kind-btn:active:not(.is-active) {
  opacity: 0.85;
}

.booking-sheet-lead {
  margin: 0 0 0.15rem;
  padding: 0 0.15rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.4;
}

.event-sheet-row--stack {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.booking-sheet-seg {
  margin: 0;
  width: 100%;
}

.booking-sheet-copy {
  width: 100%;
  margin-top: 0.25rem;
}

.booking-sheet-url {
  width: 100%;
}

.event-sheet-assignee--locked .event-sheet-row--nav {
  opacity: 0.72;
  cursor: default;
}

.event-sheet-assignee--locked .event-sheet-chevron {
  display: none;
}

.event-sheet-pills {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
}

.event-sheet-pill {
  max-width: 9.5rem;
  margin: 0;
  padding: 0.35rem 0.65rem;
  border: none;
  border-radius: 8px;
  background: color-mix(in srgb, var(--text-subtle) 28%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.2;
  color-scheme: dark;
  -webkit-appearance: none;
  appearance: none;
}

.event-sheet-pill::-webkit-calendar-picker-indicator {
  opacity: 0.7;
}

.event-sheet-attendees {
  padding: 0.55rem 0.9rem 0.85rem;
  overflow: visible;
}

.event-sheet-attendees .meeting-attendee-add {
  overflow: visible;
}

.event-sheet-attendees .meeting-attendee-suggest {
  position: static;
  z-index: 20;
  margin-top: 6px;
  max-height: min(40vh, 14rem);
}

.event-sheet-attendees .meeting-attendee-chips {
  margin-bottom: 0.45rem;
}

.event-sheet-desc {
  display: block;
  width: 100%;
  min-height: 5.5rem;
  margin: 0;
  padding: 0.7rem 0.9rem 0.9rem;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.event-sheet-desc.hidden {
  display: none;
}

.event-sheet-schedule-log {
  min-height: 4.2rem;
  color: var(--text-subtle);
  font-size: 0.92rem;
  line-height: 1.45;
  resize: none;
  cursor: default;
}

.event-sheet-link-row {
  display: flex;
  gap: 8px;
}

.event-sheet-join {
  width: 100%;
  margin: 0 0 8px;
}

.event-sheet-link-row .modal-link-action {
  flex: 1;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 14px;
  background: var(--surface-elevated) !important;
  color: var(--text);
  font-weight: 500;
}

.event-sheet-link-row .modal-link-action:active {
  background: var(--overlay-3) !important;
}

.event-sheet-checklist-group .rem-checklist-host,
.event-sheet-checklist-group .rem-checklist {
  gap: 0;
}

.event-sheet-checklist-group .rem-checklist-item,
.event-sheet-checklist-group .rem-checklist-draft {
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  border-top: 0.5px solid var(--border);
}

.event-sheet-checklist-group .rem-checklist-item:first-child,
.event-sheet-checklist-group .rem-checklist:empty + .rem-checklist-draft,
.event-sheet-checklist-group .rem-checklist:empty + .rem-checklist-add {
  border-top: none;
}

.event-sheet-checklist-group .rem-checklist-draft-input {
  padding: 0.2rem 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.event-sheet-checklist-group .rem-checklist-add {
  align-self: stretch;
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  box-shadow: inset 0 0.5px 0 var(--border) !important;
}

.event-sheet-checklist-group .rem-checklist:empty + .rem-checklist-add {
  box-shadow: none !important;
}

.reminder-card-checklist {
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
}

.reminder-card-checklist-item {
  margin: 0.15rem 0;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--text-secondary);
}

.reminder-card-checklist-item--done {
  text-decoration: line-through;
  opacity: 0.75;
}

.amount-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.amount-chip {
  flex: 1;
  min-width: 3.5rem;
  padding: 0.45rem 0.35rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

.amount-chip--active {
  color: var(--on-accent);
  background: var(--accent);
  border-color: transparent;
}

.amount-chip {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.payment-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  border: none;
  background: transparent;
  overflow: visible;
}

.payment-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-family: inherit;
  text-align: left;
  background: var(--surface);
  cursor: pointer;
}

.payment-row.selected {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.amount-custom-wrap {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.amount-rub-prefix {
  font-weight: 600;
  color: var(--text-secondary);
}

.amount-custom-input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: none;
  font-weight: 600;
  background: transparent;
}

.amount-custom-input:focus {
  box-shadow: none;
}

.pay-radio {
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-full);
}

.payment-row.selected .pay-radio {
  border: none;
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--surface);
}

.payment-row-icon {
  flex-shrink: 0;
  font-size: 1.125rem;
  line-height: 1;
}

.payment-row-label {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
}

.exp-day-req-label {
  flex: 1;
  padding-right: var(--space-2);
}

.pay-summary-card {
  margin-top: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.pay-summary-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-1) 0;
  font-size: 0.875rem;
}

.pay-summary-row--total {
  margin-top: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  font-weight: 650;
}

.promo-row {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-2);
  align-items: stretch;
}

.promo-row .field-input {
  flex: 1 1 auto;
  min-width: 0;
}

.promo-row .btn,
.promo-apply-btn {
  flex-shrink: 0;
  align-self: stretch;
  white-space: nowrap;
}

.pay-submit-btn {
  width: 100%;
  padding: 0.85rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

/* Expenses detail */
.exp-day {
  margin-bottom: var(--space-2);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.exp-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: none;
  font-family: inherit;
  text-align: left;
  background: none;
  cursor: pointer;
}

.exp-day-req {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  background: var(--surface-muted);
}

/* Swipe delete */
.swipe-row {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card, 12px);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.swipe-row__delete {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  width: 5rem;
  margin: 0;
  padding: 0 0.35rem;
  border: none;
  font-family: inherit;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--on-danger);
  background: var(--danger);
  visibility: hidden;
  cursor: pointer;
}

.swipe-row--revealed .swipe-row__delete {
  visibility: visible;
}

.swipe-row__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  background: var(--surface);
  border-radius: inherit;
  overflow: hidden;
  touch-action: pan-y;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}

.swipe-row__panel > .reminder-card,
.swipe-row__panel > .meeting-card,
.swipe-row__panel > .note-card,
.swipe-row__panel > .content-card {
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

#modal-overlay.modal-overlay {
  z-index: 280;
}

/* «+» на «Транскрипциях» доступен и при открытом листе заметки (notes-split): у обоих оверлеев
   был общий z-index 100, и лист (ниже в DOM) перекрывал модалку загрузки. */
#transcription-upload-overlay.modal-overlay {
  z-index: 270;
}

#note-unsaved-overlay.modal-overlay {
  /* Выше открытой заметки и обсуждения справа (220), иначе на десктопе окно пряталось под ними. */
  z-index: 400;
}

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

.modal {
  width: 100%;
  max-width: var(--max-w);
  max-height: min(90vh, 90dvh);
  overflow-y: auto;
  padding: var(--space-5) var(--space-4) calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
  border: none;
  border-radius: var(--radius-lg, 16px) var(--radius-lg, 16px) 0 0;
  background: var(--surface);
  box-shadow: 0 -8px 32px color-mix(in srgb, var(--shadow-color) 18%, transparent);
}

.modal--sheet {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.modal-overlay:not(.hidden) .modal--sheet {
  animation: modal-sheet-in 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes modal-sheet-in {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes modal-center-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.modal-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.modal--sheet .modal-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.modal-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--vkui--size_button_medium_height--regular, 36px);
  height: var(--vkui--size_button_medium_height--regular, 36px);
  padding: 0;
  border: none;
  font-family: inherit;
  cursor: pointer;
}

.modal-header-btn--close {
  grid-column: 1;
  justify-self: start;
  border-radius: 50%;
  color: var(--text);
  background: var(--vkui--color_background_secondary_alpha, var(--surface-muted));
}

.modal-header-btn--close:active {
  opacity: 0.85;
  transform: scale(0.98);
}

.modal-header-btn--save {
  grid-column: 3;
  justify-self: end;
  border-radius: 50%;
  color: var(--vkui--color_text_contrast);
  background: var(--vkui--color_background_accent);
}

.modal-header-btn--save svg {
  stroke: var(--vkui--color_text_contrast);
}

.modal-header-btn--save:active {
  background: var(--vkui--color_background_accent--active);
  transform: scale(0.98);
}

.modal--sheet .modal-body {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-4);
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
}

.modal--sheet .modal-body.note-editor-modal-body,
#note-editor-overlay .note-editor-modal-body {
  padding-right: 0;
  padding-left: 0;
}

.voice-overlay {
  z-index: 180;
}

.voice-sheet {
  min-height: 50dvh;
  max-height: min(62dvh, 34rem);
}

.voice-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.voice-recorder {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
}

.voice-status {
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.voice-actions {
  display: flex;
  gap: var(--space-2);
}

.voice-actions .btn {
  flex: 1;
}

.voice-transcript-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.voice-transcript-input {
  min-height: 7rem;
}

.voice-send-btn {
  width: 100%;
}

.voice-chat {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-height: 14rem;
  overflow-y: auto;
  padding: var(--space-1) 0;
  -webkit-overflow-scrolling: touch;
}

.voice-bubble {
  max-width: 94%;
}

#note-editor-overlay {
  --note-editor-pad-x: 16px;
  --note-editor-pad-y: 16px;
  align-items: stretch;
  background: var(--vkui--color_background, var(--bg));
  backdrop-filter: none;
}

#note-editor-overlay .note-editor-web-back-bar {
  flex-shrink: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: max(
      8px,
      env(safe-area-inset-top, 0px),
      var(--tg-content-safe-area-inset-top, 0px)
    )
    8px 4px 8px;
  position: relative;
  box-sizing: border-box;
}

#note-editor-overlay .note-editor-web-back-bar.hidden {
  display: none !important;
}

#note-editor-overlay .note-editor-web-back {
  position: relative;
  top: auto;
  left: auto;
  z-index: 2;
  flex-shrink: 0;
  min-height: 36px;
  padding: 0 12px 0 4px;
  border: none;
  font-size: 16px;
  line-height: 20px;
  color: var(--vkui--color_text_accent);
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

#note-editor-overlay .note-editor-web-back.hidden {
  display: none !important;
}

#note-editor-overlay .note-editor-web-back-bar #note-editor-tags-wrap:not(.hidden) {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  width: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: none;
  background: transparent;
  pointer-events: none;
}

#note-editor-overlay .note-editor-web-back-bar #note-editor-tags-wrap .tag-picker-add-wrap,
#note-editor-overlay .note-editor-web-back-bar #note-editor-tags-wrap .tag-picker-add-btn,
#note-editor-overlay .note-editor-web-back-bar #note-editor-tags-wrap .note-more-wrap,
#note-editor-overlay .note-editor-web-back-bar #note-editor-tags-wrap .note-more-btn,
#note-editor-overlay .note-editor-web-back-bar #note-editor-tags-wrap .note-more-menu {
  pointer-events: auto;
}

#note-editor-overlay .note-editor-web-back-bar .note-more-wrap {
  z-index: 2;
  top: 0;
  bottom: 0;
  right: 4px;
}

#note-editor-overlay .note-editor-modal-header {
  display: none;
}

#note-editor-overlay.note-editor-overlay--fullscreen .note-editor-modal-body {
  padding-top: 0;
  padding-right: 0;
  padding-left: 0;
  --note-editor-chrome-top: 0px;
}

html.note-editor-web-back-visible
  #note-editor-overlay.note-editor-overlay--fullscreen
  .note-editor-modal-body {
  --note-editor-chrome-top: 0px;
}

#note-editor-overlay.note-editor-overlay--fullscreen .note-editor-modal-content {
  padding-top: var(--space-2);
}

#note-editor-overlay.note-editor-overlay--fullscreen .note-more-wrap {
  right: var(--space-3);
}

#note-editor-overlay.note-editor-overlay--fullscreen .tag-picker-add-wrap {
  flex-shrink: 0;
}

#note-editor-overlay.note-editor-overlay--fullscreen .tag-picker-add-btn,
#note-editor-overlay.note-editor-overlay--fullscreen .tag-picker-menu-item,
#note-editor-overlay.note-editor-overlay--fullscreen .tag-picker-menu-empty {
  font-family: var(
    --vkui--font_paragraph--font_family--regular,
    -apple-system,
    system-ui,
    "Helvetica Neue",
    Roboto,
    sans-serif
  );
  font-size: var(--vkui--font_paragraph--font_size--regular, 15px);
  font-weight: var(--vkui--font_paragraph--font_weight--regular, 400);
  line-height: var(--vkui--font_paragraph--line_height--regular, 20px);
}

#note-editor-overlay.note-editor-overlay--fullscreen .tag-picker-add-btn {
  font-weight: 600;
}

#note-editor-overlay.note-editor-overlay--fullscreen .tag-picker-add-btn-icon {
  width: 1rem;
  height: 1rem;
}

/* Тулбар — в потоке flex внизу листа (не fixed/sticky: на iOS улетает от клавиатуры) */
#note-editor-overlay.note-editor-overlay--fullscreen .note-editor-toolbar-wrap:not(.hidden),
#note-editor-overlay.note-editor-overlay--fullscreen
  .note-editor-toolbar-wrap--bottom:not(.hidden) {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: 30;
  margin: 0;
  max-width: none;
  padding-top: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

html.note-editor-kb-open
  #note-editor-overlay.note-editor-overlay--fullscreen
  .note-editor-toolbar-wrap--bottom:not(.hidden) {
  padding-bottom: 10px;
}

#note-editor-overlay.note-editor-overlay--fullscreen
  .note-editor-modal-body:has(#note-editor-tags-wrap:not(.hidden))
  .note-editor-toolbar-wrap:not(.hidden),
#note-editor-overlay.note-editor-overlay--fullscreen
  .note-editor-modal-body:not(:has(#note-editor-tags-wrap:not(.hidden)))
  .note-editor-toolbar-wrap:not(.hidden) {
  top: auto;
  padding-top: 10px;
}

.tag-picker-menu.tag-picker-menu--fixed {
  position: fixed;
  z-index: 120;
}

#note-editor-overlay .tag-picker-add-wrap {
  position: relative;
  z-index: 1;
}

#note-editor-overlay .tag-picker-menu {
  z-index: 10;
}

.note-link-popover {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + var(--space-1));
  z-index: 20;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--shadow-color) 12%, transparent);
}

.note-link-popover--bottom {
  top: auto;
  bottom: calc(100% + 10px);
  border-color: var(--overlay-5);
  background: var(--surface-raised);
  box-shadow: 0 12px 40px color-mix(in srgb, var(--shadow-color) 45%, transparent);
}

.note-link-popover-hint {
  margin: 0 0 var(--space-2);
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-secondary);
}

.note-link-popover-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 var(--space-2);
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
}

.note-link-popover-actions {
  display: flex;
  gap: var(--space-2);
}

.note-link-popover-btn {
  flex: 1 1 0;
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-muted);
  cursor: pointer;
}

.note-link-popover-btn--apply {
  color: var(--on-accent);
  border-color: var(--accent);
  background: var(--accent);
}

.note-link-popover-btn--remove {
  color: var(--danger);
  border-color: transparent;
  background: transparent;
}

#note-editor-overlay .modal.note-editor-sheet {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  flex: 1 1 auto;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.note-editor-modal-form {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.note-editor-sheet .modal-header {
  padding-top: var(--space-3);
  padding-bottom: var(--space-2);
}

.note-editor-modal-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding-top: var(--space-2);
  padding-right: 0;
  padding-bottom: var(--space-3);
  padding-left: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-user-select: text;
  user-select: text;
}

.note-editor-modal-body #note-editor-tags-wrap:not(.hidden) {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  align-self: stretch;
  width: auto;
  max-width: none;
  margin: 0;
  background: var(--vkui--color_background_secondary);
}

.note-editor-sheet > .note-editor-modal-form > .note-editor-toolbar-wrap:not(.hidden),
.note-editor-sheet > .note-editor-modal-form > .note-editor-toolbar-wrap--bottom:not(.hidden) {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: 30;
  flex-shrink: 0;
  max-width: none;
  margin: 0;
  padding: 10px var(--space-4) calc(10px + env(safe-area-inset-bottom, 0px));
  border-bottom: none;
  border-top: 1px solid var(--overlay-3);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
}

html.note-editor-kb-open
  .note-editor-sheet
  > .note-editor-modal-form
  > .note-editor-toolbar-wrap--bottom:not(.hidden) {
  padding-bottom: 10px;
}

.note-editor-modal-content {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: visible;
  padding-bottom: var(--space-4);
  padding-left: var(--note-editor-pad-x, 16px);
  padding-right: var(--note-editor-pad-x, 16px);
}

.note-editor-modal-content .note-editor-pad--title-in-body,
.note-editor-modal-content .note-editor-pad--body {
  padding-left: 0;
  padding-right: 0;
}

.note-editor-modal-content .note-editor-page {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.note-editor-modal-content .note-editor-pad--body {
  flex: 1 1 auto;
  min-height: 12rem;
}

.note-editor-modal-content .note-rich-editor,
.note-editor-modal-content .note-rich-editor-surface {
  flex: 1 1 auto;
  min-height: 12rem;
}

.note-editor-modal-content .note-rich-editor-body {
  flex: 0 1 auto;
  min-height: 12rem;
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

.note-editor-doc-layout {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.note-editor-main-column {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.note-editor-toc-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  margin: 0 0 10px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--overlay-5);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--vkui--color_text_accent, var(--accent));
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.note-editor-toc-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: var(--vkui--color_text_primary, var(--text));
}

.note-editor-toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--vkui--color_text_secondary, var(--text-secondary));
  text-transform: uppercase;
}

.note-editor-toc-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 20px;
  line-height: 1;
  color: var(--vkui--color_text_secondary, var(--text-secondary));
  background: var(--overlay-3);
  cursor: pointer;
}

.note-editor-toc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  padding: 4px 8px 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.note-editor-toc-item {
  --toc-indent: 0px;
  /* Список прокручивается — пункты не сжимаем, иначе длинные заголовки налезают друг на друга. */
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: flex-start;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  height: auto;
  max-height: none;
  padding: 8px 10px 8px calc(10px + var(--toc-indent));
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--vkui--color_text_secondary, var(--text-secondary));
  text-align: left;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  word-break: break-word;
  background: transparent;
  cursor: pointer;
}

.note-editor-toc-item--level-1,
.note-editor-toc-item--level-2 {
  --toc-indent: 0px;
}

.note-editor-toc-item--level-3 {
  --toc-indent: 14px;
}

.note-editor-toc-item--level-4 {
  --toc-indent: 28px;
  font-size: 0.8125rem;
}

.note-editor-toc-item--level-5,
.note-editor-toc-item--level-6 {
  --toc-indent: 42px;
  font-size: 0.8125rem;
}

.note-editor-toc-item--active {
  color: var(--vkui--color_text_accent, var(--accent));
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.note-editor-toc-empty {
  margin: 0;
  padding: 10px;
  color: var(--vkui--color_text_tertiary, var(--text-tertiary));
  font-size: 0.875rem;
  line-height: 1.35;
}

.note-table-scroll {
  width: 100%;
  max-width: 100%;
  margin: 0.5rem 0 0.75rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.note-table-scroll table {
  margin: 0;
}

.note-editor-modal-body .note-editor-pad--tags {
  flex-shrink: 0;
  width: 100%;
  margin: 0 0 var(--space-2);
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.modal--sheet .modal-body .field,
.modal--sheet .modal-body .field-input,
.modal--sheet .modal-body .field-textarea {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

.modal--sheet .modal-body input[type="datetime-local"].field-input {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

html.modal-sheet-open {
  overflow: hidden;
}

html.modal-sheet-open body {
  overflow: hidden;
}

@media (max-width: 959px) {
  .note-editor-doc-layout {
    display: block;
  }

  #note-editor-overlay .note-editor-modal-content,
  #note-editor-overlay .note-editor-modal-content .note-editor-page,
  #note-editor-overlay .note-editor-doc-layout,
  #note-editor-overlay .note-editor-main-column {
    flex: 0 0 auto;
    min-height: auto;
    height: auto;
  }

  /* Нижний pad задаёт syncNoteEditorEndPad() под высоту тулбара + запас под курсор.
     Фиксированный 11.5rem избыточен, когда тулбар снова в потоке. */
  #note-editor-overlay .note-editor-modal-body {
    padding-bottom: 2rem;
  }

  #note-editor-overlay .note-editor-modal-content {
    padding-bottom: 0;
  }

  #note-editor-overlay .note-editor-pad--body,
  #note-editor-overlay .note-rich-editor,
  #note-editor-overlay .note-rich-editor-surface,
  #note-editor-overlay .note-rich-editor-body {
    flex: 0 0 auto;
    min-height: 0;
  }

  /* Web-canvas must still fill the note pane on narrow viewports */
  #note-editor-overlay.is-web-canvas-open .note-editor-modal-body,
  #note-editor-overlay.is-web-canvas-open .note-editor-modal-content,
  #note-editor-overlay.is-web-canvas-open .note-editor-modal-content .note-editor-page,
  #note-editor-overlay.is-web-canvas-open .note-editor-doc-layout,
  #note-editor-overlay.is-web-canvas-open .note-editor-main-column,
  #note-editor-overlay.is-web-canvas-open .note-editor-pad--body.is-web-canvas-mode {
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  #note-editor-overlay.is-web-canvas-open .note-editor-modal-body {
    padding-bottom: 0 !important;
  }

  #note-editor-overlay.is-web-canvas-open .note-editor-pad--body.is-web-canvas-mode > .note-web-canvas-host,
  #note-editor-overlay.is-web-canvas-open .note-web-canvas,
  #note-editor-overlay.is-web-canvas-open .note-web-canvas-frame {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
  }

  /* Тулбар в потоке flex (не absolute): на iOS absolute+bottom уезжает под клавиатуру
     и съедает safe-area («системный» отступ home indicator). */
  #note-editor-overlay.note-editor-overlay--fullscreen .note-editor-toolbar-wrap:not(.hidden),
  #note-editor-overlay.note-editor-overlay--fullscreen
    .note-editor-toolbar-wrap--bottom:not(.hidden),
  .note-editor-sheet > .note-editor-modal-form > .note-editor-toolbar-wrap:not(.hidden),
  .note-editor-sheet
    > .note-editor-modal-form
    > .note-editor-toolbar-wrap--bottom:not(.hidden) {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: 30;
    flex-shrink: 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  html.note-editor-kb-open
    #note-editor-overlay.note-editor-overlay--fullscreen
    .note-editor-toolbar-wrap--bottom:not(.hidden),
  html.note-editor-kb-open
    .note-editor-sheet
    > .note-editor-modal-form
    > .note-editor-toolbar-wrap--bottom:not(.hidden) {
    padding-bottom: 10px;
  }

  .note-editor-toc-backdrop {
    display: none !important;
  }

  .note-editor-page--toc-open .note-editor-toc-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: block !important;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.45);
  }

  .note-editor-toc-panel {
    display: none !important;
  }

  .note-editor-page--toc-open .note-editor-toc-panel {
    display: flex !important;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    width: min(82vw, 20rem);
    max-width: calc(100vw - 40px);
    padding-top: max(12px, env(safe-area-inset-top, 0px));
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    border-right: 1px solid var(--overlay-4);
    background: var(--vkui--color_background_secondary);
    box-shadow: 18px 0 40px color-mix(in srgb, var(--shadow-color) 40%, transparent);
    transform: none;
    pointer-events: auto;
  }

  .note-rich-editor-body .note-editor-table,
  .note-body-html table,
  .journal-summary-html table {
    display: block;
    width: 100%;
    min-width: 100%;
    overflow-x: auto;
    table-layout: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .note-rich-editor-body .note-editor-table tbody,
  .note-body-html table tbody,
  .journal-summary-html table tbody {
    display: table;
    min-width: 34rem;
    width: max-content;
  }

  .note-rich-editor-body .note-editor-table th,
  .note-rich-editor-body .note-editor-table td,
  .note-body-html table th,
  .note-body-html table td,
  .journal-summary-html table th,
  .journal-summary-html table td {
    min-width: 8rem;
    white-space: normal;
  }

  /* Телефон: таблица не сжимается в ширину экрана (слова рвались посередине, дальние столбцы
     и их ручки были недоступны) — она шире экрана и прокручивается вбок в .note-table-manage-scroll. */
  .note-rich-editor-body .note-table-manage-wrap .note-editor-table {
    display: table;
    width: max-content;
    min-width: 100% !important;
    overflow: visible;
    table-layout: auto;
    white-space: normal;
  }

  .note-rich-editor-body .note-table-manage-wrap .note-editor-table tbody {
    display: table-row-group;
    min-width: 0;
    width: auto;
  }

  .note-rich-editor-body .note-table-manage-wrap .note-editor-table th,
  .note-rich-editor-body .note-table-manage-wrap .note-editor-table td {
    min-width: 5.5rem;
    max-width: 16rem;
    word-break: normal;
    overflow-wrap: normal;
    hyphens: manual;
  }

  #note-discussion-overlay .note-discuss-bubble {
    padding: 10px 12px;
    font-size: 0.9375rem;
  }

  #note-discussion-overlay .note-discuss-bubble.journal-summary-html,
  #note-discussion-overlay .note-discuss-bubble.note-body-html,
  #note-discussion-overlay .note-discuss-bubble--md {
    padding: 10px 12px;
  }

  #note-discussion-overlay .note-discuss-bubble table,
  #note-discussion-overlay .note-discuss-bubble.note-body-html table,
  #note-discussion-overlay .note-discuss-bubble.journal-summary-html table {
    display: table;
    width: max-content;
    min-width: 100%;
    max-width: none;
    white-space: normal;
  }

  #note-discussion-overlay .note-discuss-bubble table tbody,
  #note-discussion-overlay .note-discuss-bubble.note-body-html table tbody,
  #note-discussion-overlay .note-discuss-bubble.journal-summary-html table tbody {
    display: table-row-group;
    min-width: 0;
    width: auto;
  }

  #note-discussion-overlay .note-discuss-bubble table th,
  #note-discussion-overlay .note-discuss-bubble table td,
  #note-discussion-overlay .note-discuss-bubble.note-body-html table th,
  #note-discussion-overlay .note-discuss-bubble.note-body-html table td,
  #note-discussion-overlay .note-discuss-bubble.journal-summary-html table th,
  #note-discussion-overlay .note-discuss-bubble.journal-summary-html table td {
    min-width: 0;
    white-space: nowrap;
  }

  #note-discussion-overlay .note-paie-reply-form {
    gap: 10px;
    padding: 12px 14px;
    border-radius: 24px;
  }

  #note-discussion-overlay .note-paie-mode-compact,
  #note-discussion-overlay .note-paie-model-btn {
    height: 40px;
    padding: 8px 12px;
    font-size: 14px;
  }

  #note-discussion-overlay .note-paie-kb-toggle,
  #note-discussion-overlay .note-paie-send,
  #note-discussion-overlay .note-paie-attach {
    width: 40px;
    height: 40px;
  }
}

@media (min-width: 960px) {
  #note-paie-reply-input,
  #note-discussion-overlay .note-paie-composer-input,
  #note-discussion-overlay .note-paie-reply-form .note-comments-input {
    padding-top: 10px;
    padding-right: 4px;
    padding-bottom: 10px;
    padding-left: 4px;
  }

  #note-paie-reply-input.is-multiline,
  #note-discussion-overlay .note-paie-composer-input.is-multiline,
  #note-discussion-overlay .note-paie-reply-form .note-comments-input.is-multiline {
    padding-top: 4px;
    padding-right: 4px;
    padding-bottom: 4px;
    padding-left: 4px;
  }

  .note-editor-modal-content .note-editor-page {
    position: relative;
  }

  .note-editor-doc-layout {
    align-items: stretch;
    gap: 0;
    overflow: visible;
  }

  .note-editor-toc-close {
    display: none !important;
  }

  .note-editor-toc-backdrop {
    display: none;
  }

  .note-editor-page--toc-open .note-editor-toc-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 120;
    background: transparent;
  }

  /* TOC в ряду с листами — компактный чип, панель под кнопкой. */
  .note-editor-toc-anchor {
    position: relative;
    z-index: 131;
    flex: 0 0 auto;
    overflow: visible;
  }

  .note-editor-toc-toggle {
    width: 28px;
    height: 28px;
    margin: 0;
    border-color: var(--border);
    color: var(--vkui--color_text_secondary, var(--text-secondary));
    background: transparent;
    box-shadow: none;
  }

  .note-editor-toc-toggle:hover,
  .note-editor-page--toc-open .note-editor-toc-toggle {
    color: var(--vkui--color_text_accent, var(--accent));
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  }

  .note-editor-toc-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 130;
    flex: none;
    width: 15rem;
    max-width: min(15rem, calc(100vw - 96px));
    max-height: min(28rem, calc(100dvh - var(--note-editor-chrome-top, 54px) - 44px));
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 12px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-md, 0 8px 24px color-mix(in srgb, var(--shadow-color) 20%, transparent));
  }

  .note-editor-page--toc-open .note-editor-toc-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

@media (max-width: 959px) {
  #modal-overlay.modal-overlay {
    align-items: stretch;
    padding: 0;
  }

  #modal-overlay .modal.modal--sheet {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-width: 479px) {
  .modal--sheet .modal-header,
  .modal--sheet .modal-body {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }
}

.modal-sheet-actions {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.modal-sheet-actions .modal-done-btn,
.modal-sheet-actions .modal-link-btn,
.modal-sheet-actions .modal-archive-btn,
.modal-sheet-actions .modal-delete-btn {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  min-height: var(--vkui--size_button_large_height--regular, 44px);
  margin: 0;
  padding: 0 var(--space-3);
  border: none;
  border-radius: var(--vkui--size_border_radius--regular, 10px);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  background: var(--vkui--color_background_secondary_alpha, var(--surface-muted));
}

.modal-done-btn {
  color: var(--success);
}

.modal-archive-btn {
  color: var(--text-secondary);
}

.modal-sheet-actions .modal-link-btn {
  flex: 0 0 auto;
  gap: 6px;
  color: var(--accent);
}

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

.modal-delete-btn,
.modal-sheet-actions .modal-delete-btn.btn-text-danger {
  color: var(--vkui--color_text_negative, var(--danger));
  background: var(--vkui--color_background_secondary_alpha, var(--surface-muted));
}

.modal-done-btn:active,
.modal-link-btn:active,
.modal-archive-btn:active,
.modal-sheet-actions .modal-delete-btn:active {
  opacity: 0.75;
}

.modal-done-btn.hidden,
.modal-archive-btn.hidden,
.modal-delete-btn.hidden {
  display: none;
}

/* Одна кнопка на всю ширину, если остальные скрыты */
.modal-sheet-actions .modal-done-btn:only-child,
.modal-sheet-actions .modal-archive-btn:only-child,
.modal-sheet-actions .modal-delete-btn:only-child {
  flex: 1 1 100%;
}

.modal-title {
  margin: 0 0 var(--space-4);
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.modal--sheet .modal-title {
  grid-column: 2;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 650;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  margin-top: var(--space-4);
}

.modal-actions--stack {
  flex-direction: column;
  align-items: stretch;
}

.modal-text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.btn-text-danger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--vkui--size_button_large_height--regular, 44px);
  padding: 0 var(--space-4);
  border: none;
  border-radius: var(--vkui--size_border_radius--regular, 10px);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--vkui--color_text_negative, var(--danger));
  background: transparent;
  cursor: pointer;
}

.btn-text-danger:active {
  opacity: 0.75;
}

.note-editor-header-save {
  flex-shrink: 0;
}

.notes-detail--note-editor .notes-detail-footer {
  display: none !important;
}

/* GPT overlay */
.gpt-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  background: var(--bg);
}

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

.gpt-overlay-backdrop {
  display: none;
}

.gpt-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  max-width: var(--max-w);
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
  border: none;
  border-radius: 0;
  background: var(--bg);
  box-shadow: none;
}

.gpt-sheet-toolbar {
  display: flex;
  flex-shrink: 0;
  gap: var(--space-2);
  align-items: center;
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.gpt-sheet-brand {
  display: flex;
  flex: 1;
  gap: var(--space-3);
  align-items: center;
  min-width: 0;
}

.gpt-brand-avatar {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  color: var(--on-accent);
  background: var(--accent);
}

.gpt-brand-text {
  min-width: 0;
}

.gpt-brand-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.gpt-context-line {
  margin: var(--space-1) 0 0;
  overflow: hidden;
  font-size: 0.6875rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.gpt-scroll {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.gpt-messages {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 6rem;
  padding: var(--space-3);
  overflow-y: visible;
}

.gpt-bubble {
  max-width: 92%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.gpt-bubble--user {
  align-self: flex-end;
  color: var(--on-accent);
  background: var(--accent);
  border-bottom-right-radius: var(--radius-xs);
}

.gpt-bubble--assistant {
  align-self: flex-start;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: var(--radius-xs);
}

.gpt-hints-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-start;
  padding: var(--space-1) var(--space-3) var(--space-4);
}

.gpt-hints-label {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

.gpt-hints-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-2);
  width: 100%;
  overflow-x: auto;
  padding-bottom: var(--space-1);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.gpt-hints-scroll::-webkit-scrollbar {
  display: none;
}

.gpt-hint-chip {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  padding: 0.45rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  text-align: left;
  white-space: nowrap;
  background: var(--accent-subtle);
  cursor: pointer;
}

.gpt-compose-bar {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-3) max(var(--space-3), env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.gpt-compose-inner {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.gpt-input {
  flex: 1;
  min-width: 0;
  max-height: 6.5rem;
  padding: var(--space-2) 0;
  border: none;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.4;
  resize: none;
  background: transparent;
}

.gpt-input:focus {
  outline: none;
}

.gpt-send-fab {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: var(--radius-full);
  color: var(--on-accent);
  background: var(--accent);
  cursor: pointer;
}

/* Legacy / misc */
.sheet,
.integration,
.badge,
.actions,
.kv,
.hint,
.footnote,
.promo-stack,
.promo-label,
.promo-input,
.promo-apply,
.check-row {
  /* kept for compatibility if injected elsewhere */
}

#panel-notes.panel:not(.hidden),
#panel-knowledge.panel:not(.hidden) {
  display: block;
}

.pay-submit-btn {
  border-radius: var(--radius-md);
}

@media (min-width: 480px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    border-radius: var(--radius-lg, 16px) var(--radius-lg, 16px) 0 0;
  }

  .modal-overlay:not(.hidden) .modal--sheet {
    animation: modal-sheet-in 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  }

  .gpt-overlay {
    align-items: center;
    padding: var(--space-4);
    background: rgba(0, 0, 0, 0.6);
  }

  .gpt-sheet {
    flex: 0 1 auto;
    max-height: min(88dvh, 36rem);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
  }
}

/* ——— Desktop: sidebar nav + two-column cards ——— */
@media (min-width: 960px) {
  :root {
    --sidebar-w: 16.75rem;
    --sidebar-w-collapsed: 4.5rem;
    --content-max: 70rem;
    --discuss-w: var(--max-w);
    --page-x: 2rem;
    --page-bottom: 6.5rem;
    --tabbar-stack: 0px;
  }

  #note-paie-reply-input,
  #note-discussion-overlay .note-paie-composer-input {
    padding-top: 10px;
    padding-right: 4px;
    padding-bottom: 10px;
    padding-left: 4px;
  }

  #note-paie-reply-input.is-multiline,
  #note-discussion-overlay .note-paie-composer-input.is-multiline {
    padding-top: 10px;
    padding-right: 4px;
    padding-bottom: 10px;
    padding-left: 4px;
  }

  html.tg-miniapp-fullscreen {
    --tabbar-stack: 0px;
    --page-bottom: 6.5rem;
  }

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

  .app {
    max-width: none;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  .app.app--immersive .tabbar-wrap,
  .app.app--immersive .tabbar-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .app.app--immersive .main-scroll {
    overflow-y: auto;
    padding-bottom: var(--page-bottom);
  }

  html.sidebar-collapsed {
    --sidebar-w: var(--sidebar-w-collapsed);
  }

  .tabbar-backdrop {
    top: 0;
    right: auto;
    bottom: 0;
    left: 0;
    width: var(--sidebar-w);
    height: auto;
    border-right: 1px solid var(--border);
    transition: width 180ms ease;
  }

  .tabbar-wrap {
    top: 0;
    right: auto;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    max-width: none;
    height: 100dvh;
    margin: 0;
    padding: 1.25rem 0.85rem 1.25rem;
    padding-bottom: 1.25rem;
    overflow: hidden;
    border-right: 1px solid var(--border);
    pointer-events: auto;
    transition: width 180ms ease, padding 180ms ease;
  }

  .sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
    flex-shrink: 0;
    margin: 0 0 1.15rem;
    min-width: 0;
  }

  .sidebar-brand {
    display: block;
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0.55rem 0.35rem 0.15rem 0.5rem;
    overflow: hidden;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    background: transparent;
    cursor: pointer;
  }

  .sidebar-toggle:hover,
  .sidebar-toggle:focus-visible {
    color: var(--text);
    background: var(--surface-muted);
  }

  .sidebar-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
  }

  .sidebar-toggle svg {
    display: block;
    transition: transform 180ms ease;
  }

  html.sidebar-collapsed .tabbar-wrap {
    padding-left: 0.45rem;
    padding-right: 0.45rem;
  }

  html.sidebar-collapsed .sidebar-head {
    justify-content: center;
    margin-bottom: 0.85rem;
  }

  html.sidebar-collapsed .sidebar-brand {
    display: none;
  }

  /* Свёрнутое меню: вверху иконка Orbita; при наведении на неё — кнопка «развернуть» на том же месте. */
  html.sidebar-collapsed .sidebar-head {
    display: grid;
    place-items: center;
  }

  html.sidebar-collapsed .sidebar-logo {
    display: block;
    grid-area: 1 / 1;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    pointer-events: none;
    transition: opacity 140ms ease;
  }

  html.sidebar-collapsed .sidebar-toggle {
    grid-area: 1 / 1;
    opacity: 0;
    transition: opacity 140ms ease;
  }

  html.sidebar-collapsed .sidebar-head:hover .sidebar-logo,
  html.sidebar-collapsed .sidebar-head:focus-within .sidebar-logo {
    opacity: 0;
  }

  html.sidebar-collapsed .sidebar-head:hover .sidebar-toggle,
  html.sidebar-collapsed .sidebar-head:focus-within .sidebar-toggle {
    opacity: 1;
  }

  html.sidebar-collapsed .sidebar-toggle svg {
    transform: scaleX(-1);
  }

  html.sidebar-collapsed .tabbar-btn {
    justify-content: center;
    gap: 0;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
  }

  html.sidebar-collapsed .tabbar-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  @media (prefers-reduced-motion: reduce) {
    .tabbar-backdrop,
    .tabbar-wrap,
    .main-scroll,
    #note-editor-overlay,
    #notes-detail:not(.hidden),
    #digest-detail:not(.hidden),
    .profile-subscreen:not(.hidden) {
      transition: none;
    }
  }

  .tabbar {
    flex: 1;
    flex-direction: column;
    align-items: stretch;
    gap: 0.3rem;
    min-height: 0;
    padding: 0.15rem 0 0;
    overflow-x: hidden;
    overflow-y: auto;
    border-top: none;
    background: transparent;
    -webkit-overflow-scrolling: touch;
  }

  .tabbar-btn {
    position: relative;
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.72rem 0.85rem;
    overflow: hidden;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
  }

  .tabbar-btn:not(.active) {
    color: var(--text-secondary);
  }

  .tabbar-btn[data-tab="profile"] {
    margin-top: auto;
  }

  .sidebar-nav-group {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    min-width: 0;
  }

  .sidebar-nav-group > .tabbar-btn {
    width: 100%;
    padding-right: 0.5rem;
  }

  .sidebar-nav-group > .tabbar-btn .tabbar-label {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
  }

  .sidebar-tree-toggle {
    display: inline-flex !important;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    background: transparent;
    cursor: pointer;
  }

  .sidebar-tree-toggle:hover,
  .sidebar-tree-toggle:focus-visible {
    color: var(--text);
    background: var(--overlay-3);
  }

  .tabbar-btn.active .sidebar-tree-toggle {
    color: inherit;
  }

  .sidebar-tree-toggle svg {
    display: block;
    transition: transform 160ms ease;
  }

  .sidebar-tree-toggle.is-open svg {
    transform: rotate(180deg);
  }

  html.sidebar-collapsed .sidebar-tree-toggle,
  html.sidebar-collapsed .sidebar-tree {
    display: none !important;
  }

  .sidebar-tree {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    margin: 0.1rem 0 0.35rem;
    /* Depth-0 chevron sits midway between tabbar icon and label */
    padding: 0 0.5rem 0 1.65rem;
    min-width: 0;
  }

  .sidebar-tree:not(.hidden) {
    display: flex !important;
  }

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

  .sidebar-tree-branch {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .sidebar-tree-children {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
  }

  .sidebar-tree-children::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0.15rem;
    left: calc(var(--parent-depth, 0) * 0.95rem + 13px);
    width: 1px;
    background: color-mix(in srgb, var(--border) 88%, transparent);
    pointer-events: none;
  }

  .sidebar-tree-row {
    display: flex;
    align-items: center;
    min-width: 0;
    /* Nested chevrons sit between parent chevron and parent label */
    padding-left: calc(var(--sidebar-depth, 0) * 0.95rem);
  }

  .sidebar-tree-label {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 0.2rem;
    min-width: 0;
    width: 100%;
    margin: 0;
    padding: 0.2rem 0.35rem 0.2rem 0;
    border: none;
    border-radius: 8px;
    color: var(--text-subtle);
    background: transparent;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
  }

  .sidebar-tree-row--section > .sidebar-tree-label {
    font-weight: 600;
  }

  .sidebar-tree-label-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-tree-chevron,
  .sidebar-tree-chevron-spacer {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 8px;
    color: var(--text-tertiary);
    background: transparent;
  }

  .sidebar-tree-chevron {
    pointer-events: auto;
    cursor: pointer;
  }

  .sidebar-tree-chevron-spacer {
    visibility: hidden;
    pointer-events: none;
  }

  .sidebar-tree-chevron svg {
    display: block;
    width: 12px;
    height: 12px;
    transition: transform 140ms ease;
  }

  .sidebar-tree-chevron.is-open svg {
    transform: rotate(180deg);
  }

  .sidebar-tree-label:hover .sidebar-tree-chevron {
    color: var(--text);
  }

  .sidebar-tree-label:hover {
    color: var(--text);
    background: var(--surface-muted);
  }

  .sidebar-tree-row.is-active > .sidebar-tree-label {
    color: var(--text);
    background: var(--accent-muted);
  }

  .sidebar-tree-row--leaf .sidebar-tree-label {
    font-weight: 400;
  }

  .sidebar-tree-label--action,
  .sidebar-tree-label--action:hover {
    color: var(--text-secondary);
    font-weight: 400;
  }

  .sidebar-tree-label--action:hover {
    color: var(--text);
    background: var(--surface-muted);
  }

  .sidebar-tree-empty {
    margin: 0;
    padding: 0.2rem 0.35rem 0.35rem 28px;
    color: var(--text-tertiary);
    font-size: 0.8125rem;
  }

  .tabbar-btn--knowledge {
    display: flex;
  }

  .tabbar-btn:hover {
    color: var(--text);
    background: var(--surface-muted);
  }

  .tabbar-btn.active {
    color: var(--accent);
    background: var(--accent-muted);
  }

  .tabbar-btn.active:hover {
    background: var(--accent-muted);
  }

  .tabbar-icon svg {
    width: 1.3rem;
    height: 1.3rem;
  }

  .tabbar-label {
    font-size: 0.9375rem;
    font-weight: 600;
  }

  .main-scroll {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    max-width: none;
    height: 100dvh;
    padding: 1.75rem 2.25rem var(--page-bottom);
    transition: margin-left 180ms ease, width 180ms ease;
  }

  .main-scroll > .panel {
    width: 100%;
    max-width: var(--content-max);
    margin-left: auto;
    margin-right: auto;
  }

  .hero-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "title stats"
      "kicker stats";
    align-items: center;
    column-gap: var(--space-6);
    row-gap: 0.15rem;
  }

  .hero-inner .hero-title {
    grid-area: title;
    margin: 0;
  }

  .hero-inner .hero-kicker {
    grid-area: kicker;
  }

  .hero-inner .hero-stats {
    grid-area: stats;
    align-self: center;
  }

  #reminders-list.stack {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-3);
    align-items: stretch;
  }

  .notes-pane--stack {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    align-items: stretch;
  }

  #digest-list.digest-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    align-items: stretch;
  }

  #digest-list .digest-day-head {
    grid-column: 1 / -1;
  }

  #digest-list .digest-card {
    height: 100%;
    min-width: 0;
  }

  #reminders-list .reminder-card {
    padding: var(--space-3);
    padding-right: calc(var(--space-3) + 1.75rem);
  }

  #reminders-list .reminder-text {
    font-size: 0.8125rem;
  }

  .meetings-week-head,
  .meetings-week-allday,
  .meetings-week-body {
    min-width: 0;
    grid-template-columns: 2.75rem repeat(7, minmax(0, 1fr));
  }

  .meetings-week-grid {
    --week-hour-h: 52px;
  }

  .meetings-month-cell {
    min-height: 7.2rem;
  }

  .meetings-board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
    align-items: start;
  }

  .meetings-day-title {
    display: block;
  }

  .meetings-day--next {
    display: block;
    min-width: 0;
  }

  .meetings-day--today .meetings-day-title {
    color: var(--accent);
  }

  .day-timeline {
    --day-hour-h: 64px;
  }

  #meetings-list.meetings-stack,
  #meetings-list-next.meetings-stack {
    display: flex;
    flex-direction: column;
    column-count: unset;
  }

  #meetings-list .meeting-row,
  #meetings-list-next .meeting-row {
    width: 100%;
    margin: 0;
    min-width: 0;
  }

  #reminders-list .swipe-row,
  .notes-pane--stack .swipe-row,
  .notes-pane--stack .note-card,
  .notes-pane--stack .content-card {
    height: 100%;
    min-width: 0;
  }

  .notes-pane--stack > .empty-hint,
  .notes-pane--stack > .error {
    grid-column: 1 / -1;
  }

  /* Профиль на десктопе — сетка: сверху аккаунт и кошелёк, ниже группы карточками в ряд, сервисы плитками. */
  #profile-main:not(.hidden) {
    max-width: 68rem;
    gap: 1.25rem;
  }

  #profile-main .pf-side {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    align-items: stretch;
    gap: 1rem;
  }

  #profile-main .profile-head {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    background: var(--surface);
  }

  #profile-main .pf-body {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 1rem;
  }

  #profile-main .pf-body > :not(.pf-group) {
    grid-column: 1 / -1;
  }

  #profile-main #profile-logout-wrap {
    justify-self: start;
    min-width: 12rem;
  }

  #profile-main .pf-svc-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    padding: 0.5rem;
  }

  #profile-main .pf-svc-list .pf-svc {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    min-height: 0;
    padding: 0.75rem;
    border-radius: var(--radius-md, 10px);
    background: var(--surface-muted);
  }

  #profile-main .pf-svc-list .pf-svc .pf-row-body {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    width: 100%;
    padding: 0;
    border-top: 0;
  }

  #profile-main .pf-svc-list .pf-svc .pf-row-text {
    width: 100%;
  }

  #profile-main .pf-svc-list .pf-svc .pf-chev {
    display: none;
  }

  #profile-main .pf-svc-list .pf-more {
    grid-column: 1 / -1;
    border-top: 0;
    padding: 0.35rem 0.25rem;
  }

  .notes-fab,
  .actual-create-menu {
    right: 2rem;
  }

  .notes-fab {
    bottom: 2rem;
  }

  .actual-create-menu {
    bottom: 5.75rem;
    width: 14rem;
  }

  .contacts-fab,
  .contacts-create-menu {
    right: 2rem;
  }

  .contacts-fab {
    bottom: 2rem;
  }

  .contacts-create-menu {
    bottom: 5.75rem;
  }

  #notes-detail:not(.hidden),
  #digest-detail:not(.hidden),
  #profile-payment:not(.hidden),
  #profile-expenses:not(.hidden),
  #profile-booking:not(.hidden),
  #profile-contacts:not(.hidden),
  #profile-calendars:not(.hidden),
  #profile-zoom:not(.hidden),
  #profile-telemost:not(.hidden),
  #profile-yandex-disk:not(.hidden),
  #profile-bitrix:not(.hidden),
  #profile-knowledge-base:not(.hidden),
  #profile-agents:not(.hidden),
  #profile-chats:not(.hidden),
  #profile-voice:not(.hidden) {
    left: var(--sidebar-w);
    right: 0;
    max-width: none;
    margin: 0;
    transition: left 180ms ease;
  }

  #notes-detail:not(.hidden) > .notes-detail-sticky,
  #notes-detail:not(.hidden) > .detail-body,
  #notes-detail:not(.hidden) > .notes-detail-footer,
  #digest-detail:not(.hidden) > .notes-detail-sticky,
  #digest-detail:not(.hidden) > .detail-body,
  .profile-subscreen:not(.hidden) > .detail-toolbar,
  .profile-subscreen:not(.hidden) > .subscreen-body,
  .profile-subscreen:not(.hidden) > .pay-footer {
    width: 100%;
    max-width: var(--content-max);
    margin-left: auto;
    margin-right: auto;
  }

  #notes-detail.notes-detail--note-editor:not(.hidden) > .notes-detail-sticky,
  #notes-detail.notes-detail--note-editor:not(.hidden) > .detail-body,
  #notes-detail.notes-detail--note-editor:not(.hidden) > .notes-detail-footer {
    max-width: 46rem;
  }

  .subscreen-body,
  .detail-body {
    padding-left: var(--page-x);
    padding-right: var(--page-x);
  }

  .modal-overlay {
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.55);
  }

  #modal-overlay.modal-overlay {
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
  }

  #modal-overlay.modal-overlay:not(.hidden) .modal--sheet {
    animation: modal-center-in 0.2s ease;
  }

  .modal,
  .modal--sheet {
    width: min(32rem, 100%);
    max-width: 32rem;
    max-height: min(88dvh, 44rem);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-md);
    padding-bottom: var(--space-5);
  }

  .teams-manage-sheet.modal--sheet {
    height: min(100dvh, 100vh);
    max-height: min(100dvh, 100vh);
    width: min(32rem, 100%);
    max-width: 32rem;
    border-radius: var(--radius-lg, 16px);
    padding-bottom: 0;
  }

  .voice-sheet {
    width: min(36rem, 100%);
    max-width: 36rem;
    min-height: 0;
    max-height: min(86dvh, 42rem);
  }

  .voice-chat {
    max-height: 18rem;
  }

  #note-editor-overlay {
    left: var(--sidebar-w);
    right: 0;
    padding: 0;
    background: var(--bg);
    backdrop-filter: none;
    transition: right 180ms ease, width 180ms ease, left 180ms ease;
  }

  html:not(.note-discussion-open)
    #note-editor-overlay.note-editor-overlay--sized:not(.hidden) {
    right: auto;
    width: var(--note-pane-w);
    border-right: 1px solid var(--border);
    box-shadow: 12px 0 32px color-mix(in srgb, var(--shadow-color) 22%, transparent);
  }

  html.note-discussion-open #note-editor-overlay {
    right: var(--discuss-w, var(--max-w));
    width: auto;
  }

  html.note-pane-resizing #note-editor-overlay,
  html.note-pane-resizing .note-discussion-overlay {
    transition: none;
  }

  html.note-pane-resizing,
  html.note-pane-resizing body {
    cursor: col-resize;
    user-select: none;
  }

  #note-editor-overlay .note-editor-sheet {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: 100dvh;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  #note-editor-overlay:not(.hidden) .note-pane-resizer,
  html.note-discussion-open .note-discuss-resizer {
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 40;
    width: 10px;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    cursor: col-resize;
    touch-action: none;
    user-select: none;
  }

  #note-editor-overlay .note-pane-resizer {
    right: 0;
  }

  html.note-discussion-open #note-editor-overlay .note-pane-resizer {
    display: none;
  }

  html.note-discussion-open .note-discuss-resizer {
    left: 0;
  }

  .note-pane-resizer::after,
  .note-discuss-resizer::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    border-radius: 1px;
    background: transparent;
    transition: background 0.15s ease;
  }

  .note-pane-resizer:hover::after,
  .note-discuss-resizer:hover::after,
  .note-pane-resizer:focus-visible::after,
  .note-discuss-resizer:focus-visible::after,
  html.note-pane-resizing .note-pane-resizer::after,
  html.note-pane-resizing .note-discuss-resizer::after {
    background: var(--accent);
  }

  .note-pane-resizer:focus,
  .note-discuss-resizer:focus {
    outline: none;
  }

  .note-discussion-overlay {
    left: auto;
    right: 0;
    width: var(--discuss-w, var(--max-w));
    max-width: none;
    justify-content: stretch;
    border-left: 1px solid var(--border);
    box-shadow: none;
  }

  .note-discussion-sheet {
    max-width: none;
    height: 100%;
    max-height: 100%;
  }

  html.note-discussion-open .note-discussion-card {
    display: none !important;
  }

  .gpt-overlay {
    padding: 2rem;
  }

  .gpt-sheet {
    width: min(40rem, 100%);
    max-width: 40rem;
    max-height: min(88dvh, 44rem);
  }

  .gate-card {
    max-width: 26rem;
  }

  #note-discussion-overlay .note-discussion-compose.note-paie-thread {
    padding-left: 0;
    padding-right: 0;
  }

  #note-discussion-overlay .note-paei-status {
    padding-left: 20px;
    padding-right: 20px;
  }

  #note-discussion-overlay .note-paie-reply-form {
    margin-left: 4px;
    margin-right: 4px;
    padding-left: 20px;
    padding-right: 20px;
  }

  #note-discussion-overlay .note-paie-composer-row {
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 4px;
  }

  #note-discussion-overlay #note-paie-reply-input,
  #note-discussion-overlay .note-paie-composer-input {
    padding-top: 10px !important;
    padding-right: 4px !important;
    padding-bottom: 10px !important;
    padding-left: 4px !important;
  }

  #note-discussion-overlay #note-paie-reply-input.is-multiline,
  #note-discussion-overlay .note-paie-composer-input.is-multiline {
    padding-top: 10px !important;
    padding-right: 4px !important;
    padding-bottom: 10px !important;
    padding-left: 4px !important;
  }
}

.offline-sync-banner {
  position: fixed;
  left: 50%;
  bottom: calc(12px + var(--tabbar-safe, 64px) + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 120000;
  max-width: min(92vw, 360px);
  padding: 8px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--text);
  font: 600 13px/1.3 "VK Sans Display", "Segoe UI", sans-serif;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--shadow-color) 35%, transparent);
  pointer-events: none;
}
.offline-sync-banner.hidden {
  display: none;
}

/* Дайджест */
.digest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px 0;
}
.digest-head .screen-title {
  margin: 0;
}
.digest-subtabs-row {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
  margin: 0 0 var(--space-4);
}
.digest-refresh-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--app-surface);
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.digest-refresh-btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.digest-refresh-btn.is-spinning svg {
  animation: digest-spin 0.8s linear infinite;
}
@keyframes digest-spin {
  to {
    transform: rotate(-360deg);
  }
}
.digest-list {
  margin-top: 0;
}
.digest-day-head {
  margin: 16px 4px 6px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.7;
}
.digest-card.note-card {
  text-align: left;
  width: 100%;
  position: relative;
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}
.digest-card .note-card-title {
  margin: 0 0 2px;
}
.digest-card .note-card-preview {
  margin: 0;
}
.digest-demo-pill,
.digest-demo-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--overlay-3);
  margin: 4px 0;
}
.digest-section {
  margin: 16px 0;
}
.note-editor-pad--body .digest-section {
  margin: 1.1rem 0;
}
.digest-section-title {
  margin: 0 0 8px;
  font-size: 15px;
}
.note-editor-pad--body .digest-section-title {
  font-size: 1.05rem;
}
.digest-section ul {
  margin: 0;
  padding-left: 1.2em;
}
.digest-market {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}
.digest-market-header {
  margin: 0;
}
.digest-market-eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.digest-market-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 650;
  line-height: 1.25;
}
.digest-market-lead,
.digest-market-meta {
  margin: 0 0 6px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.45;
}
.digest-market-section {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--surface);
}
.digest-market-section h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 650;
}
.digest-market-section h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
}
.digest-market-section h3 a {
  color: var(--accent);
  text-decoration: none;
}
.digest-market-section h3 a:hover {
  text-decoration: underline;
}
.digest-market-card {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.digest-market-card:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.digest-market-meta-line,
.digest-market-why,
.digest-market-footer {
  margin: 0 0 6px;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  line-height: 1.4;
}
.digest-market-strategy {
  display: grid;
  gap: 10px;
}
.digest-market-strategy-item {
  position: relative;
}
.digest-market-strategy-trigger {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--surface-muted);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}
.digest-market-strategy-trigger[aria-expanded="true"] {
  border-color: var(--accent);
}
.digest-market-strategy-hint {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.digest-market-strategy-tip {
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--bg);
}
.digest-market-strategy-tip[hidden] {
  display: none !important;
}
.digest-market-strategy-tip p {
  margin: 0 0 8px;
  color: var(--text-secondary);
  font-size: 0.75rem;
}
.digest-market-strategy-tip ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.digest-market-strategy-tip li + li {
  margin-top: 10px;
}
.digest-market-strategy-tip a {
  color: var(--accent);
  text-decoration: none;
}
.digest-market-strategy-tip span {
  display: block;
  margin-top: 2px;
  color: var(--text-tertiary);
  font-size: 0.7rem;
}
.digest-market-section ul {
  margin: 0;
  padding-left: 1.15em;
}
.digest-market-section li + li {
  margin-top: 8px;
}
.digest-market-pill {
  display: inline-block;
  margin: 3px 6px 3px 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 0.75rem;
}
.digest-market-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  align-items: start;
}
.digest-market-grid > section,
.digest-market-grid > aside {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}
@media (min-width: 960px) {
  .digest-market-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    gap: 1.35rem;
  }
  .digest-market-title {
    font-size: clamp(1.75rem, 2.4vw, 2.75rem);
    line-height: 1.08;
  }
  .digest-market-section h2 {
    font-size: 1.35rem;
  }
  .digest-market-section {
    padding: 1.35rem;
    border-radius: 1.25rem;
  }
}
.tabbar-btn--digest.hidden,
.tabbar-btn--digest[hidden] {
  display: none !important;
}

/* List cards: cheaper paint while scrolling (quick native-feel win). */
#reminders-list > .swipe-row,
#notes-list > .swipe-row,
#notes-list > .note-card,
.notes-pane--stack .swipe-row,
.notes-pane--stack .note-card {
  /* content-visibility:auto убрали: карточки разной высоты «прыгали» при прокрутке на телефоне */
}

/* ——— Сабтаб «Чаты» (AI-треды) ——— */
.chat-threads-pane {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

.chat-threads-splitter {
  display: none;
  flex: 0 0 1px;
  width: 1px;
  align-self: stretch;
  background: var(--border);
}

.chat-threads-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.chat-thread-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.65rem 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  background: transparent;
  transition: background 0.12s ease;
}

.chat-thread-row:hover,
.chat-thread-row.is-active {
  background: var(--overlay-1);
}

.chat-thread-row.is-active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.chat-thread-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.chat-thread-row-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-thread-row-title .chat-thread-pin {
  display: inline-block;
  margin-right: 0.35rem;
  color: var(--accent);
  vertical-align: -0.05em;
}

.chat-thread-row-preview {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--text-subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-thread-more-wrap {
  position: relative;
  flex-shrink: 0;
}

.chat-thread-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  color: var(--text-subtle);
  background: transparent;
  cursor: pointer;
}

.chat-thread-more-btn:hover,
.chat-thread-more-btn[aria-expanded="true"] {
  color: var(--text);
  background: var(--overlay-3);
}

.chat-thread-menu {
  min-width: 11rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--vkui--color_background_content);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--shadow-color) 40%, transparent);
}

.chat-thread-menu.hidden {
  display: none;
}

.chat-thread-menu-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}

.chat-thread-menu-item:hover {
  background: var(--overlay-3);
}

.chat-thread-menu-item--danger {
  color: var(--danger);
}

.chat-thread-pane {
  display: none;
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.chat-thread-empty {
  margin: auto;
  padding: 2rem 1.25rem;
  text-align: center;
  font-size: 0.9375rem;
}

.chat-thread-empty:not(.hidden) {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.chat-thread-empty .pf-btn {
  width: auto;
  margin-top: 0.25rem;
  padding: 0.55rem 1.25rem;
}

/* Контурная иллюстрация над заголовком пустой правой половины (документы / чаты) */
.empty-illo {
  display: block;
  width: 120px;
  height: 96px;
  margin-bottom: 8px;
  color: var(--text-tertiary);
}

.empty-illo * {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-illo .illo-page {
  fill: var(--surface);
}

.empty-illo .illo-accent {
  stroke: var(--accent);
}

html.notes-chats-tab.chats-split-open #note-discussion-close {
  display: none !important;
}

@media (min-width: 960px) {
  html.notes-chats-tab #panel-notes:not(.hidden),
  #panel-notes:not(.hidden):has(#notes-pane-chats:not(.hidden)) {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 3.5rem);
  }

  html.notes-chats-tab #notes-root,
  #panel-notes:has(#notes-pane-chats:not(.hidden)) #notes-root {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
  }

  html.notes-chats-tab #notes-pane-chats.chat-threads-pane,
  #notes-pane-chats.chat-threads-pane:not(.hidden) {
    display: flex;
    flex: 1 1 auto;
    flex-direction: row;
    align-items: stretch;
    min-height: 0;
    height: auto;
    max-height: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 12px);
    overflow: hidden;
  }

  html.notes-chats-tab #notes-pane-chats #chat-threads-list,
  #notes-pane-chats:not(.hidden) #chat-threads-list {
    width: 300px;
    flex: 0 0 300px;
    overflow-y: auto;
    border-right: none;
    max-height: none;
    height: 100%;
  }

  html.notes-chats-tab #notes-pane-chats .chat-threads-splitter,
  #notes-pane-chats:not(.hidden) .chat-threads-splitter {
    display: block;
  }

  html.notes-chats-tab #notes-pane-chats #chat-thread-pane,
  #notes-pane-chats:not(.hidden) #chat-thread-pane {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    position: relative;
    min-width: 0;
    max-height: none;
    height: 100%;
  }

  html.chats-split-open #chat-thread-pane #note-discussion-overlay,
  #chat-thread-pane #note-discussion-overlay {
    position: absolute !important;
    inset: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    max-width: none !important;
    border: none !important;
    box-shadow: none !important;
    z-index: 2;
    background: var(--bg);
  }

  html.chats-split-open #chat-thread-pane #note-discussion-overlay .note-discuss-resizer,
  #chat-thread-pane #note-discussion-overlay .note-discuss-resizer {
    display: none !important;
  }

  html.chats-split-open #chat-thread-pane #note-discussion-overlay .note-discussion-sheet,
  #chat-thread-pane #note-discussion-overlay .note-discussion-sheet {
    max-width: none;
    height: 100%;
    max-height: 100%;
  }
}

/* Hosted chat discussion: fills #chat-thread-pane regardless of desktop dock styles */
#chat-thread-pane > .note-discussion-overlay.chat-hosted-discussion,
.note-discussion-overlay.chat-hosted-discussion {
  position: absolute !important;
  inset: 0 !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 5 !important;
  border: none !important;
  box-shadow: none !important;
  background: var(--bg) !important;
  pointer-events: auto !important;
}

#chat-thread-pane > .note-discussion-overlay.chat-hosted-discussion .note-discussion-sheet,
.note-discussion-overlay.chat-hosted-discussion .note-discussion-sheet {
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  max-height: 100% !important;
}

#chat-thread-pane > .note-discussion-overlay.chat-hosted-discussion .note-discuss-resizer,
.note-discussion-overlay.chat-hosted-discussion .note-discuss-resizer {
  display: none !important;
}

#notes-pane-chats:not(.hidden) {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch;
  min-height: 0;
}

#notes-pane-chats:not(.hidden) #chat-threads-list {
  width: 300px;
  flex: 0 0 300px;
  overflow-y: auto;
  height: auto;
  max-height: none;
  align-self: stretch;
  position: relative;
  z-index: 3;
  visibility: visible !important;
}

#notes-pane-chats:not(.hidden) .chat-threads-splitter {
  display: block !important;
}

#notes-pane-chats:not(.hidden) #chat-thread-pane {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-direction: column;
  position: relative !important;
  min-width: 0;
  min-height: 0;
  height: auto !important;
  align-self: stretch;
  background: var(--bg);
}

@media (max-width: 959px) {
  #notes-pane-chats:not(.hidden) {
    flex-direction: column !important;
  }
  #notes-pane-chats:not(.hidden) #chat-threads-list {
    width: 100%;
    flex: 1 1 auto;
  }
  #notes-pane-chats:not(.hidden) .chat-threads-splitter,
  #notes-pane-chats:not(.hidden) #chat-thread-pane {
    display: none !important;
  }
}

.leo-prompt-overlay {

  position: fixed;
  inset: 0;
  z-index: 320;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.55);
}

.leo-prompt-sheet {
  width: min(22rem, 100%);
  padding: 1rem 1rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--vkui--color_background_content);
  box-shadow: 0 16px 40px color-mix(in srgb, var(--shadow-color) 45%, transparent);
}

.leo-prompt-message {
  margin: 0 0 0.75rem;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
}

.leo-prompt-input {
  width: 100%;
  margin: 0 0 0.85rem;
}

.leo-prompt-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
}

.note-draft-conflict-overlay {
  position: fixed;
  inset: 0;
  z-index: 340;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.55);
}

.note-draft-conflict-sheet {
  width: min(22rem, 100%);
  padding: 1rem 1rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--vkui--color_background_content);
  box-shadow: 0 16px 40px color-mix(in srgb, var(--shadow-color) 45%, transparent);
}

.note-draft-conflict-sheet p {
  margin: 0 0 0.85rem;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
}

.note-draft-conflict-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.note-draft-conflict-actions .btn,
.note-draft-conflict-actions .btn-text {
  width: 100%;
  justify-content: center;
}

.note-link-project-chips {
  flex: 0 0 auto;
  margin: 0 0 8px;
}


/* «Поручения» на «Актуальном»: «Ждут вас» / «В работе», команда, карточка с обсуждением */
#panel-actual.panel-actual--posted > #actual-hero,
#panel-actual.panel-actual--posted > #actual-focus,
#panel-actual.panel-actual--posted > .section,
#panel-actual.panel-actual--posted > .actual-fab,
#panel-actual.panel-actual--posted > #actual-create-menu,
#panel-actual.panel-actual--mytasks > #actual-hero,
#panel-actual.panel-actual--mytasks > #actual-focus,
#panel-actual.panel-actual--mytasks > .section,
#panel-actual.panel-actual--mytasks > .actual-fab,
#panel-actual.panel-actual--mytasks > #actual-create-menu {
  display: none !important;
}
#panel-actual.panel-actual--posted > #actual-posted-tasks,
#panel-actual.panel-actual--mytasks > #actual-my-tasks {
  display: flex !important;
  flex-direction: column;
  min-height: 60vh;
}
#actual-posted-tasks.actual-subscreen,
#actual-my-tasks.actual-subscreen,
.pt-sheet-overlay,
.pt-kghost {
  margin: 0;
  --pt-late: #ff6b5e;
  --pt-q: #f0b44c;
  --pt-ok: #5fd08a;
  --pt-card: var(--surface);
}
#actual-posted-tasks .subscreen-body.posted-body,
#actual-my-tasks .subscreen-body.posted-body {
  padding-left: 0;
  padding-right: 0;
  /* Своя прокрутка не нужна (листает общий контейнер); с ней лента команды выходила за край и экран ездил вбок. */
  overflow: visible;
}
/* Телефон: заголовок и «+» — в шапке, как на других вложенных экранах; под шапкой — только сводка. */
.pt-bar-actions { display: flex; justify-content: flex-end; min-width: 4.5rem; }
.pt-bar-actions .pt-btn.pt-bar-new { width: 34px; height: 34px; min-height: 34px; padding: 0; border-radius: 50%; }
@media (max-width: 959px) {
  .pt-head .pt-title, .pt-head .pt-head-actions { display: none; }
  .pt-head { margin-top: 0; }
  .pt-sub { margin-top: 0; }
}
@media (min-width: 960px) {
  .pt-bar-title, .pt-bar-actions { visibility: hidden; }
}
.pt-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 4px;
}
.pt-title {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.pt-sub { margin: 4px 0 0; font-size: 0.875rem; color: var(--text-secondary); }
.pt-head-actions { display: flex; gap: 8px; flex: none; }
.pt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pt-btn:active { opacity: 0.75; }
.pt-btn:disabled { opacity: 0.55; }
.pt-btn--primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.pt-head .pt-btn--primary { width: 36px; padding: 0; border-radius: 50%; }
.pt-only-desktop { display: none; }
.pt-search {
  width: 100%;
  margin: 10px 0 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}

/* Команда: вертикальные карточки с фото, бабл на фото — что ждёт вас */
.pt-team {
  display: flex;
  gap: 10px;
  margin: 14px calc(-1 * var(--page-x, 16px)) 0;
  padding: 2px var(--page-x, 16px) 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.pt-team::-webkit-scrollbar { display: none; }
.pt-tc {
  flex: none;
  width: 148px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--pt-card);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pt-tc.is-on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pt-tc-av { position: relative; margin-bottom: 6px; }
.pt-tc-name {
  width: 100%;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.25em;
}
.pt-tc-line { font-size: 0.76rem; line-height: 1.3; color: var(--text-secondary); }
.pt-tc-line.is-ok { color: var(--pt-ok); }
.pt-tc-line.is-late { color: var(--pt-late); }
.pt-tc-line.is-question { color: var(--pt-q); }
.pt-tc-line.is-done { color: var(--pt-ok); }
.pt-tc-due { font-size: 0.74rem; color: var(--text-tertiary); min-height: 1.2em; }
.pt-tc-due.is-late { color: var(--pt-late); }
.pt-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  border: 2px solid var(--pt-card);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  color: var(--on-accent);
}
.pt-badge--red { background: var(--danger); }
.pt-badge--green { background: var(--success); }
.pt-badge--green.is-second { top: auto; bottom: -4px; }
@media (max-width: 959px) {
  .pt-tc { width: 128px; padding: 10px; }
  .pt-tc-name { -webkit-line-clamp: 1; min-height: 0; }
  .pt-tc-av { margin-bottom: 4px; }
  .pt-tc .pt-av--l { width: 40px; height: 40px; font-size: 0.82rem; }
}

/* Аватар: фото поверх инициалов */
.pt-av {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.pt-av--l { width: 48px; height: 48px; font-size: 0.92rem; }
.pt-av--m { width: 44px; height: 44px; font-size: 0.85rem; }
.pt-av--s { width: 32px; height: 32px; font-size: 0.72rem; }
.pt-av--xs { width: 24px; height: 24px; font-size: 0.62rem; }
.pt-av-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.pt-av-img.has-photo { display: block; }
.pt-av--all { background: var(--surface-elevated); color: var(--text); font-variant-numeric: tabular-nums; }
.pt-tone--0 { background: color-mix(in srgb, var(--violet) 22%, transparent); color: var(--violet-soft); }
.pt-tone--1 { background: rgba(240, 120, 80, 0.22); color: color-mix(in srgb, var(--danger-text) 50%, var(--warning-text)); }
.pt-tone--2 { background: rgba(40, 180, 140, 0.22); color: var(--emerald-text); }
.pt-tone--3 { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-soft); }
.pt-tone--4 { background: rgba(220, 90, 150, 0.22); color: #f7a8cc; }
.pt-tone--5 { background: color-mix(in srgb, var(--warning) 22%, transparent); color: var(--warning-text); }

/* Секции и списки */
.pt-sec {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 18px 2px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.pt-sec.is-strong { color: var(--text); font-size: 0.95rem; }
.pt-sec-n { font-weight: 500; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.pt-card {
  margin: 0 0 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--pt-card);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pt-card:focus-visible, .pt-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pt-card-top { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; }
.pt-card-who { color: var(--text-secondary); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-card-top .pt-pill { margin-left: auto; }
.pt-card-title { margin: 8px 0 0; font-size: 0.98rem; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
.pt-quote {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-elevated);
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.pt-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pt-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 11px;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}
.pt-pill--question { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--pt-q); }
.pt-pill--late { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--pt-late); }
.pt-pill--done { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--pt-ok); }
.pt-pill--work { background: var(--accent-muted); color: var(--accent); }
.pt-pill--muted { background: var(--surface-elevated); color: var(--text-secondary); }

.pt-rows {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--pt-card);
  overflow: hidden;
}
.pt-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  column-gap: 12px;
  row-gap: 10px;
  min-height: 76px;
  padding: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pt-rows > .pt-row + .pt-row { box-shadow: inset 0 1px 0 var(--border); }
.pt-row:active { background: var(--surface-elevated); }
.pt-row.is-selected { background: var(--accent-subtle); }
@media (hover: hover) { .pt-row:hover { background: var(--surface-elevated); } .pt-row.is-selected:hover { background: var(--accent-subtle); } }
.pt-row > .pt-av { margin-top: 2px; }
/* «Задачи»: кружок «выполнено» вместо аватара исполнителя */
.mt-check {
  flex: none;
  position: relative;
  width: 22px;
  height: 22px;
  margin: 2px 5px 0;
  padding: 0;
  border: 2px solid var(--text-tertiary);
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.mt-check::after { content: ""; position: absolute; inset: -10px; }
.mt-check svg { opacity: 0; color: var(--on-accent); }
.mt-check.is-done { background: var(--accent); border-color: var(--accent); }
.mt-check.is-done svg { opacity: 1; }
.mt-check:disabled { opacity: 0.6; }
.pt-row.is-done .pt-row-title { text-decoration: line-through; color: var(--text-secondary); }
.pt-row-line .mt-from { color: var(--text-secondary); }
.mt-inbox {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-card);
  background: var(--accent-subtle);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.pt-row-main { flex: 1; min-width: 0; }
.pt-row-title {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.32;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.pt-row-line {
  margin: 4px 0 0;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--text-secondary);
}
.pt-row-line .pt-sep { color: var(--text-tertiary); }
.pt-row-line .is-work { color: var(--accent); }
.pt-row-line .is-unseen { color: var(--text-tertiary); }
.pt-row-line .is-question { color: var(--pt-q); font-weight: 600; }
.pt-row-line .is-late { color: var(--pt-late); }
.pt-row-line .is-done { color: var(--pt-ok); font-weight: 600; }
.pt-row-line .pt-due-inline { white-space: nowrap; }
.pt-row-line .pt-due-inline:not(.is-late) { color: var(--text); }
.pt-row .pt-quote { margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Действия: на телефоне — под текстом, на десктопе — справа */
.pt-row-acts { display: flex; gap: 8px; width: 100%; padding-left: 44px; }
.pt-row-acts .pt-btn { min-height: 32px; padding: 0 12px; font-size: 0.82rem; }
.pt-row:not([class*="pt-row--"]) .pt-row-acts { display: none; }
.pt-subsec { margin: 14px 2px 6px; font-size: 0.78rem; font-weight: 600; color: var(--text-tertiary); text-transform: none; }
.pt-sec--group { margin-bottom: 0; }
.pt-chev { color: var(--text-tertiary); font-size: 1.2rem; }
.pt-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin: 18px 0 0;
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--pt-card);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.pt-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 3rem auto 0;
  max-width: 22rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.45;
}
.pt-empty p { margin: 0; }
.pt-empty .pt-empty-title { margin-bottom: -8px; font-size: 1rem; font-weight: 600; color: var(--text); }
.pt-empty .pt-btn.pt-btn--link { min-height: 0; padding: 0; border: 0; background: none; color: var(--accent); }
.pt-muted-note { margin: 14px 0 0; text-align: center; font-size: 0.82rem; color: var(--text-tertiary); }
.pt-side { display: none; }

/* Карточка поручения */
.pt-sheet-overlay {
  position: fixed;
  inset: 0;
  /* Выше окна ассистента (220): задачу открывают и из его карточек; ниже окна правки задачи (280) и тостов (320). */
  z-index: 240;
  display: flex;
  justify-content: center;
  background: var(--bg);
}
.pt-sheet-overlay.hidden { display: none; }
.pt-sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  height: 100%;
  padding-top: env(safe-area-inset-top, 0);
}
.pt-side .pt-c-head, .pt-sheet .pt-c-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px var(--page-x, 16px) 4px;
}
.pt-c-more { margin-left: auto; }
.pt-icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--surface-elevated);
  color: var(--text-secondary);
  cursor: pointer;
}
.pt-c-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px var(--page-x, 16px) 12px; -webkit-overflow-scrolling: touch; }
.pt-c-title { margin: 4px 0 0; font-size: 1.2rem; line-height: 1.3; font-weight: 650; color: var(--text); overflow-wrap: anywhere; }
.pt-c-who { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 0.88rem; color: var(--text); }
.pt-c-role { margin-left: 6px; font-size: 0.78rem; color: var(--text-tertiary); }
.pt-c-due { margin-left: auto; font-size: 0.84rem; color: var(--text-secondary); white-space: nowrap; }
.pt-c-due.is-late { color: var(--pt-late); }
.pt-c-desc { margin: 10px 0 0; font-size: 0.9rem; line-height: 1.45; color: var(--text-secondary); white-space: pre-wrap; overflow-wrap: anywhere; }
.pt-c-body .tracker-link-chip { margin-top: 10px; }
.pt-check { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-elevated); }
.pt-check-head { display: flex; align-items: center; gap: 10px; font-size: 0.8rem; color: var(--text-secondary); }
.pt-bar { flex: 1; height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.pt-bar i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.pt-check-item { display: flex; align-items: flex-start; gap: 10px; margin-top: 8px; font-size: 0.9rem; color: var(--text); cursor: pointer; }
.pt-check-item input { margin-top: 2px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.pt-check-item.is-done span { color: var(--text-tertiary); text-decoration: line-through; }
.pt-c-result { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--success) 10%, transparent); }
.pt-c-result span { font-size: 0.78rem; font-weight: 600; color: var(--pt-ok); }
.pt-c-result p { margin: 4px 0 0; font-size: 0.9rem; line-height: 1.45; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.pt-feed { display: flex; flex-direction: column; gap: 10px; }
.pt-sys { margin: 0; text-align: center; font-size: 0.76rem; color: var(--text-tertiary); }
.pt-sys-rated { color: var(--text-secondary); }
.pt-rate-toast { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; }
.pt-rate-toast .note-toast-copy { flex-basis: 100%; }
.pt-msg { display: flex; align-items: flex-end; gap: 8px; }
.pt-msg.is-mine { flex-direction: row-reverse; }
.pt-bub {
  max-width: 78%;
  padding: 8px 11px;
  border-radius: 14px 14px 14px 4px;
  background: var(--surface-elevated);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.4;
}
.pt-msg.is-mine .pt-bub { border-radius: 14px 14px 4px 14px; background: var(--accent-muted); }
.pt-bub p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.pt-bub-tag { display: block; margin-bottom: 2px; font-size: 0.72rem; font-weight: 600; color: var(--text-secondary); }
.pt-bub.is-result .pt-bub-tag { color: var(--pt-ok); }
.pt-bub.is-return .pt-bub-tag { color: var(--pt-q); }
.pt-bub-time { display: block; margin-top: 3px; font-size: 0.7rem; color: var(--text-tertiary); text-align: right; }
.pt-c-foot {
  flex: none;
  padding: 10px var(--page-x, 16px) calc(10px + env(safe-area-inset-bottom, 0));
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.pt-c-foot .pt-acts { margin-top: 10px; }
.pt-sheet-overlay.is-kb .pt-c-foot { padding-bottom: 10px; }
.pt-composer-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.pt-composer.is-return .pt-composer-label { color: var(--pt-q); }
.pt-composer.is-result .pt-composer-label { color: var(--pt-ok); }
.pt-composer-x { border: none; background: none; color: var(--text-secondary); font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.pt-composer { position: relative; }
.pt-composer-box {
  border: 1px solid var(--border-strong, var(--border));
  border-radius: 20px;
  background: var(--surface);
  padding: 8px 8px 6px 14px;
}
.pt-composer-box:focus-within { border-color: var(--accent-border); }
.pt-composer-box textarea {
  display: block;
  width: 100%;
  min-height: 24px;
  max-height: 160px;
  padding: 4px 6px 4px 0;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.94rem;
  line-height: 1.4;
}
.pt-composer-tools { display: flex; align-items: center; gap: 4px; margin: 4px 0 0 -8px; }
.pt-tools-spacer { flex: 1; }
.pt-tool {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.pt-tool:hover { background: var(--surface-elevated); color: var(--text); }
.pt-pending { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.pt-ref {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.pt-ref span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-ref svg { flex: none; color: var(--accent); }
.pt-ref--file img { width: 22px; height: 22px; border-radius: 4px; object-fit: cover; }
.pt-ref.is-loading { opacity: 0.6; }
.pt-ref-x { border: none; background: none; color: var(--text-secondary); font-size: 1rem; line-height: 1; padding: 0 2px; cursor: pointer; }
.pt-refs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pt-bub .note-discuss-attach-list { margin-top: 6px; }
.pt-pop {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 5;
  width: min(320px, 100%);
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 14px;
  background: var(--surface-elevated);
  box-shadow: var(--shadow-md);
}
.pt-pop.hidden { display: none; }
.pt-pop-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}
.pt-pop-item:hover { background: var(--surface-muted); }
.pt-pop-hint { font-size: 0.74rem; color: var(--text-tertiary); }
.pt-pop-pad { padding: 8px 10px; margin: 0; }
.pt-pop-search {
  width: 100%;
  margin-bottom: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}
.pt-send {
  flex: none;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}
.pt-send.is-text { width: auto; padding: 0 14px; border-radius: 16px; font: inherit; font-size: 0.84rem; font-weight: 600; }
.pt-send:disabled { opacity: 0.55; }
.pt-card-loading { padding: 3rem 1rem; text-align: center; color: var(--text-tertiary); }
.pt-menu {
  position: fixed;
  z-index: 300;
  min-width: 200px;
  max-width: calc(100vw - 16px);
  padding: 6px;
  border-radius: 12px;
  background: var(--surface-elevated);
  box-shadow: var(--shadow-md);
}
.pt-menu-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}
.pt-menu-item:hover { background: var(--surface-muted); }
.pt-menu-item.is-danger { color: var(--pt-late); }


/* Десктоп: список слева, поручение или сводка «Команда сейчас» справа */
@media (min-width: 960px) {
  #actual-posted-tasks.actual-subscreen { width: 100%; max-width: 1180px; margin: 0 auto; }
  #actual-my-tasks.actual-subscreen { width: 100%; max-width: 1180px; margin: 0 auto; }
  .pt-only-desktop { display: inline; }
  .pt-head .pt-btn--primary { width: auto; padding: 0 14px; border-radius: 10px; }
  .pt-team { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; flex-wrap: wrap; }
  .pt-tc { width: 168px; }
  /* Кнопки справа — только если список достаточно широкий (с открытым ассистентом он узкий:
     тогда кнопки под текстом, как на телефоне, а не сжимают название в столбик). */
  .pt-main { container: ptlist / inline-size; }
  @container ptlist (min-width: 500px) {
    .pt-row { flex-wrap: nowrap; align-items: center; }
    .pt-row-acts { width: auto; padding-left: 0; flex: none; }
    .pt-row:not([class*="pt-row--"]) .pt-row-acts { display: flex; opacity: 0; transition: opacity 0.12s ease; }
    .pt-row:not([class*="pt-row--"]):hover .pt-row-acts, .pt-row:not([class*="pt-row--"]).is-selected .pt-row-acts { opacity: 1; }
  }
  .pt-side-empty { margin: 3rem 1rem; }
  .pt-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    margin-top: 6px;
  }
  .pt-list > .pt-row { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
  .pt-list > .pt-sec + .pt-row { border-top: 1px solid var(--border); }
  .pt-list > .pt-row:has(+ .pt-sec), .pt-list > .pt-row:last-child {
    border-bottom: 1px solid var(--border);
    border-bottom-left-radius: var(--radius-card);
    border-bottom-right-radius: var(--radius-card);
  }
  .pt-side {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 120px);
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--pt-card);
    overflow: hidden;
  }
  .pt-side:empty { display: none; }
  .pt-side > .pt-side-title, .pt-side > .pt-person, .pt-side > .pt-muted-note { margin-left: 14px; margin-right: 14px; }
  .pt-side-title { margin: 14px 14px 10px; font-weight: 600; color: var(--text); }
  .pt-person {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
  }
  .pt-person.is-on { border-color: var(--accent-border); background: var(--accent-subtle); }
  .pt-side > .pt-muted-note { margin-bottom: 16px; }
  .pt-side .pt-c-foot { background: var(--pt-card); }
  .pt-foot { display: none; }
  /* Поручение, открытое не с экрана «Поручения» (календарь, Фокус), — окно по центру. */
  .pt-sheet-overlay { align-items: center; background: rgba(0, 0, 0, 0.55); }
  .pt-sheet { height: min(820px, calc(100vh - 64px)); border-radius: 16px; background: var(--bg); overflow: hidden; box-shadow: var(--shadow-md); }
}

/* «Поставленные» — вид Канбан. Кнопка в шапке; список и правая панель в обычном виде не меняются. */
.pt-bar-actions { gap: 8px; }
.pt-bar-actions .pt-btn.pt-view-btn { background: var(--surface); color: var(--text); }
.pt-is-kanban .pt-side { display: none; }
.pt-is-kanban .pt-layout { display: block; }
.pt-kjump {
  display: flex;
  gap: 6px;
  margin: 12px calc(-1 * var(--page-x, 16px)) 0;
  padding: 0 var(--page-x, 16px) 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.pt-kjump::-webkit-scrollbar { display: none; }
.pt-kjump .pt-btn { flex: none; min-height: 30px; padding: 0 11px; font-size: 0.8rem; color: var(--text-secondary); }
.pt-kjump .pt-btn.is-on { border-color: var(--accent-border); background: var(--accent-subtle); color: var(--text); }
.pt-kanban {
  display: flex;
  gap: 10px;
  margin: 0 calc(-1 * var(--page-x, 16px));
  padding: 0 var(--page-x, 16px) 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--page-x, 16px);
  scrollbar-width: none;
}
.pt-kanban::-webkit-scrollbar { display: none; }
.pt-kcol { flex: 0 0 86%; min-width: 0; scroll-snap-align: start; transition: opacity 0.12s ease; }
.pt-kcol-head { margin-top: 14px; }
.pt-kcol-rows { min-height: 64px; transition: border-color 0.12s ease, background-color 0.12s ease; }
.pt-kcol-empty { margin: 0; padding: 22px 0; }
.pt-kanban .pt-row {
  flex-wrap: wrap;
  align-items: flex-start;
  min-height: 0;
  padding: 12px;
  column-gap: 10px;
  row-gap: 8px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.pt-kanban .pt-row-title { font-size: 0.92rem; }
.pt-kanban .pt-row-line { font-size: 0.78rem; }
.pt-kanban .pt-row-acts { width: 100%; padding-left: 0; flex-wrap: wrap; gap: 6px; }
.pt-kanban .pt-row:not([class*="pt-row--"]) .pt-row-acts { display: none; }
.pt-kanban .pt-row-acts .pt-btn { min-height: 30px; max-width: 100%; padding: 4px 10px; font-size: 0.8rem; white-space: normal; text-align: center; }
.pt-kcol-more.pt-btn { min-height: 0; margin: 10px 2px 0; padding: 0; border: 0; background: none; color: var(--accent); font-size: 0.82rem; }
.pt-kanban.is-dragging { scroll-snap-type: none; }
.pt-kcol.is-blocked { opacity: 0.45; }
.pt-kcol.is-target .pt-kcol-rows { border-style: dashed; border-color: var(--accent-border); }
.pt-kcol.is-over .pt-kcol-rows { border-color: var(--accent); background: var(--accent-subtle); }
.pt-row.is-dragging { opacity: 0.35; }
.pt-kghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 400;
  pointer-events: none;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  will-change: transform;
}
.pt-kghost .pt-row-acts { display: none; }
@media (min-width: 960px) {
  #actual-posted-tasks.actual-subscreen.pt-is-kanban { max-width: 1480px; }
  .pt-kjump { display: none; }
  /* Колонки широкие, не сжимаются под экран — лента листается вбок (тачпадом, Shift+колесо или полосой снизу). */
  .pt-kanban {
    gap: 12px;
    margin: 0;
    padding: 0 0 12px;
    scroll-snap-type: none;
    scrollbar-width: thin;
  }
  .pt-kanban::-webkit-scrollbar { display: block; height: 8px; }
  .pt-kanban::-webkit-scrollbar-thumb { border-radius: 4px; background: var(--border-strong); }
  .pt-kcol { flex: 0 0 380px; }
}

/* Чип «у других» в шапке: сколько поручений ждут вас */
.hero-chip .hero-chip-late { color: var(--danger); font-weight: 500; }

.meeting-card--task-done .item-title,
.day-timeline-band-item--task-done,
.meetings-week-chip--task-done,
.meetings-week-event--task-done .item-title,
.meetings-month-chip--task-done {
  text-decoration: line-through;
  opacity: 0.65;
}

.day-timeline-item--task-done {
  opacity: 0.65;
}

.day-timeline-item--task-done .item-title {
  text-decoration: line-through;
}

/* Число непрочитанных в чатах заметки: на кнопке меню и у пунктов списка. */
#note-discussion-new-ctx {
  position: relative;
}

.note-chats-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  box-sizing: border-box;
  border-radius: 9px;
  background: var(--vkui--color_text_accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}

#note-discussion-new-ctx .note-chats-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  box-shadow: 0 0 0 2px var(--vkui--color_background_content, var(--bg));
}

.note-chats-item-badge {
  flex: 0 0 auto;
  margin-left: auto;
}

/* «Комментарии»: без выбора режима нижняя строка пустая — «+», поле и отправка в одну строку. */
.note-paie-reply-form.is-comments-chat {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  column-gap: 8px;
}

.note-paie-reply-form.is-comments-chat > * {
  flex: 0 0 100%;
}

.note-paie-reply-form.is-comments-chat > .note-paie-composer-row {
  flex: 1 1 0;
  min-width: 0;
  padding-bottom: 0;
}

.note-paie-reply-form.is-comments-chat > .note-paie-composer-bar {
  flex: 0 0 auto;
}

.note-paie-reply-form.is-comments-chat .note-paie-composer-left {
  display: none;
}

/* Листы заметки — вкладки: [оглавление] вкладки… [+] над общей линией. */
.note-editor-sheets-bar {
  flex-wrap: nowrap;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}

.note-editor-sheets {
  flex-wrap: nowrap;
  gap: 2px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.note-editor-sheets::-webkit-scrollbar {
  display: none;
}

.note-editor-sheets-bar .note-editor-toc-anchor {
  position: relative;
  flex: 0 0 auto;
  align-self: center;
  margin-bottom: 4px;
}

.note-editor-sheets-bar .note-editor-toc-toggle {
  width: 30px;
  height: 30px;
  margin: 0;
  border: none;
  border-radius: 8px;
  color: var(--vkui--color_text_secondary, var(--text-secondary));
  background: transparent;
  box-shadow: none;
}

/* Связки документа — значок с числом справа от оглавления (только если связки есть). */
.note-editor-links-btn {
  flex: 0 0 auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  margin: 0 2px 4px 0;
  padding: 0 8px;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--vkui--color_text_accent, var(--accent));
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  cursor: pointer;
}
.note-editor-links-btn:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.note-editor-links-btn.hidden { display: none; }

.note-editor-sheets-bar .note-editor-toc-toggle:hover,
.note-editor-page--toc-open .note-editor-sheets-bar .note-editor-toc-toggle {
  color: var(--vkui--color_text_accent, var(--accent));
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.note-sheet-chip {
  position: relative;
  flex: 0 0 auto;
  padding: 8px 10px 10px;
  border: none;
  border-radius: 8px 8px 0 0;
  font-size: 14px;
  background: transparent;
}

.note-sheet-chip:not(.is-active):not(.note-sheet-chip--make-summary):hover {
  color: var(--text);
  background: var(--overlay-1);
}

.note-sheet-chip.is-active {
  color: var(--text);
  font-weight: 600;
  background: transparent;
}

.note-sheet-chip.is-active::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--vkui--color_text_accent);
}

.note-sheet-chip.is-editing {
  padding-right: 6px;
}

.note-sheet-chip--add {
  justify-content: center;
  min-width: 32px;
  padding: 6px 8px 8px;
  border-style: none;
  font-size: 18px;
  line-height: 1;
}

.note-sheet-chip--make-summary {
  align-self: center;
  margin: 0 0 4px 4px;
  padding: 4px 10px;
  border: 1px dashed var(--border);
  border-radius: 999px;
  font-size: 13px;
}

/* Стиль презентации: «Стиль: … ▾» в панели канваса. */
.note-web-canvas-theme { position: relative; }
.note-web-canvas-theme[hidden] { display: none !important; }
.note-web-canvas-theme-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  min-width: 15rem;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 8px 24px color-mix(in srgb, var(--shadow-color) 20%, transparent));
}
.note-web-canvas-theme-menu[hidden] { display: none; }
.note-web-canvas-theme-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.note-web-canvas-theme-item:hover { background: var(--accent-subtle); }
.note-web-canvas-theme-item.is-active { background: var(--accent-muted); }
.note-web-canvas-theme-swatch { display: inline-flex; flex: none; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.note-web-canvas-theme-swatch i { width: 12px; height: 26px; }
.note-web-canvas-theme-text { display: flex; flex-direction: column; min-width: 0; }
.note-web-canvas-theme-text b { font-size: 14px; font-weight: 600; }
.note-web-canvas-theme-text small { font-size: 12px; color: var(--text-secondary); }

/* Правки ИИ в заметке: подсветка и плашка подтверждения. */
::highlight(leo-ai-edit) {
  background-color: color-mix(in srgb, var(--violet-text) 38%, transparent);
  color: inherit;
}
.note-ai-edit-bar {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + var(--note-editor-chrome-top, 54px) + 8px);
  transform: translateX(-50%);
  z-index: 140;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 24px);
  padding: 6px 6px 6px 12px;
  border: 1px solid color-mix(in srgb, var(--violet-text) 55%, transparent);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--shadow-color) 35%, transparent);
  font-size: 14px;
}
.note-ai-edit-bar.hidden { display: none; }
/* Плашка лежит в body поверх обсуждения (220), ниже тоста и модалок; без открытого редактора не видна. */
.note-ai-edit-bar { z-index: 235; }
#note-editor-overlay.hidden ~ .note-ai-edit-bar { display: none; }
@media (max-width: 959px) {
  /* Обсуждение на весь экран: плашка внизу над полем ввода, не закрывает шапку. */
  html.note-discussion-open .note-ai-edit-bar { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); }
}
.note-ai-edit-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--violet-text); }
.note-ai-edit-bar button { appearance: none; font: inherit; cursor: pointer; border-radius: 999px; }
.note-ai-edit-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; background: transparent; color: var(--text); padding: 4px 6px; text-decoration: underline dotted color-mix(in srgb, var(--violet-text) 70%, transparent); text-underline-offset: 3px; }
.note-ai-edit-undo { flex: none; border: 1px solid var(--border); background: transparent; color: var(--text); padding: 6px 12px; }
.note-ai-edit-ok { flex: none; border: 0; background: var(--violet); color: var(--on-accent); font-weight: 600; padding: 6px 16px; }

/* Ссылки на заметку: своя на каждый набор листов. */
.note-share-links-block.hidden { display: none; }
.note-share-links-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.note-share-link-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; }
.note-share-link-row.is-current { border-color: var(--accent); }
.note-share-link-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.note-share-link-text strong { font-size: 14px; font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.note-share-link-text small { font-size: 12px; color: var(--text-secondary); }
.note-share-link-copy, .note-share-link-off { flex: none; font-size: 13px; padding: 4px 6px; }
.note-share-link-off { color: var(--danger); }

/* Вкладки: иконка шеринга и перетаскивание. */
.note-sheet-chip { touch-action: pan-x; -webkit-user-select: none; user-select: none; }
.note-sheet-chip.is-shared { display: inline-flex; align-items: center; gap: 6px; }
.note-sheet-chip-share {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin: -4px -4px -4px 0;
  border-radius: 6px;
  color: var(--vkui--color_text_accent);
  cursor: pointer;
}
.note-sheet-chip-share:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.note-editor-sheets.is-reordering { cursor: grabbing; }
.note-sheet-chip.is-dragging {
  z-index: 2;
  color: var(--text);
  background: var(--surface-muted);
  border-radius: 8px;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--shadow-color) 35%, transparent);
  transform: translateY(-2px) scale(1.04);
  transition: transform 0.12s ease;
}
.note-sheet-chip.is-dragging::after { display: none; }
.note-sheet-share-menu { min-width: 15.5rem; }
.note-sheet-share-menu .is-danger .note-sheet-kind-menu-title { color: var(--danger); }
.note-sheet-share-foot {
  margin: 4px 0 0;
  padding: 8px 10px 6px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

/* ---- Окно «Поделиться» (v2): вкладки «Ссылка / Участники», чипы листов, сегмент доступа ---- */
.note-share-sheet.is-v2 { display: flex; flex-direction: column; gap: 14px; max-height: min(86vh, 640px); overflow: auto; }
.note-share-sheet.is-v2 .ns-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.note-share-sheet.is-v2 .note-share-sheet-title { margin: 0; font-size: 19px; }
.note-share-sheet.is-v2 .ns-close { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--surface-muted); color: var(--text-secondary); cursor: pointer; }
.note-share-sheet.is-v2 .ns-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface-muted); }
.note-share-sheet.is-v2 .ns-tabs.hidden { display: none; }
.note-share-sheet.is-v2 .ns-tab { appearance: none; border: 0; border-radius: 8px; padding: 7px 10px; background: transparent; color: var(--text-secondary); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.note-share-sheet.is-v2 .ns-tab.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px color-mix(in srgb, var(--shadow-color) 25%, transparent); }
.note-share-sheet.is-v2 .ns-count { font-weight: 500; opacity: 0.7; }
.note-share-sheet.is-v2 .ns-pane { display: flex; flex-direction: column; gap: 10px; }
.note-share-sheet.is-v2 .ns-pane.hidden { display: none; }
.note-share-sheet.is-v2 .ns-label { margin: 4px 0 0; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-secondary); }
.note-share-sheet.is-v2 .ns-hint { margin: 0; font-size: 13px; color: var(--text-secondary); }
.note-share-sheet.is-v2 .note-share-sheets-block { display: flex; flex-direction: column; gap: 8px; }
.note-share-sheet.is-v2 .note-share-sheets-block.hidden { display: none; }
.note-share-sheet.is-v2 .ns-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.note-share-sheet.is-v2 .ns-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 14px; cursor: pointer; }
.note-share-sheet.is-v2 .ns-chip input { position: absolute; opacity: 0; pointer-events: none; }
.note-share-sheet.is-v2 .ns-chip.is-web span::before { content: "▣ "; opacity: 0.7; }
.note-share-sheet.is-v2 .ns-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-muted); color: var(--text); }
.note-share-sheet.is-v2 .ns-chip:has(input:checked)::before { content: "✓"; font-size: 12px; color: var(--accent); }
.note-share-sheet.is-v2 .ns-chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.note-share-sheet.is-v2 .ns-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface-muted); }
.note-share-sheet.is-v2 .ns-seg label { position: relative; cursor: pointer; }
.note-share-sheet.is-v2 .ns-seg input { position: absolute; opacity: 0; pointer-events: none; }
.note-share-sheet.is-v2 .ns-seg span { display: block; padding: 7px 10px; border-radius: 8px; text-align: center; font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.note-share-sheet.is-v2 .ns-seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px color-mix(in srgb, var(--shadow-color) 25%, transparent); }
.note-share-sheet.is-v2 .ns-seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.note-share-sheet.is-v2 .ns-primary { width: 100%; margin-top: 2px; }
.note-share-sheet.is-v2 .note-share-links-block { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; border-top: 1px solid var(--border); }
.note-share-sheet.is-v2 .note-share-links-block.hidden { display: none; }
.note-share-sheet.is-v2 .note-share-link-row { padding: 8px 6px 8px 12px; }
.note-share-sheet.is-v2 .note-share-link-copy,
.note-share-sheet.is-v2 .note-share-link-off { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-secondary); cursor: pointer; }
.note-share-sheet.is-v2 .note-share-link-copy:hover { color: var(--accent); background: var(--accent-muted); }
.note-share-sheet.is-v2 .note-share-link-off:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.note-share-sheet.is-v2 .note-share-members-block { display: flex; flex-direction: column; gap: 10px; }
.note-share-sheet.is-v2 .ns-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }


/* ---- фильтр заметок (владелец / доступ / дата создания) ---- */
.notes-filter-btn { position: relative; }
.notes-filter-btn.is-active {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-subtle);
}
.notes-filter-badge {
  position: absolute;
  top: -0.3rem;
  right: -0.3rem;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.05rem;
  text-align: center;
  color: var(--on-accent);
  background: var(--accent);
}
.notes-filter-body { display: flex; flex-direction: column; gap: var(--space-4); }
.notes-filter-group { margin: 0; padding: 0; border: 0; min-width: 0; }
.notes-filter-group legend {
  margin-bottom: var(--space-2);
  padding: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.notes-filter-seg { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.notes-filter-seg button {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface);
  cursor: pointer;
}
.notes-filter-seg button[aria-pressed="true"] {
  color: var(--on-accent);
  border-color: var(--accent);
  background: var(--accent);
}
.notes-filter-hint { margin: 0.5rem 0 0; font-size: 0.75rem; color: var(--text-secondary); }
.notes-filter-range { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.notes-filter-range label {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.notes-filter-range input { width: 100%; box-sizing: border-box; }
.notes-filter-reset, .notes-filter-reset:hover { width: auto; padding: 0 0.5rem; background: transparent; border: 0; font-size: 0.875rem; font-weight: 600; color: var(--accent); }
.notes-filter-reset:disabled { color: var(--text-secondary); opacity: 0.5; }
.notes-filter-apply { width: 100%; }


/* ---- шторка «Изображение» слайда: генерация по описанию / загрузка / убрать ---- */
/* Поверх редактора заметки (100) и обсуждения (220), ниже тоста (320) и системных модалок (280). */
#canvas-image-overlay { z-index: 260; }
#canvas-icon-overlay { z-index: 260; }
.canvas-icon-body { display: flex; flex-direction: column; gap: var(--space-2); }
.canvas-icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 0.375rem; max-height: min(52vh, 420px); overflow-y: auto; padding: 2px; }
.canvas-icon-btn { appearance: none; display: grid; place-items: center; aspect-ratio: 1; padding: 0; border: 1px solid transparent; border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; }
.canvas-icon-btn:hover { border-color: var(--border); }
.canvas-icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.canvas-icon-btn.is-current { border-color: var(--accent); color: var(--accent); }
.canvas-icon-note { margin: 0; color: var(--text-muted); font-size: 0.875rem; }
.canvas-image-body { display: flex; flex-direction: column; gap: var(--space-2); }
.canvas-image-label { font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); }
.canvas-image-prompt { width: 100%; box-sizing: border-box; min-height: 6.5rem; resize: vertical; font-size: 16px; line-height: 1.4; }
.canvas-image-hint { margin: 0 0 var(--space-2); font-size: 0.75rem; color: var(--text-secondary); }
.canvas-image-generate { width: 100%; min-height: 2.875rem; }
.canvas-image-actions { display: flex; gap: var(--space-2); }
.canvas-image-actions .btn { flex: 1 1 0; min-height: 2.75rem; }
.canvas-image-clear { color: var(--danger); }

.note-web-canvas-pick-btn[hidden] {
  display: none !important;
}

.note-web-canvas-theme-sep { height: 1px; margin: 4px 6px; background: var(--border); }
.note-web-canvas-theme-restyle:disabled { opacity: 0.5; cursor: default; }

.canvas-image-lib { display: flex; flex-direction: column; gap: var(--space-2); }
.canvas-image-lib-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.canvas-image-lib-grid button { appearance: none; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: var(--surface); cursor: pointer; aspect-ratio: 16 / 9; }
.canvas-image-lib-grid button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.canvas-image-lib-grid button[aria-busy="true"] { opacity: 0.5; }
.canvas-image-lib-grid img { display: block; width: 100%; height: 100%; object-fit: cover; }
.canvas-image-or { margin: var(--space-2) 0 0; font-size: 0.75rem; color: var(--text-secondary); text-align: center; }



/* ---- Список чатов обсуждения: «…» у своих чатов (переименовать / удалить) ---- */
.note-chats-row { position: relative; display: flex; align-items: stretch; }
.note-chats-row > .note-chats-item { flex: 1 1 auto; min-width: 0; padding-right: 44px; }
.note-chats-more {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.note-chats-more:hover, .note-chats-more:focus-visible { background: var(--surface-muted); color: var(--text); }
.note-chats-actions {
  position: absolute;
  right: 6px;
  top: calc(100% - 4px);
  z-index: 5;
  min-width: 180px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--shadow-color) 45%, transparent);
}
.note-chats-actions-item { appearance: none; text-align: left; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: 0.9375rem; cursor: pointer; }
.note-chats-actions-item:hover { background: var(--surface-muted); }
.note-chats-actions-item.is-danger { color: var(--danger); }
.note-chats-rename { flex: 1 1 auto; display: flex; gap: 6px; align-items: center; padding: 6px; }
.note-chats-rename-input { flex: 1 1 auto; min-width: 0; font-size: 16px; }
.note-chats-rename-ok { flex: none; appearance: none; border: 0; border-radius: 10px; padding: 8px 12px; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; cursor: pointer; }

/* ---- Нижняя панель редактора v2: ИИ, отменить/повторить, вставить, стиль (страницы), списки, чек-лист, обсуждение ---- */
.note-tg-capsule--history { flex-shrink: 0; }
.note-tg-capsule--history .note-tg-btn--undo { background: transparent; }
.note-tg-sep { flex: none; width: 1px; height: 20px; margin: 0 3px; background: var(--overlay-6); }
.note-tg-menu-label { margin: 4px 14px 2px; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }
.note-tg-menu[data-menu-panel="style"] { left: auto; right: 12px; }
.note-tg-menu-page > svg:last-child { margin-left: auto; opacity: 0.6; }
.note-tg-menu-page.note-tg-menu-item--active::after { display: none; }
.note-tg-menu-back { color: var(--text-soft); padding-top: 8px; padding-bottom: 8px; }
.note-tg-page.hidden { display: none; }
.note-tg-h { font-weight: 700; }
.note-tg-h1 { font-size: 1.35rem; }
.note-tg-h2 { font-size: 1.2rem; }
.note-tg-h3 { font-size: 1.05rem; }
.note-tg-h4 { font-size: 0.95rem; font-weight: 600; }
.note-rich-editor-body mark.note-highlight,
mark.note-highlight { background: color-mix(in srgb, var(--warning) 32%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
/* Кнопка ИИ (бывшая GPT) и обсуждение с бейджем — по краям строки. */
.note-tg-btn--ai { flex-shrink: 0; color: var(--violet-soft); background: color-mix(in srgb, var(--violet) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--violet) 45%, transparent); }
.note-tg-btn--ai:hover { background: color-mix(in srgb, var(--violet) 26%, transparent); }
.note-tg-btn--discuss { position: relative; flex-shrink: 0; background: var(--overlay-3); }
.note-tg-btn--discuss .note-tg-badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.note-tg-btn--discuss .note-tg-badge.hidden { display: none; }
.note-editor-toolbar-row.is-selection .note-tg-btn--ai,
.note-editor-toolbar-row.is-selection .note-tg-btn--discuss { display: none; }
@media (max-width: 420px) {
  .note-editor-toolbar-row, .note-tg-toolbar { gap: 6px; }
  .note-tg-btn { width: 36px; height: 36px; }
}

/* ---- Окно ИИ «Что сделать с текстом?» ---- */
#note-ai-overlay { z-index: 260; }
.note-ai-scope { font-size: 0.75rem; font-weight: 600; color: var(--violet-soft); background: color-mix(in srgb, var(--violet) 16%, transparent); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.note-ai-body { display: flex; flex-direction: column; gap: var(--space-3, 12px); }
.note-ai-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.note-ai-chips button { appearance: none; border: 1px solid var(--border); border-radius: 999px; padding: 7px 12px; background: var(--surface); color: var(--text); font: inherit; font-size: 0.875rem; cursor: pointer; }
.note-ai-chips button:hover, .note-ai-chips button[aria-pressed="true"] { border-color: color-mix(in srgb, var(--violet) 60%, transparent); background: color-mix(in srgb, var(--violet) 14%, transparent); }
.note-ai-input { width: 100%; box-sizing: border-box; min-height: 84px; resize: vertical; font-size: 16px; line-height: 1.4; border-color: color-mix(in srgb, var(--violet) 50%, transparent); }
.note-ai-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.note-ai-hint { font-size: 0.75rem; color: var(--text-secondary); }
.note-ai-go { flex: none; min-height: 42px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--violet); color: var(--on-accent); font-weight: 600; }
.note-ai-go:disabled { opacity: 0.45; }
.note-ai-go.is-busy { opacity: 0.7; pointer-events: none; }

/* ---- Плашка над выделением: ✨ ИИ · Обсудить · Задача (вместо двух цветных кругов) ---- */
.note-comment-bubble-wrap { gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 10px 26px color-mix(in srgb, var(--shadow-color) 45%, transparent); }
.note-comment-bubble-wrap .note-comment-bubble {
  width: auto; height: 32px; min-width: 0; min-height: 32px; padding: 0 10px; gap: 6px;
  border-radius: 9px; background: transparent; color: var(--text); box-shadow: none;
  font: 600 0.8125rem/1 inherit; font-family: inherit;
}
.note-comment-bubble-wrap .note-comment-bubble:hover { background: var(--surface-muted); }
.note-comment-bubble-wrap .note-comment-bubble.hidden { display: none; }
.note-comment-bubble-wrap .note-comment-bubble span { pointer-events: none; }
.note-comment-bubble-wrap .note-comment-bubble--task { background: transparent; }
.note-comment-bubble-wrap .note-comment-bubble--ai { color: var(--violet-soft); background: color-mix(in srgb, var(--violet) 16%, transparent); }
/* Обсуждение — кнопкой в нижней панели; карточка в конце текста больше не показывается. */
#note-discussion-card { display: none !important; }
.note-tg-btn--discuss .note-tg-badge.is-dot { min-width: 10px; width: 10px; height: 10px; padding: 0; top: 2px; right: 2px; }

/* ---- Шапка заметки v2: «Поделиться» иконкой рядом с «⋮»; строка свойств под названием ---- */
#note-editor-overlay .note-editor-web-back-bar .note-more-wrap { display: flex; align-items: center; gap: 2px; }
.note-share-head-btn svg { display: block; }
.note-editor-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 6px 0 2px; min-height: 26px; font-size: 0.8125rem; color: var(--text-secondary); }
.note-editor-meta-project:empty { display: none; }
.note-editor-meta-project.tag-picker { display: inline-flex; margin: 0; padding: 0; border: 0; background: transparent; }
.note-editor-meta .tag-picker-add-btn { height: 26px; min-height: 26px; padding: 0 10px; font-size: 0.8125rem; border-radius: 999px; }
.note-editor-meta .note-editor-members { flex-direction: row; align-items: center; margin: 0; gap: 8px; }
.note-editor-meta .note-editor-members-people { flex-wrap: nowrap; gap: 0; }
.note-editor-meta .note-editor-member-chip { font-size: 0; gap: 0; margin-left: -6px; }
.note-editor-meta .note-editor-member-chip:first-child { margin-left: 0; }
.note-editor-meta .note-editor-member-chip .note-member-avatar { box-shadow: 0 0 0 2px var(--bg); }
.note-editor-meta .note-editor-members-live { font-size: 0.75rem; }
.note-editor-save-state:empty { display: none; }
.note-editor-save-state::before { content: "·"; margin-right: 8px; opacity: 0.6; }
.note-editor-meta-project:empty + .note-editor-members.hidden + .note-editor-save-state::before { content: none; margin: 0; }
.note-editor-save-state.is-error { color: var(--danger); }
.note-editor-title-suggest { appearance: none; border: 1px dashed color-mix(in srgb, var(--violet) 60%, transparent); border-radius: 999px; padding: 3px 10px; background: color-mix(in srgb, var(--violet) 12%, transparent); color: var(--violet-soft); font: inherit; font-size: 0.8125rem; cursor: pointer; }
.note-editor-title-suggest.hidden { display: none; }
/* Иконки ссылок у вкладок — серые и мельче: важно, что лист открыт, но не кричать об этом. */
.note-sheet-chip-share { color: var(--text-secondary); width: 18px; height: 18px; opacity: 0.8; }
.note-sheet-chip-share svg { width: 12px; height: 12px; }
/* «⋯» у открытой вкладки и его меню: переименовать, тип листа, удалить. */
.note-sheet-chip.has-more { display: inline-flex; align-items: center; gap: 4px; }
.note-sheet-chip-more {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin: -4px -6px -4px 0;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
}
.note-sheet-chip-more:hover { color: var(--text); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.note-sheet-chip-menu { min-width: 13rem; }
.note-sheet-chip-menu .note-sheet-kind-menu-item { flex-direction: row; align-items: center; padding: 0.45rem 0.7rem; }
.note-sheet-chip-menu .note-sheet-kind-menu-item.is-checked::after { content: "✓"; margin-left: auto; color: var(--accent); font-size: 0.8125rem; }
.note-sheet-chip-menu .note-sheet-kind-menu-item:disabled { cursor: default; opacity: 0.45; }
.note-sheet-chip-menu .note-sheet-kind-menu-item:disabled:hover { background: transparent; }
.note-sheet-chip-menu-sep { margin: 4px 6px; padding-top: 6px; border-top: 1px solid var(--border); font-size: 0.75rem; color: var(--text-tertiary); }
.note-sheet-chip-menu-sep:empty { padding-top: 0; }

/* Меню проекта в строке свойств: обёртка с z-index 1 прятала его под текстом заметки */
#note-editor-overlay .note-editor-meta .tag-picker-add-wrap { position: relative; z-index: 130; }
/* Меню проекта — как остальные меню редактора: приподнятая плашка, а не цвет фона страницы */
#note-editor-overlay .note-editor-meta .tag-picker-menu {
  background: var(--surface-raised);
  border: 0;
  border-radius: 14px;
  padding: 6px;
  min-width: 200px;
  max-height: 18rem;
  box-shadow: 0 12px 40px color-mix(in srgb, var(--shadow-color) 50%, transparent), 0 0 0 0.5px var(--overlay-3);
}
#note-editor-overlay .note-editor-meta .tag-picker-menu-item { border-radius: 10px; }
#note-editor-overlay .note-editor-meta .tag-picker-menu-item:hover { background: var(--overlay-3); }

/* Диктовка: кнопка микрофона и панель записи вместо тулбара */
.note-tg-btn--mic { flex-shrink: 0; }
.note-editor-toolbar-row.is-selection .note-tg-btn--mic { display: none; }
.note-dictation-bar { display: none; align-items: center; gap: 10px; min-height: 44px; }
.note-editor-toolbar-wrap.is-dictating .note-dictation-bar { display: flex; }
.note-editor-toolbar-wrap.is-dictating .note-editor-toolbar-row { display: none !important; }
.note-dict-btn { flex-shrink: 0; width: 44px; height: 44px; border: 0; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.note-dict-cancel { background: var(--overlay-3); color: var(--text-soft); }
.note-dict-stop { background: var(--danger); color: var(--on-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent); }
.note-dict-mid { flex: 1; min-width: 0; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: 999px; background: var(--overlay-3); }
.note-dict-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); flex-shrink: 0; animation: note-dict-pulse 1.2s ease-in-out infinite; }
.note-dict-time { font-variant-numeric: tabular-nums; font-size: 0.9375rem; font-weight: 600; color: var(--text-strong); flex-shrink: 0; min-width: 2.6em; }
.note-dict-wave { flex: 1; min-width: 0; height: 28px; width: 100%; color: var(--text-strong); }
.note-dict-spin, .note-dict-label { display: none; }
.note-dictation-bar[data-state="busy"] .note-dict-dot,
.note-dictation-bar[data-state="busy"] .note-dict-time,
.note-dictation-bar[data-state="busy"] .note-dict-wave,
.note-dictation-bar[data-state="busy"] .note-dict-stop { display: none; }
.note-dictation-bar[data-state="busy"] .note-dict-spin { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--overlay-7); border-top-color: #fff; animation: note-dict-rot 0.8s linear infinite; flex-shrink: 0; }
.note-dictation-bar[data-state="busy"] .note-dict-label { display: inline; color: var(--text); font-size: 0.9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes note-dict-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.8); } }
@keyframes note-dict-rot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .note-dict-dot, .note-dictation-bar[data-state="busy"] .note-dict-spin { animation: none; } }

/* ================= Обсуждение v2 (2026-10-15) ================= */
/* Поверхность как у редактора, а не почти чёрная */
.note-discussion-overlay,
.note-discussion-overlay .note-discussion-sheet,
html.note-discussion-open .note-discussion-overlay { background: var(--surface); }
@media (max-width: 959px) {
  .note-discussion-overlay, .note-discussion-sheet { background: var(--surface) !important; }
}
.note-discussion-header { background: var(--surface); }
#note-discussion-close,
#note-discussion-new-ctx { width: 36px; height: 36px; border-radius: 50%; background: var(--overlay-3); }
#note-discussion-new-ctx.is-chats .note-chats-badge { display: none; }

/* Шапка: название ⌄ + подпись */
#note-discussion-title { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; max-width: 100%; min-width: 0; line-height: 1.2; }
.note-discussion-title-line { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-width: 0; }
#note-discussion-title-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-discussion-subtitle { font-size: 0.71875rem; font-weight: 500; letter-spacing: 0; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.note-discussion-subtitle.hidden { display: none; }
/* Память Лео догружается — тихая строка над полем ввода */
.leo-memory-status { margin: 0 12px 6px; padding: 4px 10px; border-radius: 999px; font-size: 0.75rem; line-height: 1.35; color: var(--text-secondary); background: var(--accent-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: center; max-width: calc(100% - 24px); }
.leo-memory-status.hidden { display: none; }
.note-title-unread { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.note-title-unread.hidden { display: none; }
.note-pane-switch-menu.is-from-right { left: auto !important; right: -52px !important; transform: none !important; }

/* Меню (листы, чаты, композер) — одна приподнятая плашка */
#note-pane-switch-menu,
#note-chats-menu.is-dropdown,
#note-paie-reply-form .note-paie-menu,
#note-paie-reply-form .note-paie-plus-menu,
.note-discuss-menu {
  background: var(--surface-raised);
  border: 0;
  border-radius: 14px;
  box-shadow: 0 14px 40px color-mix(in srgb, var(--shadow-color) 50%, transparent), 0 0 0 0.5px var(--overlay-3);
}
.note-menu-label { margin: 6px 10px 4px; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }
.note-menu-hint { margin: 6px 10px 2px; font-size: 0.75rem; color: var(--text-subtle); }
.note-menu-hr { height: 1px; margin: 4px 6px; background: var(--overlay-3); }

/* Чаты — выпадающим меню под названием */
#note-chats-menu.is-dropdown { position: fixed; right: auto; bottom: auto; height: auto; transform: none !important; opacity: 0; transition: opacity 0.14s ease; overflow-y: auto; padding: 6px; z-index: 400; }
#note-chats-menu.is-dropdown.is-open { opacity: 1; }
#note-chats-menu.is-dropdown .note-chats-head { display: none; }
#note-chats-backdrop.is-dropdown { background: transparent !important; }

/* ---------- Лента ---------- */
.note-discussion-messages { gap: 4px; }
.note-discuss-day { align-self: center; margin: 14px 0 6px; padding: 2px 10px; border-radius: 999px; background: var(--overlay-2); color: var(--text-secondary); font-size: 0.75rem; }
.note-discuss-msg { position: relative; margin-top: 12px; max-width: 88%; }
.note-discuss-msg.is-cont { margin-top: 2px; }
.note-discuss-msg.is-cont .note-discuss-role,
.note-discuss-msg.is-cont .note-discuss-av { display: none; }
.note-discuss-msg.is-assistant,
.note-discuss-msg.is-other { padding-left: 34px; }
.note-discuss-av { position: absolute; left: 0; top: 18px; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--on-accent); font-size: 0.6875rem; font-weight: 700; }
.note-discuss-av.is-ai { background: color-mix(in srgb, var(--violet) 16%, transparent); border: 1px solid color-mix(in srgb, var(--violet) 45%, transparent); color: var(--violet-soft); box-sizing: border-box; }
.note-discuss-role { margin: 0 2px 4px; font-weight: 500; }
.note-discuss-role em { font-style: normal; color: var(--violet-soft); font-weight: 600; }
.note-discuss-msg.is-assistant .note-discuss-bubble { background: var(--overlay-2); border: 1px solid color-mix(in srgb, var(--violet) 40%, transparent); }
.note-discuss-msg.is-other .note-discuss-bubble { background: var(--overlay-3); border: 0; }
.note-discuss-time { margin: 3px 6px 0; font-size: 0.6875rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.note-discuss-msg.is-pressed .note-discuss-bubble { box-shadow: 0 0 0 2px var(--overlay-7); }

/* Действия: при наведении (десктоп), на телефоне — долгое нажатие */
.note-discuss-actions { position: absolute; top: -6px; right: -4px; margin: 0; display: none; gap: 2px; padding: 2px; border-radius: 10px; background: var(--surface-raised); box-shadow: 0 6px 16px color-mix(in srgb, var(--shadow-color) 40%, transparent), 0 0 0 0.5px var(--overlay-3); z-index: 5; }
.note-discuss-msg.is-user .note-discuss-actions { right: auto; left: -4px; }
.note-discuss-quick,
.note-discuss-actions .note-discuss-more { width: 28px; height: 26px; border-radius: 7px; border: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--text); cursor: pointer; }
.note-discuss-quick:hover,
.note-discuss-actions .note-discuss-more:hover,
.note-discuss-actions .note-discuss-more[aria-expanded="true"] { background: var(--overlay-4); }
.note-discuss-quick svg { width: 16px; height: 16px; }
@media (hover: hover) and (pointer: fine) {
  .note-discuss-msg:not(.is-pending):not(.is-optimistic):hover .note-discuss-actions,
  .note-discuss-actions:has(.note-discuss-more[aria-expanded="true"]) { display: flex; }
}
.note-discuss-menu.is-sheet { position: fixed !important; left: 8px !important; right: 8px !important; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important; min-width: 0; padding: 6px; z-index: 400; border-radius: 16px; box-shadow: 0 0 0 100vmax color-mix(in srgb, var(--shadow-color) 45%, transparent), 0 14px 40px color-mix(in srgb, var(--shadow-color) 50%, transparent); }
.note-discuss-menu.is-sheet .note-discuss-menu-item { padding: 12px; font-size: 0.9375rem; }

/* Правки ИИ — внутри ответа, под разделителем */
.note-discuss-edits { margin-top: 10px; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--violet) 40%, transparent); display: grid; gap: 8px; white-space: normal; }
.note-discuss-edits-info { display: flex; align-items: center; gap: 6px; font-size: 0.8125rem; color: var(--violet-soft); }
.note-discuss-edits-info svg { flex: none; }
.note-discuss-edits.is-undone { border-top-color: var(--overlay-5); }
.note-discuss-edits.is-undone .note-discuss-edits-info { color: var(--text-secondary); }
.note-discuss-edits-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.note-discuss-edits-btn { flex: none; height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--overlay-4); color: var(--text-strong); font: inherit; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; cursor: pointer; }
.note-discuss-edits-btn.is-primary { background: var(--violet); }
.note-discuss-edits-btn:hover { filter: brightness(1.12); }

/* Пустой чат */
.note-discuss-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: auto 0; padding: 32px 12px; text-align: center; }
.note-discuss-empty h4 { margin: 4px 0 0; font-size: 1rem; color: var(--text); }
.note-discuss-empty p { margin: 0; max-width: 30ch; font-size: 0.8125rem; color: var(--text-secondary); }
.note-discuss-empty-ico { width: 48px; height: 48px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--violet) 16%, transparent); border: 1px solid color-mix(in srgb, var(--violet) 45%, transparent); color: var(--violet-soft); }
.note-discuss-empty-ico.is-people { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent-soft); }
.note-discuss-empty-ico svg { width: 22px; height: 22px; }
.note-discuss-sugg { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 6px; }
.note-discuss-sugg button { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--overlay-5); background: var(--overlay-2); color: var(--text); font: inherit; font-size: 0.8125rem; cursor: pointer; }
.note-discuss-sugg button:hover { background: var(--overlay-4); }
/* Пустой чат на «Макете»: группы подсказок, раскрываются по нажатию. */
.note-discuss-groups { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 420px; margin-top: 8px; }
.note-discuss-group { border: 1px solid var(--overlay-5); border-radius: 14px; background: var(--overlay-1, transparent); padding: 4px 8px 6px; }
.note-discuss-group > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 4px; font-size: 0.875rem; font-weight: 600; color: var(--text); cursor: pointer; }
.note-discuss-group > summary::-webkit-details-marker { display: none; }
.note-discuss-group > summary::after { content: ""; width: 7px; height: 7px; border-right: 1.6px solid var(--text-secondary); border-bottom: 1.6px solid var(--text-secondary); transform: rotate(45deg); margin-right: 4px; transition: transform 0.15s; }
.note-discuss-group[open] > summary::after { transform: rotate(-135deg); }
.note-discuss-group .note-discuss-sugg { justify-content: flex-start; margin: 2px 0 4px; }

/* ---------- Поле ввода ---------- */
#note-paie-reply-form { gap: 6px; padding: 8px 8px 8px 12px; border-radius: 22px; border: 1px solid var(--overlay-5); background: var(--overlay-2); box-shadow: none; }
#note-discussion-overlay #note-paie-reply-form { margin-left: 0; margin-right: 0; padding: 8px 8px 8px 12px; }
.note-discussion-compose.note-paie-thread { padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px)) !important; }
.note-paie-toprow { display: flex; align-items: center; gap: 6px; min-width: 0; position: relative; }
#note-paie-reply-form .note-paie-composer-bar { display: none; }
#note-paie-reply-form .note-paie-attach { width: 30px; height: 30px; background: var(--overlay-4); color: var(--text); }
#note-paie-reply-form .note-paie-attach svg { width: 16px; height: 16px; }
#note-paie-reply-form .note-paie-composer-left { flex: 0 1 auto; gap: 0; position: static; }
#note-paie-reply-form .note-paie-mode-switch,
#note-paie-reply-form .note-paie-model-btn { display: none !important; }
#note-paie-reply-form .note-paie-mode-compact { display: inline-flex !important; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 999px; font-size: 0.8125rem; line-height: 1; color: var(--violet-soft); background: color-mix(in srgb, var(--violet) 16%, transparent); border: 1px solid color-mix(in srgb, var(--violet) 45%, transparent); min-width: 0; }
#note-paie-reply-form .note-paie-mode-compact-label { max-width: none !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#note-paie-reply-form .note-paie-mode-compact-ico,
#note-paie-reply-form .note-paie-mode-compact-chev { display: inline-flex; flex: none; }
#note-paie-reply-form .note-paie-mode-compact.is-open .note-paie-mode-compact-chev { transform: rotate(180deg); }
#note-paie-reply-form .note-paie-kb-wrap { position: static; flex: none; }
#note-paie-reply-form .note-paie-kb-toggle { display: inline-flex; align-items: center; gap: 5px; width: auto; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--overlay-6); background: transparent; color: var(--text-secondary); font: inherit; font-size: 0.8125rem; white-space: nowrap; cursor: pointer; }
#note-paie-reply-form .note-paie-kb-toggle.is-on { color: var(--text); border-color: var(--overlay-7); }
#note-paie-reply-form .note-paie-kb-toggle svg { flex: none; width: 15px; height: 15px; }
#note-paie-reply-form .note-paie-composer-row { align-items: flex-end; gap: 6px; padding: 0 !important; }
#note-paie-reply-form .note-paie-composer-input { padding: 6px 2px !important; min-height: 32px; }
.note-paie-mic { flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--overlay-3); color: var(--text); cursor: pointer; }
.note-paie-mic.hidden { display: none; }
#note-paie-reply-form .note-paie-send { width: 34px; height: 34px; background: var(--overlay-5); color: var(--text-subtle); opacity: 1; }
#note-paie-reply-form .note-paie-send.is-ready:not(:disabled) { background: var(--violet); color: var(--on-accent); }
#note-paie-reply-form.is-comment-mode .note-paie-send.is-ready:not(:disabled) { background: var(--accent); }
#note-paie-reply-form .note-paie-send.is-stop { background: var(--text-strong); color: var(--bg); }
#note-paie-reply-form .note-paie-send-up,
#note-paie-reply-form .note-paie-send-stop { display: inline-flex; }
#note-paie-reply-form .note-paie-send-stop,
#note-paie-reply-form .note-paie-send.is-stop .note-paie-send-up { display: none; }
#note-paie-reply-form .note-paie-send.is-stop .note-paie-send-stop { display: inline-flex; }

/* Комментарии (без ИИ): одна строка — «+», текст, микрофон, отправка */
#note-paie-reply-form.is-comments-chat .note-paie-composer-left,
#note-paie-reply-form.is-comment-mode .note-paie-kb-wrap { display: none !important; }
#note-paie-reply-form.is-comments-chat { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
#note-paie-reply-form.is-comments-chat .note-paie-toprow { flex: none; padding-bottom: 2px; }
#note-paie-reply-form.is-comments-chat .note-paie-composer-row { flex: 1 1 0; min-width: 0; }
#note-paie-reply-form.is-comments-chat .note-paie-reply-target,
#note-paie-reply-form.is-comments-chat .note-paie-attach-preview { flex-basis: 100%; }

/* Меню композера открываются над полем ввода */
#note-paie-reply-form .note-paie-menu,
#note-paie-reply-form .note-paie-plus-menu { position: absolute; left: 0; right: auto; bottom: calc(100% + 8px); top: auto; z-index: 30; width: min(320px, calc(100vw - 32px)); max-width: none; max-height: min(60vh, 420px); overflow-y: auto; padding: 6px; }
#note-paie-reply-form .note-paie-plus-menu.hidden,
#note-paie-reply-form .note-paie-menu.hidden { display: none; }
#note-paie-reply-form .note-paie-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font: inherit; font-size: 0.875rem; text-align: left; cursor: pointer; }
#note-paie-reply-form .note-paie-menu-item:hover { background: var(--overlay-3); }
/* Модель закрыта руководителем организации — видна, но не выбирается */
#note-paie-reply-form .note-paie-menu-item.is-locked { flex-direction: column; align-items: flex-start; gap: 2px; color: var(--text-tertiary); cursor: not-allowed; }
#note-paie-reply-form .note-paie-menu-item.is-locked:hover { background: transparent; }
.note-paie-menu-item-sub { font-size: 0.75rem; line-height: 1.3; color: var(--text-tertiary); }
/* Уровень усилия под выбранной моделью: «Быстро · Обычно · Тщательно» */
.note-effort-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 0 10px 10px; }
.note-effort-cap { font-size: 0.75rem; color: var(--text-tertiary); margin-right: 4px; cursor: help; }
.note-effort-chip { border: 0; background: var(--overlay-3); color: var(--text-secondary); border-radius: 999px; padding: 4px 9px; font: inherit; font-size: 0.78125rem; line-height: 1.2; white-space: nowrap; cursor: pointer; }
.note-effort-chip:hover { background: var(--overlay-5); color: var(--text); }
.note-effort-chip.is-on { background: color-mix(in srgb, var(--violet) 22%, transparent); color: var(--text); font-weight: 600; }
.note-plus-ico,
.note-ask-ico { flex: none; width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--overlay-3); color: var(--text-secondary); }
.note-ask-ico.is-spark { background: color-mix(in srgb, var(--violet) 16%, transparent); color: var(--violet-soft); }
.note-ask-copy { flex: 1; min-width: 0; display: grid; gap: 1px; }
.note-ask-copy b { font-weight: 600; font-size: 0.875rem; }
.note-ask-copy small { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.3; }
.note-ask-check { flex: none; color: var(--accent); visibility: hidden; display: inline-flex; }
.note-ask-item.is-active .note-ask-check { visibility: visible; }
#note-paie-reply-form .note-ask-item.is-active { background: var(--overlay-2); }
.note-ask-model .note-ask-model-val { margin-left: auto; color: var(--text-secondary); }
.note-ask-model-chev { display: inline-flex; color: var(--text-secondary); }
#note-paie-reply-form:not(.is-gpt-mode):not(.is-paie-mode):not(.is-research-mode) .note-ask-model,
#note-paie-reply-form:not(.is-gpt-mode):not(.is-paie-mode):not(.is-research-mode) .note-ask-model-hr { display: none; }
#note-paie-reply-form .note-paie-plus-back { margin: 2px 2px 4px; padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text-soft); font: inherit; font-size: 0.8125rem; cursor: pointer; }
#note-paie-reply-form .note-paie-plus-back:hover { background: var(--overlay-3); }
#note-paie-reply-form .note-paie-model-search,
#note-paie-reply-form .note-paie-plus-search { margin: 2px 4px 6px; padding: 8px 10px; border-radius: 9px; border: 0; background: rgba(0, 0, 0, 0.25); color: var(--text); font: inherit; font-size: 0.875rem; }
#note-paie-reply-form .note-paie-menu-section { margin: 8px 10px 4px; font-size: 0.6875rem; letter-spacing: 0.06em; color: var(--text-subtle); }
#note-paie-reply-form .note-paie-kb-check { border-radius: 5px; border-color: rgba(255, 255, 255, 0.35); }
#note-paie-reply-form .note-paie-kb-check.is-on,
#note-paie-reply-form .note-paie-kb-check.is-mixed { border-color: var(--accent); background: var(--accent); }

/* Диктовка в поле обсуждения */
#note-paie-reply-form.is-dictating .note-paie-toprow,
#note-paie-reply-form.is-dictating .note-paie-composer-row { display: none !important; }
#note-paie-reply-form.is-dictating .note-dictation-bar { display: flex; flex-basis: 100%; }
#note-paie-reply-form .note-dictation-bar .note-dict-btn { width: 38px; height: 38px; }
#note-paie-reply-form .note-dictation-bar .note-dict-mid { height: 38px; }

/* Мелочь из ревью: кнопка микрофона в тулбаре редактора — с кругом, как ✨ и 💬 */
.note-tg-btn--mic { background: var(--overlay-3); }
.note-discuss-msg.is-user .note-discuss-role { display: none; }
/* Телефон: обсуждение на весь экран — плашка правок ИИ появится, когда вернётесь к заметке */
@media (max-width: 959px) {
  html.note-discussion-open #note-ai-edit-bar { display: none !important; }
}
.note-discuss-actions { top: -16px; }
.note-discuss-msg.is-assistant:not(.is-cont) .note-discuss-actions,
.note-discuss-msg.is-other:not(.is-cont) .note-discuss-actions { top: -4px; }

/* ===== Обсуждение: правки после ревью (2026-10-15) ===== */
/* 1. Поле ввода не прижато к краям экрана */
#note-paie-thread.note-discussion-compose { padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)) !important; }
#note-discussion-overlay #note-paie-thread.note-discussion-compose { padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)) !important; }

/* 4. Кнопка листов видна и на открытом листе/заметке; название там — без меню */
html.note-discussion-sheet-open #note-discussion-new-ctx.is-chats { visibility: visible !important; }
#note-discussion-title.note-pane-switch--plain .note-pane-switch-chevron { display: none; }

/* 5. «···» — в строке со временем, в углу напротив него */
.note-discuss-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; align-self: stretch; min-height: 24px; margin-top: 2px; }
.note-discuss-msg.is-user .note-discuss-meta { flex-direction: row-reverse; }
.note-discuss-meta .note-discuss-time { margin: 0 4px; }
.note-discuss-meta .note-discuss-actions { position: relative !important; top: auto !important; left: auto !important; right: auto !important; display: inline-flex !important; margin: 0; padding: 0; background: transparent; box-shadow: none; border-radius: 0; }
.note-discuss-meta .note-discuss-more { width: 28px; height: 24px; border-radius: 8px; color: var(--text-secondary); }
.note-discuss-meta .note-discuss-more:hover,
.note-discuss-meta .note-discuss-more[aria-expanded="true"] { color: var(--text); background: var(--overlay-4); }
.note-discuss-msg.is-cont .note-discuss-meta { margin-top: 1px; }

/* 6. Кнопки над выделенным текстом ответа — та же тёмная плашка с иконками */
.note-discuss-selection { height: 32px; padding: 2px; gap: 2px; border-radius: 10px; background: var(--surface-raised); color: var(--text); box-shadow: 0 6px 16px color-mix(in srgb, var(--shadow-color) 45%, transparent), 0 0 0 0.5px var(--overlay-3); }
.note-discuss-selection-btn { width: 30px; height: 28px; border-radius: 7px; color: var(--text); }
.note-discuss-selection-btn:hover,
.note-discuss-selection-btn:active { background: var(--overlay-4); }
.note-discuss-selection .note-discuss-menu-icon { color: currentColor; }
/* Телефон: панель выделения внизу над полем ввода, кнопки под палец */
.note-discuss-selection.is-docked { height: 46px; padding: 3px; gap: 4px; border-radius: 14px; }
.note-discuss-selection.is-docked .note-discuss-selection-btn { width: 40px; height: 40px; border-radius: 10px; }

/* 7. Меню «Обсуждение / листы / новый лист / открыть заметку»: иконки и воздух между группами */
#note-pane-switch-menu { padding: 6px; min-width: 240px; }
#note-pane-switch-menu .note-pane-switch-item.has-ico { display: flex; align-items: center; gap: 10px; text-align: left; }
.note-pane-ico { flex: none; width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; background: var(--overlay-3); color: var(--text-secondary); }
#note-pane-switch-menu .note-pane-switch-item.is-active .note-pane-ico { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-soft); }
#note-pane-switch-menu .note-pane-switch-sep { height: 1px; margin: 8px 6px; background: var(--overlay-3); }
#note-pane-switch-menu .note-pane-switch-label { margin: 6px 10px 4px; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }

/* Список чатов: подложка под меню, а не над ним (иначе клики уходили в неё) */
#note-chats-backdrop.is-dropdown { z-index: 399 !important; }
#note-chats-menu.is-dropdown { z-index: 401 !important; }
.note-chats-actions[style*="fixed"] { background: var(--surface-raised); border: 0; border-radius: 12px; box-shadow: 0 14px 40px color-mix(in srgb, var(--shadow-color) 50%, transparent), 0 0 0 0.5px var(--overlay-3); }
#note-discussion-new-ctx.is-open { background: var(--overlay-6); }
/* Реплай: мигаем цитируемым фрагментом */
::highlight(leo-flash) { background-color: color-mix(in srgb, var(--warning) 45%, transparent); color: inherit; }
/* Ссылка на фрагмент заметки (…/webapp/?note=N&…&q=…) — с пометкой, чтобы не путать с внешней. */
.note-rich-editor-body a[href*="/webapp/?note="][href*="&q="]::before {
  content: "#";
  margin-right: 1px;
  font-weight: 600;
  opacity: 0.6;
}
.note-discuss-bubble.is-flash, .is-flash { box-shadow: 0 0 0 2px color-mix(in srgb, var(--warning) 70%, transparent); border-radius: 8px; }
.note-discuss-reply.is-nav { cursor: pointer; }

/* Вкладки «Заметки / Чаты / Транскрипции» всплывают при прокрутке вверх */
#panel-notes .notes-subtabs-row.is-floating { position: fixed; top: 0; z-index: 60; margin: 0; padding-top: calc(var(--safe-top, 0px) + 8px); padding-bottom: 8px; background: var(--bg); box-sizing: border-box; transform: translateY(-110%); transition: transform 0.22s ease; pointer-events: none; }
#panel-notes .notes-subtabs-row.is-floating.is-shown { transform: none; pointer-events: auto; box-shadow: 0 10px 18px -12px color-mix(in srgb, var(--shadow-color) 60%, transparent); }
@media (prefers-reduced-motion: reduce) { #panel-notes .notes-subtabs-row.is-floating { transition: none; } }

/* Цитата в поле ввода переносится, а не уходит за правый край */
#note-paie-reply-form .note-gpt-quote-chip { display: inline; white-space: normal; overflow-wrap: anywhere; max-width: none; border-radius: 8px; padding: 1px 6px; line-height: 22px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
#note-paie-reply-form .note-paie-reply-target-quote { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

/* Меню проекта — как остальные меню: подпись, иконки, галочка, «Новый проект…» */
.tag-picker-menu { background: var(--surface-raised); border: 0; border-radius: 14px; padding: 6px; min-width: 220px; box-shadow: 0 14px 40px color-mix(in srgb, var(--shadow-color) 50%, transparent), 0 0 0 0.5px var(--overlay-3); }
.tag-picker-menu .tag-picker-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font: inherit; font-size: 0.875rem; text-align: left; cursor: pointer; }
.tag-picker-menu .tag-picker-menu-item:hover { background: var(--overlay-3); }
.tag-picker-menu .tag-picker-menu-item--selected { background: var(--overlay-2); }
.tag-picker-menu-ico { flex: none; width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; background: var(--overlay-3); color: var(--text-secondary); }
.tag-picker-menu-item--selected .tag-picker-menu-ico { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-soft); }
.tag-picker-menu .tag-picker-menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; padding: 0; font-size: inherit; letter-spacing: 0; text-transform: none; color: inherit; font-weight: 400; }
.tag-picker-menu .tag-picker-menu-check { flex: none; display: inline-flex; width: 16px; color: var(--accent); }
.tag-picker-menu .tag-picker-menu-head { margin: 6px 10px 4px; }
.tag-picker-menu .tag-picker-menu-item--create { color: var(--accent); }
.tag-picker-menu .tag-picker-menu-item--create .tag-picker-menu-ico { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tag-picker-menu .tag-picker-menu-empty { margin: 6px 10px; color: var(--text-secondary); font-size: 0.8125rem; }

/* Слои: меню поля ввода обсуждения — над «···» сообщений; меню проекта — над кнопкой оглавления */
#note-paie-thread.note-discussion-compose { position: relative; z-index: 50; }
#note-editor-overlay .note-editor-meta .tag-picker-add-wrap { z-index: 140; }

/* Подсказка в пустом поле — на той же строке, что и текст (отступ поля стал 6px) */
#note-paie-reply-form .note-paie-composer-editor.is-empty::before,
#note-paie-reply-form .note-paie-composer-editor.is-empty.is-multiline::before { top: 6px; left: 2px; right: 2px; }

/* Действия ИИ с календарём — внутри ответа, под разделителем */
.note-discuss-cal { margin-top: 10px; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--violet) 40%, transparent); display: grid; gap: 10px; white-space: normal; }
.note-discuss-cal-item { display: grid; gap: 8px; }
.note-discuss-cal-info { display: flex; align-items: flex-start; gap: 7px; font-size: 0.8125rem; line-height: 1.35; color: var(--violet-soft); }
.note-discuss-cal-info svg { flex: none; margin-top: 1px; }
.note-discuss-cal-item.is-proposed .note-discuss-cal-info { color: var(--danger-text); }
.note-discuss-cal-item.is-faded .note-discuss-cal-info { color: var(--text-secondary); }
.note-discuss-edits-btn.is-danger { background: var(--danger); }

/* Контакты списком ников */
.contacts-bulk-input { min-height: 84px; resize: vertical; font: inherit; }
.contacts-bulk-save { width: 100%; margin-top: 4px; }
.contacts-bulk-results { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.contacts-bulk-results.hidden { display: none; }
.contacts-bulk-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 8px 10px; border-radius: 10px; background: var(--overlay-2); font-size: 0.875rem; }
.contacts-bulk-row b { font-weight: 600; }
.contacts-bulk-row .contacts-bulk-name { color: var(--text); }
.contacts-bulk-row small { flex-basis: 100%; color: var(--text-secondary); font-size: 0.75rem; }
.contacts-bulk-row.is-ok small { color: var(--emerald-text); }
.contacts-bulk-row.is-warn small { color: var(--warning-text); }
.contacts-bulk-row.is-err small { color: var(--danger-text); }
.modal-header-spacer { display: inline-block; width: 36px; height: 36px; }

/* Карточки встреч/задач/напоминаний и варианты времени в ответе ИИ */
.note-cal-card { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 12px; background: var(--overlay-2); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.note-cal-card:hover { background: var(--overlay-4); }
.note-cal-card.is-done { opacity: 0.62; }
.note-cal-card.is-done .note-cal-card-copy b { text-decoration: line-through; }
.note-cal-card-ico { flex: none; width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--violet) 16%, transparent); color: var(--violet-soft); }
.note-cal-card-copy { flex: 1; min-width: 0; display: grid; gap: 2px; }
.note-cal-card-copy b { font-weight: 600; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-cal-card-copy small { font-size: 0.75rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-cal-card-chev { flex: none; display: inline-flex; color: var(--text-secondary); }
.note-cal-slots-label { margin: 0; font-size: 0.75rem; color: var(--violet-soft); }
.note-cal-slot { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--overlay-2); }
.note-cal-slot .note-discuss-edits-btn { flex: none; }
.note-discuss-cal:has(.note-cal-card, .note-cal-slot) { gap: 6px; }

/* «+» на «Актуальном»: меню в общем стиле, первым — Ассистент */
#actual-create-menu.actual-create-menu { gap: 2px; width: min(16rem, calc(100vw - 2rem)); padding: 6px; border: 0; border-radius: 16px; background: var(--surface-raised); box-shadow: 0 14px 40px color-mix(in srgb, var(--shadow-color) 50%, transparent), 0 0 0 0.5px var(--overlay-3); backdrop-filter: none; }
#actual-create-menu .actual-create-menu-btn { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: transparent; font-weight: 500; }
#actual-create-menu .actual-create-menu-btn:hover,
#actual-create-menu .actual-create-menu-btn:active { background: var(--overlay-3); transform: none; }
.actual-create-ico { flex: none; width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--overlay-3); color: var(--text-secondary); }
.actual-create-copy { display: grid; gap: 1px; min-width: 0; }
.actual-create-copy b { font-weight: 600; font-size: 0.9375rem; }
.actual-create-copy small { font-size: 0.75rem; color: var(--text-secondary); font-weight: 400; }
#actual-create-menu .actual-create-menu-btn.is-ai .actual-create-ico { background: color-mix(in srgb, var(--violet) 18%, transparent); color: var(--violet-soft); }
#actual-create-menu .actual-create-menu-btn.is-ai .actual-create-copy b { color: var(--violet-soft); }
.actual-create-sep { height: 1px; margin: 4px 6px; background: var(--overlay-3); }

/* Ассистент открыт справа — «+» и его меню сдвигаются левее панели */
@media (min-width: 960px) {
  html.actual-assistant-open .actual-fab,
  html.actual-assistant-open #actual-create-menu.actual-create-menu { right: calc(var(--discuss-w, 420px) + 24px) !important; }
  html.actual-assistant-open .actual-fab { transition: right 0.2s ease; }
}
@media (min-width: 960px) {
  /* Ассистент открыт на «Актуальном» — экран сжимается, календарь не уходит под панель */
  html.actual-assistant-open .main-scroll { padding-right: calc(var(--discuss-w, 420px) + var(--page-x, 16px)); }
}

/* «+» в «Заметках»: меню Заметка / Надиктовать в общем стиле */
#notes-create-menu.actual-create-menu { gap: 2px; width: min(17rem, calc(100vw - 2rem)); padding: 6px; border: 0; border-radius: 16px; background: var(--surface-raised); box-shadow: 0 14px 40px color-mix(in srgb, var(--shadow-color) 50%, transparent), 0 0 0 0.5px var(--overlay-3); backdrop-filter: none; }
#notes-create-menu .actual-create-menu-btn { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: transparent; font-weight: 500; }
#notes-create-menu .actual-create-menu-btn:hover,
#notes-create-menu .actual-create-menu-btn:active { background: var(--overlay-3); transform: none; }

/* ——— Список заметок: новая карточка, группы по времени ——— */
.notes-list-group { grid-column: 1 / -1; margin: 6px 4px -4px; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary); }
.notes-pane--stack > .notes-list-group:first-child { margin-top: 0; }
.note-card.nl-card { padding: 12px 14px; border-radius: 14px; }
.note-card.nl-card .nl-inner { padding: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.nl-head { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 28px; }
.nl-title { flex: 1; min-width: 0; font-weight: 600; font-size: 0.9375rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.nl-date { flex: none; font-size: 0.75rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.nl-head .note-card-actions { position: static; flex: none; max-width: none; margin: -4px -8px -4px -4px; }
.nl-preview { margin: 0; font-size: 0.8125rem; line-height: 1.4; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.nl-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 0.75rem; color: var(--text-secondary); min-width: 0; }
.nl-foot > * { margin: 0 !important; }
.nl-foot .note-card-tags, .nl-foot .tag-chips-row { display: contents; }
.nl-badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 7px; background: var(--overlay-2); }
.nl-shared { margin-left: auto !important; display: inline-flex; align-items: center; gap: 6px; }
.nl-shared .note-card-avatars { padding: 0; }
.notes-project-chip-count { margin-left: 5px; font-weight: 500; opacity: 0.6; font-variant-numeric: tabular-nums; }
.notes-skeleton-card { height: 92px; border-radius: 14px; background: linear-gradient(90deg, var(--overlay-1), var(--overlay-3), var(--overlay-1)); background-size: 200% 100%; animation: notesSkel 1.2s ease-in-out infinite; }
@keyframes notesSkel { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* Свайп вправо — закрепить */
.swipe-row__pin { position: absolute; top: 0; left: 0; bottom: 0; z-index: 0; display: flex; align-items: center; justify-content: flex-start; padding-left: 18px; width: 50%; font-size: 0.75rem; font-weight: 600; color: var(--on-accent); background: color-mix(in srgb, var(--accent) 55%, transparent); visibility: hidden; transition: background 0.15s ease; }
.swipe-row--pin .swipe-row__pin { visibility: visible; }
.swipe-row__pin.is-armed { background: var(--accent); }

/* Шторка действий карточки (долгое нажатие / правый клик) */
.nl-sheet-overlay { position: fixed; inset: 0; z-index: 420; display: flex; align-items: flex-end; justify-content: center; padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); background: rgba(0, 0, 0, 0); transition: background 0.18s ease; }
.nl-sheet-overlay.is-open { background: rgba(0, 0, 0, 0.45); }
.nl-sheet { width: 100%; max-width: 420px; max-height: 80vh; overflow-y: auto; padding: 6px; border-radius: 18px; background: var(--surface-raised); box-shadow: 0 14px 40px color-mix(in srgb, var(--shadow-color) 50%, transparent), 0 0 0 0.5px var(--overlay-3); transform: translateY(16px); opacity: 0; transition: transform 0.2s ease, opacity 0.2s ease; }
.nl-sheet-overlay.is-open .nl-sheet { transform: none; opacity: 1; }
.nl-sheet-title { padding: 10px 12px 8px; font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nl-sheet-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 0; border-radius: 12px; background: transparent; color: var(--text); font: inherit; font-size: 0.9375rem; text-align: left; cursor: pointer; }
.nl-sheet-item:hover, .nl-sheet-item:active { background: var(--overlay-3); }
.nl-sheet-item.is-active { color: var(--accent-soft); }
.nl-sheet-item.is-danger { color: var(--danger); }
.nl-sheet-ico { flex: none; display: inline-flex; color: var(--text-secondary); }
.nl-sheet-item.is-danger .nl-sheet-ico { color: var(--danger); }
.nl-sheet-item.is-active .nl-sheet-ico { color: var(--accent-soft); }
.nl-sheet-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nl-sheet-hint { flex: none; max-width: 40%; font-size: 0.8125rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nl-sheet-sep { height: 1px; margin: 4px 8px; background: var(--overlay-3); }
@media (min-width: 960px) { .nl-sheet-overlay { align-items: center; } }

/* Выбор нескольких заметок */
.nl-check { position: absolute; top: 12px; left: 12px; z-index: 5; width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.35); background: var(--surface); color: transparent; display: none; align-items: center; justify-content: center; cursor: pointer; }
.note-card.nl-card { position: relative; }
html.notes-select-on .nl-card .nl-check { display: inline-flex; }
html.notes-select-on .nl-card .nl-inner { padding-left: 32px; }
html.notes-select-on .nl-card .note-card-actions { display: none; }
.nl-card.is-selected { box-shadow: inset 0 0 0 1.5px var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.nl-card.is-selected .nl-check { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
html.notes-select-on #notes-create-btn, html.notes-select-on #notes-create-menu { display: none !important; }
.notes-select-top { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 8px; right: 8px; z-index: 60; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 8px 0 16px; border-radius: 16px; background: var(--surface-raised); box-shadow: 0 10px 30px color-mix(in srgb, var(--shadow-color) 45%, transparent); }
.notes-select-count { flex: 1; font-weight: 600; font-size: 0.9375rem; }
.notes-select-all, .notes-select-done { height: 34px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--accent); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; }
.notes-select-done { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.notes-select-bar { position: fixed; left: 8px; right: 8px; bottom: calc(var(--tabbar-stack, 72px) + 8px); z-index: 60; display: flex; justify-content: space-around; gap: 4px; padding: 6px; border-radius: 18px; background: var(--surface-raised); box-shadow: 0 10px 30px color-mix(in srgb, var(--shadow-color) 45%, transparent); }
.notes-select-act { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border: 0; border-radius: 12px; background: transparent; color: var(--text); font: inherit; font-size: 0.6875rem; font-weight: 500; cursor: pointer; }
.notes-select-act:hover:not(:disabled) { background: var(--overlay-3); }
.notes-select-act:disabled { opacity: 0.4; cursor: default; }
.notes-select-act.is-danger { color: var(--danger); }
.notes-select-top.hidden, .notes-select-bar.hidden { display: none; }
@media (min-width: 960px) {
  .notes-select-top { left: calc(var(--sidebar-w, 244px) + 24px); right: 24px; top: 12px; max-width: 760px; }
  .notes-select-bar { left: calc(var(--sidebar-w, 244px) + 24px); right: auto; bottom: 24px; width: 420px; }
}
html.notes-select-on .notes-pane--stack { padding-bottom: 96px; }
.nl-card mark { background: color-mix(in srgb, var(--warning) 28%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.notes-load-more { grid-column: 1 / -1; }

/* ——— Десктоп: список слева, заметка справа ——— */
/* Проекты — кнопкой со списком (и на телефоне, и на десктопе) вместо ленты чипов */
#notes-project-chips { display: none !important; }
.notes-project-btn { display: inline-flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; max-width: 150px; height: 2.5rem; margin-left: auto; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-md, 12px); background: var(--surface); color: var(--text); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; }
.notes-project-btn.is-active { border-color: var(--accent-border); color: var(--accent-soft); }
.notes-project-btn-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-project-btn svg { flex: none; }
.notes-search-wrap--open ~ .notes-project-btn { margin-left: 0; }
.notes-search-wrap--open ~ .notes-project-btn .notes-project-btn-label,
.notes-search-wrap--open ~ .notes-project-btn svg:last-child { display: none; }
html.notes-chats-tab .notes-project-btn { display: none; }
.notes-split-placeholder { display: none; }
.note-editor-expand-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; margin-left: 0; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--text-secondary); cursor: pointer; flex: none; }
.note-editor-expand-btn:hover { background: var(--overlay-3); color: var(--text); }
.note-editor-expand-btn.hidden { display: none; }
@media (min-width: 960px) {
  html.notes-split #panel-notes { max-width: none; }
  html.notes-col #panel-notes { max-width: none !important; margin-left: 0 !important; margin-right: 0 !important; }
  html.notes-col #notes-root { width: clamp(300px, 28vw, 380px) !important; max-width: 380px !important; margin-left: 0 !important; margin-right: 0 !important; }
  html.notes-split .notes-pane--stack { grid-template-columns: minmax(0, 1fr) !important; gap: 8px; }
  html.notes-split #notes-project-chips { display: none; }
  html.notes-split .notes-filter-bar { flex-wrap: nowrap; gap: 8px; }
  html.notes-split .notes-search-wrap { flex: 1 1 auto; min-width: 0; }
  html.notes-split .notes-search-wrap--open ~ .notes-project-btn .notes-project-btn-label,
  html.notes-split .notes-search-wrap--open ~ .notes-project-btn svg:last-child { display: inline; }
  html.notes-split #note-editor-overlay { left: var(--notes-split-left, 660px) !important; right: 0 !important; width: auto !important; border-left: 1px solid var(--border); box-shadow: none; }
  html.notes-split #note-editor-overlay .note-pane-resizer { display: none !important; }
  html.notes-split #note-editor-web-back { display: none; }
  html.notes-split.modal-sheet-open, html.notes-split.modal-sheet-open body { overflow: auto; }
  html.notes-split .notes-fab, html.notes-split #notes-create-menu.actual-create-menu { right: calc(100vw - var(--notes-split-left, 660px) + 28px) !important; }
  html.notes-split-empty .notes-split-placeholder { display: flex; position: fixed; top: 0; bottom: 0; right: 0; left: var(--notes-split-left, 660px); z-index: 4; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border-left: 1px solid var(--border); color: var(--text-secondary); text-align: center; pointer-events: none; }
  .notes-split-placeholder p { margin: 8px 0 0; font-size: 1rem; color: var(--text); }
  .notes-split-placeholder small { font-size: 0.8125rem; }
  .notes-split-placeholder small { max-width: 22rem; line-height: 1.45; }
  .notes-split-placeholder .pf-btn { width: auto; margin-top: 10px; padding: 0.55rem 1.25rem; pointer-events: auto; }
  html.notes-split .nl-card.is-current { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
  .nl-sheet-overlay.is-anchored { background: transparent !important; align-items: flex-start; justify-content: flex-start; padding: 0; }
  .nl-sheet-overlay.is-anchored .nl-sheet { transform: none; max-width: none; }
}

/* ——— «Чаты» в том же виде, что «Заметки»: карточки, колонка списка, справа — чат ——— */
/* Список чатов — строки в одном блоке, с разделителями (не карточки) */
#chat-threads-list.chat-threads-list { gap: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; }
#chat-threads-list.chat-threads-list > .empty-hint { margin: 0; border: 0; }
.chat-thread-row.cl-row { padding: 10px 6px 10px 14px; border-bottom: 1px solid var(--border); }
.chat-thread-row.cl-row:last-child { border-bottom: 0; }
.chat-thread-row.cl-row:hover { background: var(--overlay-1); }
.chat-thread-row.cl-row.is-active { background: color-mix(in srgb, var(--accent) 9%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.cl-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cl-title { flex: 1; min-width: 0; font-weight: 600; font-size: 0.9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.cl-date { flex: none; font-size: 0.75rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.cl-head .note-card-pin { flex: none; color: var(--accent); display: inline-flex; }
.chat-thread-row.cl-row .chat-thread-row-preview { margin-top: 2px; font-size: 0.8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-thread-row.cl-row mark { background: color-mix(in srgb, var(--warning) 28%, transparent); color: inherit; border-radius: 3px; }
@media (min-width: 960px) {
  html.notes-chats-tab #notes-pane-chats.chat-threads-pane,
  #notes-pane-chats.chat-threads-pane:not(.hidden) { border: 0 !important; border-radius: 0 !important; overflow: visible !important; }
  #notes-pane-chats:not(.hidden) #chat-threads-list { width: 100% !important; flex: 1 1 auto !important; overflow: visible !important; height: auto !important; }
  #notes-pane-chats:not(.hidden) .chat-threads-splitter { display: none !important; }
  #notes-pane-chats:not(.hidden) #chat-thread-pane { position: fixed !important; top: 0; bottom: 0; right: 0; left: var(--notes-split-left, 696px); height: auto !important; border-left: 1px solid var(--border); z-index: 6; }
  /* Только «+» в «Сохранённом»: кнопки других экранов (Актуальное, База знаний) не двигаем. */
  html.notes-chats-tab #panel-notes .notes-fab { right: calc(100vw - var(--notes-split-left, 696px) + 28px) !important; }
  html.notes-chats-tab #notes-filter-btn,
  html.notes-chats-tab #notes-project-btn,
  html.notes-chats-tab #notes-project-chips,
  html.notes-chats-tab #notes-search-tag-btn { display: none !important; }
  html.notes-chats-tab .notes-filter-bar { flex-wrap: nowrap; }
  html.notes-chats-tab .notes-search-wrap { flex: 1 1 auto; min-width: 0; }
  #chat-thread-empty.chat-thread-empty { color: var(--text-secondary); }
}

/* Десктоп: нижняя панель редактора — один общий блок, как в макете */
@media (min-width: 960px) {
  #note-editor-toolbar-wrap .note-editor-toolbar-row { gap: 4px; padding: 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--overlay-3); box-shadow: 0 8px 24px color-mix(in srgb, var(--shadow-color) 35%, transparent); }
  #note-editor-toolbar-wrap .note-tg-toolbar { gap: 0; }
  #note-editor-toolbar-wrap .note-tg-capsule { background: transparent; box-shadow: none; padding: 0 6px; border-radius: 0; border-left: 1px solid var(--overlay-4); }
  #note-editor-toolbar-wrap .note-tg-btn { width: 36px; height: 36px; border-radius: 10px; }
  #note-editor-toolbar-wrap .note-tg-btn:hover:not(:disabled) { background: var(--overlay-3); }
  #note-editor-toolbar-wrap .note-tg-btn--ai { border-radius: 50%; box-shadow: none; }
  #note-editor-toolbar-wrap .note-tg-btn--discuss,
  #note-editor-toolbar-wrap .note-tg-btn--gpt,
  #note-editor-toolbar-wrap .note-tg-btn--undo,
  #note-editor-toolbar-wrap .note-tg-btn--mic { background: transparent; }
  #note-editor-toolbar-wrap .note-tg-btn--active,
  #note-editor-toolbar-wrap .note-tg-btn--menu-open { color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
}

@media (min-width: 960px) {
  /* Одна колонка списка для «Заметок», «Транскрипций» и «Чатов» — ширина не прыгает при переключении */
  html.notes-col .notes-filter-bar { flex-wrap: nowrap; gap: 8px; }
  html.notes-col .notes-search-wrap { flex: 1 1 auto; min-width: 0; }
  /* Поле поиска всегда открыто — иконка внутри поля, без отдельной кнопки */
  html.notes-col #notes-search-toggle { display: none; }
  html.notes-col .notes-search-wrap .notes-search-field { position: relative; flex: 1 1 auto; margin-left: 0; }
  html.notes-col .notes-search-wrap .notes-search-input { padding-left: 2.25rem; }
  html.notes-col .notes-search-wrap .notes-search-field::before { content: ""; position: absolute; left: 0.75rem; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); pointer-events: none; opacity: 0.6; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") center / contain no-repeat; color: var(--text-secondary); z-index: 1; }
  /* Шторка фильтра — над колонкой списка, а не под открытой заметкой */
  html.notes-col #notes-filter-overlay.modal-overlay { left: var(--sidebar-w, 244px); right: calc(100vw - var(--notes-split-left, 696px)); z-index: 130; align-items: flex-start; justify-content: stretch; padding: 16px 12px; }
  html.notes-col #notes-filter-overlay .modal { width: 100%; max-width: none; max-height: calc(100dvh - 32px); }
  /* Под панелью редактора нет отдельной подложки */
  #note-editor-toolbar-wrap.note-editor-toolbar-wrap--bottom { background: transparent; border-top: 0; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 8px 16px 16px; }
}

@media (min-width: 960px) {
  /* Колонка списка по центру своего места и на уровне кнопки сворачивания меню */
  html.notes-col .main-scroll { padding-left: 16px; padding-top: 18px; }
  /* Фильтр — внутри поля поиска, рядом с «#» */
  #notes-search-field > #notes-filter-btn { position: absolute; right: 2.4rem; top: 50%; transform: translateY(-50%); width: 2rem; height: 2rem; padding: 0; border: 0; border-radius: var(--radius-sm, 8px); background: transparent; color: var(--text-secondary); z-index: 1; }
  #notes-search-field > #notes-filter-btn:hover { color: var(--text); background: var(--overlay-2); }
  #notes-search-field > #notes-filter-btn .notes-filter-badge { top: -0.2rem; right: -0.2rem; }
  html.notes-col .notes-search-wrap .notes-search-input { padding-right: 4.6rem; }
  /* Панель редактора: без тени вниз (она выглядела лишней подложкой) */
  #note-editor-toolbar-wrap .note-editor-toolbar-row { box-shadow: none; }
  #note-editor-overlay #note-editor-toolbar-wrap.note-editor-toolbar-wrap--bottom { padding: 8px 16px 16px; }
  /* «Чаты»: шапка диалога по левому краю, замок слева от названия */
  html.notes-chats-tab .note-discussion-header { grid-template-columns: minmax(0, 1fr) auto !important; padding-left: 16px; }
  html.notes-chats-tab .note-discussion-header > #note-discussion-close { display: none !important; }
  html.notes-chats-tab .note-discussion-header > .note-pane-switch-wrap { grid-column: 1 !important; justify-self: stretch; justify-content: flex-start !important; min-width: 0; }
  html.notes-chats-tab .note-discussion-header > .note-chats-wrap { grid-column: 2 !important; }
  html.notes-chats-tab #note-discussion-title { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; row-gap: 1px; align-items: center; justify-items: start; text-align: left; width: 100%; }
  html.notes-chats-tab #note-discussion-title.is-private-chat::before { grid-row: 1 / span 2; grid-column: 1; width: 16px; height: 16px; }
  html.notes-chats-tab #note-discussion-title .note-discussion-title-line { grid-column: 2; }
  html.notes-chats-tab #note-discussion-title .note-discussion-subtitle { grid-column: 2; }
  html.notes-chats-tab #note-discussion-title:not(.is-private-chat) .note-discussion-title-line,
  html.notes-chats-tab #note-discussion-title:not(.is-private-chat) .note-discussion-subtitle { grid-column: 1 / -1; }
}

@media (min-width: 960px) {
  /* Окно заметки: без нижнего отступа общего .modal — под тулбаром не остаётся полосы фона */
  #note-editor-overlay .modal.note-editor-sheet { padding-bottom: 0 !important; }
}
@media (min-width: 960px) {
  /* Узкая заметка (рядом обсуждение): кнопки не сжимаются, средняя группа листается вбок */
  #note-editor-toolbar-wrap .note-tg-btn { flex: 0 0 auto; }
  #note-editor-toolbar-wrap .note-editor-format-toolbar-host,
  #note-editor-toolbar-wrap .note-tg-toolbar { min-width: 0; }
  #note-editor-toolbar-wrap .note-tg-capsule--default { min-width: 0; overflow-x: auto; scrollbar-width: none; }
}

/* Поиск: крестик «очистить», когда есть текст */
.notes-search-clear { position: absolute; top: 50%; right: 2.4rem; transform: translateY(-50%); z-index: 2; width: 1.5rem; height: 1.5rem; padding: 0; border: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--overlay-5); color: var(--text); cursor: pointer; }
.notes-search-clear:hover { background: var(--overlay-7); }
.notes-search-clear.hidden { display: none; }
.notes-search-wrap.has-value .notes-search-input { padding-right: 4.4rem; }
@media (min-width: 960px) {
  #notes-search-field .notes-search-clear { right: 4.5rem; }
  html.notes-col .notes-search-wrap.has-value .notes-search-input { padding-right: 6.5rem; }
  /* Поле поиска в фокусе или с текстом — кнопка проекта сжимается до иконки */
  html.notes-col .notes-search-wrap:focus-within ~ #notes-project-btn .notes-project-btn-label,
  html.notes-col .notes-search-wrap:focus-within ~ #notes-project-btn svg:last-child,
  html.notes-col .notes-search-wrap.has-value ~ #notes-project-btn .notes-project-btn-label,
  html.notes-col .notes-search-wrap.has-value ~ #notes-project-btn svg:last-child { display: none; }
  html.notes-col .notes-search-wrap:focus-within ~ #notes-project-btn,
  html.notes-col .notes-search-wrap.has-value ~ #notes-project-btn { padding: 0; width: 2.5rem; justify-content: center; }
}

/* Проект в заметке — в общем стиле кнопок (как «📁 Проект ▾» в списке), без пунктира */
.note-editor-meta .tag-picker-add-btn { height: 28px; min-height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text-secondary); font-size: 0.8125rem; font-weight: 600; }
.note-editor-meta .tag-picker-add-btn:hover { color: var(--text); border-color: var(--overlay-7); }
.note-editor-meta .tag-picker-add-btn.tag-picker-trigger--selected { color: var(--accent-soft); border-color: var(--accent-border); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.note-editor-meta .tag-picker-add-btn-inner { gap: 6px; }
.note-editor-meta .tag-picker-add-btn-icon { width: 14px; height: 14px; }
#note-editor-overlay.note-editor-overlay--fullscreen .note-editor-meta .tag-picker-add-btn { font-size: 0.8125rem; line-height: 1; font-weight: 600; }

/* Реплай в поле ввода обсуждения — с отступом от «+» и от текста */
#note-paie-reply-form .note-paie-reply-target { margin: 4px 4px 10px; padding: 0; gap: 10px; }
#note-paie-reply-form.is-comments-chat .note-paie-reply-target { margin: 4px 4px 8px; }

/* «Дайджест» показываем, только когда известно, что он включён (класс ставится при запуске из памяти) */
html:not(.digest-on) .tabbar-btn[data-tab="digest"],
html:not(.digest-on) .sidebar-nav-group[data-sidebar-group="digest"] { display: none !important; }

/* ---- История версий заметки ---- */
.note-history-overlay {
  position: fixed;
  inset: 0;
  z-index: 230;
  display: flex;
  background: var(--bg);
  color: var(--text);
}
.note-history-overlay.hidden { display: none !important; }
.nh-sheet { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.nh-screen { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.nh-screen.hidden { display: none !important; }
.nh-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 6px 12px;
  padding-top: calc(6px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.nh-title { font-weight: 600; font-size: 1rem; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nh-back {
  border: none; background: transparent; color: var(--accent); font: inherit; font-size: 0.95rem;
  padding: 6px 4px; cursor: pointer; white-space: nowrap;
}
.nh-close { display: none; }
.nh-filter { display: flex; gap: 6px; padding: 10px 12px; overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
.nh-filter::-webkit-scrollbar { display: none; }
.nh-filter.hidden { display: none; }
.nh-chip {
  flex-shrink: 0; border: 1px solid var(--border); background: transparent; color: var(--text-secondary);
  border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 0.82rem; cursor: pointer; white-space: nowrap;
}
.nh-chip.is-on { background: var(--accent-muted); border-color: var(--accent-border); color: var(--text); }
.nh-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px calc(16px + env(safe-area-inset-bottom, 0px)); overscroll-behavior: contain; }
.nh-day { padding: 14px 8px 6px; font-size: 0.75rem; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; }
.nh-row {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 9px 8px; border: none; border-radius: 10px;
  background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.nh-row:hover { background: var(--surface-muted); }
.nh-row.is-sel { background: var(--accent-subtle); box-shadow: inset 0 0 0 1px var(--accent-border); }
.nh-row--now { margin-top: 4px; }
.nh-av {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden; background: var(--surface-elevated); color: var(--text-secondary); font-size: 0.8rem; font-weight: 600;
}
.nh-av img { width: 100%; height: 100%; object-fit: cover; }
.nh-av--ai { background: color-mix(in srgb, var(--violet) 20%, transparent); color: var(--violet-text); }
.nh-row-mid { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.nh-row-top { display: flex; align-items: baseline; gap: 8px; font-size: 0.9rem; }
.nh-row-sub { font-size: 0.8rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nh-delta { font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.nh-delta.is-plus { color: var(--success); }
.nh-delta.is-minus { color: var(--danger); }
.nh-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.nh-tag { font-size: 0.7rem; padding: 1px 7px; border-radius: 999px; background: var(--surface-elevated); color: var(--text-secondary); }
.nh-tag--ai { background: color-mix(in srgb, var(--violet) 20%, transparent); color: var(--violet-text); }
.nh-tag--del { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger-text); }
.nh-empty { padding: 16px 8px; color: var(--text-secondary); font-size: 0.88rem; line-height: 1.45; }
.nh-seg { display: flex; gap: 4px; margin: 10px 12px 0; padding: 3px; border-radius: 10px; background: var(--surface-elevated); flex-shrink: 0; }
.nh-seg.hidden { display: none; }
.nh-seg button { flex: 1; border: none; background: transparent; color: var(--text-secondary); border-radius: 8px; padding: 6px; font: inherit; font-size: 0.85rem; cursor: pointer; }
.nh-seg button.is-on { background: var(--surface); color: var(--text); }
.nh-view-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px 24px; }
.nh-view-foot { flex-shrink: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); }
.nh-restore-big { width: 100%; }
.nh-doc { user-select: text; -webkit-user-select: text; line-height: 1.55; word-break: break-word; }
.nh-doc img { max-width: 100%; height: auto; }
.nh-doc table { border-collapse: collapse; }
.nh-doc td, .nh-doc th { border: 1px solid var(--border); padding: 4px 8px; }
.nh-doc--diff p { margin: 0 0 0.5em; }
.nh-doc ins { text-decoration: none; background: color-mix(in srgb, var(--success) 22%, transparent); color: inherit; border-radius: 3px; }
.nh-doc del { text-decoration: line-through; background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger-text); border-radius: 3px; }
.nh-diff-none { color: var(--text-secondary); font-style: italic; }
.nh-web-frame { width: 100%; min-height: 70vh; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.nh-board-frame { position: relative; display: flex; width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.nh-preview { display: block; }
.nh-preview.hidden { display: none !important; }
#note-editor-overlay.nh-previewing .note-editor-pad--body,
#note-editor-overlay.nh-previewing #note-editor-toolbar-wrap { display: none !important; }
.nh-banner {
  position: sticky; top: 8px; z-index: 5;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 0; padding: 10px 12px;
  border-radius: 12px; background: var(--surface-elevated); border: 1px solid var(--accent-border);
}
.nh-banner-text { flex: 1; min-width: 200px; font-size: 0.88rem; }
.nh-banner-sub { color: var(--text-secondary); }
.nh-banner-diff.hidden { display: none; }
.nh-preview-scroll { padding: 16px 0 48px; }

@media (min-width: 960px) {
  .note-history-overlay {
    left: auto;
    width: var(--discuss-w, 380px);
    border-left: 1px solid var(--border);
    background: var(--surface);
  }
  .nh-back { display: none; }
  .nh-head { grid-template-columns: 1fr auto; padding-top: 6px; }
  .nh-title { text-align: left; padding-left: 4px; }
  .nh-close { display: inline-flex; }
  html.note-history-open #note-editor-overlay:not(.hidden),
  html.note-history-open #note-editor-overlay.note-editor-overlay--sized:not(.hidden) {
    right: var(--discuss-w, 380px);
    width: auto;
    box-shadow: none;
  }
  html.note-history-open #note-editor-overlay .note-pane-resizer { display: none; }
  html.note-history-open #note-ai-edit-bar { display: none !important; }
}
@media (max-width: 959px) {
  html.note-history-open, html.note-history-open body { overflow: hidden; }
  html.note-history-open .tabbar { visibility: hidden !important; }
}
.notes-filter-trash { display: block; margin: 10px auto 0; color: var(--text-secondary); }
.notes-trash-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.notes-trash-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.notes-trash-row.is-restored { opacity: 0.7; }
.notes-trash-mid { flex: 1; min-width: 0; }
.notes-trash-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-trash-meta { font-size: 0.78rem; color: var(--text-tertiary); margin-top: 2px; }
.notes-trash-preview { font-size: 0.82rem; color: var(--text-secondary); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notes-trash-restore { flex-shrink: 0; }
.nh-close { align-items: center; justify-content: center; width: 32px; height: 32px; border: none; border-radius: 8px; background: transparent; color: var(--text-secondary); cursor: pointer; }
.nh-close:hover { background: var(--surface-muted); color: var(--text); }
.note-toast-copy + .note-toast-link { margin-left: 10px; }

/* ---- Материалы встречи (окно встречи) ---- */
.ev-materials { display: flex; flex-direction: column; gap: 8px; }
.ev-materials-head { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-tertiary); padding: 2px 2px 0; }
.ev-materials-list { display: flex; flex-direction: column; gap: 8px; }
.ev-materials-empty { margin: 0; padding: 4px 2px; font-size: 0.85rem; line-height: 1.45; color: var(--text-secondary); }
.ev-materials-empty b { font-weight: 600; color: var(--text); }
.ev-mat { border-radius: 14px; background: var(--surface-elevated); padding: 10px 12px; }
.ev-mat-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.9rem; }
.ev-mat-head svg { flex-shrink: 0; color: var(--accent); }
.ev-mat-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-mat-open { border: none; background: transparent; color: var(--accent); font: inherit; font-weight: 600; font-size: 0.85rem; cursor: pointer; padding: 2px 0; }
.ev-mat-text { margin-top: 5px; font-size: 0.85rem; line-height: 1.45; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ev-mat-list { margin: 6px 0 0; padding-left: 18px; font-size: 0.85rem; line-height: 1.45; color: var(--text); }
.ev-mat-prog { height: 4px; margin-top: 8px; border-radius: 2px; background: var(--overlay-3); overflow: hidden; position: relative; }
.ev-mat-prog i { position: absolute; top: 0; bottom: 0; width: 35%; border-radius: 2px; background: var(--accent); animation: ev-mat-prog 1.4s ease-in-out infinite; }
@keyframes ev-mat-prog { 0% { left: -35%; } 100% { left: 100%; } }
.ev-materials-acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ev-materials-act { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border: none; border-radius: 14px; background: var(--surface-elevated); color: var(--text); font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; text-align: center; }
.ev-materials-act svg { color: var(--accent); }
.ev-materials-act:hover { background: var(--accent-subtle); }
.meeting-card-mats { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: -3px; opacity: 0.85; }
.meeting-card-mats svg { width: 13px; height: 13px; }
.nl-badge--action { border: none; cursor: pointer; color: var(--accent); background: var(--accent-subtle); font: inherit; font-size: 0.75rem; }

@media (min-width: 960px) {
  #modal-overlay .modal.modal--ev-materials {
    width: min(62rem, 100%);
    max-width: 62rem;
    max-height: min(92dvh, 54rem);
  }
  .event-sheet.event-sheet--materials {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 20px;
    row-gap: 0;
    align-items: start;
  }
  .event-sheet.event-sheet--materials > * { grid-column: 1; margin-bottom: 10px; min-width: 0; }
  .event-sheet.event-sheet--materials > .ev-materials {
    grid-column: 2;
    grid-row: 1 / span 40;
    position: sticky;
    top: 0;
    padding: 12px;
    border-radius: 16px;
    background: var(--surface-muted);
  }
}

/* ---- Плашка встречи в заметке ---- */
.note-meeting-plaque { margin: 4px 0 10px; padding: 9px 12px; border-radius: 12px; background: var(--accent-subtle); box-shadow: inset 0 0 0 1px var(--accent-border); display: flex; flex-direction: column; gap: 7px; font-size: 0.85rem; }
.note-meeting-plaque.hidden { display: none; }
.nmp-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.nmp-line svg { flex-shrink: 0; color: var(--accent); }
.nmp-share { flex-wrap: wrap; row-gap: 2px; }
.nmp-share .nmp-link:disabled { opacity: 0.6; cursor: default; }
.nmp-hint { font-size: 0.75rem; color: var(--text-tertiary); }
.nmp-when { border: none; background: transparent; color: var(--text); font: inherit; padding: 0; cursor: pointer; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nmp-sp { flex: 1; }
.nmp-link { border: none; background: transparent; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 0; white-space: nowrap; }
.nmp-x { border: none; background: transparent; color: var(--text-tertiary); font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0 2px; }
.nmp-people { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; position: relative; }
.nmp-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--surface-elevated); font-size: 0.8rem; color: var(--text); }
.nmp-chip button { border: none; background: transparent; color: var(--text-tertiary); cursor: pointer; padding: 0; font-size: 0.95rem; line-height: 1; }
.nmp-add { border: none; color: var(--accent); background: transparent; cursor: pointer; font: inherit; font-size: 0.8rem; font-weight: 600; }
.nmp-add.hidden, .nmp-add-box.hidden, .nmp-suggest.hidden { display: none; }
.nmp-add-box { position: relative; }
.nmp-input { width: 200px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--accent-border); background: var(--surface); color: var(--text); font: inherit; font-size: 0.8rem; outline: none; }
.nmp-suggest { position: absolute; left: 0; top: calc(100% + 4px); z-index: 30; min-width: 240px; display: flex; flex-direction: column; padding: 4px; border-radius: 12px; background: var(--surface-elevated); box-shadow: 0 12px 30px color-mix(in srgb, var(--shadow-color) 40%, transparent); }
.nmp-suggest button { border: none; background: transparent; color: var(--text); font: inherit; font-size: 0.85rem; text-align: left; padding: 7px 9px; border-radius: 8px; cursor: pointer; }
.nmp-suggest button:hover { background: var(--accent-subtle); }

/* ---- «Добавить ко встрече» ---- */
.meeting-pick-body { display: flex; flex-direction: column; gap: 8px; }
.meeting-pick-list { display: flex; flex-direction: column; gap: 6px; }
.meeting-pick-sect { margin: 8px 2px 0; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-tertiary); }
.meeting-pick-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; border: none; border-radius: 12px; background: var(--surface-elevated); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.meeting-pick-row:hover { background: var(--accent-subtle); }
.meeting-pick-row.is-best { box-shadow: inset 0 0 0 1px var(--accent-border); background: var(--accent-subtle); }
.meeting-pick-row b { font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meeting-pick-row em { font-style: normal; font-size: 0.75rem; color: var(--accent); }
.meeting-pick-row small { grid-column: 1 / 3; font-size: 0.8rem; color: var(--text-secondary); }
#m-ev-avail.ev-avail-past { display: none !important; }

/* ---- Связки: «Связанное» у документа и задачи, выбор, страница связки ---- */
/* поверх панели чата документа (220), под окном ввода (320) и меню действий (420) */
.link-pick-overlay, .bundle-page-overlay { z-index: 300; }
.linked-items { display: flex; flex-direction: column; gap: 4px; }
.linked-items.hidden { display: none; }
.linked-items--note { margin: 2px 0 8px; }
.linked-items--card { margin-top: 10px; }
.linked-box { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; font-size: 0.82rem; }
.linked-name { display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 220px; height: 26px; border: none; background: none; padding: 0 2px 0 0; font: inherit; color: var(--text-secondary); cursor: default; }
.linked-name svg { flex-shrink: 0; width: 0.95rem; height: 0.95rem; }
button.linked-name { cursor: pointer; color: var(--accent); font-weight: 600; }
.linked-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linked-add, .linked-more { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border: none; border-radius: 999px; background: none; padding: 0; font: inherit; font-size: 1rem; line-height: 1; color: var(--text-secondary); cursor: pointer; }
.linked-add:hover, .linked-more:hover { background: var(--surface-elevated); color: var(--accent); }
.linked-add--solo { display: inline-flex; align-items: center; gap: 6px; width: auto; align-self: flex-start; padding: 4px 0; font-size: 0.82rem; color: var(--accent); }
.linked-add--solo:hover { background: none; }
.linked-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 240px; height: 26px; padding: 0 9px 0 7px; border: none; border-radius: 999px; background: var(--surface-elevated); color: var(--text); font: inherit; font-size: 0.8rem; cursor: pointer; }
.linked-chip:hover { background: var(--accent-subtle); }
.linked-chip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linked-chip svg { flex-shrink: 0; width: 0.9rem; height: 0.9rem; color: var(--accent); }
.linked-chip--meeting svg, .link-ico--meeting { color: var(--violet-text); }
.linked-chip--task svg, .link-ico--task { color: var(--emerald-text); }
.linked-chip--chat svg, .link-ico--chat { color: var(--ui-due-fg); }
.linked-chip--person svg, .link-ico--person, .linked-chip--reminder svg, .link-ico--reminder { color: var(--text-secondary); }
.link-ico { flex: none; width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-subtle); color: var(--accent); }
.link-ico svg { width: 17px; height: 17px; }
.link-ico--meeting { background: var(--violet-muted); }
.link-ico--task { background: var(--emerald-muted); }
.link-ico--chat { background: var(--ui-due-bg); }
.link-ico--person, .link-ico--reminder { background: var(--overlay-3); }
.link-pick-sheet { display: flex; flex-direction: column; }
.link-pick-tabs { flex: none; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.link-pick-tabs::-webkit-scrollbar { display: none; }
.link-pick-tab { flex: none; height: var(--ui-chip-h); padding: 0 12px; border: none; border-radius: 999px; background: var(--surface-elevated); color: var(--text); font: inherit; font-size: 0.82rem; cursor: pointer; }
.link-pick-tab.is-active { background: var(--accent); color: var(--on-accent); }
.link-pick-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: none; border-radius: 12px; background: var(--surface-elevated); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.link-pick-row:hover { background: var(--accent-subtle); }
.link-pick-row.is-picked { background: var(--accent-subtle); box-shadow: inset 0 0 0 1px var(--accent-border); }
.link-pick-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.link-pick-txt b { font-size: 0.92rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-pick-txt small { font-size: 0.78rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-pick-check { flex: none; width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.link-pick-check { display: inline-flex; align-items: center; justify-content: center; }
.link-pick-row.is-picked .link-pick-check { background: var(--accent); box-shadow: none; }
.link-pick-row.is-picked .link-pick-check::after { content: ""; width: 5px; height: 9px; margin-top: -2px; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.link-pick-foot { padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); }
.link-pick-go { width: 100%; height: var(--ui-h); }
.btn.primary.link-pick-go.is-empty { background: var(--surface-elevated); color: var(--text-secondary); }
.notes-bundle-hits { display: flex; flex-direction: column; gap: 6px; margin: 0 0 12px; }
.notes-bundle-hits-title, .nl-sheet-sect { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-tertiary); }
.nl-sheet-sect { padding: 10px 12px 4px; }
.notes-bundle-hit { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: none; border-radius: 12px; background: var(--surface-elevated); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.notes-bundle-hit:hover { background: var(--accent-subtle); }
.bundle-page-body { display: flex; flex-direction: column; gap: 8px; }
.bundle-page-title { align-self: flex-start; border: none; background: none; padding: 0; color: var(--text); font-family: var(--font-heading); font-size: 1.2rem; font-weight: 500; text-align: left; cursor: text; }
.bundle-page-meta { margin: 0 0 4px; font-size: 0.8rem; color: var(--text-secondary); }
.bundle-sect { display: flex; flex-direction: column; gap: 6px; }
.bundle-row { display: flex; align-items: center; gap: 6px; }
.bundle-row-open { flex: 1; min-width: 0; }
.bundle-row-x { flex: none; }
.bundle-page-foot { display: flex; gap: 8px; margin-top: 8px; }
.bundle-page-foot .btn { flex: 1; height: var(--ui-h); }
.bundle-page-more { font-size: 1.2rem; }
@media (min-width: 960px) {
  /* «Удалить» — под колонкой полей, а не на всю ширину широкого окна встречи. */
  #modal-overlay .modal--ev-materials .modal-sheet-actions { width: calc(50% - 10px); }
}

/* ---- Карточка контакта: встречи ---- */
.contact-card-head--link { cursor: pointer; }
.contact-detail-body { display: flex; flex-direction: column; gap: 6px; }
.contact-detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.contact-detail-name { font-size: 1.15rem; font-weight: 650; }
.contact-detail-meta { font-size: 0.82rem; color: var(--text-secondary); margin-top: 2px; }
.contact-detail-edit { width: auto; padding: 0 10px; font-size: 0.9rem; color: var(--accent); }
.contact-meet-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-elevated); cursor: pointer; }
.contact-meet-row:hover { background: var(--accent-subtle); }
.contact-meet-row .cm-date { grid-row: 1 / 3; font-size: 0.8rem; color: var(--text-secondary); line-height: 1.35; }
.contact-meet-row .cm-date b { display: block; color: var(--text); font-weight: 600; font-size: 0.85rem; }
.contact-meet-row .cm-title { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-meet-row .cm-meta { font-size: 0.78rem; color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-meet-row .cm-acts { grid-row: 1 / 3; grid-column: 3; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cm-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border: none; border-radius: 9px; font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.cm-btn svg { width: 13px; height: 13px; }
.cm-btn--tr { background: color-mix(in srgb, var(--violet) 18%, transparent); color: var(--violet-soft); }
.cm-btn--note { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--emerald-text); }
.cm-btn--add { background: var(--accent-subtle); color: var(--accent); }
@media (max-width: 479px) {
  .contact-meet-row { grid-template-columns: 70px minmax(0, 1fr); }
  .contact-meet-row .cm-acts { grid-row: auto; grid-column: 1 / 3; justify-content: flex-start; }
}
.contact-detail-head .note-member-avatar { width: 48px; height: 48px; flex-shrink: 0; font-size: 1.1rem; }

/* Чаты на десктопе: «Новый чат» в шапке списка */
.chats-new-btn { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: auto; height: 36px; padding: 0 12px; border: none; border-radius: 10px; background: var(--accent-subtle); color: var(--accent); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chats-new-btn:hover { background: var(--accent-muted); }
.chats-new-btn.hidden { display: none !important; }
.discuss-scroll-down { position: absolute; left: 50%; transform: translateX(-50%); z-index: 45; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-elevated); color: var(--text); display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px color-mix(in srgb, var(--shadow-color) 35%, transparent); cursor: pointer; }
.discuss-scroll-down:hover { background: var(--accent-subtle); }
.discuss-scroll-down.hidden { display: none; }

/* ---- «Фокус» на «Актуальном» ---- */
.actual-focus { margin: 12px 0 4px; }
.actual-focus.hidden { display: none !important; }
.focus-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.focus-head b { font-size: 0.95rem; }
.focus-count { font-size: 0.78rem; color: var(--text-tertiary); }
.focus-sp { flex: 1; }
.focus-arrow { width: 28px; height: 28px; border: none; border-radius: 50%; background: var(--surface-elevated); color: var(--text-secondary); cursor: pointer; font-size: 1rem; line-height: 1; }
.focus-arrow:hover { color: var(--text); }
.focus-all { border: none; background: transparent; color: var(--accent); font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; padding: 4px 2px; }
.focus-row { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; padding-bottom: 2px; }
.focus-row::-webkit-scrollbar { display: none; }
.focus-card { flex: none; width: 272px; min-height: 176px; box-sizing: border-box; scroll-snap-align: start; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); padding: 12px 12px 0; display: flex; flex-direction: column; gap: 9px; }
.focus-card.is-wide { width: auto; min-height: 0; }
.focus-card-head { display: flex; align-items: center; gap: 9px; min-width: 0; }
.focus-card-ico { flex: none; width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-subtle); color: var(--accent); }
.focus-card-ico svg { width: 17px; height: 17px; }
.focus-card-ico.is-blue { background: var(--accent-subtle); color: var(--accent); }
.focus-card-ico.is-red { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger-text); }
.focus-card-ico.is-amber { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning); }
.focus-card-ico.is-violet { background: var(--violet-muted); color: var(--violet-text); }
.focus-card-ico.is-green { background: var(--emerald-muted); color: var(--emerald-text); }
.focus-card-kind { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.25; }
.focus-card-kind-label { font-size: 0.78rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-card-kind-due { font-size: 0.7rem; color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-card.is-urgent .focus-card-kind-due { color: var(--danger-text); }
.focus-card-x { flex: none; align-self: flex-start; width: 24px; height: 24px; border: none; border-radius: 8px; background: transparent; color: var(--text-tertiary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.focus-card-x svg { width: 13px; height: 13px; }
.focus-card-x:hover { color: var(--text); background: var(--surface-elevated); }
.focus-card-title { font-size: 0.9rem; font-weight: 600; line-height: 1.34; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* Кнопки и футер прижаты к низу: в ряду карточек стоят на одной линии при любой длине текста. */
.focus-card-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.focus-card-btn { border: none; border-radius: 10px; padding: 7px 11px; background: var(--surface-elevated); color: var(--text); font: inherit; font-size: 0.78rem; font-weight: 600; line-height: 1.2; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.focus-card-btn.is-primary { background: var(--accent); color: var(--on-accent); }
.focus-card-btn.is-soft { background: var(--accent-subtle); color: var(--accent); }
.focus-card-btn.is-soft:hover { background: var(--accent-muted); }
.focus-card-btn.is-icon { width: 32px; padding: 7px 0; color: var(--text-secondary); }
.focus-card-btn.is-icon:hover { color: var(--emerald-text); background: var(--emerald-muted); }
.focus-card-btn.is-icon svg { width: 15px; height: 15px; }
.focus-card-btn:disabled { opacity: 0.6; }
.focus-card-foot { display: flex; align-items: center; gap: 7px; min-width: 0; margin: 0 -12px; padding: 9px 12px 10px; border: none; border-top: 1px solid var(--border); border-radius: 0 0 14px 14px; background: transparent; color: var(--text-tertiary); font: inherit; font-size: 0.75rem; text-align: left; }
.focus-card-foot.is-link { cursor: pointer; color: var(--text-secondary); }
.focus-card-foot.is-link:hover { background: var(--surface-muted); }
.focus-card-foot-ico, .focus-card-foot-chev { flex: none; display: inline-flex; color: var(--text-tertiary); }
.focus-card-foot-ico svg { width: 14px; height: 14px; }
.focus-card-foot-chev { margin-left: auto; }
.focus-card-foot-chev svg { width: 14px; height: 14px; }
.focus-card-foot-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-panel { flex-shrink: 0; padding: 0 0 14px; display: flex; flex-direction: column; gap: 8px; }
.focus-panel-head { display: flex; align-items: center; gap: 8px; }
.focus-panel-head b { font-size: 0.95rem; }
.focus-panel-head .focus-count { flex: 1; }
.focus-panel-x { border: none; background: transparent; color: var(--text-tertiary); cursor: pointer; font-size: 0.85rem; }
.focus-panel-list { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 959px) {
  .focus-card { width: 248px; }
  .focus-card-acts { gap: 5px; }
  .focus-card-btn { padding: 7px 9px; font-size: 0.75rem; }
  .focus-card-btn.is-icon { width: 30px; padding: 7px 0; }
  .focus-arrow { display: none; }
}
/* Фокус: карточка разбора пункта в чате ассистента */
/* minmax(0, 1fr) + min-width: 0 — длинная строка статуса («Выполнено · отмечено в источнике · Имя») не распирает колонку и все карточки шире экрана. */
.focus-chat { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 8px; max-width: 460px; }
.focus-chat > * { min-width: 0; }
.focus-chat .focus-card { width: auto; min-height: 0; }
.focus-chat-card.is-closed .focus-card-kind-label { white-space: normal; overflow-wrap: anywhere; }
.focus-card.no-foot { padding-bottom: 12px; }
.focus-card-title.is-muted { font-weight: 500; color: var(--text-secondary); text-decoration: line-through; text-decoration-color: var(--text-tertiary); }
.focus-card-note { font-size: 0.78rem; color: var(--text-secondary); }
.focus-card-more.is-open { background: var(--accent-subtle); color: var(--accent); }
.focus-card-more svg { width: 15px; height: 15px; }
.focus-card-btn svg { width: 14px; height: 14px; flex: none; }
.focus-card-split { display: inline-flex; border-radius: 10px; overflow: hidden; }
.focus-card-split .focus-card-btn { border-radius: 0; }
.focus-card-split .focus-card-chev { padding: 7px 7px; border-left: 1px solid var(--accent-muted); }
.focus-card-chev.is-open svg { transform: rotate(180deg); }
.focus-card .focus-chat-menu, .focus-card .focus-chat-edit, .focus-card .focus-chat-link, .focus-card .focus-chat-date { margin-top: 2px; }
.focus-chat-all { justify-self: start; background: transparent; color: var(--text-secondary); }
.focus-chat-all:hover { color: var(--emerald-text); }
.focus-chat-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.focus-chat-btn { display: inline-flex; align-items: center; gap: 5px; border: none; border-radius: 9px; padding: 6px 10px; background: var(--surface-elevated); color: var(--text); font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.focus-chat-btn svg { width: 14px; height: 14px; flex: none; }
.focus-chat-btn.is-primary { background: var(--accent); color: var(--on-accent); }
.focus-chat-btn.is-ghost { background: transparent; color: var(--text-secondary); }
.focus-chat-btn:disabled { opacity: 0.6; }
.focus-chat-menu { display: grid; gap: 1px; padding: 5px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-elevated); }
.focus-chat-menu-head { padding: 6px 8px 2px; font-size: 0.7rem; color: var(--text-tertiary); }
.focus-chat-menu-item, .focus-chat-result { justify-content: flex-start; width: 100%; background: transparent; font-weight: 500; text-align: left; }
.focus-chat-menu-item:hover, .focus-chat-result:hover { background: var(--surface); }
.focus-chat-fields { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 6px 10px; align-items: center; }
.focus-chat-field-label { font-size: 0.75rem; color: var(--text-secondary); }
.focus-chat-fields input, .focus-chat-fields select, .focus-chat-search, .focus-chat-date input { min-width: 0; width: 100%; box-sizing: border-box; height: 32px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-elevated); color: var(--text); font: inherit; font-size: 0.82rem; }
.focus-chat-edit, .focus-chat-link { display: grid; gap: 8px; }
.focus-chat-results { display: grid; gap: 1px; }
.focus-chat-hint { margin: 0; font-size: 0.72rem; color: var(--text-tertiary); }
.focus-chat-date { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.focus-chat-date input { flex: 1 1 180px; width: auto; }
/* Значок разбора в исходнике: в конце строки задачи из Фокуса */
.note-focus-mark { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; border-radius: 999px; background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); font-size: 0.72rem; font-weight: 700; line-height: 1; vertical-align: 1px; cursor: default; user-select: none; }
/* Поставленная из Фокуса задача — чип с её названием (как чип «+»), выполненная — зачёркнута. */
.note-focus-mark[data-leo-mark="task"] { gap: 5px; height: auto; min-height: 22px; max-width: 100%; padding: 2px 9px 2px 7px; border-radius: 8px; background: var(--accent-subtle); color: var(--accent); font-size: 0.85em; font-weight: 600; line-height: 1.3; white-space: normal; text-align: left; vertical-align: baseline; cursor: pointer; }
.note-focus-mark[data-leo-mark="task"]::before { content: ""; flex: none; width: 13px; height: 13px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 11l3 3L22 4'/%3E%3Cpath d='M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 11l3 3L22 4'/%3E%3Cpath d='M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11'/%3E%3C/svg%3E") center / contain no-repeat; }
.note-focus-mark[data-leo-mark="task"][data-leo-mark-done] { color: var(--success); background: color-mix(in srgb, var(--success) 14%, transparent); text-decoration: line-through; }
/* «Не задача», «дубль», смена типа — серая пометка: пункт разобран, заводить не нужно. */
:is(p, li):has(> .note-focus-mark[data-leo-mark="dismissed"]) { color: var(--text-secondary); }
.note-focus-mark[data-leo-mark="dismissed"], .note-focus-mark[data-leo-mark="retyped"] { padding: 0 7px; background: var(--surface-muted); color: var(--text-secondary); font-weight: 600; cursor: pointer; }
.note-focus-mark[data-leo-mark="linked"] { background: var(--accent-subtle); color: var(--accent); cursor: pointer; font-weight: 600; }
.digest-people { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; font-size: 0.82rem; }
.digest-people-label { color: var(--text-tertiary); margin-right: 2px; }
.digest-person { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--surface-elevated); }
.digest-person.is-contact { background: var(--accent-subtle); }
.digest-person-name { border: none; background: transparent; padding: 0; font: inherit; color: var(--text); }
.digest-person.is-contact .digest-person-name { color: var(--accent); font-weight: 600; cursor: pointer; }
.digest-person-add { border: none; background: transparent; padding: 0; font: inherit; font-size: 0.78rem; color: var(--accent); cursor: pointer; }
.proactive-settings-body { display: flex; flex-direction: column; gap: 8px; }
.proactive-row { display: flex; align-items: center; gap: 10px; }
.proactive-row .svc-text { flex: 1; min-width: 0; }
.focus-done-body { display: flex; flex-direction: column; gap: 10px; }
.focus-done-sub { margin: 0; font-size: 0.82rem; color: var(--text-tertiary); }
.focus-done-list { display: flex; flex-direction: column; gap: 2px; max-height: 55vh; overflow-y: auto; }
.focus-done-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; border-radius: 8px; font-size: 0.88rem; line-height: 1.32; cursor: pointer; }
.focus-done-row:hover { background: var(--surface-elevated); }
.focus-done-row input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); }
.focus-done-row.is-all { color: var(--text-tertiary); border-bottom: 1px solid var(--border); border-radius: 0; margin-bottom: 2px; }
.focus-done-save { align-self: stretch; padding: 10px 12px; font-size: 0.88rem; }
.focus-done-text small { display: block; margin-top: 2px; font-size: 0.76rem; color: var(--text-tertiary); }
.proactive-time { width: 118px; flex-shrink: 0; padding-left: 10px; padding-right: 8px; }
.digest-important { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--warning) 6%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warning) 30%, transparent); display: flex; flex-direction: column; gap: 8px; }
.digest-important-head { font-weight: 650; font-size: 0.88rem; }
.digest-important-row { display: flex; align-items: center; gap: 8px; }
.digest-important-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 0.85rem; }
.digest-important-text small { color: var(--text-tertiary); font-size: 0.75rem; }
.digest-important-pill { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 7px; background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--warning-text); font-size: 0.75rem; font-weight: 600; }
@media (max-width: 559px) { .digest-important-row { flex-wrap: wrap; } .digest-important-text { flex-basis: 100%; } }
.focus-plan { border: none; background: transparent; color: var(--text-secondary); font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; padding: 4px 6px; }
.focus-plan:hover { color: var(--text); }
.focus-plan:disabled { opacity: 0.6; }
.note-discuss-sugg--focus button { border-color: var(--accent-border) !important; }

/* ---- шрифт заголовков в заметках, транскрипциях и саммари (Unbounded) ---- */
.note-rich-editor-body :is(h1, h2, h3, h4),
.note-editor-body.note-body-html :is(h1, h2, h3, h4),
.journal-summary-html :is(h1, h2, h3, h4) {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
}
/* Одна шкала заголовков везде — заметка, саммари, ответы Лео (и share.html):
   H1–H3 кеглем от текста блока, H4 — в размер текста, но шрифтом заголовков. */
:is(.note-rich-editor-body, .note-editor-body.note-body-html, .journal-summary-html, .note-discuss-bubble) h1 { font-size: 1.5em; }
:is(.note-rich-editor-body, .note-editor-body.note-body-html, .journal-summary-html, .note-discuss-bubble) h2 { font-size: 1.3em; }
:is(.note-rich-editor-body, .note-editor-body.note-body-html, .journal-summary-html, .note-discuss-bubble) h3 { font-size: 1.15em; font-weight: 500; }
:is(.note-rich-editor-body, .note-editor-body.note-body-html, .journal-summary-html, .note-discuss-bubble) :is(h4, h5, h6) { font-size: 1em; font-weight: 500; }

/* Карточка задачи: «Скопировать ссылку» — действие, а не раскрывающаяся строка. */
#m-task-copy-link .event-sheet-row-label { color: var(--accent); font-weight: 600; }

/* «Наговорить» на «Актуальном»: полоска записи на месте «+» */
.actual-voice-wrap {
  position: fixed;
  left: max(var(--space-4), calc((100vw - var(--max-w)) / 2 + var(--space-4)));
  right: max(var(--space-4), calc((100vw - var(--max-w)) / 2 + var(--space-4)));
  bottom: calc(var(--tabbar-stack) + var(--space-4));
  z-index: 36;
  padding: 6px;
  border-radius: 999px;
  background: var(--surface-raised);
  box-shadow: 0 14px 40px color-mix(in srgb, var(--shadow-color) 50%, transparent), 0 0 0 0.5px var(--overlay-3);
}
.actual-voice-wrap .note-dictation-bar { display: flex; }
html.actual-voice-open #actual-create-btn { visibility: hidden; }
#panel-actual.panel-actual--posted > .actual-voice-wrap,
#panel-actual.panel-actual--mytasks > .actual-voice-wrap { display: none !important; }
#actual-create-menu .actual-create-menu-btn.is-voice .actual-create-ico { color: var(--danger); }
@media (min-width: 960px) {
  .actual-voice-wrap { left: auto; right: 2rem; bottom: 2rem; width: 26rem; }
}

/* ==== «Актуальное»: редизайн (шапка «Дальше», чипы, Фокус, календарь) ==== */
/* Мелкий серый текст на экране — контраст ≥4.5:1 на тёмном фоне. */
#panel-actual {
  --text-tertiary: #8a8c90;
  --text-faint: #8a8c90;
}

/* Шапка: дата, чипы, «Дальше» — без карточки-баннера и приветствия */
#panel-actual .hero-card {
  margin: var(--space-4) 0 var(--space-6);
  padding: 0;
  border: none;
  background: none;
  overflow: visible;
}
#panel-actual .hero-card::before { display: none; }
#panel-actual .hero-inner { display: flex; flex-direction: column; gap: 14px; }
#panel-actual .hero-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
#panel-actual .hero-date {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 959px) {
  /* На телефоне — одной строкой с прокруткой, без переноса третьего чипа. */
  .hero-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-right: calc(-1 * var(--page-x));
    padding-right: var(--page-x);
  }
  .hero-chips::-webkit-scrollbar { display: none; }
  .hero-chip { flex: none; padding: 0 11px; gap: 5px; }
}
.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.hero-chip::before {
  content: "";
  width: 15px;
  height: 15px;
  flex: none;
  background: currentColor;
  -webkit-mask: var(--chip-ico) center/contain no-repeat;
  mask: var(--chip-ico) center/contain no-repeat;
}
.hero-chip b { font-weight: 650; font-variant-numeric: tabular-nums; }
.hero-chip span { color: var(--text-secondary); }
.hero-chip:hover { background: var(--surface-elevated); }
.hero-chip:active { opacity: 0.75; }
.hero-chip--meetings::before { color: var(--violet-text); --chip-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='3'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E"); }
.hero-chip--tasks::before { color: var(--warning); --chip-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='4'/%3E%3Cpath d='M8.5 12.5l2.5 2.5 4.5-5'/%3E%3C/svg%3E"); }
.hero-chip--posted::before { color: var(--accent); --chip-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M3 20c0-3.3 2.7-6 6-6s6 2.7 6 6M16 11l2 2 4-4'/%3E%3C/svg%3E"); }

.hero-next {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 14%, var(--bg));
  border: 1px solid var(--accent-border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.hero-next:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hero-next.is-muted {
  flex-direction: row;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: default;
}
.hero-next-kicker { display: flex; align-items: center; gap: 6px; font-size: 0.8125rem; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.hero-next-kicker b { color: var(--accent-soft); font-weight: 600; }
.hero-next-dot { width: 8px; height: 8px; border-radius: 4px; background: var(--accent); flex: none; }
.hero-next-dot.is-live { background: var(--danger); }
.hero-next-dot.is-live + b { color: var(--danger-text); }
.hero-next-row { display: flex; align-items: center; gap: 12px; }
.hero-next-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hero-next-title { font-size: 1.0625rem; font-weight: 650; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-next-meta { font-size: 0.8125rem; color: var(--text-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-next-join {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.hero-next-now { display: flex; gap: 6px; min-width: 0; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--accent) 18%, transparent); font-size: 0.8125rem; color: var(--text-subtle); white-space: nowrap; }
.hero-next-now-label { color: var(--slate); }
.hero-next-now-title { color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; }

@media (min-width: 960px) {
  #panel-actual .hero-inner { flex-direction: row; align-items: stretch; gap: 24px; }
  #panel-actual .hero-main { flex: 1; justify-content: space-between; gap: 16px; padding: 4px 0; }
  #panel-actual .hero-date { font-size: 1.75rem; }
  #panel-actual .hero-next { flex: 0 1 440px; min-width: 320px; padding: 16px 18px; }
  #panel-actual .hero-next.is-muted { flex-basis: auto; min-width: 0; align-self: flex-end; }
}

/* Фокус: заголовок секции, кнопки, тач-зоны */
#panel-actual .actual-focus { margin: 0 0 var(--space-6); }
#panel-actual .focus-head { gap: 8px; height: 36px; margin-bottom: 10px; }
#panel-actual .focus-title { margin: 0; font-size: 1.0625rem; font-weight: 650; letter-spacing: -0.01em; color: var(--text); }
#panel-actual .focus-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  box-sizing: border-box;
  border-radius: 10px;
  background: var(--surface-elevated);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#panel-actual .focus-plan,
#panel-actual .focus-all {
  height: 36px;
  padding: 0 8px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 550;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}
#panel-actual .focus-all { margin-right: -8px; }
#panel-actual .focus-plan:hover,
#panel-actual .focus-all:hover { background: var(--accent-subtle); }
#panel-actual .focus-card { width: 280px; border-radius: 16px; padding: 14px 14px 0; gap: 10px; }
#panel-actual .focus-card.no-foot { padding-bottom: 14px; }
#panel-actual .focus-card-ico { width: 32px; height: 32px; border-radius: 10px; }
#panel-actual .focus-card-kind-label { font-size: 0.8125rem; color: var(--text-soft); font-weight: 550; }
#panel-actual .focus-card-kind-due { font-size: 0.75rem; color: var(--text-secondary); }
#panel-actual .focus-card.is-urgent .focus-card-kind-due { color: var(--danger-text); }
#panel-actual .focus-card-x { width: 36px; height: 36px; margin: -8px -8px 0 0; border-radius: 10px; }
#panel-actual .focus-card-x svg { width: 15px; height: 15px; }
#panel-actual .focus-card-title { font-size: 0.9375rem; line-height: 1.35; }
#panel-actual .focus-card-acts { gap: 8px; flex-wrap: wrap; align-items: center; }
#panel-actual .focus-card-btn { height: 36px; padding: 0 12px; font-size: 0.8125rem; white-space: nowrap; }
#panel-actual .focus-card-btn.is-primary { padding: 0 14px; }
#panel-actual .focus-card-btn.is-icon { width: 36px; padding: 0; margin-left: auto; border: 1px solid var(--border); background: transparent; }
.focus-card-br { display: none; }
#panel-actual .focus-card-br { display: block; flex-basis: 100%; height: 0; margin-top: -8px; }
.focus-nav { display: none; }
#panel-actual .focus-card-foot { margin: 0 -14px; padding: 0 14px; height: 40px; font-size: 0.8125rem; border-radius: 0 0 16px 16px; }
.focus-card-btn.is-quiet { background: var(--surface-elevated); color: var(--text); font-weight: 500; }
.focus-card-btn.is-quiet:hover { background: var(--surface-raised); }
.focus-dots { display: flex; justify-content: center; gap: 6px; padding-top: 10px; }
.focus-dots span { width: 6px; height: 6px; border-radius: 3px; background: var(--surface-hover); transition: width 0.2s ease, background 0.2s ease; }
.focus-dots span.is-active { width: 16px; background: var(--accent); }
@media (max-width: 959px) {
  /* Лента — от края до края экрана: отступ страницы только перед первой карточкой и после последней. */
  #panel-actual .focus-row {
    margin-left: calc(-1 * var(--page-x));
    margin-right: calc(-1 * var(--page-x));
    padding-left: var(--page-x);
    padding-right: var(--page-x);
    scroll-padding-left: var(--page-x);
  }
}
@media (min-width: 960px) {
  /* На десктопе — лента всех карточек: листается тачпадом и стрелками в заголовке. */
  #panel-actual .focus-row { gap: 12px; scroll-snap-type: x mandatory; scroll-behavior: smooth; }
  #panel-actual .focus-row > .focus-card { width: 280px; }
  #panel-actual .focus-dots { display: none; }
  #panel-actual .focus-nav { display: inline-flex; gap: 4px; }
  #panel-actual .focus-nav.hidden { display: none; }
  #panel-actual .focus-nav .cal-nav-btn { width: 32px; height: 32px; border-radius: 10px; font-size: 1rem; }
  #panel-actual .focus-nav .cal-nav-btn:disabled { opacity: 0.35; cursor: default; background: transparent; }
}

/* Шапка календаря: плашка «☰ + неделя» (как в iOS-календарях). Вид и «Мой / Поставленные» — в меню ☰. */
#panel-actual .cal-strip {
  position: relative;
  margin: 0 0 10px;
  padding: 8px 8px 0;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--cal-strip-bg);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
#panel-actual .cal-strip-row { display: flex; align-items: center; gap: 4px; }
#panel-actual .cal-strip-menu-wrap { display: inline-flex; flex: none; }
#panel-actual .cal-strip-menu-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--cal-strip-btn);
  cursor: pointer;
}
#panel-actual .cal-strip-menu-btn i { display: block; width: 16px; height: 3px; border-radius: 2px; background: var(--text); }
/* Открыт календарь «Поставленные» — кнопка ☰ фиолетовая, чтобы было видно, чей календарь на экране. */
#panel-actual .cal-strip.is-posted .cal-strip-menu-btn { background: var(--violet-muted); }
#panel-actual .cal-strip.is-posted .cal-strip-menu-btn i { background: var(--violet-text); }
#panel-actual .cal-strip-month { display: none; font-size: 0.9375rem; font-weight: 600; color: var(--text); white-space: nowrap; padding: 0 4px 0 6px; }
#panel-actual .cal-strip-arrow {
  display: none;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
#panel-actual .cal-strip-arrow:hover { color: var(--text); background: var(--cal-strip-sel); }
#panel-actual .cal-strip-days { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; border-radius: 11px; }
#panel-actual .cal-strip--week .cal-strip-days { background: var(--cal-strip-sel); }
#panel-actual .cal-strip-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  padding: 4px 0;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#panel-actual .cal-strip-wd { font-size: 0.75rem; font-weight: 500; line-height: 1.2; }
#panel-actual .cal-strip-wd-l { display: none; }
#panel-actual .cal-strip-num { font-size: 0.9375rem; font-weight: 400; line-height: 1.25; font-variant-numeric: tabular-nums; }
#panel-actual .cal-strip-day.is-today { color: var(--accent); }
#panel-actual .cal-strip-day.is-sel { background: var(--cal-strip-sel); color: var(--text); }
#panel-actual .cal-strip-day.is-sel.is-today { color: var(--accent); }
#panel-actual .cal-strip-day.is-sel .cal-strip-wd,
#panel-actual .cal-strip-day.is-sel .cal-strip-num { font-weight: 650; }
#panel-actual .cal-strip-day.is-out { opacity: 0.4; }
/* Вид «Месяц»: вместо дней — «Октябрь 2026 ‹ ›». */
#panel-actual .cal-strip--month .cal-strip-days { display: none; }
#panel-actual .cal-strip--month .cal-strip-month { display: block; flex: 1; }
#panel-actual .cal-strip--month .cal-strip-arrow { display: inline-flex; }
#panel-actual .cal-strip--month { padding-bottom: 8px; }
/* Раскрытый месяц под строкой букв. */
#panel-actual .cal-strip-grid { padding: 4px 0 4px; }
#panel-actual .cal-strip-grid.hidden { display: none; }
#panel-actual .cal-strip-grid-head { display: flex; align-items: center; gap: 2px; padding: 0 0 2px 4px; }
#panel-actual .cal-strip-grid-title { flex: 1; font-size: 0.875rem; font-weight: 600; color: var(--text); }
#panel-actual .cal-strip-grid .cal-strip-arrow { display: inline-flex; }
#panel-actual .cal-strip-grid-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
#panel-actual .cal-strip-grid-days .cal-strip-day { padding: 6px 0; }
#panel-actual .cal-strip.is-expanded .cal-strip-days .cal-strip-num { display: none; }
#panel-actual .cal-strip.is-expanded .cal-strip-days .cal-strip-day { background: transparent; color: var(--text-secondary); }
#panel-actual .cal-strip.is-expanded.cal-strip--week .cal-strip-days { background: transparent; }
#panel-actual .cal-strip-handle {
  display: block;
  width: 100%;
  height: 14px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: grab;
}
#panel-actual .cal-strip-handle.hidden { display: none; }
#panel-actual .cal-strip-handle span { display: block; width: 30px; height: 4px; margin: 4px auto 6px; border-radius: 2px; background: var(--overlay-7); }
/* Меню ☰. */
#panel-actual .cal-menu {
  position: absolute;
  top: 54px;
  left: 4px;
  z-index: 40;
  width: 15rem;
  padding: 6px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 14px 40px color-mix(in srgb, var(--shadow-color) 50%, transparent), 0 0 0 0.5px var(--overlay-3);
}
#panel-actual .cal-menu.hidden { display: none; }
#panel-actual .cal-menu-label { padding: 6px 10px 3px; font-size: 0.75rem; color: var(--text-tertiary); }
#panel-actual .cal-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  text-align: left;
  cursor: pointer;
}
#panel-actual .cal-menu-item.hidden,
#panel-actual .cal-menu-sep.hidden { display: none; }
#panel-actual .cal-menu-item:hover { background: var(--cal-strip-sel); }
#panel-actual .cal-menu-item.is-active { background: var(--cal-strip-sel); font-weight: 600; }
#panel-actual .cal-menu-item.is-active::after {
  content: "";
  width: 0.45rem;
  height: 0.8rem;
  margin-right: 4px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg) translateY(-2px);
}
#panel-actual #cal-menu-today { color: var(--accent); }
#panel-actual .cal-menu-sep { height: 0.5px; margin: 4px 6px; background: var(--border); }
#panel-actual .cal-menu-seg { display: flex; gap: 2px; margin: 2px 4px 4px; padding: 3px; border-radius: 11px; background: var(--cal-strip-sel); }
#panel-actual .cal-menu-seg button {
  flex: 1;
  height: 30px;
  padding: 0 6px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
}
#panel-actual .cal-menu-seg button.is-active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 0.5px var(--overlay-3); }

/* Телефон — плашка «☰ + неделя», десктоп — прежняя шапка календаря. */
#panel-actual .meetings-head { display: none; }
@media (min-width: 960px) {
  #panel-actual .cal-strip { display: none; }
  #panel-actual .meetings-head { display: flex; }
}

/* Заголовок календаря: «Сегодня · вт, 20 окт» слева, навигация и вид справа */
#panel-actual .meetings-head { gap: 8px; margin-bottom: 10px; min-height: 40px; }
#panel-actual .meetings-head-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0; }
#panel-actual .meetings-head-titles .section-head-inline {
  flex: 0 1 auto;
  margin: 0;
  text-align: left;
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#panel-actual .meetings-head-sub { flex: 0 1 auto; min-width: 0; font-size: 0.8125rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#panel-actual .meetings-head-sub.hidden { display: none; }
#panel-actual #meetings-badge { display: none !important; }
#panel-actual .meetings-head-tools { gap: 6px; }
#panel-actual .meetings-head .cal-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-soft);
}
#panel-actual .meetings-head .cal-nav-btn:hover { background: var(--surface-elevated); color: var(--text); }
#panel-actual .meetings-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 10px 0 12px;
  border: none;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 550;
  cursor: pointer;
}
#panel-actual .meetings-view-btn svg { width: 14px; height: 14px; color: var(--text-secondary); }
#panel-actual .meetings-view-btn[aria-expanded="true"] { background: var(--surface-elevated); }
#panel-actual .meetings-view-menu { left: auto; right: 0; }
#panel-actual .meetings-today-btn {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--accent);
}
#panel-actual .meetings-today-btn:disabled { color: var(--text-tertiary); cursor: default; }
#panel-actual .meetings-today-btn.hidden { display: none; }
.meetings-view-seg { display: none; }
@media (min-width: 960px) {
  #panel-actual .meetings-head { margin-bottom: 14px; }
  #panel-actual .meetings-head-titles { flex-direction: row; align-items: baseline; gap: 8px; }
  #panel-actual .meetings-head-titles .section-head-inline { font-size: 1.125rem; }
  #panel-actual .meetings-head-sub { font-size: 0.9375rem; }
  #panel-actual .meetings-view-wrap { display: none; }
  #panel-actual .meetings-view-seg { display: flex; gap: 2px; padding: 3px; margin-left: 6px; border-radius: 11px; background: var(--surface); }
  .meetings-view-seg-btn {
    height: 30px;
    padding: 0 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
  }
  .meetings-view-seg-btn:hover { color: var(--text); }
  .meetings-view-seg-btn.is-active { background: var(--surface-raised); color: var(--text); font-weight: 600; }
  #panel-actual .meetings-day-title { font-size: 0.875rem; font-weight: 650; color: var(--text); margin-bottom: 8px; padding-left: var(--day-gutter, 2.75rem); }
  #panel-actual .meetings-day--today .meetings-day-title { color: var(--accent); }
}

/* Сетка дня: обычный шрифт часов, заливка цветом вместо полоски слева */
#panel-actual .day-timeline-label,
#panel-actual .day-timeline-now-time {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
}
#panel-actual .day-timeline-label { font-weight: 400; color: var(--text-tertiary); }
#panel-actual .day-timeline-now-time { font-weight: 700; }
#panel-actual .day-timeline-hour-line { background: var(--overlay-5); }
#panel-actual .meeting-card--timeline {
  border: none;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  box-shadow: none;
  padding: 5px 8px 5px 10px;
}
#panel-actual .meeting-card--timeline .item-title { font-size: 0.8125rem; font-weight: 600; color: var(--text); }
#panel-actual .meeting-card--timeline .day-timeline-event-meta { font-family: var(--font); font-variant-numeric: tabular-nums; color: var(--accent-soft); }
#panel-actual .meeting-card--timeline.meeting-card--task { background: var(--success-muted); box-shadow: none; }
#panel-actual .meeting-card--timeline.meeting-card--task .day-timeline-event-meta { color: var(--emerald-text); }
#panel-actual .meeting-card--timeline.has-entry-color,
#panel-actual .meeting-card--timeline.meeting-card--task.has-entry-color {
  background: color-mix(in srgb, var(--entry-color) 22%, transparent);
  box-shadow: none;
}
#panel-actual .meeting-card--timeline.has-entry-color .day-timeline-event-meta { color: color-mix(in srgb, var(--entry-color) 55%, var(--text-strong)); }
#panel-actual .meeting-card--timeline-pending { background-color: var(--overlay-1); box-shadow: inset 0 0 0 1px var(--overlay-4); }
#panel-actual .day-timeline-reminder {
  border: none;
  border-radius: 10px;
  background: color-mix(in srgb, var(--warning) 16%, transparent);
  color: var(--warning-text);
}
#panel-actual .day-timeline-band-item {
  border: none;
  border-radius: 10px;
  min-height: 32px;
}
#panel-actual .day-timeline-band-item--pending { box-shadow: inset 0 0 0 1px var(--overlay-4); }
#panel-actual .day-timeline-item.is-past { opacity: 0.5; }

/* Чекбокс задачи прямо в сетке */
.meeting-card-check {
  position: relative;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0 2px 0 0;
  padding: 0;
  border: 1.6px solid currentColor;
  border-radius: 9px;
  background: transparent;
  color: var(--emerald-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
}
.meeting-card-check::after { content: ""; position: absolute; inset: -12px; }
.meeting-card-check svg { opacity: 0; color: #0b0b0c; }
.meeting-card-check.is-done { background: currentColor; }
.meeting-card-check.is-done svg { opacity: 1; }
.meeting-card-check:disabled { opacity: 0.6; }
.has-entry-color .meeting-card-check { color: color-mix(in srgb, var(--entry-color) 70%, var(--text-strong)); }
.meeting-card--timeline .meeting-card-top { align-items: center; }

/* Пустой день и ошибка загрузки */
.meetings-empty-day,
.meetings-load-error {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.meetings-empty-day { flex-wrap: wrap; }
.meetings-empty-day-text,
.meetings-load-error-text { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; }
.meetings-empty-day-text b,
.meetings-load-error-text b { font-size: 0.9375rem; font-weight: 600; color: var(--text); }
.meetings-empty-day-text span,
.meetings-load-error-text span { font-size: 0.8125rem; color: var(--text-secondary); }
.meetings-empty-day-acts { display: flex; gap: 8px; }
.meetings-empty-day-btn,
.meetings-load-error-retry {
  height: 36px;
  padding: 0 12px;
  border: none;
  border-radius: 10px;
  background: var(--surface-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}
.meetings-empty-day-btn:hover,
.meetings-load-error-retry:hover { background: var(--surface-raised); }
.meetings-load-error { background: color-mix(in srgb, var(--danger) 4%, var(--surface)); border-color: color-mix(in srgb, var(--danger-text) 30%, transparent); }
.meetings-load-error > svg { flex: none; color: var(--danger-text); }
.meetings-load-error-retry:disabled { opacity: 0.6; }

/* «Наговорить» — кнопка-микрофон рядом с «+» */
.notes-fab.actual-fab-mic {
  width: 2.75rem;
  height: 2.75rem;
  right: calc(max(var(--space-4), calc((100vw - var(--max-w)) / 2 + var(--space-4))) + 3.25rem + 10px);
  bottom: calc(var(--tabbar-stack) + var(--space-4) + 0.25rem);
  border: 1px solid var(--surface-raised);
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--shadow-color) 50%, transparent);
}
.notes-fab.actual-fab-mic svg { width: 1.25rem; height: 1.25rem; }
.notes-fab.actual-fab-mic:hover { background: var(--surface-raised); box-shadow: 0 6px 20px color-mix(in srgb, var(--shadow-color) 50%, transparent); }
html.actual-voice-open #actual-voice-btn { visibility: hidden; }
@media (min-width: 960px) {
  .notes-fab.actual-fab-mic { right: calc(2rem + 3.25rem + 10px); bottom: calc(2rem + 0.25rem); }
  html.actual-assistant-open .notes-fab.actual-fab-mic { right: calc(var(--discuss-w, 420px) + 24px + 3.25rem + 10px) !important; }
}

/* Фокус: кнопка «Найти инсайты» и пустое состояние */
.focus-analyze {
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.focus-analyze:hover { background: var(--accent-subtle); }
.focus-analyze:disabled { cursor: default; }
.focus-analyze.is-busy svg { animation: focus-analyze-spin 1s linear infinite; }
@keyframes focus-analyze-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .focus-analyze.is-busy svg { animation: none; opacity: 0.55; }
}
.focus-empty-text { font-size: 0.875rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#panel-actual .focus-head--empty { margin-bottom: 0; }

/* Фокус в чате: форма «В задачу» и мобильные поля */
.focus-chat-assignee { min-width: 0; display: grid; gap: 6px; }
.focus-chat-assignee .meeting-attendee-chips:empty { display: none; }
.focus-chat-assignee .field-input { min-width: 0; width: 100%; box-sizing: border-box; height: 32px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-elevated); color: var(--text); font: inherit; font-size: 0.82rem; }
.focus-card-split .focus-card-chev { border-left: 1px solid var(--overlay-3); }
@media (max-width: 959px) {
  /* 16px — иначе iOS зумит страницу при касании поля, и форма «уезжает». */
  .focus-chat-fields { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .focus-chat-field-label { margin-top: 6px; }
  .focus-chat-fields input,
  .focus-chat-fields select,
  .focus-chat-assignee .field-input,
  .focus-chat-search,
  .focus-chat-date input { height: 40px; font-size: 16px; }
  .focus-chat-acts .focus-chat-btn { min-height: 40px; }
}
.focus-chat-card.is-openable { cursor: pointer; }
.focus-chat-card.is-openable:hover { border-color: var(--accent-border); }

/* ==== Окно встречи / задачи / напоминания / ссылки: редизайн ==== */
#modal-overlay .modal--sheet .modal-header { grid-template-columns: auto 1fr auto; }
#modal-overlay .modal-title { text-align: center; font-size: 1.0625rem; font-weight: 650; }
.modal-header-end { grid-column: 3; justify-self: end; display: inline-flex; align-items: center; gap: 8px; position: relative; }
#modal-save {
  width: auto;
  min-width: 36px;
  height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  font-size: 0.9375rem;
  font-weight: 600;
}
#modal-save.hidden, #modal-more.hidden { display: none; }
.modal-header-btn--more {
  border-radius: 50%;
  color: var(--text);
  background: var(--vkui--color_background_secondary_alpha, var(--surface-muted));
}
.modal-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  min-width: 13.5rem;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-elevated);
  box-shadow: 0 14px 36px color-mix(in srgb, var(--shadow-color) 50%, transparent), 0 0 0 0.5px var(--overlay-3);
  display: flex;
  flex-direction: column;
}
.modal-more-menu.hidden { display: none; }
.modal-more-item { display: block; width: 100%; min-height: 40px; padding: 0 12px; border: none; border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: 0.9375rem; text-align: left; cursor: pointer; }
.modal-more-item:hover { background: var(--overlay-2); }
.modal-more-item.is-danger { color: var(--danger-text); }
.modal-sheet-actions.is-empty { display: none; }
/* Задача: «Выполнено» — главная зелёная, «Ссылка» — компактная рядом. */
.modal-sheet-actions.is-task .modal-done-btn { flex: 1 1 auto; background: var(--success); color: var(--on-accent); font-weight: 600; }
.modal-sheet-actions.is-task .modal-link-btn { flex: 0 0 auto; }
/* «В работе» слева от «Выполнено»: нажата — синий контур и точка. */
.modal-sheet-actions .modal-progress-btn { display: flex; flex: 1 1 0; align-items: center; justify-content: center; gap: 8px; min-height: var(--vkui--size_button_large_height--regular, 44px); margin: 0; padding: 0 var(--space-3); border: 1px solid transparent; border-radius: var(--vkui--size_border_radius--regular, 10px); background: var(--vkui--color_background_secondary_alpha, var(--surface-muted)); color: var(--text); font: inherit; font-size: 0.9375rem; font-weight: 600; }
.modal-sheet-actions .modal-progress-btn.hidden { display: none; }
.modal-sheet-actions .modal-progress-btn.is-on { border-color: var(--accent); color: var(--accent); background: var(--accent-subtle); }
.modal-sheet-actions .modal-progress-btn.is-on::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.modal-sheet-actions .modal-progress-btn:active { opacity: 0.75; }
.modal-sheet-actions.is-task .modal-progress-btn:not(.hidden) ~ .modal-done-btn { flex: 1 1 0; }

/* Переключатель типа: неактивные пункты читаемы */
#modal-fields .event-sheet-kind-btn { color: var(--text-subtle); font-size: 0.8125rem; min-height: 32px; }
#modal-fields .event-sheet-kind-btn.is-active { color: var(--text); background: var(--seg-active); box-shadow: 0 1px 2px color-mix(in srgb, var(--shadow-color) 18%, transparent); }
#modal-fields .event-sheet-title { font-size: 1.1875rem; font-weight: 600; }

.sheet-glabel { margin: 0; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-subtle); }

/* Блок «Когда» */
.sheet-when { display: flex; flex-direction: column; gap: 10px; padding: 12px; overflow: visible; }
.sheet-when-row { display: flex; align-items: center; gap: 8px; min-height: 36px; flex-wrap: wrap; }
.sheet-date-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--text-subtle) 28%, transparent);
  color: var(--text);
  font-size: 0.9375rem;
  cursor: pointer;
}
.sheet-date-pill svg { color: var(--text-subtle); flex: none; }
.sheet-date-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; color-scheme: dark; border: none; padding: 0; }
.sheet-when-times .sheet-time { max-width: 6.5rem; height: 36px; font-variant-numeric: tabular-nums; text-align: center; }
.sheet-when-arrow { color: var(--text-secondary); flex: none; }
.sheet-when-dur { font-size: 0.875rem; color: var(--text-subtle); margin-left: 2px; white-space: nowrap; }
.sheet-when-until { font-size: 0.875rem; color: var(--text-subtle); }
.sheet-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.sheet-chip { height: 32px; padding: 0 12px; border: 1px solid var(--overlay-5); border-radius: 16px; background: transparent; color: var(--text-soft); font: inherit; font-size: 0.8125rem; font-weight: 500; cursor: pointer; }
.sheet-chip.is-active { background: var(--accent-muted); border-color: var(--accent-border); color: var(--accent-soft); }
.sheet-switch-row { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--text-soft); cursor: pointer; }
.sheet-switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sheet-switch { position: relative; width: 42px; height: 26px; border-radius: 13px; background: var(--surface-hover); transition: background 0.15s ease; flex: none; }
.sheet-switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 10px; background: #e8e9eb; transition: transform 0.15s ease; }
.sheet-switch-input:checked + .sheet-switch { background: var(--success); }
.sheet-switch-input:checked + .sheet-switch::after { transform: translateX(16px); }
.sheet-switch-input:focus-visible + .sheet-switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.sheet-when.is-allday .sheet-when-times,
.sheet-when.is-allday .sheet-durs,
.sheet-when.is-allday .sheet-when-enddate { display: none; }
.sheet-when-summary { display: none; }
.sheet-when.is-collapsible .sheet-when-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  text-align: left;
  cursor: pointer;
}
.sheet-when-summary-val { flex: 1; text-align: right; color: var(--text-subtle); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.sheet-when.is-collapsible:not(.is-collapsed) .sheet-when-summary .event-sheet-chevron { transform: rotate(180deg); }
.sheet-when.is-collapsible.is-collapsed > :not(.sheet-when-summary):not(input[type="hidden"]) { display: none; }

/* Открытая встреча: сводка и «Присоединиться» наверху */
.sheet-ev-summary { display: flex; flex-direction: column; gap: 6px; padding: 2px 2px 4px; }
.sheet-ev-when { margin: 0; font-size: 0.9375rem; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.sheet-ev-dur { color: var(--text-subtle); }
.sheet-ev-rel { margin: 0; font-size: 0.8125rem; font-weight: 600; color: var(--accent-soft); }
.sheet-ev-rel.is-live { color: var(--danger-text); }
.sheet-ev-rel.is-past { color: var(--text-subtle); font-weight: 500; }
.sheet-ev-acts { display: flex; gap: 8px; margin-top: 4px; }
.sheet-ev-join { flex: 1; height: 46px; border: none; border-radius: 12px; background: var(--accent); color: var(--on-accent); font: inherit; font-size: 1rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.sheet-ev-copy { flex: none; width: 46px; height: 46px; border: 1px solid var(--overlay-5); border-radius: 12px; background: var(--surface-elevated); color: var(--text-soft); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }

/* Видеосвязь */
.sheet-video { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.sheet-video .event-sheet-kind-switch { margin: 0; }
.sheet-video .event-sheet-meet-link-input { margin: 0; }

/* Цвет — строка кружков */
.event-sheet-color-group--inline { padding: 8px 12px; }
.event-sheet-color-inline { display: flex; align-items: center; gap: 12px; min-height: 36px; }
.event-sheet-color-inline .event-sheet-color-swatches { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px; flex: 1; min-width: 0; }
.event-sheet-color-inline .event-sheet-color-swatches::-webkit-scrollbar { display: none; }
.event-sheet-color-inline .event-sheet-color-swatch { flex: none; width: 24px; height: 24px; }

/* Напоминание: быстрые варианты */
.sheet-rem-when { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.sheet-rem-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sheet-rem-q { min-height: 56px; padding: 6px 12px; border: 1px solid var(--overlay-4); border-radius: 12px; background: color-mix(in srgb, var(--text-subtle) 18%, transparent); color: var(--text); font: inherit; text-align: left; display: flex; flex-direction: column; justify-content: center; gap: 2px; cursor: pointer; }
.sheet-rem-q b { font-size: 0.875rem; font-weight: 600; }
.sheet-rem-q span { font-size: 0.75rem; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.sheet-rem-q.is-active { background: color-mix(in srgb, var(--warning) 14%, transparent); border-color: color-mix(in srgb, var(--warning) 55%, transparent); }
.sheet-rem-q.is-active span { color: var(--warning-text); }
.sheet-rem-when .event-sheet-row { padding: 0; }
.event-sheet-group > .sheet-glabel { padding: 12px 12px 0; }
.sheet-rem-when > .sheet-glabel, .sheet-when > .sheet-glabel, .sheet-video > .sheet-glabel { padding: 0; }
.sheet-rem-repeat { margin: 10px 12px 12px; }

/* Ссылка на запись */
.booking-sheet-hint { margin: 6px 2px 0; font-size: 0.75rem; color: var(--text-subtle); }
.booking-sheet-hint.hidden { display: none; }
.booking-sheet-result { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--success) 40%, transparent); background: color-mix(in srgb, var(--success) 10%, transparent); }
.booking-sheet-result.hidden { display: none; }
.booking-sheet-result-head { margin: 0; font-size: 0.8125rem; font-weight: 600; color: var(--emerald-text); }
.booking-sheet-result .booking-sheet-url { margin: 0; }
.booking-sheet-result-acts { display: flex; gap: 8px; }
.booking-sheet-result-btn { flex: 1; height: 40px; border: none; border-radius: 10px; background: var(--surface-elevated); color: var(--text); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; }
.booking-sheet-result-btn.hidden { display: none; }

@media (max-width: 959px) {
  /* 16px в полях — без зума iOS */
  #modal-fields .event-sheet-pill, #modal-fields .field-input, #modal-fields .event-sheet-title { font-size: 16px; }
}
/* Окно записи: «Срок / Когда» — свёрнутая строка; раскрыто — «Дата», разделитель, «Время». Цвета нейтральные. */
.sheet-when { padding: 0 0 12px; gap: 10px; }
.sheet-when.is-collapsed { padding-bottom: 0; }
.sheet-when > :not(.sheet-when-summary):not(input[type="hidden"]) { margin-left: 12px; margin-right: 12px; }
.sheet-when.is-collapsible .sheet-when-summary { min-height: 44px; padding: 0.45rem 0.9rem; font-size: 1rem; }
.sheet-when-summary-val { color: var(--text); font-size: 0.9375rem; }
.sheet-sublabel { margin: 2px 0 -2px; font-size: 0.75rem; color: var(--text-secondary); }
.sheet-date-pill.sheet-date-field { display: flex; width: auto; height: var(--ui-h, 40px); background: var(--ui-field-bg); box-shadow: inset 0 0 0 1px var(--ui-field-border, transparent); }
.sheet-date-field .sheet-date-text { flex: 1; }
.sheet-date-field .event-sheet-chevron { color: var(--text-secondary); }
.sheet-when .event-sheet-pill.sheet-time { flex: 1; max-width: none; background: var(--ui-field-bg); color: var(--text); box-shadow: inset 0 0 0 1px var(--ui-field-border, transparent); }
.sheet-when-times { flex-wrap: nowrap; }
.sheet-when-sep { height: 0; border-top: 0.5px solid var(--border); margin-top: 2px; margin-bottom: 0; }
.sheet-when-head { display: flex; align-items: center; justify-content: space-between; min-height: 26px; }
.sheet-when-head .sheet-sublabel { margin: 0; }
.sheet-when-head .sheet-switch-row { margin-left: auto; }
/* Строка подсказок: одна строка, прокрутка вбок, без полосы прокрутки */
.sheet-chips.sheet-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin-bottom: -2px; padding-bottom: 2px; }
.sheet-chips.sheet-scroll::-webkit-scrollbar { display: none; }
.sheet-chips.sheet-scroll .sheet-chip { flex: none; }
/* Иконка у подписи строки свойства */
.sheet-prop-label { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.sheet-row-ico { flex: none; color: var(--text-secondary); }
.event-sheet-color-inline .event-sheet-color-swatches { flex-wrap: nowrap; }
.booking-sheet-chips { margin-top: 8px; }
#modal-fields .booking-sheet-seg .event-sheet-kind-btn { white-space: nowrap; font-size: 0.8125rem; padding-left: 4px; padding-right: 4px; }

/* Профиль → «Голосовой ввод» */
.voice-feature {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.voice-feature-head {
  margin: 0;
  padding: 0;
}

.voice-feature--off .voice-feature-body {
  display: none;
}

.voice-feature-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.voice-list {
  display: flex;
  flex-direction: column;
}

.voice-list:empty {
  display: none;
}

.voice-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--border);
}

.voice-item:first-child {
  border-top: none;
  padding-top: 0;
}

.voice-item-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.voice-item-from {
  color: var(--text-secondary);
}

.voice-item-to {
  color: var(--text);
  font-weight: 600;
}

.voice-item-body {
  white-space: pre-wrap;
  margin-top: 2px;
}

.voice-arrow {
  color: var(--text-tertiary);
}

.voice-item-copy {
  flex: 0 0 auto;
  font-size: 0.8125rem;
}

.voice-item-del {
  flex: 0 0 auto;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.voice-item-del:hover {
  background: var(--surface-muted);
  color: var(--danger);
}

.voice-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.voice-add-row .field-input {
  flex: 1 1 8rem;
  min-width: 0;
}

.voice-add-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.voice-add-col .btn,
.voice-feature-body > .btn {
  align-self: flex-start;
}

/* ---- логотип Orbita: знак-орбита вместо «o» + «rbita» Unbounded ---- */
.wordmark {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.wordmark-o {
  width: 0.66em;
  height: 0.66em;
  margin-right: 0.03em;
  flex: none;
  transform: translateY(0.02em);
}

/* ---- Профиль: аккаунт, кошелёк, группы-списки, сервисы ---- */
#profile-main {
  --pf-row-gap: 0.75rem;
}

.pf-side,
.pf-body {
  display: grid;
  gap: 1.5rem;
  align-content: start;
  min-width: 0;
}

#profile-main:not(.hidden) {
  display: grid;
  gap: 1.5rem;
}

#profile-main .profile-head {
  margin: 0;
  padding: 0.25rem 0.25rem 0;
  border: 0;
  background: none;
}

#profile-main .profile-names {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

#profile-main .profile-names h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

#profile-main .profile-names p {
  margin: 0;
  font-size: 0.8125rem;
}

#profile-main .profile-names p:empty {
  display: none;
}

/* Шапка профиля — кнопка «Аккаунт»: фото, имя, почта и › */
.pf-head-btn {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pf-head-btn .profile-names {
  flex: 1 1 auto;
}

.pf-head-btn .pf-nick {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pf-head-btn .pf-chev {
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 1.25rem;
}

/* Экран «Аккаунт»: фото и имя сверху */
#profile-account-head {
  margin: 0 0 var(--space-2);
  border: 0;
  background: none;
  padding: var(--space-2) var(--space-1);
}

#profile-account-head .profile-names {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

#profile-account-head .profile-names h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

/* Скелетоны: серые плашки, пока данные не пришли. */
@keyframes pf-shimmer {
  0% { opacity: 0.45; }
  50% { opacity: 0.9; }
  100% { opacity: 0.45; }
}

.pf-skel,
.pf-skel-circle,
.pf-row-val:empty::before,
.pf-wallet-balance:empty::before,
#profile-expenses-total:empty::before {
  content: "";
  display: inline-block;
  border-radius: 6px;
  background: var(--overlay-3);
  animation: pf-shimmer 1.4s ease-in-out infinite;
  vertical-align: middle;
}

.pf-skel-circle {
  border: 0;
  border-radius: 50%;
}

.pf-skel--name { width: 8rem; height: 1.1rem; }
.pf-skel--nick { width: 5rem; height: 0.75rem; }
.pf-row-val:empty::before { width: 2rem; height: 0.8rem; }
.pf-wallet-balance:empty::before { width: 7rem; height: 1.6rem; }
#profile-expenses-total:empty::before { width: 3rem; height: 0.8rem; }

@media (prefers-reduced-motion: reduce) {
  .pf-skel,
  .pf-skel-circle,
  .pf-row-val:empty::before,
  .pf-wallet-balance:empty::before,
  #profile-expenses-total:empty::before {
    animation: none;
  }
}

/* Кошелёк: баланс, тариф, расходы за 7 дней, пополнение. */
.pf-wallet {
  display: grid;
  gap: 0.9rem;
  padding: 1rem 1rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--surface);
}

.pf-wallet-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.pf-wallet-label {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.pf-wallet-balance {
  margin: 0.15rem 0 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.pf-plan-chip {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--accent);
  background: var(--accent-muted);
}

.pf-plan-chip:empty {
  display: none;
}

.pf-wallet-foot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pf-wallet-spend {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  margin: 0;
  padding: 0.35rem 0;
  border: 0;
  font: inherit;
  font-size: 0.8125rem;
  text-align: left;
  color: var(--text-secondary);
  background: none;
  cursor: pointer;
}

.pf-wallet-spend b {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pf-wallet-spend-text {
  white-space: nowrap;
}

.pf-spark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  width: 3.5rem;
  height: 1.4rem;
  flex: none;
}

.pf-spark i {
  flex: 1;
  border-radius: 2px 2px 1px 1px;
  background: var(--overlay-6);
}

.pf-spark i.on {
  background: var(--accent);
}

.pf-pay {
  flex: none;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  cursor: pointer;
}

.pf-pay:active {
  background: var(--accent-pressed);
}

/* Группы-списки в стиле «Настроек» iOS. */
.pf-group {
  display: grid;
  gap: 0.45rem;
}

.pf-group-title {
  margin: 0;
  padding-left: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary, var(--text-secondary));
}

.pf-list {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--surface);
}

.pf-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--pf-row-gap, 0.75rem);
  width: 100%;
  min-height: 3rem;
  margin: 0;
  padding: 0 0 0 1rem;
  border: 0;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: none;
  cursor: pointer;
}

button.pf-row:hover,
.pf-svc--setup:hover,
.pf-row--select:hover {
  background: var(--surface-muted);
}

button.pf-row:focus-visible,
.pf-row--select:focus-within,
.pf-link:focus-visible,
.pf-more:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.pf-row-body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  align-self: stretch;
  min-width: 0;
  padding: 0.65rem 1rem 0.65rem 0;
}

.pf-row + .pf-row .pf-row-body,
.pf-row + .pf-more {
  border-top: 1px solid var(--border);
}

.pf-row-text {
  flex: 1;
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.pf-row-title {
  font-size: 0.9688rem;
  line-height: 1.3;
}

.pf-row-sub {
  margin: 0;
  overflow: hidden;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text-secondary);
}

.pf-row-val {
  flex: none;
  max-width: 45%;
  overflow: hidden;
  font-size: 0.9063rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text-secondary);
}

.pf-chev {
  flex: none;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--text-faint);
}

.pf-chev--down {
  transform: rotate(90deg);
  font-size: 1rem;
}

.pf-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: var(--radius-sm, 8px);
  color: var(--accent);
  background: var(--accent-muted);
}

.pf-ico svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}


/* Выбор модели: нативный select поверх всей строки — системный пикер на iOS/Android. */
.pf-row-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
}

/* Сервисы: статус вместо крупных кнопок. */
.pf-svc .svc-desc {
  margin: 0;
}

.pf-svc .svc-desc--connected {
  color: var(--text-secondary);
}

.pf-svc .svc-desc--connected::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.35rem;
  border-radius: 50%;
  background: var(--emerald-text);
  vertical-align: 0.08em;
}

.pf-svc-actions {
  display: flex;
  flex: none;
  gap: 0.5rem;
}

.pf-link {
  padding: 0.35rem 0;
  border: 0;
  font: inherit;
  font-size: 0.9063rem;
  white-space: nowrap;
  color: var(--accent);
  background: none;
  cursor: pointer;
}

.pf-link--muted {
  color: var(--text-secondary);
}

/* У сервисов с экраном настройки отключение — внутри экрана; в списке — шеврон. */
.pf-svc--setup [data-action="disconnect"],
.pf-svc--setup:not(.is-on) .pf-chev {
  display: none !important;
}

.pf-svc:not(.pf-svc--setup) {
  cursor: default;
}

.pf-svc-list:not(.pf-svc-list--expanded) .pf-svc--extra:not(.is-on) {
  display: none;
}

.pf-more {
  display: block;
  width: 100%;
  padding: 0.8rem 1rem;
  border: 0;
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  color: var(--accent);
  background: none;
  cursor: pointer;
}

.pf-svc-list .pf-row:first-child .pf-row-body {
  border-top: 0;
}

/* Ошибка — у места, с «Повторить». */
.pf-error {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.75rem 0.75rem 1rem;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

.pf-error.hidden {
  display: none;
}

.pf-error-text {
  flex: 1;
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--text);
}

.pf-error-btn {
  flex: none;
  padding: 0.45rem 0.85rem;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-muted);
  cursor: pointer;
}

.pf-row--danger {
  justify-content: center;
  padding-left: 0;
}

.pf-row--danger .pf-row-body {
  padding: 0.8rem 1rem;
}

.pf-row--danger .pf-row-title {
  width: 100%;
  text-align: center;
  color: var(--danger);
}

#profile-main .profile-legal-footer {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0 0 0.5rem;
}

.pf-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-faint);
}

.pf-meta-id {
  padding: 0;
  border: 0;
  font: inherit;
  color: inherit;
  background: none;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

.pf-meta .profile-legal-sep {
  display: none;
}

.pf-meta {
  column-gap: 1rem;
}

/* ==== Профиль: вложенные экраны — общие детали (карточки-списки приложения) ==== */
.pf-screen-body {
  display: grid;
  gap: 1.25rem;
  align-content: start;
  max-width: 44rem;
}

.pf-hint {
  margin: 0.45rem 0 0;
  padding: 0 0.25rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-secondary);
}

.pf-hint a,
.pf-hint button {
  padding: 0;
  border: 0;
  font: inherit;
  color: var(--accent);
  background: none;
  cursor: pointer;
}

.pf-row--static {
  cursor: default;
}

button.pf-row--static:hover,
.pf-row--static:hover {
  background: none;
}

.pf-row .svc-toggle {
  flex: none;
}

.pf-row--off .pf-row-title,
.pf-row--off .pf-row-sub,
.pf-list--off {
  opacity: 0.45;
}

.pf-list--off {
  pointer-events: none;
}

.pf-field {
  display: grid;
  gap: 0.15rem;
  padding: 0.6rem 1rem;
}

.pf-field + .pf-field,
.pf-row + .pf-field,
.pf-field + .pf-row .pf-row-body {
  border-top: 1px solid var(--border);
}

.pf-field-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.pf-input {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0.15rem 0;
  border: 0;
  outline: none;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: none;
}

textarea.pf-input {
  min-height: 5rem;
  resize: vertical;
  line-height: 1.4;
}

.pf-input::placeholder {
  color: var(--text-faint);
}

.pf-field:focus-within {
  box-shadow: inset 2px 0 0 var(--accent);
}

.pf-btn {
  display: block;
  width: 100%;
  padding: 0.8rem 1rem;
  border: 0;
  border-radius: var(--radius-lg, 12px);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: center;
  color: var(--on-accent);
  background: var(--accent);
  cursor: pointer;
}

.pf-btn:active {
  background: var(--accent-pressed);
}

.pf-btn:disabled {
  color: var(--text-faint);
  background: var(--surface-muted);
  cursor: default;
}

.pf-btn--ghost {
  border: 1px solid var(--border);
  color: var(--accent);
  background: var(--surface);
}

.pf-btn--ghost:active {
  background: var(--surface-muted);
}

.pf-add-row .pf-row-title {
  color: var(--accent);
}

.pf-add-row .pf-ico {
  background: none;
}

.pf-empty {
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  padding: 1.75rem 1rem;
  text-align: center;
}

.pf-empty-ico {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.25rem;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-muted);
}

.pf-empty-ico svg {
  width: 1.4rem;
  height: 1.4rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pf-empty-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.pf-empty-text {
  margin: 0;
  max-width: 18rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.pf-empty .pf-btn {
  width: auto;
  margin-top: 0.5rem;
  padding: 0.6rem 1.25rem;
}

.pf-skel-list .pf-row-body::before {
  content: "";
  display: block;
  width: 55%;
  height: 0.8rem;
  border-radius: 6px;
  background: var(--overlay-3);
  animation: pf-shimmer 1.4s ease-in-out infinite;
}

.pf-skel-list .pf-row {
  cursor: default;
}

.pf-seg {
  display: flex;
  gap: 0.2rem;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--surface);
}

.pf-seg button {
  flex: 1;
  padding: 0.45rem 0.5rem;
  border: 0;
  border-radius: calc(var(--radius-lg, 12px) - 3px);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  cursor: pointer;
}

.pf-seg button.is-on {
  color: var(--on-accent);
  background: var(--accent);
}

.pf-stat-value {
  margin: 0;
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.pf-stat-sub {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.pf-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  height: 6.5rem;
}

.pf-bars--dense {
  gap: 2px;
}

.pf-bar {
  flex: 1;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  gap: 0.3rem;
  align-self: stretch;
  min-width: 0;
}

.pf-bar i {
  width: 100%;
  align-self: end;
  border-radius: 4px 4px 2px 2px;
  background: var(--overlay-6);
}

.pf-bar.is-today i {
  background: var(--accent);
}

.pf-bar em {
  min-height: 0.9rem;
  font-size: 0.65rem;
  font-style: normal;
  color: var(--text-secondary);
}

.pf-row-val--strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pf-chev--open {
  transform: rotate(90deg);
}

.pf-sublist {
  display: grid;
  gap: 0.35rem;
  padding: 0 1rem 0.75rem 1rem;
  font-size: 0.8125rem;
}

.pf-sublist div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--text-secondary);
}

.pf-sublist div span:last-child {
  flex: none;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pf-note {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin: 0;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg, 12px);
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text);
  background: var(--accent-subtle);
}

.pf-note--warn {
  border-color: color-mix(in srgb, var(--warning) 35%, transparent);
  background: color-mix(in srgb, var(--warning) 8%, transparent);
}

.pf-hero {
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.5rem 0;
  text-align: center;
}

.pf-hero-ico {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 14px;
  color: var(--accent);
  background: var(--accent-muted);
}

.pf-hero-ico svg {
  width: 1.75rem;
  height: 1.75rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pf-hero-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
}

.pf-hero-text {
  margin: 0;
  max-width: 22rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.pf-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: var(--surface);
}

.pf-pill > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pf-pill--on {
  border-color: color-mix(in srgb, var(--success) 25%, transparent);
  color: var(--emerald-text);
  background: var(--success-muted);
}

.pf-pill--on::before {
  content: "";
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--emerald-text);
}

.pf-pill--warn {
  border-color: color-mix(in srgb, var(--warning) 35%, transparent);
  color: var(--warning);
}

.pf-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-muted);
}

.pf-radio {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--text-faint);
  border-radius: 50%;
}

.is-selected > .pf-row-body .pf-radio,
.pf-row.is-selected .pf-radio {
  border: 6px solid var(--accent);
}

.pf-check {
  flex: none;
  width: 1.25rem;
  font-weight: 700;
  text-align: center;
  color: var(--accent);
}

.pf-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  overflow: hidden;
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-muted);
}

.pf-letter {
  margin: 0 0 0.35rem;
  padding-left: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.pf-toolbar-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--on-accent);
  background: var(--accent);
  cursor: pointer;
}

.pf-toolbar-btn--muted {
  color: var(--text);
  background: var(--surface-muted);
}

.pf-toolbar-btn svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pf-field-error {
  margin: 0.45rem 0 0;
  padding: 0 0.25rem;
  font-size: 0.8125rem;
  color: var(--danger-text);
}

.pf-sublist + .pf-row .pf-row-body {
  border-top: 1px solid var(--border);
}

/* Пополнение: сумма крупно, чипы под ней. */
.pf-amount {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0 0.25rem;
}

.pf-amount-input {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.pf-amount-input input {
  width: 5.5ch;
  padding: 0;
  border: 0;
  outline: none;
  font: inherit;
  text-align: right;
  color: inherit;
  background: none;
  font-variant-numeric: tabular-nums;
}

.pf-amount-input span {
  color: var(--text-secondary);
}

.pf-amount-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}

.pf-amount-chips .amount-chip {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

.pf-amount-chips .amount-chip--active {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-muted);
}

#profile-payment .pf-row-body .pf-input {
  flex: 1;
}

#profile-payment .pay-footer {
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}

/* ---- Контакты ---- */
.pf-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--surface);
}

.pf-search svg {
  flex: none;
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 2;
  stroke-linecap: round;
}

.pf-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: none;
}

.pf-search input::placeholder {
  color: var(--text-faint);
}

.pf-search:focus-within {
  border-color: var(--accent-border);
}

.pf-contacts {
  display: grid;
  gap: 1rem;
}

.pf-row .pf-contact-avatar,
.pf-row .note-member-avatar.pf-contact-avatar {
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  font-size: 0.8rem;
}

.pf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pf-chip {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

.pf-chip.is-on {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-muted);
}

.pf-chip.is-on::before {
  content: "✓ ";
}

.pf-chip--add {
  border-style: dashed;
  color: var(--accent);
  background: none;
}

.contact-detail-sheet .contact-detail-body {
  gap: 1rem;
}

.pf-contact-hero {
  display: grid !important;
  justify-items: center;
  gap: 0.35rem;
  margin: 0.25rem 0 0.25rem !important;
  text-align: center;
}

.pf-contact-hero .note-member-avatar {
  width: 4.5rem !important;
  height: 4.5rem !important;
  border: 0;
  font-size: 1.6rem !important;
}

.pf-contact-hero .contact-detail-name {
  font-size: 1.3rem;
  font-weight: 700;
}

.pf-contact-acts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(5rem, 1fr));
  gap: 0.5rem;
}

.pf-contact-acts a,
.pf-contact-acts button {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  padding: 0.6rem 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  font: inherit;
  font-size: 0.75rem;
  text-decoration: none;
  color: var(--accent);
  background: var(--surface);
  cursor: pointer;
}

.pf-contact-acts svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pf-field-value {
  font-size: 0.9688rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

.pf-meet-list .contact-meet-row {
  border-radius: 0;
  background: none;
}

.pf-meet-list .contact-meet-row + .contact-meet-row {
  border-top: 1px solid var(--border);
}

.pf-meet-list .contact-meet-row:hover {
  background: var(--surface-muted);
}

.pf-status--ok { color: var(--emerald-text); }
.pf-status--warn { color: var(--warning); }
.pf-status--err { color: var(--danger-text); }

.pf-link--danger {
  color: var(--danger);
}

.pf-ico.pf-add-ico {
  background: none;
}

.pf-add-select select.pf-input {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  color: var(--accent);
  cursor: pointer;
}

.pf-row-body > .pf-input {
  flex: 1;
}

.contacts-form-body.pf-screen-body,
.teams-manage-body .pf-screen-body {
  gap: 1rem;
}

#teams-manage-edit-members:empty,
#teams-manage-edit-shares:empty {
  display: none;
}

#teams-manage-edit-members:empty + .pf-row .pf-row-body,
#teams-manage-edit-shares:empty + .pf-row .pf-row-body,
#teams-manage-edit-members .pf-row:first-child .pf-row-body,
#teams-manage-edit-shares .pf-row:first-child .pf-row-body {
  border-top: 0;
}

#teams-manage-edit-members:not(:empty) + .pf-row .pf-row-body,
#teams-manage-edit-shares:not(:empty) + .pf-row .pf-row-body {
  border-top: 1px solid var(--border);
}

/* В карточке контакта тело — flex-колонка со скроллом: карточки не должны сжиматься. */
.contact-detail-body > * {
  flex-shrink: 0;
}

/* ---- Агент: модель, креативность, переключатель ---- */
.pf-select {
  flex: 0 1 auto;
  max-width: 55%;
  padding: 0.2rem 1.2rem 0.2rem 0.4rem;
  border: 0;
  outline: none;
  font: inherit;
  font-size: 0.9375rem;
  text-align: right;
  text-align-last: right;
  color: var(--text-secondary);
  background: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 7px) 55%, calc(100% - 3px) 55%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.pf-range-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.pf-range {
  width: 100%;
  margin: 0.5rem 0 0.15rem;
  accent-color: var(--accent);
}

.pf-range-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.pf-switch {
  flex: none;
  position: relative;
  width: 2.75rem;
  height: 1.55rem;
  margin: 0;
  border-radius: 999px;
  background: var(--surface-muted);
  box-shadow: inset 0 0 0 1px var(--border);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.pf-switch::after {
  content: "";
  position: absolute;
  top: 0.135rem;
  left: 0.135rem;
  width: 1.28rem;
  height: 1.28rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--shadow-color) 35%, transparent);
  transition: transform 0.15s ease;
}

.pf-switch:checked {
  background: var(--accent);
  box-shadow: none;
}

.pf-switch:checked::after {
  transform: translateX(1.2rem);
}

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

.pf-num-input {
  flex: none;
  width: 3.5rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  font: inherit;
  text-align: center;
  color: var(--text);
  background: var(--surface-muted);
}

.pf-agent-form {
  gap: 1rem;
}

.pf-agent-form .agents-textarea {
  min-height: 7rem;
}

.pf-agent-form .agents-textarea--rules {
  min-height: 3.5rem;
}

/* Строка-галочка: нативный checkbox спрятан, справа синяя ✓. */
.pf-check-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.pf-check-input + .pf-avatar + .pf-row-body .pf-check::after,
.pf-check-input + .pf-row-body .pf-check::after {
  content: "";
}

.pf-check-input:checked + .pf-avatar + .pf-row-body .pf-check::after,
.pf-check-input:checked + .pf-row-body .pf-check::after {
  content: "✓";
}

.pf-check-input:focus-visible ~ .pf-row-body {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Telegram: на любом вложенном экране профиля — системная «Назад», своя кнопка скрыта. */
#panel-profile .profile-subscreen.profile-subscreen--native-back .detail-toolbar {
  grid-template-columns: 1fr auto;
}

#panel-profile .profile-subscreen.profile-subscreen--native-back .detail-toolbar > .btn-text:first-child {
  display: none !important;
}

#panel-profile .profile-subscreen.profile-subscreen--native-back .detail-title {
  grid-column: 1;
  justify-self: start;
  text-align: left;
}

#panel-profile .profile-subscreen:not(.hidden) {
  display: flex;
}

/* ---- Голосовой ввод ---- */
.pf-row.voice-feature,
.pf-screen-body.voice-feature {
  margin-bottom: 0;
}

.pf-row.voice-feature {
  display: flex;
  flex-direction: row;
  gap: var(--pf-row-gap, 0.75rem);
}

.pf-screen-body.voice-feature {
  display: grid;
  gap: 1.25rem;
}

.voice-feature--off .pf-voice-dim {
  opacity: 0.45;
  pointer-events: none;
}

.pf-row-title--wrap {
  overflow-wrap: anywhere;
}

.pf-row-sub--wrap {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
}

.pf-del {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--text-secondary);
  background: var(--surface-muted);
  cursor: pointer;
}

.pf-del svg {
  width: 0.85rem;
  height: 0.85rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.pf-del:hover {
  color: var(--danger);
}

form.pf-list .pf-add-row {
  border-top: 1px solid var(--border);
}

form.pf-list .pf-add-row .pf-row-body {
  border-top: 0;
}

.pf-row.voice-feature,
.pf-screen-body.voice-feature {
  padding-top: 0;
  padding-right: 0;
  padding-bottom: 0;
  border-radius: 0;
  background: none;
}

.pf-row.voice-feature {
  padding-left: 1rem;
}

.pf-screen-body.voice-feature {
  padding-left: 0;
}

.pf-del--accent {
  color: var(--accent);
}

.pf-del--accent:hover {
  color: var(--accent);
}

.pf-cal-dot {
  flex: none;
  width: 0.7rem;
  height: 0.7rem;
  margin: 0 0.3rem 0 0.35rem;
  border-radius: 50%;
}

.pf-row-title--muted {
  color: var(--text-secondary);
}

.pf-time {
  flex: none;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  font: inherit;
  color: var(--text);
  background: var(--surface-muted);
  color-scheme: dark;
}

/* ---- База знаний: источники ---- */
.knowledge-sources-entry {
  margin: 0 0 1rem;
}

.kb-sources {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.kb-sources.hidden {
  display: none !important;
}

.kb-fab-suppressed {
  display: none !important;
}

.pf-kb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-top: 0.35rem;
}

.pf-kb-actions .pf-link {
  padding: 0.15rem 0;
  font-size: 0.875rem;
}

#knowledge-sources.profile-subscreen--native-back .detail-toolbar {
  grid-template-columns: 1fr auto;
}

#knowledge-sources.profile-subscreen--native-back #knowledge-sources-back {
  display: none !important;
}

#knowledge-sources.profile-subscreen--native-back .detail-title {
  grid-column: 1;
  justify-self: start;
  text-align: left;
}

/* Профиль на десктопе: поздние правила выше сбрасывают карточку шапки — возвращаем. */
@media (min-width: 960px) {
  #profile-main .profile-head {
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    background: var(--surface);
  }

  #profile-main .pf-body {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    /* Три колонки: «Лео» | «Мои данные» и под ними «Орбита» | «Сервисы»; крайние — на всю высоту. */
    align-items: stretch;
  }
  /* Ошибка загрузки — над колонками (строка 1), колонки — строки 2–3, выход — ниже. */
  #profile-main .pf-body > .pf-error { grid-row: 1; }
  #profile-main .pf-body > #profile-onboarding-reset-wrap { grid-row: 4; }
  #profile-main .pf-body > #profile-logout-wrap { grid-row: 5; }
  #profile-main .pf-body > .profile-legal-footer { grid-row: 6; }
  #profile-main .pf-body > .pf-group--leo { grid-column: 1; grid-row: 2 / span 2; }
  #profile-main .pf-body > .pf-group--data { grid-column: 2; grid-row: 2; }
  #profile-main .pf-body > .pf-group--orbita { grid-column: 2; grid-row: 3; }
  #profile-main .pf-body > .pf-group--svc { grid-column: 3; grid-row: 2 / span 2; }
  #profile-main .pf-body > .pf-group {
    display: flex;
    flex-direction: column;
  }
  #profile-main .pf-body > .pf-group > .pf-list {
    flex: 1;
    align-content: start;
  }
  #profile-main #profile-logout-wrap {
    align-self: start;
  }

  #profile-main .profile-names h2 {
    font-size: 1.4rem;
  }
}

/* ---- Подсказка над столбиком расходов ---- */
.pf-bars,
.pf-spark {
  position: relative;
}

.pf-bar-tip {
  position: absolute;
  z-index: 3;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text);
  background: var(--surface-elevated);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--shadow-color) 35%, transparent);
  transform: translate(-50%, calc(-100% - 6px));
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.pf-bar-tip.hidden {
  display: none;
}

.pf-bar.is-tipped i {
  background: var(--accent-pressed);
}

.pf-bar.is-today.is-tipped i {
  background: var(--accent);
}

.pf-spark i.is-tipped {
  background: var(--accent-pressed);
}

/* ---- Аватар в шапке профиля: тап — сменить фото ---- */
.pf-avatar-btn {
  padding: 0;
  overflow: visible !important;
  cursor: pointer;
  font: inherit;
}

.pf-avatar-btn .avatar-img {
  border-radius: 50%;
}

.pf-avatar-btn.is-busy {
  opacity: 0.5;
  pointer-events: none;
}

.pf-avatar-cam {
  position: absolute;
  right: -0.15rem;
  bottom: -0.15rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border: 2px solid var(--bg);
  border-radius: 50%;
  color: var(--on-accent);
  background: var(--accent);
}

.pf-avatar-cam svg {
  width: 0.75rem;
  height: 0.75rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pf-avatar-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.pf-avatar-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.9rem;
  margin: 0.15rem 0 0 !important;
}

.pf-avatar-links .pf-link {
  padding: 0;
  font-size: 0.8125rem;
}

/* ——— Почта: мастера подключения (webapp/mail.js) ——— */
.mail-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.mail-tile {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  font: inherit;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

.mail-tile:active {
  background: var(--surface-muted);
}

.mail-tile-title {
  font-weight: 600;
}

.mail-tile-sub {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.mail-wiz,
.mail-done {
  display: grid;
  gap: 0.75rem;
}

.mail-wiz-progress {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.mail-wiz-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 650;
}

.mail-wiz-text {
  margin: 0;
  line-height: 1.45;
  color: var(--text-secondary);
}

.mail-wiz-foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.mail-wiz-alt {
  justify-self: center;
}

.mail-wiz .pf-list,
.mail-wiz .pf-group-title {
  margin: 0;
}

/* Схема экрана провайдера с подсвеченной кнопкой */
.mail-illo {
  padding: 0.75rem;
  border-radius: var(--radius-lg, 12px);
  background: var(--surface-muted);
}

.mail-illo-win {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.8125rem;
}

.mail-illo-bar {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-illo-page {
  display: grid;
  gap: 0.5rem;
  padding: 0.7rem 0.75rem;
}

.mail-illo-lines {
  display: grid;
  gap: 0.3rem;
}

.mail-illo-lines i {
  display: block;
  height: 0.4rem;
  border-radius: 4px;
  background: var(--surface-muted);
}

.mail-illo-lines i:last-child {
  width: 60%;
}

.mail-illo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.mail-illo-acts {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}

.mail-illo-btn,
.mail-illo-input,
.mail-illo-check,
.mail-illo-pass {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.mail-illo-btn--fill {
  border-color: transparent;
  color: var(--on-accent);
  background: var(--text-tertiary);
}

.mail-illo-input {
  min-width: 5rem;
  color: var(--text);
}

.mail-illo-pass {
  justify-self: center;
  padding: 0.45rem 0.8rem;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  color: #3a2f00;
  background: #ffe58a;
}

.mail-illo-hl {
  border-color: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-border);
  animation: mail-illo-pulse 1.6s ease-out infinite;
}

.mail-illo-btn--fill.mail-illo-hl {
  background: var(--accent);
}

@keyframes mail-illo-pulse {
  0% {
    box-shadow: 0 0 0 0 var(--accent-border);
  }
  70% {
    box-shadow: 0 0 0 0.45rem color-mix(in srgb, var(--accent) 0%, transparent);
  }
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mail-illo-hl {
    animation: none;
  }
}

.mail-acc-sub .pf-row-body {
  gap: 0.75rem;
}

/* Тексты почты (обещание Лео, ответы на «Не получается», отчёт синхронизации) — целиком, без обрезки в 2 строки */
#profile-mail-body .pf-row-sub--wrap,
#profile-mail-body .pf-row-title--wrap {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  white-space: normal;
}

/* ——— Почта в чате: карточки письма и черновика, окно письма (webapp/mail.js) ——— */
.mail-card {
  display: grid;
  gap: 0.55rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--surface-muted);
}

.mail-card-head {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.mail-card-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-muted);
}

.mail-card-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.mail-card-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.mail-card-title {
  overflow-wrap: anywhere;
}

.mail-card-gist {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.mail-card-err {
  font-size: 0.8125rem;
  color: var(--danger);
}

.mail-card-acts {
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mail-card--draft.is-sent .mail-card-ico {
  color: var(--emerald-text);
  background: var(--success-muted);
}

.mail-card--draft.is-failed .mail-card-ico {
  color: var(--danger);
  background: var(--danger-muted);
}

/* Окно письма — на месте поля ввода чата */
.mail-composer {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 78%;
  padding: 0.5rem 0.75rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  overflow: auto;
}

.mail-cmp-grab {
  display: none;
}

.mail-cmp-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mail-cmp-kind {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-cmp-saved {
  flex: none;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.mail-cmp-send {
  padding: 0.45rem 0.95rem;
  border: 0;
  border-radius: var(--radius-full);
  font: inherit;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  cursor: pointer;
}

.mail-cmp-summary {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  color: var(--text-secondary);
  background: transparent;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.mail-cmp-fields {
  display: grid;
  gap: 0.15rem;
}

.mail-cmp-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.2rem;
  border-bottom: 1px solid var(--border);
}

.mail-cmp-field > span {
  flex: none;
  width: 3.6rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.mail-cmp-field input,
.mail-cmp-field select,
.mail-chip-input {
  flex: 1;
  min-width: 6rem;
  padding: 0.35rem 0;
  border: 0;
  font: inherit;
  color: var(--text);
  background: transparent;
  outline: none;
}

.mail-chips {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0;
}

.mail-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  padding: 0.15rem 0.3rem 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  background: var(--accent-subtle);
  overflow-wrap: anywhere;
}

.mail-chip.is-new {
  color: #3a2f00;
  background: #ffe58a;
}

.mail-chip--file {
  padding-left: 0.6rem;
  background: var(--surface-muted);
}

.mail-chip-x {
  padding: 0 0.3rem;
  border: 0;
  font: inherit;
  color: inherit;
  background: transparent;
  opacity: 0.7;
  cursor: pointer;
}

.mail-cmp-replyall {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.mail-cmp-warn,
.mail-plus-warn {
  margin: 0.25rem 0;
  font-size: 0.8125rem;
  color: var(--warning);
}

.mail-cmp-body-wrap {
  position: relative;
}

.mail-cmp-body {
  display: block;
  width: 100%;
  min-height: 6rem;
  padding: 0.5rem 0;
  border: 0;
  font: inherit;
  line-height: 1.45;
  color: var(--text);
  background: transparent;
  resize: none;
  outline: none;
}

.mail-cmp-atts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.mail-cmp-tools,
.mail-cmp-fix {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.mail-cmp-fix input {
  flex: 1;
  min-width: 10rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  color: var(--text);
  background: transparent;
}

.mail-tool {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font: inherit;
  font-size: 0.8125rem;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.mail-tool:disabled {
  opacity: 0.5;
  cursor: default;
}

.mail-tool--primary {
  border-color: transparent;
  color: var(--on-accent);
  background: var(--accent);
}

.mail-tool--undo {
  color: var(--accent);
}

/* Меню «+» — над строкой с курсором */
.mail-plus {
  position: absolute;
  z-index: 5;
  width: min(20rem, 100%);
  max-height: 18rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border-strong, var(--border));
  border-radius: 12px;
  background: var(--surface-elevated, var(--surface));
  box-shadow: var(--shadow-md);
  overflow: auto;
}

.mail-plus-head {
  font-weight: 600;
}

.mail-plus-sub {
  margin: 0.2rem 0 0.4rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.mail-plus-slot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.875rem;
  cursor: pointer;
}

.mail-plus-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

@media (max-width: 767px) {
  .mail-composer {
    max-height: 88%;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px color-mix(in srgb, var(--shadow-color) 35%, transparent);
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }

  .mail-cmp-grab {
    display: block;
    align-self: center;
    width: 2.5rem;
    height: 0.3rem;
    border-radius: var(--radius-full);
    background: var(--border-strong, var(--border));
  }
}

.mail-signature {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
}

/* Повтор встречи */
.sheet-repeat { display: flex; flex-direction: column; }
.sheet-repeat-body { display: flex; flex-direction: column; gap: 10px; padding: 4px 12px 12px; }
.sheet-repeat-body.hidden { display: none; }
.sheet-repeat-toggle #m-repeat-value { max-width: 15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-repeat.is-open .sheet-repeat-toggle .event-sheet-chevron { transform: rotate(180deg); }
.sheet-repeat-custom, .sheet-repeat-end { display: flex; flex-direction: column; gap: 10px; }
.sheet-repeat-custom.hidden, .sheet-repeat-end.hidden, .sheet-repeat-line.hidden, .sheet-repeat-wds.hidden, .sheet-repeat-month.hidden, .sheet-repeat-summary.hidden { display: none; }
.sheet-repeat-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 36px; font-size: 0.875rem; color: var(--text-soft); }
.sheet-repeat-line > span:first-child { min-width: 4.5rem; }
.sheet-repeat-num { width: 4.25rem; height: 36px; text-align: center; font-variant-numeric: tabular-nums; }
.sheet-repeat-unit { height: 36px; padding: 0 10px; color-scheme: dark; }
.sheet-repeat-wds { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.sheet-repeat-wd { height: 36px; border: 1px solid var(--overlay-5); border-radius: 10px; background: transparent; color: var(--text-soft); font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer; }
.sheet-repeat-wd.is-active { background: var(--accent-muted); border-color: var(--accent-border); color: var(--accent-soft); }
.sheet-repeat-summary { margin: 0; font-size: 0.8125rem; color: var(--accent-soft); }

/* Окно встречи: перетаскивание записи */
#modal-overlay .modal { position: relative; }
.ev-drop-veil { position: absolute; inset: 8px; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; border: 2px dashed var(--accent); border-radius: 16px; background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--text); text-align: center; pointer-events: none; }
.ev-drop-veil.hidden { display: none; }
.ev-drop-veil svg { width: 36px; height: 36px; color: var(--accent); }
.ev-drop-veil b { font-size: 1.0625rem; }
.ev-drop-veil span { max-width: 22rem; font-size: 0.85rem; color: var(--text-secondary); }
.ev-materials-drop-hint { margin: 0; font-size: 0.75rem; color: var(--text-tertiary); text-align: center; }

.mail-group-toggle {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

/* ——— «Дайджест» → «Почта»: переписка как мессенджер (webapp/mail-inbox.js) ——— */
.mail-inbox {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
}

.mail-inbox-bar,
.mail-leo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.mail-bar-spacer {
  flex: 1;
}

.mail-chip-filter {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font: inherit;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
}

.mail-chip-filter.is-on {
  border-color: transparent;
  color: var(--on-accent);
  background: var(--accent);
}

.mail-acc-select {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--text);
  background: var(--surface);
}

.mail-seg {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--radius-full);
  background: var(--surface-muted);
}

.mail-seg-btn {
  padding: 0.25rem 0.7rem;
  border: 0;
  border-radius: var(--radius-full);
  font: inherit;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
}

.mail-seg-btn.is-on {
  color: var(--text);
  background: var(--surface-elevated, var(--surface));
  box-shadow: 0 1px 2px color-mix(in srgb, var(--shadow-color) 25%, transparent);
}

.mail-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-secondary);
}

.mail-threads {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* длинная строка без переносов не растягивает колонку */
}

.mail-thread-row {
  display: flex;
  min-width: 0;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.65rem 0.25rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  font: inherit;
  text-align: left;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.mail-thread-row:hover {
  background: var(--surface-muted);
}

.mail-ava {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--on-accent);
}

.mail-thread-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* иначе длинная тема без переносов растягивает строку за край */
  flex: 1;
  gap: 0.1rem;
  min-width: 0;
}

.mail-thread-top {
  display: flex;
  gap: 0.5rem;
  min-width: 0;
}

.mail-thread-who {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-thread-row.is-unread .mail-thread-who,
.mail-thread-row.is-unread .mail-thread-subj {
  font-weight: 700;
}

.mail-thread-time {
  flex: none;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.mail-thread-subj,
.mail-thread-snip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-thread-subj {
  font-size: 0.875rem;
}

.mail-thread-snip {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.mail-thread-count {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.mail-unread {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 1.3rem;
  height: 1.3rem;
  padding: 0 0.35rem;
  align-self: center;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--on-accent);
  background: var(--accent);
}

.mail-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.2rem;
}

.mail-label {
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  color: var(--text-secondary);
  background: var(--surface-muted);
}

.mail-label--awaiting {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 14%, transparent);
}

.mail-label--promise {
  color: var(--violet-text);
  background: var(--violet-muted);
}

.mail-label--deadline {
  color: var(--danger-text);
  background: color-mix(in srgb, var(--danger-text) 14%, transparent);
}

/* ветка */
.mail-thread {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 60vh;
}

.mail-thread-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mail-thread-title {
  display: grid;
  flex: 1;
  min-width: 0;
}

.mail-thread-title b,
.mail-thread-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-thread-title span {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.mail-icon-btn {
  flex: none;
  width: 2.2rem;
  height: 2.2rem;
  border: 0;
  border-radius: 50%;
  font: inherit;
  font-size: 1.1rem;
  color: var(--text-secondary);
  background: var(--surface-muted);
  cursor: pointer;
}

.mail-menu {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-elevated, var(--surface));
}

.mail-menu button {
  padding: 0.65rem 0.9rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  font: inherit;
  text-align: left;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.mail-menu button:last-child {
  border-bottom: 0;
}

.mail-menu .is-danger {
  color: var(--danger);
}

.mail-mini {
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font: inherit;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
}

.mail-mini--leo {
  color: var(--violet-text);
  border-color: color-mix(in srgb, var(--violet) 40%, transparent);
}

.mail-summary {
  padding: 0.6rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--violet) 40%, transparent);
  border-radius: 12px;
  background: var(--violet-muted);
  font-size: 0.875rem;
}

.mail-summary-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.3rem;
  font-weight: 600;
}

.mail-msgs {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.25rem 0;
  overflow: auto;
}

.mail-sys {
  align-self: center;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  background: var(--surface-muted);
}

.mail-msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 86%;
}

.mail-msg.is-out {
  align-self: flex-end;
  align-items: flex-end;
}

.mail-msg.is-flash .mail-bubble {
  box-shadow: 0 0 0 2px var(--accent);
}

.mail-msg-who {
  margin: 0 0.6rem 0.15rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
}

.mail-bubble {
  position: relative;
  max-width: 100%;
  padding: 0.5rem 0.7rem 0.35rem;
  border-radius: 16px 16px 16px 4px;
  background: var(--surface-elevated, var(--surface));
  overflow-wrap: anywhere;
}

.mail-msg.is-out .mail-bubble {
  border-radius: 16px 16px 4px 16px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.mail-msg.is-pending .mail-bubble {
  opacity: 0.75;
}

.mail-bubble-body {
  max-height: 18.5em; /* ~12 строк */
  overflow: hidden;
}

.mail-bubble.is-expanded .mail-bubble-body {
  max-height: none;
}

.mail-more {
  padding: 0.2rem 0;
  border: 0;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
}

.mail-reply-quote {
  display: grid;
  width: 100%;
  margin-bottom: 0.35rem;
  padding: 0.25rem 0.5rem;
  border: 0;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font: inherit;
  font-size: 0.75rem;
  text-align: left;
  color: var(--text-secondary);
  background: var(--surface-muted);
  cursor: pointer;
}

.mail-reply-quote b {
  color: var(--accent);
}

.mail-reply-quote span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-bubble-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
}

.mail-bubble-meta {
  margin-top: 0.15rem;
  font-size: 0.6875rem;
  text-align: right;
  color: var(--text-tertiary);
}

.mail-reply-btn {
  position: absolute;
  top: 50%;
  right: -2.1rem;
  width: 1.8rem;
  height: 1.8rem;
  border: 0;
  border-radius: 50%;
  color: var(--text-secondary);
  background: var(--surface-muted);
  opacity: 0;
  transform: translateY(-50%);
  cursor: pointer;
  transition: opacity 0.15s;
}

.mail-msg.is-out .mail-reply-btn {
  right: auto;
  left: -2.1rem;
}

.mail-bubble:hover .mail-reply-btn,
.mail-reply-btn:focus {
  opacity: 1;
}

@media (hover: none) {
  .mail-reply-btn {
    display: none; /* на телефоне — долгий тап по пузырю */
  }
}

/* текст письма */
.mail-html {
  font-size: 0.9375rem;
  line-height: 1.45;
}

.mail-html p,
.mail-html div {
  margin: 0 0 0.45em;
}

.mail-html > :last-child {
  margin-bottom: 0;
}

.mail-html a {
  color: var(--accent);
}

.mail-html ul,
.mail-html ol {
  margin: 0.2em 0 0.5em;
  padding-left: 1.3em;
}

.mail-html blockquote,
.mail-html .mail-quote {
  margin: 0.4em 0;
  padding-left: 0.7em;
  border-left: 3px solid var(--border-strong, var(--border));
  color: var(--text-secondary);
}

.mail-html table {
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.mail-html td,
.mail-html th {
  padding: 0.25em 0.5em;
  border: 1px solid var(--border);
}

.mail-html img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.mail-html img[data-src]:not([src]) {
  display: none;
}

.mail-html .mail-sig {
  max-height: 1.3em;
  overflow: hidden;
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  cursor: pointer;
}

.mail-html .mail-sig::before {
  content: "— ";
}

.mail-html .mail-sig:hover {
  max-height: none;
}

/* вложения */
.mail-files {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.3rem;
}

.mail-file {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 16rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

.mail-file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-file-size {
  flex: none;
  color: var(--text-tertiary);
}

/* вид «Письма» */
.mail-msgs.is-letters {
  gap: 0.75rem;
}

.mail-letter {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.mail-letter-head {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.mail-letter-meta {
  display: grid;
  flex: 1;
  min-width: 0;
}

.mail-letter-meta span {
  overflow: hidden;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-letter-date {
  flex: none;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* Цитата в виде «Письма»: свёрнута до 6 строк, по нажатию — целиком */
.mail-html--letter .mail-quote:not(.is-open),
.mail-html--letter blockquote:not(.is-open) {
  position: relative;
  max-height: 6em;
  overflow: hidden;
  cursor: pointer;
}

.mail-html--letter .mail-quote:not(.is-open)::after,
.mail-html--letter blockquote:not(.is-open)::after {
  content: "Показать цитату ▾";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.6em 0 0.1em 0.7em;
  font-size: 0.8125rem;
  color: var(--accent);
  background: linear-gradient(transparent, var(--surface) 70%);
}

.mail-html--letter .mail-quote .mail-quote::after,
.mail-html--letter blockquote blockquote::after {
  content: none; /* вложенные цитаты раскрываются вместе с внешней */
}

.mail-letter-acts {
  display: flex;
  gap: 0.4rem;
}

/* ответ — как поле ввода в чате Лео (.note-paie-reply-form) */
.mail-input-wrap {
  --mail-composer-border: #6b6b6b;
  --mail-composer-accent: #9eaddb;
  --mail-composer-ink: #19191a;
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 0.4rem;
  padding: 0.5rem 0 0.6rem;
  background: var(--surface, var(--bg));
}

.mail-replybar {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.4rem 0.35rem 0.7rem;
  border-left: 3px solid var(--mail-composer-accent);
  border-radius: 8px;
  font-size: 0.8125rem;
  background: var(--surface-muted);
}

.mail-replybar span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-replybar-x {
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
}

.mail-compose {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 8px 8px 10px;
  border: 1px solid var(--mail-composer-border);
  border-radius: 26px;
  background: var(--vkui--color_background_content, var(--surface));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--shadow-color) 6%, transparent);
}

.mail-compose:focus-within {
  border-color: var(--mail-composer-accent);
}

.mail-input {
  box-sizing: border-box;
  flex: 1;
  min-width: 0;
  min-height: 40px;
  max-height: 10rem;
  margin: 0;
  padding: 9px 0;
  border: 0;
  border-radius: 0;
  font: inherit;
  font-size: 15px;
  line-height: 22px;
  color: var(--vkui--color_text_primary, var(--text));
  background: transparent;
  resize: none;
  outline: none;
}

.mail-input::placeholder {
  color: var(--text-subtle);
}

.mail-compose-btn,
.mail-compose-send {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 100px;
  color: var(--mail-composer-ink);
  background: var(--mail-composer-border);
  cursor: pointer;
}

.mail-compose-btn {
  color: var(--text-secondary);
  background: transparent;
}

.mail-compose-btn:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.mail-compose-send {
  opacity: 0.7;
}

.mail-compose-send.is-ready {
  opacity: 1;
  background: var(--mail-composer-accent);
}

.mail-split-detail .mail-input-wrap {
  padding: 0.5rem 0.75rem 0.75rem;
}

/* «Оригинал» — изолированная страница */
.mail-orig {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.mail-orig-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.mail-orig iframe {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}

/* На телефоне ветка — на весь экран, поле ответа над клавиатурой */
@media (max-width: 767px) {
  html.mail-thread-open #digest-pane-mail .mail-thread {
    position: fixed;
    inset: 0;
    z-index: 1200;
    padding: calc(0.5rem + env(safe-area-inset-top, 0px)) 0.75rem calc(0.25rem + env(safe-area-inset-bottom, 0px));
    background: var(--bg);
  }

  .mail-msg {
    max-width: 92%;
  }
}

.mail-letter > .mail-mini {
  justify-self: start;
}

/* ——— «Дайджест»: чаты списком по чатам, почта и рынок (digest-chats.js, mail-inbox.js, digest-market.js) ——— */
.digest-focus-link {
  margin-left: auto;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font: inherit;
  font-size: 0.8125rem;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}

.digest-head .digest-focus-link + .digest-refresh-btn {
  margin-left: 0.4rem;
}

.dgx-split,
.mail-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.dgx.is-wide .dgx-split,
.mail-split {
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  height: calc(100vh - 190px);
  min-height: 480px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.dgx.is-wide .dgx-list,
.mail-split-list {
  overflow: auto;
  border-right: 1px solid var(--border);
}

.dgx.is-wide .dgx-detail,
.mail-split-detail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.mail-split-list .mail-inbox-bar {
  padding: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.mail-split-list .mail-seg {
  display: none;
}

.mail-split-list .mail-thread-row {
  width: 100%;
  padding: 0.65rem 0.75rem;
}

.mail-thread-row.is-sel,
.dgx-row.is-sel {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.mail-split-detail .mail-thread {
  height: 100%;
  min-height: 0;
  padding: 0.6rem 1rem 0;
}

.mail-split-detail .mail-thread-head [data-mi="back"] {
  display: none;
}

.mail-empty--big,
.dgx-empty--big {
  margin: auto;
}

.dgx-tools {
  display: grid;
  gap: 0.5rem;
  padding: 0 0 0.6rem;
}

.dgx.is-wide .dgx-tools {
  padding: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.dgx-search {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--surface-muted);
  outline: none;
}

.dgx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.dgx-chip {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font: inherit;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
}

.dgx-chip.is-on {
  border-color: transparent;
  color: var(--on-accent);
  background: var(--accent);
}

/* счётчик «Важного» — красный, как непрочитанное */
.dgx-chip-count {
  display: inline-block;
  min-width: 1.15rem;
  margin-left: 0.25rem;
  padding: 0 0.3rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.15rem;
  text-align: center;
  color: var(--on-danger);
  background: var(--danger);
}

.dgx-row {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  width: 100%;
  padding: 0.7rem 0.25rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  font: inherit;
  text-align: left;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.dgx.is-wide .dgx-row {
  padding: 0.7rem 0.75rem;
}

.dgx-row:hover {
  background: var(--surface-muted);
}

.dgx-row.is-quiet {
  opacity: 0.55;
}

.dgx-ava {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--on-accent);
}

.dgx-rmain {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* иначе длинная тема без переносов растягивает строку за край */
  flex: 1;
  gap: 0.15rem;
  min-width: 0;
}

.dgx-rtop {
  display: flex;
  gap: 0.5rem;
}

.dgx-rtop b {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dgx-time {
  flex: none;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.dgx-snip {
  overflow: hidden;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dgx-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.15rem;
}

.dgx-tag {
  padding: 0.05rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  color: var(--text-secondary);
  background: var(--surface-muted);
}

.dgx-tag--wait {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 15%, transparent);
}

.dgx-tag--risk {
  color: var(--danger-text);
  background: color-mix(in srgb, var(--danger) 15%, transparent);
}

.dgx-tag--promise {
  color: var(--violet-text);
  background: var(--violet-muted);
}

.dgx-tag--deadline {
  color: color-mix(in srgb, var(--danger-text) 50%, var(--warning-text));
  background: color-mix(in srgb, var(--warning) 15%, transparent);
}

.dgx-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-secondary);
}

.dgx-empty--start {
  display: grid;
  justify-items: center;
  gap: 0.4rem;
}

.dgx-empty--start b {
  font-weight: 600;
  color: var(--text);
}

.dgx-empty--start span {
  max-width: 24rem;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.dgx-empty--start .pf-btn {
  width: auto;
  margin-top: 0.5rem;
  padding: 0.55rem 1.25rem;
}

.dgx-dhead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding: 0.25rem 0 0.75rem;
  border-bottom: 1px solid var(--border);
}

.dgx.is-wide .dgx-dhead {
  padding: 0.8rem 1.1rem;
}

.dgx-back {
  border: 0;
  font: inherit;
  font-size: 1.2rem;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
}

.dgx.is-wide .dgx-back {
  display: none;
}

.dgx-dtitle {
  display: grid;
  flex: 1;
  min-width: 10rem;
}

.dgx-dtitle b {
  font-size: 1.0625rem;
}

.dgx-dtitle span,
.dgx-muted {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.dgx-body {
  display: grid;
  gap: 0.75rem;
  align-content: start;
  padding: 0.9rem 0;
}

.dgx.is-wide .dgx-body {
  flex: 1;
  overflow: auto;
  padding: 1rem 1.1rem 1.5rem;
}

.dgx-box {
  display: grid;
  gap: 0.6rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.dgx-box--wait {
  border-color: color-mix(in srgb, var(--warning) 45%, transparent);
}

.dgx-boxh {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.dgx-infocus {
  margin-left: auto;
  padding: 0.05rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-subtle);
}

.dgx-q {
  display: grid;
  gap: 0.35rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.dgx-q:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.dgx-who {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.dgx-acts,
.mkt-leo-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.dgx-btn {
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font: inherit;
  font-size: 0.8125rem;
  color: var(--text);
  background: transparent;
  white-space: nowrap;
  cursor: pointer;
}

.dgx-btn--p,
.dgx-btn--leo {
  border-color: transparent;
  color: var(--on-accent);
  background: var(--violet);
}

.dgx-day {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.dgx-sec {
  display: grid;
  gap: 0.3rem;
}

.dgx-sec h4 {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.dgx-sec p {
  margin: 0;
  line-height: 1.45;
}

.dgx-li {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  line-height: 1.45;
}

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

.dgx-dot {
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: 0.5rem;
  border-radius: 50%;
  background: var(--text-tertiary);
}

.dgx-collapsed {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  color: var(--text-secondary);
  cursor: pointer;
}

.dgx-more {
  flex: none;
  color: var(--accent);
}

/* Рынок — журнальный выпуск */
.mkt {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  overflow: clip; /* не hidden: иначе меню слева не прилипает при прокрутке */
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.mkt-toc {
  display: grid;
  gap: 0.2rem;
  align-content: start;
  align-self: start;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 0.75rem 0.6rem;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
}

.mkt-toc small {
  margin: 0.8rem 0.75rem 0.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.mkt-toc small:first-child {
  margin-top: 0;
}

.mkt-toc-item {
  padding: 0.6rem 0.75rem;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 1rem; /* как названия в списках «Чатов» и «Почты» */
  font-weight: 500;
  text-align: left;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
}

.mkt-toc-item.is-on {
  font-weight: 600;
  color: var(--text);
  background: var(--surface-muted);
}

.mkt-body {
  display: grid;
  gap: 1.1rem;
  align-content: start;
  min-width: 0;
  padding: 1.2rem 1.5rem 1.6rem;
}

.mkt-eyebrow,
.mkt-meta {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.mkt-title {
  margin: 0.3rem 0;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
}

.mkt-lead {
  margin: 0.4rem 0 0;
  line-height: 1.55;
  color: var(--text-secondary);
}

.mkt-leo {
  display: grid;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border: 1px solid color-mix(in srgb, var(--violet) 45%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--violet) 12%, transparent);
}

.mkt-leo b {
  color: var(--violet-soft);
}

.mkt-leo ul {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding-left: 1.1rem;
  line-height: 1.45;
}

.mkt-sec {
  display: grid;
  gap: 0.6rem;
  scroll-margin-top: 1rem;
}

.mkt-h {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.mkt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.6rem;
}

.mkt-card {
  display: grid;
  gap: 0.35rem;
  align-content: start;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: var(--bg);
  text-decoration: none;
}

.mkt-card:hover {
  border-color: var(--border-strong, var(--border));
}

.mkt-card-src {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

.mkt-card-title {
  line-height: 1.3;
}

.mkt-card-desc,
.mkt-card-why {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-secondary);
}

.mkt-card-why::before {
  content: "Почему важно: ";
  color: var(--text-tertiary);
}

.mkt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.mkt-chip {
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
}

.mkt-prose {
  line-height: 1.5;
  color: var(--text-secondary);
}

.mkt-prose ul {
  margin: 0;
  padding-left: 1.2rem;
}

@media (max-width: 767px) {
  .digest-focus-link {
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
  }

  .mkt {
    grid-template-columns: minmax(0, 1fr);
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .mkt-toc {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding: 0 0 0.4rem;
    border: 0;
    position: static;
  }

  .mkt-toc small {
    display: none;
  }

  .mkt-toc-item {
    flex: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 0.3rem 0.8rem;
    white-space: nowrap;
  }

  .mkt-toc-item--arch {
    display: none;
  }

  .mkt-body {
    padding: 0.6rem 0 1rem;
  }
}

@media (max-width: 767px) {
  .mkt-toc-item {
    font-size: 0.875rem;
    padding: 0.3rem 0.8rem;
  }
}

/* Письмо со своей вёрсткой (таблицы, цвета) — «как в почте», на белом листе */
.mail-msg.is-rich {
  max-width: 100%;
  width: 100%;
}

.mail-msg.is-rich .mail-bubble {
  width: 100%;
  padding: 0.35rem;
}

.mail-paper {
  padding: 0.9rem 1rem;
  border-radius: 10px;
  color: #1a1a1a;
  background: #fff;
  overflow-x: auto;
}

.mail-paper a {
  color: #1a5fd0;
}

.mail-paper table {
  max-width: 100%;
  font-size: inherit;
}

.mail-paper td,
.mail-paper th {
  padding: 0;
  border: 0; /* рамки — только если они есть в самом письме */
}

.mail-msg.is-rich .mail-bubble-body {
  max-height: 32em;
}

.mail-msg.is-rich .mail-bubble.is-expanded .mail-bubble-body {
  max-height: none;
}

/* ——— Внешние трекеры (Битрикс24…): форма задачи, WWA, бейджи дублей, Фокус, настройки ——— */
/* Место под «Орбита / Битрикс24», пока трекер не подключён: без лишнего отступа в форме. */
#m-task-target-slot {
  display: none;
}

.task-target-switch {
  margin: 0;
}

.task-target-switch .event-sheet-kind-btn {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-sheet-kind-switch + .task-target-switch {
  margin-top: -0.35rem;
}

.tracker-desc-group .tracker-desc-head {
  min-height: 40px;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.tracker-desc-head .event-sheet-row-label {
  flex-shrink: 0;
}

.tracker-wwa-acts {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.tracker-wwa-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  margin: 0;
  padding: 5px 10px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-muted);
  color: var(--accent);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.tracker-wwa-btn svg {
  flex-shrink: 0;
}

.tracker-wwa-btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-secondary);
}

.tracker-wwa-btn.hidden {
  display: none;
}

.tracker-wwa-btn.is-loading,
.focus-chat-btn.is-loading {
  opacity: 0.7;
  cursor: progress;
}

.tracker-wwa-btn.is-loading svg {
  animation: tracker-wwa-pulse 1s ease-in-out infinite;
}

@keyframes tracker-wwa-pulse {
  50% {
    opacity: 0.35;
  }
}

textarea.tracker-desc {
  min-height: 6rem;
  resize: none;
  overflow-y: hidden;
  border-top: 0.5px solid var(--border);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.tracker-hint {
  margin: -0.2rem 0 0;
  padding: 0 0.25rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--text-tertiary);
  overflow-wrap: anywhere;
}

.tracker-row {
  cursor: default;
}

.tracker-row .event-sheet-row-label {
  flex-shrink: 0;
}

.tracker-select,
.tracker-input {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 62%;
  margin: 0;
  padding: 0.25rem 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 1rem;
  text-align: right;
  text-overflow: ellipsis;
}

.tracker-select {
  cursor: pointer;
  text-align-last: right;
}

.tracker-select:disabled {
  opacity: 0.6;
}

.tracker-input {
  flex: 1 1 auto;
}

.tracker-input::placeholder {
  color: var(--text-tertiary);
}

.tracker-input--date {
  flex: 0 1 auto;
  color-scheme: light dark;
}

.tracker-sheet .pf-field-error {
  margin: 0;
  padding: 0 0.25rem;
}

.tracker-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: -0.2rem;
}

.tracker-links.hidden {
  display: none;
}

.tracker-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 10px;
  border: none;
  border-radius: 999px;
  background: var(--accent-muted);
  color: var(--accent);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.tracker-link-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tracker-link-chip svg {
  flex-shrink: 0;
}

/* Фокус: «В задачу» → трекер */
.focus-task-target {
  margin: 0;
}

.focus-task-target .event-sheet-kind-btn {
  padding: 0.35rem 0.2rem;
}

.focus-tracker-desc {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.focus-tracker-desc textarea {
  width: 100%;
  min-width: 0;
  min-height: 4.5rem;
  box-sizing: border-box;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.45;
  resize: none;
  overflow-y: hidden;
  overflow-wrap: anywhere;
}

.focus-tracker-wwa {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.focus-tracker-wwa .focus-chat-btn:not(.is-ghost) {
  background: var(--accent-muted);
  color: var(--accent);
}

.focus-chat-btn.hidden,
.focus-tracker-err.hidden {
  display: none;
}

.focus-tracker-err {
  color: var(--danger);
}

.focus-chat-task--tracker .focus-chat-fields > .focus-chat-field-label:nth-of-type(2) {
  align-self: start;
  padding-top: 8px;
}

/* Настройки: «Задачи из Орбиты» */
.tracker-pf-section {
  margin-top: 1.25rem;
}

.tracker-pf-lead {
  margin-top: 0;
}

.tracker-pf-field,
.tracker-pf-btn {
  margin-top: 0.6rem;
}

.tracker-pf-row {
  justify-content: space-between;
  gap: 0.75rem;
  padding-right: 1rem;
  cursor: default;
}

.tracker-pf-row + .tracker-pf-row {
  border-top: 1px solid var(--border);
}

.tracker-pf-row .pf-row-title {
  flex-shrink: 0;
}

.tracker-pf-row .tracker-select {
  max-width: 60%;
  font-size: 0.9375rem;
}

.pf-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

@media (max-width: 959px) {
  /* 16px — иначе iOS зумит страницу при касании поля. */
  .focus-tracker-desc textarea { font-size: 16px; }
  .focus-chat-task--tracker .focus-chat-fields > .focus-chat-field-label:nth-of-type(2) { padding-top: 0; }
  .tracker-pf-row .tracker-select { font-size: 16px; }
}

/* «Дайджест» на десктопе: шапка, переключатель и рамка списков стоят на месте —
   прокручиваются только список, переписка и выпуск «Рынка». */
@media (min-width: 960px) {
  .main-scroll.panels-stage:has(> #panel-digest:not(.hidden) > #digest-root:not(.hidden)) {
    overflow: hidden;
    padding-bottom: 24px;
  }

  #panel-digest:not(.hidden):has(> #digest-root:not(.hidden)) {
    height: 100%;
  }

  #panel-digest:has(> #digest-root:not(.hidden)) #digest-root {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }

  #panel-digest:has(> #digest-root:not(.hidden)) #digest-root > [id^="digest-pane-"]:not(.hidden),
  #panel-digest:has(> #digest-root:not(.hidden)) #digest-pane-chats > .dgx,
  #panel-digest:has(> #digest-root:not(.hidden)) #mail-inbox,
  #panel-digest:has(> #digest-root:not(.hidden)) #digest-market-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }

  #panel-digest:has(> #digest-root:not(.hidden)) .dgx.is-wide .dgx-split,
  #panel-digest:has(> #digest-root:not(.hidden)) .mail-split {
    flex: 1;
    height: auto;
    min-height: 0;
  }

  #panel-digest:has(> #digest-root:not(.hidden)) .mkt {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  #panel-digest:has(> #digest-root:not(.hidden)) .mkt > * {
    min-height: 0;
    max-height: none;
    overflow-y: auto;
  }
}

/* «Дайджест» на телефоне: заголовок и переключатель прилипают к верху при прокрутке. */
@media (max-width: 959px) {
  /* страница здесь прокручивается целиком; overflow-x у .main-scroll сделал бы его «прокручиваемым»
     и залипание не сработало бы — от сдвига вбок страницу и так защищает .app (overflow-x: clip) */
  .main-scroll.panels-stage:has(> #panel-digest:not(.hidden)) {
    overflow: visible;
  }

  .digest-top {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: calc(-1 * var(--safe-top, 0px)) calc(-1 * var(--page-x, 16px)) 0;
    padding: var(--safe-top, 0px) var(--page-x, 16px) 0.5rem;
    background: var(--bg);
  }
}

/* Исполнитель из трекера: список сотрудников под полем */
.tracker-user-list {
  display: grid;
  max-height: 18rem;
  overflow-y: auto;
  border-top: 0.5px solid var(--border);
}

.tracker-user-list.hidden {
  display: none;
}

.tracker-user-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0.45rem 0.9rem;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tracker-user-item:hover,
.tracker-user-item:focus-visible {
  background: var(--accent-muted);
  outline: none;
}

.tracker-user-avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-muted);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
}

.tracker-user-text {
  display: grid;
  min-width: 0;
}

.tracker-user-name,
.tracker-user-pos {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tracker-user-name {
  font-size: 0.9375rem;
}

.tracker-user-pos {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.tracker-user-empty {
  padding: 0.6rem 0.9rem;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.tracker-input.has-user {
  color: var(--accent);
}

/* Фокус: тот же список — рамкой под полем исполнителя */
.focus-tracker-resp {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.focus-tracker-resp .tracker-user-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-elevated);
  max-height: 14rem;
}

.focus-tracker-resp .tracker-user-item {
  padding: 0.4rem 0.6rem;
}

.focus-tracker-resp input.has-user {
  color: var(--accent);
}

/* Свой календарь у полей даты (мышь): см. openDatePop в app.js. */
@media (pointer: fine) {
  input[type="date"]:not([data-native-picker])::-webkit-calendar-picker-indicator { cursor: pointer; }
}
.date-pop {
  position: fixed;
  z-index: 130000;
  width: 252px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-raised);
  border: 1px solid var(--overlay-4);
  box-shadow: 0 12px 36px color-mix(in srgb, var(--shadow-color) 50%, transparent);
  color: var(--text);
  font-family: var(--font);
  user-select: none;
}
.date-pop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.date-pop-title { font-size: 0.9375rem; font-weight: 600; }
.date-pop-nav {
  width: 30px; height: 30px; border: none; border-radius: 8px; background: transparent;
  color: var(--text); font-size: 1.25rem; line-height: 1; cursor: pointer;
}
.date-pop-nav:hover, .date-pop-day:not(:disabled):hover, .date-pop-today:not(:disabled):hover { background: var(--overlay-3); }
.date-pop-wd, .date-pop-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.date-pop-wd span { text-align: center; font-size: 0.6875rem; color: var(--text-subtle); padding: 2px 0 4px; }
.date-pop-day {
  height: 32px; border: none; border-radius: 8px; background: transparent; color: var(--text);
  font: inherit; font-size: 0.8125rem; font-variant-numeric: tabular-nums; cursor: pointer;
}
.date-pop-day.is-other { color: var(--text-secondary); }
.date-pop-day.is-today { color: var(--accent); font-weight: 600; }
.date-pop-day.is-selected, .date-pop-day.is-selected:hover { background: var(--accent); color: var(--on-accent); }
.date-pop-day:disabled, .date-pop-today:disabled { opacity: 0.3; cursor: default; }
.date-pop-foot { display: flex; justify-content: flex-end; margin-top: 6px; }
.date-pop-today {
  height: 28px; padding: 0 10px; border: none; border-radius: 8px; background: transparent;
  color: var(--accent); font: inherit; font-size: 0.8125rem; cursor: pointer;
}

/* Выгрузка заметки: формат и куда (openNoteExportSheet). */
.note-export-sheet { padding: 6px 14px 14px; }
.note-export-label { margin: 10px 2px 6px; font-size: 0.8125rem; color: var(--text-secondary); }
.note-export-sheet .event-sheet-kind-switch { display: flex; }
.note-export-sheet .event-sheet-kind-btn { flex: 1; }
.note-export-go { width: 100%; margin-top: 16px; }

/* «Поставленные» в календаре: на десктопе — кнопка в шапке, на телефоне — выбор в меню ☰. */
#panel-actual .meetings-head .meetings-posted-toggle.is-active,
#panel-actual .meetings-head .meetings-posted-toggle.is-active:hover { color: var(--violet-text); background: var(--violet-muted); border-color: color-mix(in srgb, var(--violet-text) 45%, transparent); }
.meetings-week-chip--posted,
.meetings-month-chip--posted { background: var(--violet-muted); color: var(--violet-text); border-left-color: var(--violet-text); }
.day-timeline-band-item--posted { border-color: color-mix(in srgb, var(--violet-text) 45%, transparent); border-left-color: var(--violet-text); background: var(--violet-muted); }
/* Поставленные другим со временем (неделя/день): фиолетовая карточка вместо зелёной задачи */
.meeting-card--timeline.meeting-card--task.meeting-card--posted { border-left-color: var(--violet-text); background: var(--violet-muted); }
#panel-actual .meeting-card--timeline.meeting-card--task.meeting-card--posted { background: var(--violet-muted); box-shadow: none; }
#panel-actual .meeting-card--timeline.meeting-card--task.meeting-card--posted .day-timeline-event-meta { color: var(--violet-text); }
.meeting-card--posted .meeting-card-check { color: var(--violet-text); }

/* Редактор: меню «Шрифт и размер». */
.note-tg-font-item { padding-top: 10px; padding-bottom: 10px; }
.note-tg-size-row { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 4px 4px; }
.note-tg-menu-item.note-tg-size-item { width: auto; min-width: 40px; padding: 8px 10px; justify-content: center; font-variant-numeric: tabular-nums; }
.note-tg-size-item.note-tg-menu-item--active { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-soft); }
.note-tg-size-item.note-tg-menu-item--active::after { display: none; }

/* Дайджест → отчёт чата: поставленная из «Следующих шагов» задача — чип вместо «В задачу». */
.dgx-task-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  flex: 0 1 auto;
  max-width: 14rem;
  min-width: 0;
  padding: 0.3rem 0.7rem;
  border: none;
  border-radius: var(--radius-full);
  background: var(--success-muted);
  color: var(--success);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  white-space: nowrap;
}
.dgx-task-chip::before { content: "✓"; flex: none; }
.dgx-task-chip-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dgx-task-chip.is-done { opacity: 0.65; text-decoration: line-through; }

/* База знаний: в какую команду расшарен документ — на карточке и в строке под названием. */
.note-card-teams,
.note-editor-teams { display: flex; flex-wrap: wrap; gap: 4px; }
.note-card-teams { margin: 4px 0 2px; }
.note-editor-teams.hidden { display: none; }
.note-team-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 14rem;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--violet-muted);
  color: var(--violet-text);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
.note-team-chip svg { flex: none; }
.note-team-chip span { overflow: hidden; text-overflow: ellipsis; }
.note-tg-menu-hint { margin: 2px 8px 6px; font-size: 0.75rem; line-height: 1.3; color: var(--text-subtle); }

/* Поле в обсуждении поручения = поле ассистента (#note-paie-reply-form), копия правил для .pt-assist */
.pt-assist .note-paie-menu, .pt-assist .note-paie-plus-menu { background: var(--surface-raised);
  border: 0;
  border-radius: 14px;
  box-shadow: 0 14px 40px color-mix(in srgb, var(--shadow-color) 50%, transparent), 0 0 0 0.5px var(--overlay-3); }
.pt-assist { gap: 6px; padding: 8px 8px 8px 12px; border-radius: 22px; border: 1px solid var(--overlay-5); background: var(--overlay-2); box-shadow: none; }
.pt-assist .note-paie-composer-bar { display: none; }
.pt-assist .note-paie-attach { width: 30px; height: 30px; background: var(--overlay-4); color: var(--text); }
.pt-assist .note-paie-attach svg { width: 16px; height: 16px; }
.pt-assist .note-paie-composer-left { flex: 0 1 auto; gap: 0; position: static; }
.pt-assist .note-paie-mode-switch, .pt-assist .note-paie-model-btn { display: none !important; }
.pt-assist .note-paie-mode-compact { display: inline-flex !important; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 999px; font-size: 0.8125rem; line-height: 1; color: var(--violet-soft); background: color-mix(in srgb, var(--violet) 16%, transparent); border: 1px solid color-mix(in srgb, var(--violet) 45%, transparent); min-width: 0; }
.pt-assist .note-paie-mode-compact-label { max-width: none !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-assist .note-paie-mode-compact-ico, .pt-assist .note-paie-mode-compact-chev { display: inline-flex; flex: none; }
.pt-assist .note-paie-mode-compact.is-open .note-paie-mode-compact-chev { transform: rotate(180deg); }
.pt-assist .note-paie-kb-wrap { position: static; flex: none; }
.pt-assist .note-paie-kb-toggle { display: inline-flex; align-items: center; gap: 5px; width: auto; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--overlay-6); background: transparent; color: var(--text-secondary); font: inherit; font-size: 0.8125rem; white-space: nowrap; cursor: pointer; }
.pt-assist .note-paie-kb-toggle.is-on { color: var(--text); border-color: var(--overlay-7); }
.pt-assist .note-paie-kb-toggle svg { flex: none; width: 15px; height: 15px; }
.pt-assist .note-paie-composer-row { align-items: flex-end; gap: 6px; padding: 0 !important; }
.pt-assist .note-paie-composer-input { padding: 6px 2px !important; min-height: 32px; }
.pt-assist .note-paie-send { width: 34px; height: 34px; background: var(--overlay-5); color: var(--text-subtle); opacity: 1; }
.pt-assist .note-paie-send.is-ready:not(:disabled) { background: var(--violet); color: var(--on-accent); }
.pt-assist.is-comment-mode .note-paie-send.is-ready:not(:disabled) { background: var(--accent); }
.pt-assist .note-paie-send.is-stop { background: var(--text-strong); color: var(--bg); }
.pt-assist .note-paie-send-up, .pt-assist .note-paie-send-stop { display: inline-flex; }
.pt-assist .note-paie-send-stop, .pt-assist .note-paie-send.is-stop .note-paie-send-up { display: none; }
.pt-assist .note-paie-send.is-stop .note-paie-send-stop { display: inline-flex; }
.pt-assist.is-comments-chat .note-paie-composer-left, .pt-assist.is-comment-mode .note-paie-kb-wrap { display: none !important; }
.pt-assist.is-comments-chat { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
.pt-assist.is-comments-chat .note-paie-toprow { flex: none; padding-bottom: 2px; }
.pt-assist.is-comments-chat .note-paie-composer-row { flex: 1 1 0; min-width: 0; }
.pt-assist.is-comments-chat .note-paie-reply-target, .pt-assist.is-comments-chat .note-paie-attach-preview { flex-basis: 100%; }
.pt-assist .note-paie-menu, .pt-assist .note-paie-plus-menu { position: absolute; left: 0; right: auto; bottom: calc(100% + 8px); top: auto; z-index: 30; width: min(320px, calc(100vw - 32px)); max-width: none; max-height: min(60vh, 420px); overflow-y: auto; padding: 6px; }
.pt-assist .note-paie-plus-menu.hidden, .pt-assist .note-paie-menu.hidden { display: none; }
.pt-assist .note-paie-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font: inherit; font-size: 0.875rem; text-align: left; cursor: pointer; }
.pt-assist .note-paie-menu-item:hover { background: var(--overlay-3); }
.pt-assist .note-ask-item.is-active { background: var(--overlay-2); }
.pt-assist:not(.is-gpt-mode):not(.is-paie-mode):not(.is-research-mode) .note-ask-model, .pt-assist:not(.is-gpt-mode):not(.is-paie-mode):not(.is-research-mode) .note-ask-model-hr { display: none; }
.pt-assist .note-paie-plus-back { margin: 2px 2px 4px; padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text-soft); font: inherit; font-size: 0.8125rem; cursor: pointer; }
.pt-assist .note-paie-plus-back:hover { background: var(--overlay-3); }
.pt-assist .note-paie-model-search, .pt-assist .note-paie-plus-search { margin: 2px 4px 6px; padding: 8px 10px; border-radius: 9px; border: 0; background: rgba(0, 0, 0, 0.25); color: var(--text); font: inherit; font-size: 0.875rem; }
.pt-assist .note-paie-menu-section { margin: 8px 10px 4px; font-size: 0.6875rem; letter-spacing: 0.06em; color: var(--text-subtle); }
.pt-assist .note-paie-kb-check { border-radius: 5px; border-color: rgba(255, 255, 255, 0.35); }
.pt-assist .note-paie-kb-check.is-on, .pt-assist .note-paie-kb-check.is-mixed { border-color: var(--accent); background: var(--accent); }
.pt-assist.is-dictating .note-paie-toprow, .pt-assist.is-dictating .note-paie-composer-row { display: none !important; }
.pt-assist.is-dictating .note-dictation-bar { display: flex; flex-basis: 100%; }
.pt-assist .note-dictation-bar .note-dict-btn { width: 38px; height: 38px; }
.pt-assist .note-dictation-bar .note-dict-mid { height: 38px; }
.pt-assist .note-gpt-quote-chip { display: inline; white-space: normal; overflow-wrap: anywhere; max-width: none; border-radius: 8px; padding: 1px 6px; line-height: 22px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.pt-assist .note-paie-reply-target-quote { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.pt-assist .note-paie-composer-editor.is-empty::before, .pt-assist .note-paie-composer-editor.is-empty.is-multiline::before { top: 6px; left: 2px; right: 2px; }
.pt-assist .note-paie-reply-target { margin: 4px 4px 10px; padding: 0; gap: 10px; }
.pt-assist.is-comments-chat .note-paie-reply-target { margin: 4px 4px 8px; }
.pt-assist { position: relative; bottom: auto; margin: 0; z-index: 5; }
.pt-assist .pt-assist-input { display: block; width: 100%; resize: none; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 0.95rem; line-height: 1.4; max-height: 160px; }
/* Меньше 16px — iOS при фокусе зумит страницу, и после отправки всё остаётся увеличенным. */
@media (max-width: 959px) { .pt-assist .pt-assist-input { font-size: 16px; } }
.pt-assist .note-paie-send.pt-send-text { width: auto; padding: 0 14px; border-radius: 17px; font: inherit; font-size: 0.84rem; font-weight: 600; }
.pt-assist .note-paie-send.is-ready:not(:disabled) { background: var(--accent); }
.pt-assist .pt-chip-ico { display: inline-flex; color: var(--accent); }
.pt-assist .note-paie-attach-chip.is-loading { opacity: 0.6; }

/* Профиль: у встроенных вложенных экранов («Подсказки», «Уведомления»…) свой боковой отступ добавлялся к отступу
   панели — блоки стояли правее кнопки «Назад» и были уже, чем на остальных экранах профиля. Полноэкранные
   (position: fixed, inset 0) отступ дают сами — их не трогаем. */
#panel-profile .profile-subscreen:not(#profile-payment):not(#profile-expenses):not(#profile-booking):not(#profile-contacts):not(#profile-calendars):not(#profile-zoom):not(#profile-telemost):not(#profile-yandex-disk):not(#profile-bitrix):not(#profile-knowledge-base):not(#profile-agents):not(#profile-chats):not(#profile-voice) .subscreen-body {
  padding-left: 0;
  padding-right: 0;
}

/* «База знаний» на телефоне открывается из Профиля (в нижнем меню её нет) — нужна «Назад». На десктопе есть боковое меню. */
.knowledge-back-bar { display: none; }
@media (max-width: 959px) {
  .knowledge-back-bar { display: flex; }
  .knowledge-list-head .screen-title { display: none; }
  html.knowledge-native-back .knowledge-back-bar { display: none; }
  html.knowledge-native-back .knowledge-list-head .screen-title { display: block; }
}

/* Карточка задачи: действия — как внизу окна задачи (плашки с иконкой), главная — зелёная; «Источник» — ссылками. */
.pt-c-foot .pt-card-actions { margin-top: 10px; flex-wrap: wrap; }
.pt-card-actions .pt-act { flex: 1 1 0; gap: 6px; white-space: nowrap; min-width: max-content; }
.pt-card-actions .pt-act svg { flex: none; }
.pt-card-actions .pt-act.is-primary { background: var(--success); color: var(--on-accent); }
.pt-card-actions .pt-act:disabled { opacity: 0.55; }
.pt-c-sources { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pt-c-sources.hidden { display: none; }
.pt-c-sources .event-sheet-row-label { font-size: 0.82rem; color: var(--text-secondary); }

/* ---- Редактор заметок как в Telegram: меню-стекло с крупными строками, галочка у текущего пункта ---- */
.note-tg-capsule { box-shadow: inset 0 0 0 1px var(--overlay-3); }
.note-tg-capsule .note-tg-btn { flex: 0 0 auto; }
/* Телефон: кнопки не сжимаются — «Повторить» видна, только когда есть что повторить. */
@media (max-width: 420px) {
  #note-editor-toolbar-wrap .note-editor-toolbar-row,
  #note-editor-toolbar-wrap .note-tg-toolbar { gap: 5px; }
  #note-editor-toolbar-wrap .note-tg-btn { width: 34px; height: 34px; }
  #note-editor-toolbar-wrap .note-tg-capsule { gap: 0; padding: 3px; }
  #note-editor-toolbar-wrap .note-tg-btn--redo.note-tg-btn--disabled { display: none; }
}
.note-tg-menu,
.note-table-menu {
  min-width: 232px;
  padding: 8px 0;
  border: 1px solid var(--overlay-5);
  border-radius: 26px;
  background: var(--surface-elevated);
  box-shadow: 0 18px 50px color-mix(in srgb, var(--shadow-color) 50%, transparent);
}
.note-tg-menu-item,
.note-table-menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 22px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-strong);
  font: inherit;
  font-size: 1.0625rem;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.note-tg-menu { max-width: calc(100vw - 24px); }
.note-tg-menu-item svg,
.note-table-menu-item svg { flex: none; width: 22px; height: 22px; opacity: 0.95; }
.note-tg-menu-item:hover,
.note-tg-menu-item:active,
.note-table-menu-item:hover:not(:disabled),
.note-table-menu-item:active:not(:disabled) { background: var(--overlay-3); }
.note-tg-menu-item--active { background: transparent; }
.note-tg-menu-item--active::after {
  content: "";
  flex: none;
  margin-left: auto;
  width: 18px;
  height: 18px;
  border-radius: 0;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 12.5l5 5L19.5 7'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 12.5l5 5L19.5 7'/%3E%3C/svg%3E") center / contain no-repeat;
}
.note-tg-menu-sep,
.note-table-menu-sep { height: 1px; margin: 6px 20px; background: var(--overlay-5); }
.note-tg-menu-label,
.note-table-menu-label { margin: 4px 16px 6px; font-size: 0.8125rem; font-weight: 500; letter-spacing: 0; text-transform: none; text-align: center; color: var(--text-subtle); }
.note-tg-menu-hint { margin: 2px 20px 6px; text-align: center; }
.note-tg-page--font { min-width: 264px; }
.note-tg-size-row { padding: 2px 14px 6px; }
.note-tg-menu-item.note-tg-size-item { min-height: 36px; border-radius: 10px; font-size: 0.9375rem; }
/* Уровни заголовка — образцом: крупнее и жирнее. */
.note-tg-menu-item.note-tg-h { font-weight: 700; }
.note-tg-menu-item.note-tg-h1 { font-size: 1.5625rem; }
.note-tg-menu-item.note-tg-h2 { font-size: 1.375rem; }
.note-tg-menu-item.note-tg-h3 { font-size: 1.1875rem; }
.note-tg-menu-item.note-tg-h4 { font-size: 1.0625rem; font-weight: 600; }

/* Заголовок таблицы — по левому краю, как ячейки (выравнивание меняется в меню таблицы). */
.note-editor-table th { text-align: left; }

/* ---- Таблица как в Telegram: рамка с точками, «⋮» у строки, «•••» под выделением, меню ---- */
.note-table-manage-wrap { margin: 0.75rem 0; }
.note-table-manage-wrap.is-active { z-index: 20; padding-bottom: 16px; }
.note-table-frame {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid var(--accent);
  border-radius: 8px;
  pointer-events: none;
}
.note-table-frame--cells,
.note-table-frame--col,
.note-table-frame--row,
.note-table-frame--table { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.note-table-frame--col { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.note-table-frame--row,
.note-table-frame--table { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.note-table-frame.is-cut-left { border-left-width: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.note-table-frame.is-cut-right { border-right-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.note-table-dot {
  position: absolute;
  z-index: 2;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: crosshair;
  touch-action: none;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.note-table-dot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--accent);
}
@media (pointer: coarse) {
  .note-table-dot { width: 34px; height: 34px; margin: -17px 0 0 -17px; }
}
.note-table-manage-overlay .note-table-handle {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
  color: var(--text-soft);
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}
.note-table-manage-overlay .note-table-handle--row { width: 16px; height: 34px; margin-left: -2px; transform: translate(-100%, -50%); }
.note-table-manage-overlay .note-table-handle--col { width: 34px; height: 16px; margin-top: 3px; transform: translateX(-50%); background: color-mix(in srgb, var(--surface-raised) 92%, transparent); }
.note-table-manage-overlay .note-table-handle.is-selected,
.note-table-manage-overlay .note-table-handle.is-dragging { color: var(--on-accent); background: var(--accent); }
.note-table-manage-overlay .note-table-handle--row.is-selected { width: 18px; margin-left: 0; transform: translateX(-100%); border-radius: 8px 0 0 8px; }
.note-table-manage-overlay .note-table-handle--col.is-selected { height: 20px; margin-top: 0; transform: none; border-radius: 0 0 8px 8px; }
@media (pointer: coarse) {
  .note-table-manage-overlay .note-table-handle--row:not(.is-selected) { width: 22px; height: 40px; }
  .note-table-manage-overlay .note-table-handle--col:not(.is-selected) { width: 40px; height: 20px; }
}
.note-table-menu {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  min-width: 264px;
  max-width: calc(100vw - 16px);
  max-height: min(70vh, 520px);
  overflow-y: auto;
  pointer-events: auto;
}
.note-table-menu[hidden] { display: none; }
.note-table-menu .note-table-menu-item { min-height: 40px; padding: 8px 20px; }
.note-table-menu-item:disabled { opacity: 0.4; cursor: default; }
.note-table-menu-item.is-danger { color: var(--danger); }
.note-table-align-row { display: flex; align-items: center; justify-content: center; gap: 2px; padding: 0 12px 6px; }
.note-table-align-gap { flex: none; width: 10px; }
.note-table-align-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-strong);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.note-table-align-btn svg { width: 22px; height: 22px; }
.note-table-align-btn:hover { background: var(--overlay-3); }
.note-table-align-btn.is-on { background: var(--overlay-6); }
/* Выделенные ячейки — общей рамкой, без рамки у каждой. */
.note-rich-editor-body .note-editor-table .selectedCell { background: transparent; }
.note-rich-editor-body .note-editor-table .selectedCell::selection,
.note-rich-editor-body .note-editor-table .selectedCell *::selection { background: transparent; }
/* Заливка ячейки — в редакторе и в просмотре заметки. */
td[data-highlight],
th[data-highlight] { background: var(--overlay-4); }

/* Кнопка «Скрыть клавиатуру» — только пока открыта клавиатура; обсуждение на это время прячется (иначе ряд не влезает). */
.note-tg-btn--kb { display: none; flex-shrink: 0; background: var(--overlay-3); }
html.note-editor-kb-open #note-editor-toolbar-wrap .note-tg-btn--kb { display: inline-flex; }
html.note-editor-kb-open #note-editor-toolbar-wrap .note-tg-btn--discuss { display: none; }

/* Выделение на телефоне: ИИ / Обсудить / Задача — в нижней панели (плашка над текстом спорила с системным меню),
   зачёркнутый / подчёркнутый / маркер — в «H → Ещё». Десктоп — как раньше. */
.note-tg-mob-only { display: none !important; }
@media (max-width: 959px) and (pointer: coarse) {
  .note-tg-capsule .note-tg-mob-only { display: inline-flex !important; }
  .note-tg-menu .note-tg-mob-only { display: flex !important; }
  .note-tg-capsule .note-tg-mob-only.hidden,
  .note-tg-desk-only { display: none !important; }
  .note-tg-btn--sel-ai { color: var(--violet-soft); }
  #note-editor-toolbar-wrap .note-editor-toolbar-row.is-selection .note-tg-btn--mic { display: none; }
}

/* Меню панели: не выше места над панелью (max-height ставит JS) — остальное листается внутри. */
.note-tg-menu { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.note-tg-menu::-webkit-scrollbar { display: none; }
/* «Шрифт и размер»: шрифты и кегли — по одному ряду, листаются вбок. */
.note-tg-chip-row { display: flex; flex-wrap: nowrap; gap: 6px; padding: 2px 14px 8px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.note-tg-chip-row::-webkit-scrollbar { display: none; }
.note-tg-menu-item.note-tg-font-item,
.note-tg-menu-item.note-tg-size-item { flex: none; width: auto; min-height: 38px; padding: 8px 14px; border-radius: 12px; background: var(--overlay-2); font-size: 1rem; }
.note-tg-font-item.note-tg-menu-item--active,
.note-tg-size-item.note-tg-menu-item--active { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-soft); }
.note-tg-font-item.note-tg-menu-item--active::after,
.note-tg-size-item.note-tg-menu-item--active::after { display: none; }
/* Выделение, пока открыто меню панели (родное на это время свёрнуто — иначе поверх меню системное «Скопировать»). */
.note-rich-editor-body .note-menu-range { background: color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 2px; }

/* «N изменений ждут сеть» — нажимается (отправить снова / очистить); в открытой заметке — сверху, не на панели редактора. */
.offline-sync-banner { pointer-events: auto; cursor: pointer; }
html.note-editor-open .offline-sync-banner { top: calc(8px + env(safe-area-inset-top, 0px)); bottom: auto; }

/* Таблица: ширина / высота. Десктоп — граница под мышью тянется (курсор ↔ / ↕); телефон — «Ширина столбца» /
   «Высота строки» в меню: ручки на границах и «Готово». */
.note-table-manage-wrap[data-resize="col"] .note-table-manage-scroll,
.note-table-manage-wrap[data-resize="col"] .note-table-manage-scroll * { cursor: col-resize !important; }
.note-table-manage-wrap[data-resize="row"] .note-table-manage-scroll,
.note-table-manage-wrap[data-resize="row"] .note-table-manage-scroll * { cursor: row-resize !important; }
.note-table-grip { position: absolute; z-index: 3; pointer-events: auto; touch-action: none; -webkit-tap-highlight-color: transparent; }
.note-table-grip--col { width: 28px; margin-left: -14px; }
.note-table-grip--row { height: 28px; margin-top: -14px; }
.note-table-grip::before { content: ""; position: absolute; background: var(--accent); border-radius: 1px; }
.note-table-grip--col::before { top: 0; bottom: 0; left: 13px; width: 2px; }
.note-table-grip--row::before { left: 0; right: 0; top: 13px; height: 2px; }
.note-table-grip-knob { position: absolute; left: 50%; top: 50%; border-radius: 999px; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--shadow-color) 35%, transparent); }
.note-table-grip--col .note-table-grip-knob { width: 10px; height: 30px; margin: -15px 0 0 -5px; }
.note-table-grip--row .note-table-grip-knob { width: 30px; height: 10px; margin: -5px 0 0 -15px; }
.note-table-grip.is-dragging .note-table-grip-knob { transform: scale(1.15); }
.note-table-manage-overlay .note-table-resize-done { position: absolute; z-index: 4; pointer-events: auto; height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--accent); color: var(--on-accent); font: inherit; font-size: 0.9375rem; font-weight: 600; cursor: pointer; }

/* Обсуждение на телефоне: клавиатура открыта — без нижнего отступа под home indicator (пустая полоса над клавиатурой). */
html.note-discussion-kb-open #note-discussion-overlay #note-paie-thread.note-discussion-compose { padding-bottom: 8px !important; }

/* Ответ ассистента на телефоне: аватар и «Ассистент · модель» — шапкой внутри бабла, бабл на всю ширину. */
.note-discuss-bubble-head { display: none; }
@media (max-width: 959px) {
  .note-discuss-msg.is-assistant { padding-left: 0; max-width: 100%; }
  .note-discuss-msg.is-assistant:not(.is-pending) > .note-discuss-role,
  .note-discuss-msg.is-assistant > .note-discuss-av { display: none; }
  .note-discuss-msg.is-assistant:not(.is-cont) .note-discuss-bubble-head { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; }
  .note-discuss-bubble-head .note-discuss-av { position: static; flex: none; width: 30px; height: 30px; }
  .note-discuss-bubble-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
  .note-discuss-bubble-who b { color: var(--violet-soft); font-weight: 600; font-size: 0.875rem; }
  .note-discuss-bubble-who small { color: var(--text-secondary); font-size: 0.75rem; }
}

/* Несколько реплаев в одном сообщении: цитата → комментарий → цитата → комментарий. */
.note-discuss-thread-text + .note-discuss-reply { margin-top: 10px; }
.note-discuss-reply + .note-discuss-thread-text { margin-top: 2px; }

/* Два столбца в заметке («[[» в конце абзаца или «+» → «Два столбца»): линия между столбцами;
   на узком экране — друг под другом. И в редакторе, и в просмотре заметки. */
.note-columns { display: grid; grid-template-columns: minmax(0, var(--note-col-l, 1fr)) minmax(0, var(--note-col-r, 1fr)); gap: 0; margin: 0.5rem 0; }
.note-column { min-width: 0; padding-right: 20px; }
.note-column + .note-column { padding-right: 0; padding-left: 20px; border-left: 1px solid var(--overlay-7); }
.note-column > :first-child { margin-top: 0; }
.note-column > :last-child { margin-bottom: 0; }
@media (max-width: 599px) {
  .note-columns { grid-template-columns: minmax(0, 1fr); }
  .note-column { padding-right: 0; }
  .note-column + .note-column { padding-left: 0; padding-top: 10px; margin-top: 10px; border-left: 0; border-top: 1px solid var(--overlay-7); }
}
/* Линия между столбцами под мышью — ↔, тянется (ширина левого столбца 20–80 %). */
.note-columns.is-col-resize,
.note-columns.is-col-resize *,
.note-columns.is-col-resizing,
.note-columns.is-col-resizing * { cursor: col-resize !important; }
.note-columns.is-col-resize > .note-column + .note-column,
.note-columns.is-col-resizing > .note-column + .note-column { border-left-color: var(--accent); }
.note-columns.is-col-resizing { user-select: none; }

/* Сворачиваемый блок: шеврон сразу после текста заголовка (∨ свёрнуто, ⌃ развёрнуто), у развёрнутого — линия
   под заголовком. Редактор — div.note-toggle(.is-open); просмотр и ссылка — <details class="note-toggle">. */
.note-toggle { margin: 6px 0; }
.note-toggle-summary { font-weight: 600; }
.note-toggle > .note-toggle-summary { padding-bottom: 6px; }
.note-toggle.is-open > .note-toggle-summary,
details.note-toggle[open] > summary { border-bottom: 1px solid var(--overlay-7); margin-bottom: 8px; }
.note-toggle:not(.is-open) > .note-toggle-body { display: none; }
.note-toggle-summary-text { display: inline; }
.note-toggle-summary.is-empty .note-toggle-summary-text::before { content: "Заголовок блока"; color: var(--text-secondary); font-weight: 500; pointer-events: none; }
.note-toggle-chevron { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-left: 6px; padding: 0; vertical-align: -5px; border: 0; border-radius: 6px; background: transparent; color: var(--text-secondary); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.note-toggle-chevron:hover { background: var(--overlay-3); color: var(--text); }
.note-toggle-chevron svg { transition: transform 0.15s ease; }
.note-toggle.is-open > .note-toggle-summary .note-toggle-chevron svg { transform: rotate(180deg); }
details.note-toggle > summary { list-style: none; cursor: pointer; font-weight: 600; padding-bottom: 6px; }
details.note-toggle > summary::-webkit-details-marker { display: none; }
details.note-toggle > summary::after { content: ""; display: inline-block; width: 16px; height: 16px; margin-left: 6px; vertical-align: -2px; background: currentColor; opacity: 0.6; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; }
details.note-toggle[open] > summary::after { transform: rotate(180deg); }

/* ——— Входящие поручения: карточка в Фокусе и разбор стопкой ——— */
body.tinbox-open { overflow: hidden; }
.tinbox { position: fixed; inset: 0; z-index: 300; background: var(--bg); color: var(--text); display: flex; flex-direction: column; align-items: center; padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); box-sizing: border-box; overflow-y: auto; }
.tinbox-panel { width: 100%; max-width: 560px; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.tinbox-loading { margin: auto; text-align: center; color: var(--text-secondary); }
.tinbox-top { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.tinbox-count { font-size: 0.85rem; color: var(--text-secondary); white-space: nowrap; }
.tinbox-sp { flex: 1; }
.tinbox-bar { flex: 1; height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.tinbox-bar span { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.25s ease; }
.tinbox-x { flex: none; width: 36px; height: 36px; border: none; border-radius: 10px; background: transparent; color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.tinbox-x svg { width: 16px; height: 16px; }
.tinbox-x:hover { background: var(--surface-elevated); color: var(--text); }
.tinbox-stage { position: relative; margin: 14px 0 0; padding-top: 10px; }
.tinbox-peek { position: absolute; left: 16px; right: 16px; top: 0; height: 40px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); opacity: 0.7; }
.tinbox-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 18px 16px; box-sizing: border-box; touch-action: pan-y; user-select: none; -webkit-user-select: none; transition: transform 0.28s ease, opacity 0.28s ease; overflow: hidden; }
.tinbox-card.is-drag { transition: none; cursor: grabbing; }
.tinbox-card.is-fly-left { transform: translateX(-120%) rotate(-8deg); opacity: 0; }
.tinbox-card.is-fly-right { transform: translateX(120%) rotate(8deg); opacity: 0; }
.tinbox-who { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; min-width: 0; margin-bottom: 12px; }
.tinbox-who-name { font-weight: 600; white-space: nowrap; }
.tinbox-who-src { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tinbox-title { margin: 0 0 8px; font-size: 1.2rem; font-weight: 600; line-height: 1.3; }
.tinbox-desc { margin: 0 0 12px; color: var(--text-secondary); font-size: 0.92rem; line-height: 1.5; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.tinbox-check { margin: 0 0 12px; padding: 0; list-style: none; font-size: 0.9rem; line-height: 1.7; }
.tinbox-check li::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 8px; border: 1.5px solid var(--text-tertiary); border-radius: 3px; vertical-align: -1px; }
.tinbox-check li.is-done { color: var(--text-tertiary); text-decoration: line-through; }
.tinbox-src { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 12px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-muted); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.tinbox-src:hover { background: var(--surface-elevated); }
.tinbox-src-ico { flex: none; width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--violet-muted); color: var(--violet-text); }
.tinbox-src-ico svg { width: 16px; height: 16px; }
.tinbox-src-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.tinbox-src-kind { font-size: 0.72rem; color: var(--text-secondary); }
.tinbox-src-title { font-size: 0.88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tinbox-src-chev { flex: none; color: var(--text-tertiary); display: inline-flex; }
.tinbox-src-chev svg { width: 14px; height: 14px; }
.tinbox.is-away { display: none; }
.tinbox-back { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 310; display: inline-flex; align-items: center; gap: 8px; padding: 11px 16px; border: none; border-radius: 22px; background: var(--accent); color: var(--on-accent); font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer; box-shadow: 0 8px 24px color-mix(in srgb, var(--shadow-color) 30%, transparent); white-space: nowrap; }
.tinbox-back svg { width: 16px; height: 16px; }
.tinbox-due { display: inline-block; font-size: 0.82rem; padding: 4px 10px; border-radius: 8px; background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--warning); }
.tinbox-badge { position: absolute; top: 14px; padding: 3px 10px; border-radius: 8px; border: 2px solid; font-weight: 700; font-size: 0.85rem; opacity: 0; pointer-events: none; }
.tinbox-badge.is-left { right: 14px; color: var(--warning); border-color: var(--warning); transform: rotate(8deg); }
.tinbox-badge.is-right { left: 14px; color: var(--accent); border-color: var(--accent); transform: rotate(-8deg); }
/* Кнопки стопки — всегда на экране, как таббар: карточка с формой прокручивается под ними. */
.tinbox-acts { position: sticky; bottom: calc(-1 * max(16px, env(safe-area-inset-bottom))); z-index: 3; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: auto; margin-bottom: calc(-1 * max(16px, env(safe-area-inset-bottom))); padding: 12px 0 max(16px, env(safe-area-inset-bottom)); background: var(--bg); }
.tinbox-act { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; border: none; background: transparent; color: var(--text-secondary); font: inherit; font-size: 0.78rem; font-weight: 500; cursor: pointer; }
.tinbox-act-ico { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--border-strong, var(--border)); display: inline-flex; align-items: center; justify-content: center; color: var(--text); transition: background 0.15s ease, border-color 0.15s ease; }
.tinbox-act-ico svg { width: 20px; height: 20px; }
.tinbox-act:hover .tinbox-act-ico { background: var(--surface-elevated); }
.tinbox-act.is-primary { color: var(--accent); }
.tinbox-act.is-primary .tinbox-act-ico { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tinbox-act.is-primary:hover .tinbox-act-ico { background: var(--accent-pressed, var(--accent)); }
.tinbox-act.is-on .tinbox-act-ico { background: var(--accent-subtle); border-color: var(--accent-border); color: var(--accent); }
.tinbox-act-label { text-align: center; line-height: 1.2; }
/* Стопка «Разобрать»: отказ — красный контур слева, «В задачу» — синий контур справа, без заливки. */
.tinbox-act.is-danger { color: var(--danger); }
.tinbox-act.is-danger .tinbox-act-ico { border-color: var(--danger); color: var(--danger); }
.tinbox-act.is-danger:hover .tinbox-act-ico, .tinbox-act.is-danger.is-on .tinbox-act-ico { background: var(--danger-muted); border-color: var(--danger); color: var(--danger); }
.tinbox-act.is-accent { color: var(--accent); }
.tinbox-act.is-accent .tinbox-act-ico { border-color: var(--accent); color: var(--accent); }
.tinbox-act.is-accent:hover .tinbox-act-ico, .tinbox-act.is-accent.is-on .tinbox-act-ico { background: var(--accent-subtle); border-color: var(--accent); color: var(--accent); }
.fstack .tinbox-badge.is-left { color: var(--danger); border-color: var(--danger); }
.fstack-pop.is-decline { width: min(240px, 100%); }
.fstack-pop.is-decline .focus-chat-menu-item { justify-content: flex-start; text-align: left; font-weight: 600; }
/* Подсказка с клавишей — при наведении (только где есть мышь). */
@media (hover: hover) {
  .tinbox-act[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); padding: 5px 9px; border-radius: 8px; background: var(--surface-elevated); border: 1px solid var(--border); color: var(--text); font-size: 0.75rem; font-weight: 500; white-space: nowrap; pointer-events: none; z-index: 2; }
}
.tinbox-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; user-select: text; -webkit-user-select: text; }
.tinbox-label { font-size: 0.78rem; color: var(--text-secondary); margin-top: 4px; }
.tinbox-form input, .tinbox-form textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 0.92rem; color: var(--text); background: var(--surface-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; resize: vertical; }
.tinbox-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tinbox-chip { padding: 6px 10px; border-radius: 9px; border: 1px solid var(--border-strong, var(--border)); background: transparent; color: var(--text); font: inherit; font-size: 0.82rem; cursor: pointer; }
.tinbox-chip.is-on { background: var(--accent-subtle); border-color: var(--accent-border); color: var(--accent); }
.tinbox-when { display: flex; gap: 6px; flex: 1 1 220px; }
.tinbox-when input[type="date"] { flex: 1.4; }
.tinbox-when input[type="time"] { flex: 1; }
.tinbox-form-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.tinbox-btn { padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border-strong, var(--border)); background: transparent; color: var(--text); font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.tinbox-btn.is-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
/* «Разобрать» в Фокусе: стопка пунктов, формы чата внутри карточки — крупно, в стиле разбора входящих */
.fstack-view { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border: 1px solid var(--border-strong, var(--border)); border-radius: 10px; background: transparent; color: var(--text-secondary); font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.fstack-view:hover { color: var(--text); background: var(--surface-elevated); }
.fstack-view svg { width: 15px; height: 15px; }
.fstack-card .tinbox-who .focus-card-ico { width: 28px; height: 28px; border-radius: 8px; }
.fstack-card.is-open { overflow: visible; }
.tinbox-src.is-static { cursor: default; }
.tinbox-src.is-static:hover { background: var(--surface-muted); }
.fstack-form > * { margin: 0; }
.fstack-form .focus-chat-edit, .fstack-form .focus-chat-link { display: flex; flex-direction: column; gap: 8px; }
.fstack-form .focus-chat-fields { grid-template-columns: minmax(0, 1fr); gap: 4px; }
.fstack-form .focus-chat-field-label { font-size: 0.78rem; color: var(--text-secondary); margin-top: 6px; }
.fstack-form .focus-chat-fields input, .fstack-form .focus-chat-fields select, .fstack-form .focus-chat-search, .fstack-form .focus-chat-date input,
.fstack-form .focus-chat-fields textarea { height: 44px; padding: 0 12px; border-radius: 10px; font-size: 0.95rem; background: var(--surface-elevated); }
.fstack-form .focus-chat-fields textarea { height: auto; min-height: 88px; padding: 10px 12px; }
.fstack-form .focus-chat-acts { flex-direction: row-reverse; justify-content: space-between; gap: 8px; margin-top: 10px; }
.fstack-form .fstack-task-acts { flex-direction: row; }
.fstack-form input[type="date"], .fstack-form input[type="time"], .fstack-when input { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; box-sizing: border-box; }
.fstack-form input::-webkit-date-and-time-value, .fstack-when input::-webkit-date-and-time-value { text-align: left; }
.fstack-title-edit { display: block; width: calc(100% + 16px); box-sizing: border-box; margin: 0 -8px 8px; padding: 6px 8px; border: none; border-radius: 10px; background: transparent; box-shadow: inset 0 0 0 1px var(--border); color: var(--text); font: inherit; font-size: 1.2rem; font-weight: 600; line-height: 1.3; resize: none; overflow: hidden; user-select: text; -webkit-user-select: text; }
.fstack-title-edit:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--accent); }
.fstack-when { display: flex; gap: 8px; margin: 0 0 4px; }
.fstack-when input { flex: 1.4; height: 40px; padding: 0 10px; border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--warning); font: inherit; font-size: 0.92rem; color-scheme: dark; }
.fstack-when input[type="time"] { flex: 1; }
.fstack-when input:focus { outline: none; border-color: var(--warning); }
.fstack-assignee { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 44px; padding: 4px 6px; box-sizing: border-box; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-elevated); cursor: text; }
.fstack-assignee:focus-within { border-color: var(--accent); }
.fstack-assignee .meeting-attendee-chips { display: flex; flex: none; margin: 0; }
.fstack-assignee .meeting-attendee-add { position: relative; flex: 1; min-width: 90px; margin: 0; }
.fstack-form .fstack-assignee input.field-input { width: 100%; height: 34px; padding: 0 6px; border: none; border-radius: 0; background: transparent; box-shadow: none; font-size: 0.95rem; }
.fstack-form .focus-chat-btn { padding: 10px 16px; border-radius: 10px; font-size: 0.9rem; border: 1px solid var(--border-strong, var(--border)); background: transparent; }
.fstack-form .focus-chat-btn.is-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.fstack-form .focus-chat-btn.is-ghost { color: var(--text); }
.fstack-form .focus-chat-menu { padding: 0; border: none; background: transparent; gap: 2px; }
.fstack-form .focus-chat-menu-head { padding: 10px 4px 4px; font-size: 0.78rem; }
.fstack-form .focus-chat-menu-item, .fstack-form .focus-chat-result { padding: 12px; border: none; border-radius: 10px; font-size: 0.95rem; background: var(--surface-muted); }
.fstack-form .focus-chat-menu-item:hover, .fstack-form .focus-chat-result:hover { background: var(--surface-elevated); }
.fstack-form .focus-chat-results { display: flex; flex-direction: column; gap: 4px; }
.fstack-form .focus-chat-hint { font-size: 0.85rem; }
.fstack-form .focus-chat-date { display: flex; flex-wrap: wrap; gap: 8px; }
.fstack-form .focus-chat-date input { flex: 1 1 100%; }
.fstack-pop { position: absolute; bottom: calc(100% + 6px); z-index: 4; width: min(300px, 100%); max-height: min(60vh, 440px); overflow-y: auto; padding: 6px; box-sizing: border-box; border: 1px solid var(--border-strong, var(--border)); border-radius: 14px; background: var(--surface-elevated); box-shadow: 0 12px 32px color-mix(in srgb, var(--shadow-color) 45%, transparent); }
.fstack-pop.is-left { left: 0; }
.fstack-pop.is-right { right: 0; }
.fstack-pop .focus-chat-menu { padding: 0; border: none; background: transparent; gap: 2px; }
.fstack-pop .focus-chat-menu-head { padding: 8px 10px 4px; font-size: 0.75rem; color: var(--text-tertiary); }
.fstack-pop .focus-chat-menu-item { padding: 11px 10px; border-radius: 9px; font-size: 0.95rem; }
.fstack-pop .focus-chat-menu-item:hover { background: var(--surface); }
.fstack-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.fstack-list-sub { margin: 0; font-size: 0.88rem; color: var(--text-secondary); }
.fstack-rows { display: flex; flex-direction: column; gap: 8px; }
.fstack-row { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.fstack-row-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.fstack-row-title { font-size: 1rem; font-weight: 600; line-height: 1.35; }
.fstack-row-meta { font-size: 0.8rem; color: var(--text-secondary); }
.fstack-row.is-closed .fstack-row-title { color: var(--text-tertiary); font-weight: 500; text-decoration: line-through; }
.fstack-row-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fstack-pill { padding: 8px 12px; border: 1px solid var(--border-strong, var(--border)); border-radius: 10px; background: transparent; color: var(--text); font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.fstack-pill:hover { background: var(--surface-elevated); }
.fstack-pill.is-done { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.fstack-pill.is-ghost { color: var(--text-secondary); }
.fstack-pill:disabled { opacity: 0.5; cursor: default; }
.fstack-row-status { margin-right: auto; font-size: 0.85rem; font-weight: 600; color: var(--emerald-text); }
.fstack-row-status.is-dismissed, .fstack-row-status.is-retyped { color: var(--text-tertiary); }
.fstack-row-status.is-snoozed { color: var(--warning); }
.fstack-list-foot { position: sticky; bottom: calc(-1 * max(16px, env(safe-area-inset-bottom))); display: flex; justify-content: flex-end; gap: 8px; margin-bottom: calc(-1 * max(16px, env(safe-area-inset-bottom))); padding: 10px 0 max(16px, env(safe-area-inset-bottom)); background: var(--bg); }
@media (min-width: 960px) {
  .fstack-row { flex-direction: row; align-items: center; }
  .fstack-row-text { flex: 1; }
  .fstack-row-acts { flex: none; justify-content: flex-end; }
  .fstack-list-foot { bottom: -20px; margin-bottom: -20px; padding-bottom: 20px; }
}
.tinbox-finish { margin: auto; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 24px 0; }
.tinbox-finish-ico { width: 56px; height: 56px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--emerald-muted); color: var(--emerald-text); margin-bottom: 6px; }
.tinbox-finish-ico svg { width: 26px; height: 26px; }
.tinbox-finish .tinbox-btn { margin-top: 10px; min-width: 140px; }
/* Телефон: срок у «Беру» не влезает под кругом; тост «Вернуть» — над кнопками. */
@media (max-width: 959px) {
  .tinbox-act-sub { display: none; }
  body.tinbox-open .note-toast { bottom: calc(112px + env(safe-area-inset-bottom, 0px)); }
}
/* Компьютер: разбор — окном по центру, как открытая поставленная задача. */
@media (min-width: 960px) {
  .tinbox { justify-content: center; background: rgba(0, 0, 0, 0.55); padding: 32px; }
  .tinbox-panel { flex: none; max-width: 600px; max-height: calc(100vh - 64px); overflow-y: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 16px; padding: 14px 20px 20px; box-shadow: var(--shadow-md, 0 12px 40px color-mix(in srgb, var(--shadow-color) 40%, transparent)); box-sizing: border-box; }
  .tinbox-acts { margin-top: 18px; bottom: -20px; margin-bottom: -20px; padding-bottom: 20px; }
  .tinbox-finish { margin: 0; }
}

/* Вёрстка в поле ввода обсуждения / чатов и в сообщениях участников: заголовки и списки. */
.note-paie-composer-editor h1, .note-paie-composer-editor h2, .note-paie-composer-editor h3 { margin: 2px 0; font-weight: 700; line-height: 1.3; }
.note-paie-composer-editor h1 { font-size: 1.2em; }
.note-paie-composer-editor h2 { font-size: 1.1em; }
.note-paie-composer-editor h3 { font-size: 1em; }
.note-paie-composer-editor ul, .note-paie-composer-editor ol { margin: 2px 0; padding-left: 1.4em; }
.note-paie-composer-editor ul { list-style: disc; }
.note-paie-composer-editor ol { list-style: decimal; }
.note-discuss-bubble-body.has-md { white-space: normal; }
.note-discuss-bubble-body.has-md .note-discuss-md-p { white-space: pre-wrap; margin: 0 0 4px; }
.note-discuss-md-h { margin: 6px 0 4px; font-weight: 700; line-height: 1.3; white-space: pre-wrap; }
.note-discuss-md-h:first-child { margin-top: 0; }
.note-discuss-md-h1 { font-size: 1.15em; }
.note-discuss-md-h2 { font-size: 1.07em; }
.note-discuss-md-list { margin: 2px 0 6px; padding-left: 1.35em; }
ul.note-discuss-md-list { list-style: disc; }
ol.note-discuss-md-list { list-style: decimal; }
.note-discuss-md-list li { margin: 1px 0; white-space: pre-wrap; }

/* «Сохранить» в окне записи, пока ждём сервер. */
#modal-save.is-busy { opacity: 0.6; pointer-events: none; }


/* ================= Единые контролы карточек задач =================
   Окно задачи, «Поставлено», разбор входящих, «Разобрать», карточки Фокуса, пункты в чате.
   Кнопки: главная (синяя) / обычная (серая) / тихая / опасная; 44px в формах, 36px в небольших карточках.
   Поля: 44px (в чате 36px), скругление 10px, на телефоне шрифт 16px. Чипы: 28px, круглые. Карточки: 16px. */

/* — кнопки — */
.tinbox-btn, .fstack-form .focus-chat-btn, .modal-sheet-actions .modal-done-btn, .modal-sheet-actions .modal-link-btn, .modal-sheet-actions .modal-archive-btn, .modal-sheet-actions .modal-delete-btn, .pt-card-actions .pt-act, .focus-done-save {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; box-sizing: border-box;
  min-height: var(--ui-h); height: auto; padding: 0 16px; border: 1px solid transparent; border-radius: var(--ui-r);
  background: var(--ui-btn-bg); color: var(--text); font: inherit; font-size: var(--ui-font); font-weight: 600; line-height: 1.2; cursor: pointer;
}
.focus-card-btn, #panel-actual .focus-card-btn, .focus-chat-btn, .fstack-pill, .fstack-view, .pt-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; box-sizing: border-box;
  min-height: var(--ui-h-sm); height: auto; padding: 0 12px; border: 1px solid transparent; border-radius: var(--ui-r);
  background: var(--ui-btn-bg); color: var(--text); font: inherit; font-size: var(--ui-font-sm); font-weight: 600; line-height: 1.2; cursor: pointer; white-space: nowrap;
}
@media (hover: hover) {
  .pt-btn:hover, .tinbox-btn:hover, .focus-card-btn:hover, .focus-chat-btn:hover, .fstack-pill:hover, .fstack-view:hover, .pt-card-actions .pt-act:hover,
  .modal-sheet-actions .modal-link-btn:hover, .modal-sheet-actions .modal-archive-btn:hover { background: var(--ui-btn-bg-hover); }
}
/* главная */
.tinbox-btn.is-primary, .focus-card-btn.is-primary, #panel-actual .focus-card-btn.is-primary, .focus-chat-btn.is-primary, .fstack-form .focus-chat-btn.is-primary,
.fstack-pill.is-done, .pt-btn--primary, .pt-card-actions .pt-act.is-primary, .modal-sheet-actions .modal-done-btn, .modal-sheet-actions.is-task .modal-done-btn,
.focus-card-btn.focus-done-save.is-primary {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
}
@media (hover: hover) {
  .pt-btn--primary:hover, .tinbox-btn.is-primary:hover, .focus-card-btn.is-primary:hover, .focus-chat-btn.is-primary:hover, .fstack-pill.is-done:hover,
  .pt-card-actions .pt-act.is-primary:hover, .modal-sheet-actions .modal-done-btn:hover { background: var(--accent-pressed, var(--accent)); }
}
/* обычная: «мягкие» и «тихие» варианты прежних карточек — тот же серый */
.focus-card-btn.is-soft, .focus-card-btn.is-quiet, .focus-chat-btn.is-soft { background: var(--ui-btn-bg); color: var(--text); font-weight: 600; }
/* тихая */
.focus-chat-btn.is-ghost, .fstack-form .focus-chat-btn.is-ghost, .fstack-pill.is-ghost, .modal-sheet-actions .modal-archive-btn {
  background: transparent; border-color: var(--ui-field-border); color: var(--text-secondary);
}
/* опасная */
.modal-sheet-actions .modal-delete-btn, .modal-sheet-actions .modal-delete-btn.btn-text-danger { background: var(--ui-btn-bg); color: var(--danger); }
/* иконка-кнопка — квадрат того же размера */
.focus-card-btn.is-icon, #panel-actual .focus-card-btn.is-icon { width: var(--ui-h-sm); min-width: var(--ui-h-sm); padding: 0; background: var(--ui-btn-bg); border-color: transparent; color: var(--text-secondary); }
.focus-card-split .focus-card-btn { border-radius: 0; }
.focus-card-split .focus-card-btn:first-child { border-radius: var(--ui-r) 0 0 var(--ui-r); }
.focus-card-split .focus-card-btn:last-child { border-radius: 0 var(--ui-r) var(--ui-r) 0; }
.focus-card-split .focus-card-chev { padding: 0 9px; border-left: 1px solid var(--border); }
.focus-card-btn.focus-done-save { min-height: var(--ui-h); padding: 0 16px; font-size: var(--ui-font); }
.tinbox-btn:disabled, .focus-card-btn:disabled, .focus-chat-btn:disabled, .fstack-pill:disabled, .pt-card-actions .pt-act:disabled { opacity: 0.55; cursor: default; }

/* — поля — */
.tinbox-form input, .fstack-form .focus-chat-fields input, .fstack-form .focus-chat-fields select, .fstack-form .focus-chat-search,
.fstack-form .focus-chat-date input {
  box-sizing: border-box; min-height: var(--ui-h); height: var(--ui-h); padding: 0 12px; border: 1px solid var(--ui-field-border); border-radius: var(--ui-r);
  background: var(--ui-field-bg); color: var(--text); font: inherit; font-size: 0.95rem;
}
.modal--sheet input.field-input, .meeting-attendee-add input.field-input {
  box-sizing: border-box; min-height: var(--ui-h); padding: 0 12px; border: 1px solid var(--ui-field-border); border-radius: var(--ui-r);
  background: var(--ui-field-bg); color: var(--text); font: inherit; font-size: 0.95rem;
}
.modal--sheet .field-textarea, .tinbox-form textarea, .fstack-form .focus-chat-fields textarea {
  box-sizing: border-box; min-height: 88px; height: auto; padding: 10px 12px; border: 1px solid var(--ui-field-border); border-radius: var(--ui-r);
  background: var(--ui-field-bg); color: var(--text); font: inherit; font-size: 0.95rem;
}
.focus-chat-fields input, .focus-chat-fields select, .focus-chat-search, .focus-chat-date input, .focus-chat-assignee .meeting-attendee-add input.field-input {
  box-sizing: border-box; min-height: var(--ui-h-sm); height: var(--ui-h-sm); padding: 0 10px; border: 1px solid var(--ui-field-border); border-radius: var(--ui-r);
  background: var(--ui-field-bg); color: var(--text); font: inherit; font-size: var(--ui-font-sm);
}
.modal--sheet .field-input:focus, .modal--sheet .field-textarea:focus, .tinbox-form input:focus, .tinbox-form textarea:focus, .focus-chat-fields input:focus,
.focus-chat-fields select:focus, .focus-chat-search:focus, .focus-chat-date input:focus { outline: none; border-color: var(--accent); }
/* поле исполнителя с чипом внутри — рамка снаружи, само поле без рамки */
.fstack-assignee { min-height: var(--ui-h); border: 1px solid var(--ui-field-border); border-radius: var(--ui-r); background: var(--ui-field-bg); }
.fstack-form .fstack-assignee input.field-input { min-height: 34px; height: 34px; border: none; background: transparent; padding: 0 6px; }
/* срок — дата и время одинаково везде: жёлтые поля */
.fstack-when input, .tinbox-when input { min-height: var(--ui-h); height: var(--ui-h); border: 1px solid var(--ui-due-border); border-radius: var(--ui-r); background: var(--ui-due-bg); color: var(--ui-due-fg); color-scheme: dark; }
.sheet-date-pill, .event-sheet-pill.sheet-time { border-radius: var(--ui-r); }
/* описание в окне — часть сгруппированного блока, без своей рамки */
.modal--sheet .field-textarea.event-sheet-desc { border-color: transparent; border-radius: 14px; }
@media (max-width: 959px) {
  /* iPhone не увеличивает экран при фокусе, только если шрифт поля от 16px */
  .modal--sheet .field-input, .modal--sheet .field-textarea, .meeting-attendee-add input.field-input, .tinbox-form input, .tinbox-form textarea, .focus-chat-fields input, .focus-chat-fields select, .focus-chat-fields textarea,
  .focus-chat-search, .focus-chat-date input, .fstack-form .focus-chat-fields input, .fstack-form .focus-chat-search, .fstack-form .focus-chat-date input,
  .fstack-form .fstack-assignee input.field-input, .fstack-when input, .tinbox-when input, .fstack-title-edit { font-size: 16px; }
}

/* — чипы — */
.meeting-attendee-chip, .sheet-chip, .tinbox-chip, .pt-ref, .tracker-link-chip, .note-backlink-chip, .tinbox-due, .fstack-row-status, .pt-c-due {
  display: inline-flex; align-items: center; gap: 6px; box-sizing: border-box; min-height: var(--ui-chip-h); height: auto; padding: 0 10px;
  border-radius: 999px; font-size: 0.8125rem; font-weight: 600; line-height: 1.2; white-space: nowrap;
}
.meeting-attendee-chip { padding-left: 3px; border: 1px solid var(--border); background: var(--surface); }
.sheet-chip, .tinbox-chip { border: 1px solid var(--ui-field-border); background: transparent; color: var(--text); cursor: pointer; }
.sheet-chip.is-active, .sheet-chip.active, .sheet-chip[aria-pressed="true"], .tinbox-chip.is-on { background: var(--accent-subtle); border-color: var(--accent-border, var(--accent)); color: var(--accent); }
.pt-ref { border: 1px solid var(--border); background: var(--ui-btn-bg); }
/* срок — жёлтый чип */
.tinbox-due, .pt-c-due { border: none; background: var(--ui-due-bg); color: var(--ui-due-fg); }
.pt-c-due.is-late { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--pt-late); }
/* статусы — одинаковые цветные метки */
.pt-pill, .fstack-row-status { min-height: 24px; padding: 0 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.fstack-row-status { margin-right: auto; background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--pt-ok); }
.fstack-row-status.is-dismissed, .fstack-row-status.is-retyped { background: var(--surface-elevated); color: var(--text-secondary); }
.fstack-row-status.is-snoozed { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--pt-q); }
.fstack-row-status.is-converted, .fstack-row-status.is-linked { background: var(--accent-muted); color: var(--accent); }

/* — карточки — */
.tinbox-card, .fstack-row, .focus-card, #panel-actual .focus-card, .pt-card { border-radius: var(--ui-card-r); }

/* Темы встреч: экран темы и чип в карточке встречи */
.topic-scope { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface-muted); }
.topic-scope-btn { flex: 1; padding: 6px 10px; border: none; border-radius: 8px; background: transparent; color: var(--text-secondary); font-size: 0.84rem; cursor: pointer; }
.topic-scope-btn.is-on { background: var(--surface-elevated); color: var(--text-primary); }
.topic-row { align-items: center; cursor: default; }
.topic-row .focus-done-text { flex: 1; min-width: 0; }
.topic-row.is-off .focus-done-text { color: var(--text-tertiary); }
.topic-history { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px solid var(--border); }
.topic-history p { margin: 0; font-size: 0.76rem; color: var(--text-tertiary); }
.ev-topic-chip { align-self: flex-start; margin: 0 0 8px; padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--radius-full); background: transparent; color: var(--text-secondary); font-size: 0.8rem; cursor: pointer; }
.ev-topic-chip:hover { color: var(--text-primary); border-color: var(--text-tertiary); }

/* «Чаты»: кнопка «Поделиться» в шапке открытого чата — слева от кнопки чатов. */
.note-chats-wrap { display: flex; align-items: center; gap: 8px; }
.note-discussion-header.has-chat-share { grid-template-columns: 80px 1fr 80px; }
#note-discussion-share { width: 36px; height: 36px; border-radius: 50%; color: var(--text); background: var(--overlay-3); }
#note-discussion-share.hidden { display: none; }
#note-discussion-share.is-active { color: var(--vkui--color_text_accent); }
#note-discussion-share:active { opacity: 0.85; transform: scale(0.98); }

/* «Надиктовать» к прошедшей встрече: плашка записи внизу экрана → транскрипция встречи. */
.ev-rec { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 400; display: flex; align-items: center; gap: 12px; width: min(520px, calc(100vw - 32px)); box-sizing: border-box; padding: 10px 10px 10px 16px; border: 1px solid var(--border-strong, var(--border)); border-radius: 16px; background: var(--surface-elevated); box-shadow: 0 12px 32px color-mix(in srgb, var(--shadow-color) 35%, transparent); color: var(--text); }
.ev-rec-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: ev-rec-pulse 1.2s ease-in-out infinite; }
@keyframes ev-rec-pulse { 50% { opacity: 0.35; } }
.ev-rec-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.ev-rec-text b { font-size: 0.92rem; }
.ev-rec-sub { font-size: 0.78rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-rec-time { flex: none; font-variant-numeric: tabular-nums; color: var(--text-secondary); font-size: 0.88rem; }
.ev-rec-btn { flex: none; padding: 8px 14px; border: none; border-radius: 10px; background: var(--accent); color: var(--on-accent); font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.ev-rec-btn.is-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); font-weight: 500; }
/* Карандаш в углу карточки стопки — «Изменить». */
.tinbox-pen { margin-left: auto; flex: none; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: 9px; background: transparent; color: var(--text-secondary); cursor: pointer; }
.tinbox-pen:hover { background: var(--surface-elevated); color: var(--text); }
.tinbox-pen svg { width: 16px; height: 16px; }

/* ——— Окно записи: свойства одной группой (Срок/Когда, Исполнитель, Где, Цвет, Повтор, Участники…) ——— */
.event-sheet-group.sheet-props { overflow: visible; }
.sheet-props > .event-sheet-group,
.sheet-props > .sheet-prop { overflow: visible; margin: 0; border-radius: 0; background: transparent; box-shadow: none; }
.sheet-props > :not(input[type="hidden"]):not(.hidden) ~ :not(input[type="hidden"]):not(.hidden) { border-top: 0.5px solid var(--border); }
.sheet-props > .event-sheet-group.meeting-attendees-field > .event-sheet-row { border-radius: 0; }
.sheet-prop-row .event-sheet-row-value { color: var(--text-secondary); }
.sheet-prop-row .event-sheet-row-value > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-prop-row[aria-expanded="true"] .event-sheet-row-value { color: var(--accent); }
/* Где */
.sheet-where-val { display: inline-flex; align-items: center; gap: 6px; }
.sheet-where-ico { flex: none; width: 16px; height: 16px; color: var(--text); }
.sheet-where-ico--b24, .sheet-where-ico--txt { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: #2fc6f6; color: var(--on-accent); font-size: 0.5625rem; font-weight: 700; letter-spacing: -0.02em; }
.sheet-where-ico--txt { background: var(--surface-muted); color: var(--text); }
.sheet-where-body { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; }
.sheet-where-body.hidden { display: none; }
.sheet-where-body .task-target-switch { margin: 0; }
.sheet-where-body .task-target-switch .event-sheet-kind-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.sheet-where-nested { display: flex; flex-direction: column; border-radius: 12px; background: var(--ui-field-bg); box-shadow: inset 0 0 0 1px var(--border); overflow: visible; }
.sheet-where-nested > .sheet-sublabel { margin: 0; padding: 10px 12px 4px; }
.sheet-where-nested .event-sheet-row { min-height: 42px; padding: 0.35rem 0.75rem; }
.sheet-where-nested .event-sheet-row-label { font-size: 0.9375rem; color: var(--text-secondary); }
.sheet-where-nested .tracker-row + .tracker-row, .sheet-where-nested .tracker-user-list + .tracker-row { border-top: 0.5px solid var(--border); }
/* Цвет */
.event-sheet-color-group .event-sheet-color-preview { width: 16px; height: 16px; }
.sheet-color-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.sheet-color-body.hidden { display: none; }
.sheet-color-body .event-sheet-color-swatches { display: flex; flex-wrap: nowrap; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px; }
.sheet-color-body .event-sheet-color-swatches::-webkit-scrollbar { display: none; }
.sheet-color-body .event-sheet-color-swatch { flex: none; width: 26px; height: 26px; }
.sheet-color-hint { margin: 0; font-size: 0.75rem; color: var(--text-secondary); }
/* Описание и подзадачи — одна карточка */
.sheet-desc-group .field-textarea.event-sheet-desc { min-height: 56px; border: none; border-radius: 0; background: transparent; }
.sheet-desc-group .rem-checklist-host { border-top: 0.5px solid var(--border); }
.sheet-desc-group .rem-checklist-item, .sheet-desc-group .rem-checklist-draft { min-height: 40px; padding: 0.45rem 0.9rem; border-top: 0.5px solid var(--border); }
.sheet-desc-group .rem-checklist-item:first-child { border-top: none; }
.sheet-desc-group .rem-checklist-add { width: 100%; box-sizing: border-box; min-height: 40px; padding: 0.45rem 0.9rem; justify-content: flex-start; }
/* История переносов срока — одна серая строка */
.sheet-history { margin: -2px 2px 0; }
.sheet-history.hidden { display: none; }
.sheet-history-row { display: flex; align-items: center; gap: 6px; width: 100%; padding: 4px 2px; border: none; background: transparent; color: var(--text-secondary); font: inherit; font-size: 0.8125rem; text-align: left; cursor: pointer; }
.sheet-history-text { flex: 1; min-width: 0; }
.sheet-history.is-single .sheet-history-row { cursor: default; }
.sheet-history.is-single .event-sheet-chevron { display: none; }
.sheet-history-row[aria-expanded="true"] .event-sheet-chevron { transform: rotate(180deg); }
.sheet-history-list { padding: 2px 2px 4px; }
.sheet-history-list.hidden { display: none; }
.sheet-history-list p { margin: 2px 0; font-size: 0.8125rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.sheet-when .sheet-date-pill.sheet-date-field, .sheet-when .event-sheet-pill.sheet-time { border: none; box-shadow: none; background: rgba(0, 0, 0, 0.24); }
.sheet-when .sheet-date-pill.sheet-date-field:focus-within, .sheet-when .event-sheet-pill.sheet-time:focus { box-shadow: inset 0 0 0 1px var(--accent-border, var(--accent)); }
/* Участники: поиск, под ним добавленные, ниже — занятость */
.sheet-props .event-sheet-attendees { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; border-top: none; }
.sheet-props .event-sheet-attendees.hidden { display: none; }
.sheet-props .event-sheet-attendees .meeting-attendee-chips { margin: 0; }
.sheet-props .event-sheet-attendees .meeting-attendee-chips:empty { display: none; }
.sheet-props .meeting-avail { margin: 0; padding-top: 10px; border-top: 0.5px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.sheet-props .meeting-avail.hidden { display: none; }
.meeting-avail .meeting-avail-head { display: flex; align-items: center; justify-content: space-between; margin: 0; font-size: 0.75rem; font-weight: 400; color: var(--text-secondary); }
.meeting-avail-nav { display: inline-flex; gap: 4px; }
.meeting-avail-navbtn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: none; border-radius: 8px; background: transparent; color: var(--text-secondary); cursor: pointer; }
.meeting-avail-navbtn:hover { background: var(--overlay-2); color: var(--text); }
.meeting-avail .meeting-avail-grid { min-width: 0; display: grid; grid-template-columns: 78px minmax(0, 1fr); row-gap: 6px; column-gap: 8px; align-items: center; }
.meeting-avail .meeting-avail-row { display: contents; }
.meeting-avail .meeting-avail-hours { position: relative; display: block; height: 14px; margin: 0; font-size: 0.6875rem; color: var(--text-tertiary); }
.meeting-avail .meeting-avail-hour { position: absolute; top: 0; flex: none; transform: translateX(-50%); }
.meeting-avail .meeting-avail-hour:first-child { transform: none; }
.meeting-avail .meeting-avail-label { width: auto; font-size: 0.75rem; color: var(--text); }
.meeting-avail .meeting-avail-label.is-muted { color: var(--text-tertiary); }
.meeting-avail-who { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.meeting-avail-av { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-muted); color: var(--accent); font-size: 0.5625rem; font-weight: 700; }
.meeting-avail-label.is-muted .meeting-avail-av { background: var(--surface-muted); color: var(--text-tertiary); }
.meeting-avail-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meeting-avail-all { font-weight: 600; color: var(--success); }
.meeting-avail .meeting-avail-track { height: 16px; border-radius: 5px; background: rgba(0, 0, 0, 0.24); overflow: visible; }
.meeting-avail .meeting-avail-busy { top: 0; bottom: 0; border-radius: 4px; background: var(--overlay-7); }
.meeting-avail .meeting-avail-track--joint { cursor: pointer; }
.meeting-avail .meeting-avail-free { top: 0; bottom: 0; border-radius: 4px; background: color-mix(in srgb, var(--success) 42%, transparent); }
.meeting-avail-sel { position: absolute; top: -3px; bottom: -3px; border: 2px solid var(--accent); border-radius: 6px; pointer-events: none; box-sizing: border-box; }
.meeting-avail .sheet-sublabel { margin: 2px 0 0; }
.meeting-avail .meeting-avail-hint { margin: 0; font-size: 0.75rem; color: var(--text-secondary); }
/* Видеосвязь строкой */
.sheet-props .sheet-video { padding: 0; gap: 0; }
.sheet-video-body { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; }
.sheet-video-body.hidden { display: none; }
.sheet-video-body .event-sheet-kind-switch { margin: 0; }
.sheet-video-body .event-sheet-meet-link-input { margin: 0; }
/* Повтор внутри группы свойств */
.sheet-props .sheet-repeat .sheet-repeat-body { padding: 0 12px 12px; }
/* Напоминание: Когда / Повтор / Список строками */
.sheet-props .sheet-rem-when { display: block; padding: 0; gap: 0; }
.sheet-rem-body { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; }
.sheet-rem-body.hidden, .sheet-rem-list-body.hidden { display: none; }
.sheet-rem-body .sheet-rem-repeat { margin: 0; }
.sheet-rem-exact { display: flex; gap: 8px; }
.sheet-rem-exact .event-sheet-pill { flex: 1; min-width: 0; height: var(--ui-h, 40px); border: none; box-shadow: none; border-radius: var(--ui-r, 10px); background: rgba(0, 0, 0, 0.24); color: var(--text); color-scheme: dark; text-align: center; font-variant-numeric: tabular-nums; }
.sheet-rem-list-body { border-top: 0.5px solid var(--border); }
.sheet-props .sheet-rem-list-prop .rem-checklist-item:first-child { border-top: none; }
.sheet-props .sheet-rem-when > .event-sheet-row { padding: 0.45rem 0.9rem; }
.sheet-rem-exact .event-sheet-pill { max-width: none; width: auto; }
.booking-expire-row.hidden { display: none; }
.sheet-rem-body .booking-sheet-hint { margin: 0; }
.sheet-props .note-backlinks-row { padding-left: calc(0.9rem + 28px); }
.sheet-result-group > .sheet-sublabel { margin: 0; padding: 10px 0.9rem 0; }
.sheet-result-group .field-textarea.event-sheet-desc { min-height: 48px; padding-top: 4px; border: none; background: transparent; }
/* Подсказки не липнут к полям: отступ сверху, рамки чипов мягче */
.sheet-when .sheet-chips.sheet-scroll { margin-top: 4px; }
.sheet-when .sheet-when-sep { margin-top: 6px; margin-bottom: 4px; }
.sheet-props .sheet-chip { border-color: var(--overlay-6); color: var(--text-soft); }
.sheet-props .sheet-chip.is-active { border-color: var(--accent-border, var(--accent)); color: var(--accent); }
/* Повтор: варианты одной строкой с прокруткой, «Настроить…» — там же последним */
.sheet-props .sheet-repeat-body { gap: 12px; }
.sheet-repeat-body .sheet-chips.sheet-scroll { padding-bottom: 2px; }
/* Занятость на телефоне: час ≈ 56 px, прокрутка вбок, имена закреплены слева */
.meeting-avail .meeting-avail-scroll { overflow-x: auto; overflow-y: visible; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 4px 0; margin: -4px 0; }
.meeting-avail .meeting-avail-scroll::-webkit-scrollbar { display: none; }
@media (max-width: 959px) {
  .meeting-avail .meeting-avail-grid { min-width: calc(78px + var(--avail-hours, 9) * 56px); }
  .meeting-avail .meeting-avail-label,
  .meeting-avail .meeting-avail-row > span:first-child { position: sticky; left: 0; z-index: 2; align-self: stretch; display: flex; align-items: center; background: var(--surface-elevated); box-shadow: 6px 0 6px -4px color-mix(in srgb, var(--shadow-color) 50%, transparent); }
  .meeting-avail .meeting-avail-row--hours > span:first-child { box-shadow: none; }
}

/* Таблица задач встречи в саммари: живой статус, ответственный и срок поверх ячеек (их ведёт сервер),
   над таблицей — «Разобрано N из M», «Не задачи» и «Дубли» свёрнуты под ней. На телефоне строки — карточки. */
.mt-summary { display: flex; align-items: center; gap: 10px; margin: 2px 0 8px; user-select: none; }
.mt-summary-bar { flex: 1; max-width: 240px; height: 6px; border-radius: 3px; background: var(--surface-elevated); overflow: hidden; }
.mt-summary-bar > span { display: block; height: 100%; border-radius: 3px; background: var(--success); }
.mt-summary-text { font-size: var(--ui-font-sm); color: var(--text-secondary); white-space: nowrap; }
.mt-summary.is-skipped .mt-summary-text { white-space: normal; color: var(--text-tertiary); }
.mt-summary-skip { margin-left: auto; flex: none; border: none; background: transparent; color: var(--text-tertiary); font: inherit; font-size: var(--ui-font-sm); padding: 4px 0; cursor: pointer; }
.mt-summary-skip:hover { color: var(--text-secondary); }
.mt-chip--skipped { background: var(--surface-muted); color: var(--text-tertiary); }
.mt-chip--waiting { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning-text); }
.mt-val.is-unknown { color: var(--text-secondary); }
/* Исполнитель не из команды: имя + компания, ниже «+ в контакты» и «следит: …» */
.mt-ext { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; max-width: 100%; min-width: 0; }
.mt-ext-name { gap: 6px; flex-wrap: wrap; }
.mt-ext-org { display: inline-block; padding: 0 7px; line-height: 18px; border-radius: var(--radius-full); background: var(--surface-muted); color: var(--text-secondary); font-size: 0.72rem; white-space: nowrap; }
.mt-ext-sub { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 0.75rem; color: var(--text-tertiary); cursor: pointer; white-space: nowrap; }
.mt-ext-sub:hover { color: var(--text-secondary); }
.mt-ext-add { color: var(--accent); }
.mt-ext-add:hover { color: var(--accent); text-decoration: underline; }
/* Выбор исполнителя из ячейки таблицы задач */
.mt-who { width: 300px; max-height: min(420px, 70vh); overflow-y: auto; }
.mt-who-input { width: 100%; box-sizing: border-box; margin: 0 0 4px; }
.mt-who .pt-menu-item small { display: block; font-size: 0.75rem; color: var(--text-tertiary); }
.mt-who .pt-menu-item.is-ext { color: var(--accent); }
.mt-who-form { display: flex; flex-direction: column; gap: 6px; padding: 6px; }
.mt-who-form label { font-size: 0.75rem; color: var(--text-secondary); }
.mt-who-form .mt-who-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.ProseMirror table:has(tr.mt-row) col:nth-child(1) { width: 42%; }
.ProseMirror table:has(tr.mt-row) col:nth-child(2) { width: 20%; }
.ProseMirror table:has(tr.mt-row) col:nth-child(3) { width: 24%; }
.ProseMirror table:has(tr.mt-row) col:nth-child(4) { width: 14%; }
.ProseMirror td.mt-cell > p { display: none; }
.ProseMirror td.mt-cell { cursor: pointer; vertical-align: middle; }
.mt-val { display: inline-flex; align-items: center; max-width: 100%; font-size: var(--ui-font-sm); color: var(--text); cursor: pointer; }
.mt-val.is-empty { color: var(--text-tertiary); }
.mt-chip { display: inline-block; line-height: 24px; height: 24px; padding: 0 9px; border-radius: var(--radius-full); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.78rem; }
.mt-chip--open { background: var(--ui-due-bg); color: var(--ui-due-fg); box-shadow: inset 0 0 0 1px var(--ui-due-border); }
.mt-chip--taken, .mt-chip--accepted, .mt-chip--in_progress, .mt-chip--tracker { background: var(--accent-muted); color: var(--quote-text); }
.mt-chip--assigned, .mt-chip--question { background: var(--violet-muted); color: var(--violet-text); }
.mt-chip--done { background: var(--emerald-muted); color: var(--emerald-text); }
.mt-chip--declined { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger-text); }
.mt-chip--not_task, .mt-chip--duplicate { background: var(--surface-muted); color: var(--text-tertiary); }
.mt-chip--doubtful { background: var(--surface-muted); color: var(--text-secondary); box-shadow: inset 0 0 0 1px var(--border-strong); }
.ProseMirror tr.mt-row.mt-row--doubtful.is-excluded td:first-child { text-decoration: none; color: var(--text-secondary); }
.ProseMirror tr.mt-row.is-excluded td:first-child { color: var(--text-tertiary); text-decoration: line-through; }
.ProseMirror tr.mt-row.is-collapsed { display: none; }
/* Ручка ≡ и вложенность: подзадачи сдвинуты вправо, у основной — шеврон; перетаскивание — линия или подсветка. */
.ProseMirror td.mt-c0 > p { padding-left: calc(var(--mt-depth, 0) * 22px); }
.mt-lead { display: inline-flex; align-items: center; gap: 2px; margin: 0 6px 0 -4px; vertical-align: -3px; user-select: none; }
.mt-grip { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; color: var(--text-tertiary); cursor: grab; touch-action: none; }
.mt-grip:hover { background: var(--surface-hover); color: var(--text-secondary); }
.mt-fold { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 22px; color: var(--text-secondary); cursor: pointer; transition: transform 0.15s; }
.mt-fold.is-folded { transform: rotate(-90deg); }
.mt-pick { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; cursor: pointer; }
.mt-pick::before { content: ""; width: 15px; height: 15px; box-sizing: border-box; border: 1.5px solid var(--accent); border-radius: 4px; }
.mt-pick.is-radio::before { border-radius: 50%; }
.mt-pick.is-check.is-on::before { background: var(--accent); box-shadow: inset 0 0 0 2px var(--surface); }
.mt-pick.is-off { cursor: default; }
.mt-pick.is-off::before { border-color: transparent; }
.ProseMirror tr.mt-row.is-folded { display: none; }
.ProseMirror tr.mt-row.is-pick-src td { background: var(--accent-soft); }
.ProseMirror tr.mt-row.mt-dragging td { opacity: 0.35; }
.ProseMirror tr.mt-row.mt-drop-nest td { background: var(--accent-muted); }
.ProseMirror tr.mt-row.mt-drop-before td { box-shadow: inset 0 3px 0 var(--accent); }
.ProseMirror tr.mt-row.mt-drop-after td { box-shadow: inset 0 -3px 0 var(--accent); }
/* «Поднятая» строка под курсором при перетаскивании */
.mt-drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10000;
  pointer-events: none;
  border-radius: 10px;
  background: var(--surface-elevated);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--shadow-color) 45%, transparent), 0 0 0 1px var(--accent-border);
  opacity: 0.96;
}
.mt-drag-ghost table.note-editor-table { width: 100%; margin: 0; table-layout: fixed; border: 0; background: transparent; }
.mt-drag-ghost tr.mt-row > td { border: 0 !important; background: transparent !important; opacity: 1 !important; vertical-align: middle; }
.mt-drag-ghost .mt-grip { opacity: 1 !important; color: var(--accent); }
.mt-drag-ghost .mt-lead,
.mt-drag-ghost td.mt-cell > p { display: none; }
.mt-drag-ghost-more { display: block; padding: 0 12px 8px; font-size: var(--ui-font-sm); color: var(--text-secondary); }
body.mt-drag-active, body.mt-drag-active * { cursor: grabbing !important; user-select: none; }
.mt-chip--nested { background: var(--surface-muted); color: var(--text-secondary); }
.mt-pickbar { display: flex; align-items: center; gap: 10px; margin: 8px 0; padding: 8px 12px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--accent); background: var(--surface-elevated); user-select: none; }
.mt-pickbar-text { flex: 1; min-width: 0; font-size: var(--ui-font-sm); color: var(--text); }
.mt-pickbar-btn { flex: none; border: none; border-radius: 8px; padding: 5px 12px; background: var(--surface-hover); color: var(--text); font: inherit; font-size: var(--ui-font-sm); cursor: pointer; }
.mt-pickbar-btn.is-primary { background: var(--accent); color: var(--on-accent); }
.mt-pickbar-btn.is-danger { color: var(--danger-text); }
.mt-pickbar-btn:disabled { opacity: 0.45; cursor: default; }
/* Массовое выделение: панель действий прилипает к низу экрана, пока таблица выше */
.mt-pickbar--select { position: sticky; bottom: 12px; z-index: 5; flex-wrap: wrap; box-shadow: inset 0 0 0 1px var(--accent), 0 8px 24px color-mix(in srgb, var(--shadow-color) 35%, transparent); }
.mt-pickbar--select .mt-pickbar-text { flex: 1 0 auto; font-weight: 600; }
/* Чекбокс в заголовке «Задача»: пустой — включить выделение; «−» — выбраны не все; ✓ — все */
.mt-head-check.is-idle::before { border-color: var(--text-tertiary); }
.mt-head-check.is-idle:hover::before { border-color: var(--accent); }
.mt-pick.is-check.is-some::before { background: linear-gradient(var(--accent), var(--accent)) center / 8px 2px no-repeat; }
.mt-summary-select { display: none; flex: none; border: none; background: transparent; color: var(--accent); font: inherit; font-size: var(--ui-font-sm); padding: 4px 0; cursor: pointer; }
.mt-assign-sheet .mt-assign-host { margin: 4px 0 12px; }
.mt-excluded-toggle { display: block; border: none; background: transparent; color: var(--text-tertiary); font: inherit; font-size: var(--ui-font-sm); padding: 6px 0; cursor: pointer; }
.mt-excluded-toggle::after { content: " ▾"; }
.mt-excluded-toggle.is-open::after { content: " ▴"; }
.pt-menu-info { padding: 8px 12px 6px; font-size: 0.78rem; color: var(--text-tertiary); }
@media (max-width: 640px) {
  .mt-summary-select { display: inline-flex; margin-left: 12px; }
  .mt-summary:not(:has(.mt-summary-skip)) .mt-summary-select { margin-left: auto; }
  .ProseMirror table:has(tr.mt-row),
  .ProseMirror table:has(tr.mt-row) > tbody { display: block; width: 100% !important; min-width: 0 !important; border: none; }
  .ProseMirror table:has(tr.mt-row) colgroup,
  .ProseMirror tr.mt-head { display: none; }
  .ProseMirror tr.mt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface-elevated); }
  .ProseMirror tr.mt-row.is-collapsed, .ProseMirror tr.mt-row.is-folded { display: none; }
  .ProseMirror tr.mt-row.is-sub { margin-left: calc(var(--mt-depth-row, 1) * 14px); }
  .ProseMirror td.mt-c0 > p { padding-left: 0; }
  .ProseMirror tr.mt-row > td { display: block; flex: 0 0 auto; width: auto !important; min-width: 0 !important; max-width: 100%; padding: 0 !important; border: none !important; background: none !important; }
  .ProseMirror tr.mt-row > td:first-child { flex: 0 0 100%; margin-bottom: 2px; }
  .ProseMirror tr.mt-row > td:first-child > p { margin: 0; }
  .ProseMirror tr.mt-row > td.mt-col2 .mt-ext { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
  .ProseMirror tr.mt-row > td.mt-col2 .mt-val,
  .ProseMirror tr.mt-row > td.mt-col3 .mt-val { height: 24px; padding: 0 9px; border-radius: var(--radius-full); background: var(--surface-muted); color: var(--text-secondary); font-size: 0.78rem; }
}

/* ——— Подзадачи (окно и карточка задачи) ——— */
.st-box { display: flex; flex-direction: column; gap: 4px; }
.pt-subtasks { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-elevated); }
.st-crumb { align-self: flex-start; margin: 0 0 6px; padding: 0; border: 0; background: none; font: inherit; font-size: 0.8rem; color: var(--accent); cursor: pointer; text-align: left; }
.st-head { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-secondary); }
.st-head .st-bar { margin-left: 4px; }
.event-sheet-group .st-head .st-bar { display: none; }
.st-list { display: flex; flex-direction: column; }
.st-row { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0 7px calc(var(--st-depth, 0) * 22px); border-bottom: 1px solid var(--border); }
.st-row:last-child { border-bottom: 0; }
.st-cb { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.st-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 0; border: 0; background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.st-title { font-size: 0.92rem; line-height: 1.35; overflow-wrap: anywhere; }
.st-row.is-done .st-title { color: var(--text-tertiary); text-decoration: line-through; }
.st-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-secondary); }
/* Статусы подзадач — те же цвета, что у статусов в таблице задач встречи */
.st-state { display: inline-block; line-height: 20px; height: 20px; padding: 0 8px; border-radius: var(--radius-full); font-size: 0.72rem; background: var(--accent-muted); color: var(--quote-text); }
.st-state.is-assigned, .st-state.is-question { background: var(--violet-muted); color: var(--violet-text); }
.st-state.is-declined { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger-text); }
.st-edit { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 8px calc(var(--st-depth, 0) * 22px + 28px); padding: 10px; border-radius: 10px; background: var(--surface-hover); }
.st-field { display: flex; align-items: center; gap: 10px; }
.st-label { flex: none; width: 92px; font-size: 0.8rem; color: var(--text-secondary); }
.st-assignee { flex: 1; min-width: 0; }
.st-due { max-width: 180px; }
.st-note { width: 100%; box-sizing: border-box; }
.st-result span { font-size: 0.76rem; font-weight: 600; color: var(--text-secondary); }
.st-result p { margin: 2px 0 0; font-size: 0.88rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.st-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.st-acts .btn { padding: 5px 10px; font-size: 0.82rem; }
.st-ghost { background: none; }
.st-add-form { padding: 6px 0 4px calc(var(--st-depth, 0) * 22px); }
.st-add-input { width: 100%; box-sizing: border-box; }
.tinbox-parent { margin: 0 0 6px; font-size: 0.8rem; color: var(--text-secondary); }
.tinbox-sub-head { margin: 0 0 4px; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); }
.tinbox-bundle { margin: 0 0 12px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.tinbox-bundle li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 0.92rem; line-height: 1.4; color: var(--text); }
.tinbox-bundle li::before { content: "·"; color: var(--text-tertiary); }
.tinbox-bundle li.is-done { color: var(--text-tertiary); text-decoration: line-through; }
.tinbox-bundle-due { font-size: 0.78rem; color: var(--text-secondary); }
.tinbox-bundle-note { flex-basis: 100%; padding-left: 12px; font-size: 0.8rem; color: var(--text-secondary); }
.st-preview-note { margin: 4px 0 0; font-size: 0.78rem; color: var(--text-tertiary); }
/* Группы от Лео над таблицей задач встречи */
.mt-groups { display: flex; flex-direction: column; gap: 6px; margin: 0 0 8px; user-select: none; }
.mt-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--surface-elevated); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.mt-group-text { flex: 1 1 220px; min-width: 0; font-size: var(--ui-font-sm); color: var(--text); }
.mt-group-btn { flex: none; border: none; border-radius: 8px; padding: 5px 12px; background: var(--surface-hover); color: var(--text); font: inherit; font-size: var(--ui-font-sm); cursor: pointer; }
.mt-group-btn.is-primary { background: var(--accent); color: var(--on-accent); }
.mt-group-btn.is-ask { align-self: flex-start; padding: 4px 0; background: none; color: var(--accent); }
.mt-group-btn:disabled { opacity: 0.6; cursor: default; }
.ProseMirror tr.mt-row.mt-group-hl td { background: var(--accent-soft); }
.fstack-group .tinbox-bundle li.is-lead { font-weight: 600; }

/* Подзадачи в окне задачи — как остальные группы листа: подпись группы, строки с разделителями, «+» как у чек-листа */
.event-sheet-group.st-box { gap: 0; }
.event-sheet-group.st-box > .st-crumb { margin: 0; padding: 10px 0.9rem 0; }
.event-sheet-group.st-box > .st-head { padding: 10px 0.9rem 2px; }
.event-sheet-group.st-box .st-head-title { font-weight: 400; font-size: 0.75rem; }
.event-sheet-group.st-box .st-head-count { font-size: 0.75rem; color: var(--text-secondary); }
.event-sheet-group.st-box .st-row { min-height: 40px; box-sizing: border-box; padding: 0.45rem 0.9rem 0.45rem calc(0.9rem + var(--st-depth, 0) * 22px); border-bottom: none; border-top: 0.5px solid var(--border); }
.event-sheet-group.st-box .st-list > .st-row:first-child { border-top: none; }
.event-sheet-group.st-box .st-title { font-size: 0.9375rem; }
.event-sheet-group.st-box .st-meta { font-size: 0.75rem; }
.event-sheet-group.st-box .st-edit { margin: 0 0.9rem 10px calc(0.9rem + var(--st-depth, 0) * 22px + 28px); }
.event-sheet-group.st-box .st-add-form { padding: 0.45rem 0.9rem 0.45rem calc(0.9rem + var(--st-depth, 0) * 22px); border-top: 0.5px solid var(--border); }
.event-sheet-group.st-box > .st-add { width: 100%; box-sizing: border-box; min-height: 40px; padding: 0.45rem 0.9rem; border-top: 0.5px solid var(--border) !important; }
.event-sheet-group.st-box > .st-preview-note { margin: 0; padding: 0.45rem 0.9rem 10px; border-top: 0.5px solid var(--border); font-size: 0.75rem; }
/* В карточке поручения — как блок «Чек-лист»: без разделителей, пункты через отступ */
.pt-subtasks .st-list { gap: 8px; margin-top: 8px; }
.pt-subtasks .st-row { padding: 0 0 0 calc(var(--st-depth, 0) * 22px); border: none; }
.pt-subtasks .st-cb { margin-top: 2px; }
.pt-subtasks .st-title { font-size: 0.9rem; }
.pt-subtasks .st-crumb { margin-bottom: 8px; }
.pt-subtasks .st-add { margin-top: 10px; font-size: 0.9rem; }
.pt-subtasks .st-add .rem-checklist-add-icon { width: 1.5rem; height: 1.5rem; }
/* Подзадача открыта своей карточкой: наверху — общая задача и шаг назад к ней */
.st-crumb-host.hidden { display: none; }
.st-back { display: flex; align-items: center; gap: 8px; width: 100%; box-sizing: border-box; margin: 0 0 10px; padding: 8px 12px 8px 8px; border: none; border-radius: 12px; background: var(--surface-elevated); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.st-back:hover { background: var(--surface-hover); }
.st-back-ico { display: inline-flex; flex: none; color: var(--accent); }
.st-back-text { display: flex; flex-direction: column; min-width: 0; }
.st-back-kind { font-size: 0.72rem; color: var(--text-secondary); }
.st-back-title { font-size: 0.9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-sheet > .st-crumb-host .st-back { margin: 0; }
.st-go { display: inline-flex; flex: none; align-self: center; color: var(--text-tertiary); }
.st-row .st-main:hover .st-title { color: var(--accent); }

/* Кредиты ИИ: тонкая полоска под шапкой окна диалога, подробности при наведении */
.credits-bar { position: relative; z-index: 40; flex-shrink: 0; height: 3px; background: var(--overlay-3); cursor: help; outline: none; }
.credits-bar.hidden { display: none; }
.credits-bar-fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.credits-bar.is-warn .credits-bar-fill { background: var(--warning, var(--accent)); }
.credits-bar.is-over .credits-bar-fill { background: var(--danger, var(--accent)); }
.credits-bar-tip { position: absolute; top: calc(100% + 6px); right: 12px; z-index: 42; min-width: 220px; max-width: min(320px, calc(100vw - 24px)); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); box-shadow: 0 8px 24px color-mix(in srgb, var(--text) 14%, transparent); font-size: 0.8125rem; line-height: 1.45; opacity: 0; visibility: hidden; transition: opacity .15s ease; pointer-events: none; }
.credits-bar:hover .credits-bar-tip, .credits-bar:focus .credits-bar-tip, .credits-bar.is-open .credits-bar-tip { opacity: 1; visibility: visible; }
.credits-bar-tip b { font-weight: 600; }
.credits-bar-tip .credits-tip-muted { color: var(--text-secondary); }


/* ——— Таблицы со скруглёнными углами (заметки, саммари, история версий) ———
   border-collapse: collapse не умеет радиус, поэтому рамка — у таблицы, а ячейки делят линии справа и снизу. */
.note-editor-table,
.journal-summary-html table,
.nh-doc table {
  --tbl-line: var(--border);
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--tbl-line);
  border-radius: 10px;
}
.note-editor-table { --tbl-line: var(--overlay-6); }
:is(.note-editor-table, .journal-summary-html table, .nh-doc table) :is(td, th) {
  border: 0;
  border-right: 1px solid var(--tbl-line);
  border-bottom: 1px solid var(--tbl-line);
}
:is(.note-editor-table, .journal-summary-html table, .nh-doc table) tr > :last-child { border-right: 0; }
:is(.note-editor-table, .journal-summary-html table, .nh-doc table) > tbody:last-of-type > tr:last-child > * { border-bottom: 0; }
:is(.note-editor-table, .journal-summary-html table, .nh-doc table) > :is(thead, tbody:not(thead ~ tbody)) > tr:first-child > :first-child { border-top-left-radius: 9px; }
:is(.note-editor-table, .journal-summary-html table, .nh-doc table) > :is(thead, tbody:not(thead ~ tbody)) > tr:first-child > :last-child { border-top-right-radius: 9px; }
:is(.note-editor-table, .journal-summary-html table, .nh-doc table) > tbody:last-of-type > tr:last-child > :first-child { border-bottom-left-radius: 9px; }
:is(.note-editor-table, .journal-summary-html table, .nh-doc table) > tbody:last-of-type > tr:last-child > :last-child { border-bottom-right-radius: 9px; }

/* ——— Таблица задач встречи: ручка ≡ — своей колонкой слева в ячейке, по центру текста
   (у подзадачи — под началом текста основной), шеврон «свернуть» — справа в ячейке. ——— */
@media (min-width: 641px) {
  .ProseMirror tr.mt-row td.mt-c0 > p {
    position: relative;
    padding-left: calc(var(--mt-depth, 0) * 30px + 30px);
  }
  .ProseMirror tr.mt-row td.mt-c0 > p:has(.mt-fold) { padding-right: 26px; }
  .ProseMirror tr.mt-head th.mt-c0 > p { position: relative; padding-left: 30px; }
  .ProseMirror :is(td, th).mt-c0 .mt-lead { display: contents; }
  .ProseMirror th.mt-c0 .mt-pick { position: absolute; top: 50%; left: 0; transform: translateY(-50%); }
  .ProseMirror td.mt-c0 .mt-grip,
  .ProseMirror td.mt-c0 .mt-pick {
    position: absolute;
    top: 50%;
    left: calc(var(--mt-depth, 0) * 30px);
    transform: translateY(-50%);
  }
  .ProseMirror td.mt-c0 .mt-fold {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%) rotate(180deg);
  }
  .ProseMirror td.mt-c0 .mt-fold.is-folded { transform: translateY(-50%); }
}

/* Новое сообщение в обсуждении, которое сейчас не открыто: плашка сверху, нажатие — открыть. */
.discuss-banner {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 330;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(420px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text-strong);
  background: var(--surface-raised);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--shadow-color) 28%, transparent);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transform: translate(-50%, 0);
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.discuss-banner.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 16px));
}
.discuss-banner-ico {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-muted);
}
.discuss-banner-ico svg { width: 18px; height: 18px; }
.discuss-banner-body { flex: 1; min-width: 0; }
.discuss-banner-title,
.discuss-banner-text {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.discuss-banner-title { font-size: 0.8rem; color: var(--text-secondary); }
.discuss-banner-text { font-size: 0.9rem; font-weight: 600; }
.discuss-banner-x {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  background: transparent;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

/* Широкая заметка (десктоп): «К списку», заголовок, проект и кнопки — одной строкой, вкладки — ниже.
   Полоса с кнопками ложится поверх строки заголовка (app.js syncNoteHeadInline задаёт --head-*). */
#note-editor-overlay .note-editor-sheet.note-head-inline .note-editor-web-back-bar:not(.hidden) {
  position: absolute;
  top: var(--head-t, 0px);
  left: 0;
  right: 0;
  height: 48px;
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

#note-editor-overlay .note-editor-sheet.note-head-inline .note-editor-web-back-bar > button {
  pointer-events: auto;
}

/* Текст прокручен: полоса прилипла к верху окна — непрозрачная, чтобы кнопки не висели поверх текста. */
#note-editor-overlay .note-editor-sheet.note-head-inline.note-head-stuck .note-editor-web-back-bar:not(.hidden) {
  background: var(--vkui--color_background, var(--bg));
  border-bottom: 1px solid var(--border);
  pointer-events: auto;
}

#note-editor-overlay .note-editor-sheet.note-head-inline .note-editor-pad--title-in-body {
  /* Строка 1: заголовок (сжимается до «…») и проект рядом; строка 2: вкладки во всю ширину. */
  display: grid;
  /* Заголовок занимает свободное место, проект — справа, у кнопок. Отступы — от краёв окна заметки
     (--head-l/-r), минус поля контейнера: при переключении листа (у доски полей нет) заголовок не сдвигается. */
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  padding-left: calc(var(--head-l, 52px) - var(--note-editor-pad-x, 16px)) !important;
  padding-right: calc(var(--head-r, 134px) - var(--note-editor-pad-x, 16px)) !important;
  padding-top: 0;
}

#note-editor-overlay.is-web-canvas-open .note-editor-sheet.note-head-inline .note-editor-modal-content:has(.note-editor-pad--body.is-board-mode) .note-editor-pad--title-in-body {
  padding-left: var(--head-l, 52px) !important;
  padding-right: var(--head-r, 134px) !important;
  padding-bottom: 0;
}

#note-editor-overlay .note-editor-sheet.note-head-inline .note-editor-title {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  min-width: 4ch;
  height: auto;
  min-height: 48px;
  max-height: 48px;
  padding-top: 8px;
  padding-bottom: 8px;
  box-sizing: border-box;
  /* Длинный заголовок — одной строкой, конец плавно гаснет; при правке — прокрутка внутри строки. */
  white-space: nowrap;
  overflow: hidden;
  overflow-wrap: normal;
  word-break: normal;
}


#note-editor-overlay .note-editor-sheet.note-head-inline .note-editor-title.is-clipped:not(:focus) {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
}

#note-editor-overlay .note-editor-sheet.note-head-inline .note-editor-meta {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  flex-wrap: nowrap;
}

/* Вкладки — на прежнем месте (с полем заметки), независимо от отступов строки заголовка. */
#note-editor-overlay .note-editor-sheet.note-head-inline .note-editor-sheets-bar {
  grid-column: 1 / -1;
  grid-row: 2;
  margin-left: calc(var(--note-editor-pad-x, 16px) - var(--head-l, 52px));
  margin-right: calc(var(--note-editor-pad-x, 16px) - var(--head-r, 134px));
}

/* «К списку» — квадратная кнопка со стрелкой. */
#note-editor-overlay .note-editor-sheet.note-head-inline .note-editor-web-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0;
  color: var(--text);
}

#note-editor-overlay .note-editor-sheet.note-head-inline .note-editor-web-back::before {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%222.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M15%205l-7%207%207%207%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%222.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M15%205l-7%207%207%207%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
}

#note-editor-overlay .note-editor-sheet.note-head-inline .note-editor-web-back:hover {
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

/* Доска в тексте документа (узел leoBoardEmbed): рамка только для просмотра, сама доска — webapp/board.js (embed). */
.note-board-embed {
  position: relative;
  margin: 0.75em 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-muted);
  color: var(--text-secondary);
  user-select: none;
  -webkit-user-select: none;
}

.note-board-embed.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.note-board-embed-host {
  position: absolute;
  inset: 0;
}

.note-board-embed-host > .leo-board {
  position: absolute;
  inset: 0;
}

.note-board-embed-tag {
  position: absolute;
  z-index: 6;
  left: 8px;
  top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 260px);
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font: 500 12px/1.4 var(--font);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.note-board-embed-tag svg {
  flex-shrink: 0;
}

.note-board-embed-msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  text-align: center;
  font: 14px/1.4 var(--font);
  color: var(--text-secondary);
}

.note-board-embed-msg button {
  font: inherit;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.note-board-embed-grip {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 2px;
  width: 44px;
  height: 6px;
  margin-left: -22px;
  border-radius: 3px;
  background: var(--border-strong);
  cursor: ns-resize;
  opacity: 0;
  transition: opacity 0.15s;
  touch-action: none;
}

.note-board-embed:hover .note-board-embed-grip,
.note-board-embed.is-resizing .note-board-embed-grip {
  opacity: 1;
}

.ProseMirror:not([contenteditable="true"]) .note-board-embed-grip {
  display: none;
}

/* Презентация в тексте: слайд 16:9 по ширине и своя панель ← N/M → под ним. */
.note-board-embed.is-deck {
  height: auto;
}

.note-board-embed.is-deck .note-board-embed-host {
  position: relative;
  inset: auto;
  min-height: 120px;
}

.note-deck-embed {
  display: flex;
  flex-direction: column;
}

.note-deck-embed-frame {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  background: var(--surface);
}

.note-deck-embed-shield {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 44px;
}

.note-deck-embed-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 8px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font: 13px/1 var(--font);
  color: var(--text-secondary);
}

.note-deck-embed-bar button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  min-width: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.note-deck-embed-bar button:disabled {
  opacity: 0.4;
  cursor: default;
}

.note-deck-embed-bar.is-single [data-d] {
  display: none;
}

.note-deck-embed-count {
  min-width: 48px;
  text-align: center;
}

.note-deck-embed-sep {
  flex: 1;
}

.note-board-embed.is-deck .note-board-embed-msg {
  position: relative;
  min-height: 160px;
}

/* ——— «Чей календарь»: мой / поставленные другим / подчинённого (только просмотр) ——— */
#panel-actual .meetings-head .cal-nav-btn.meetings-whose-btn {
  width: auto;
  min-width: 36px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
#panel-actual .meetings-head .meetings-whose-btn .meetings-whose-label { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; }
#panel-actual .meetings-head .meetings-whose-btn .meetings-whose-ico { display: inline-flex; color: var(--text-soft); }
#panel-actual .meetings-head .meetings-whose-btn .meetings-whose-chev { color: var(--text-secondary); }
#panel-actual .meetings-head .meetings-whose-btn.is-active .meetings-whose-ico,
#panel-actual .meetings-head .meetings-whose-btn.is-active .meetings-whose-chev { color: var(--violet-text); }
#panel-actual .meetings-head .meetings-whose-btn.is-active { color: var(--violet-text); }
#panel-actual .meetings-head .meetings-whose-btn.is-user,
#panel-actual .meetings-head .meetings-whose-btn.is-user:hover {
  padding-left: 5px;
  color: var(--accent-soft);
  background: var(--accent-muted);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
#panel-actual .meetings-head .meetings-whose-btn.is-user .meetings-whose-chev { color: var(--accent-soft); }
.meetings-whose-wrap { position: relative; }
.meetings-view-menu.meetings-whose-menu {
  left: auto;
  right: 0;
  width: 20rem;
  max-height: min(70vh, 34rem);
  overflow-y: auto;
  padding: 6px;
}
.meetings-whose-item { gap: 10px; justify-content: flex-start; font-size: 0.875rem; }
.meetings-whose-item.is-active { background: var(--surface-muted); }
.meetings-whose-item.is-active::after { display: none; }
.meetings-whose-item-ico { display: inline-flex; color: var(--text-soft); flex: none; }
.meetings-whose-item--posted .meetings-whose-item-ico { color: var(--violet-text); }
.meetings-whose-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.meetings-whose-item-text small { font-size: 0.75rem; font-weight: 400; color: var(--text-secondary); }
.meetings-whose-check { flex: none; color: var(--accent); }
.meetings-whose-sep { height: 1px; margin: 4px 6px; background: var(--border); }
.meetings-whose-label { padding: 6px 12px 4px; font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); }
.cal-menu-count {
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  box-sizing: border-box;
  border-radius: var(--radius-full);
  background: var(--violet-muted);
  color: var(--violet-text);
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cal-menu-count:empty { display: none; }

/* Список подчинённых (меню на компьютере и раскрытый список в ☰ на телефоне) */
.cal-people-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 6px 4px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--ui-r);
  background: var(--surface-elevated);
  color: var(--text-secondary);
}
.cal-people-search-input { flex: 1; min-width: 0; border: none; background: transparent; outline: none; font: inherit; font-size: 0.875rem; color: var(--text); }
.cal-people-group { padding: 8px 12px 2px; font-size: 0.72rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.cal-person {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}
.cal-person:hover, .cal-person:focus-visible { background: var(--surface-muted); }
.cal-person.is-active { background: var(--accent-muted); }
.cal-person-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cal-person-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-person-sub { font-size: 0.75rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-person-av {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: var(--radius-full);
  color: var(--on-accent);
  font-size: 0.6875rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cal-person-av--sm { width: 24px; height: 24px; font-size: 0.625rem; }
.cal-people-empty { margin: 6px 12px 8px; font-size: 0.8125rem; color: var(--text-secondary); }
#panel-actual .cal-menu-people { margin: 0 4px 2px; padding: 4px 0; border-radius: 12px; background: var(--cal-strip-sel); max-height: 50vh; overflow-y: auto; }
#panel-actual .cal-menu-people.hidden,
#panel-actual .cal-menu-seg.hidden,
#panel-actual .cal-menu-label.hidden { display: none; }
#panel-actual .cal-menu-people .cal-person { padding: 4px 8px; }
#panel-actual .cal-menu-people .cal-people-search { background: var(--surface); }
#panel-actual .cal-menu-posted { justify-content: flex-start; gap: 10px; color: var(--violet-text); }
#panel-actual .cal-menu-posted span:first-of-type { flex: 1; }
#panel-actual .cal-menu-posted.is-active::after { border-color: var(--violet-text); }
#panel-actual .cal-strip.is-subordinate .cal-strip-menu-btn { background: var(--accent-muted); }
#panel-actual .cal-strip.is-subordinate .cal-strip-menu-btn i { background: var(--accent-soft); }

/* Полоска над сеткой в календаре подчинённого */
.cal-view-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 10px;
  padding: 8px 8px 8px 12px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
}
.cal-view-banner.hidden { display: none; }
.cal-view-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 0.875rem; color: var(--text); }
.cal-view-banner-text b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-view-banner-sub { font-size: 0.78rem; color: var(--accent-soft); }
.cal-view-banner-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--text-secondary); white-space: nowrap; }
.cal-view-banner-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--violet-muted); box-shadow: inset 0 0 0 1px var(--violet-text); }
.cal-view-banner-back {
  flex: none;
  height: 32px;
  padding: 0 12px;
  border: none;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}
@media (max-width: 959px) {
  .cal-view-banner-legend { display: none; }
}

/* Карточка события в календаре подчинённого (только просмотр) */
.cal-ro-sheet .cal-ro-row { margin: 0 0 8px; font-size: 0.9rem; color: var(--text); }
.cal-ro-sheet .cal-ro-when { font-weight: 600; }
.cal-ro-sheet .cal-ro-muted { color: var(--text-secondary); font-size: 0.82rem; }
.cal-ro-sheet .cal-ro-desc { white-space: pre-line; color: var(--text-soft); max-height: 12rem; overflow-y: auto; }
.cal-ro-sheet .cal-ro-close { width: 100%; margin-top: 6px; }
.meetings-whose-wrap { flex: none; }
/* Закрытое в Google событие подчинённого — «Занят», серым в штриховку */
#panel-actual .meeting-card--timeline.meeting-card--busy {
  background-color: var(--surface-raised);
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--overlay-2) 6px 12px);
  border-left-color: var(--border-strong);
}
#panel-actual .meeting-card--timeline.meeting-card--busy .item-title,
#panel-actual .meeting-card--timeline.meeting-card--busy .day-timeline-event-meta { color: var(--text-secondary); }
#panel-actual .cal-menu-posted span:first-of-type { white-space: nowrap; }
.cal-view-banner-short { display: none; }
@media (max-width: 959px) {
  .cal-view-banner-long { display: none; }
  .cal-view-banner-short { display: inline; }
}

/* Открытое меню «⋯» — над кнопкой «Проект» (у её обёртки свой высокий слой для выпадашки). */
#note-editor-overlay .note-editor-sheet .note-editor-web-back-bar:has(.note-more-menu:not(.hidden)) {
  z-index: 160;
}
