/* Базовая тема default (Light) - используется по умолчанию */
:root {
  --background: oklch(0.9818 0.0054 95.0986);
  --foreground: oklch(0.2438 0.0269 95.7226);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.1908 0.002 106.5859);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.2671 0.0196 98.939);
  --primary: oklch(0.45 0.08 250);
  --primary-foreground: oklch(0.9818 0.0054 95.0986);
  --secondary: oklch(0.9245 0.0138 92.9892);
  --secondary-foreground: oklch(0.4334 0.0177 98.6048);
  --muted: oklch(0.9341 0.0153 90.239);
  --muted-foreground: oklch(0.5559 0.0075 97.4233);
  --accent: oklch(0.9245 0.0138 92.9892);
  --accent-foreground: oklch(0.2671 0.0196 98.939);
  --destructive: oklch(0.35 0.02 250);
  --destructive-foreground: oklch(0.95 0.005 250);
  --border: oklch(0.8847 0.0069 97.3627);
  --input: oklch(0.7621 0.0156 98.3528);
  --ring: oklch(0.45 0.08 250);
  --chart-1: oklch(0.5583 0.1276 42.9956);
  --chart-2: oklch(0.6898 0.1581 290.4107);
  --chart-3: oklch(0.8816 0.0276 93.128);
  --chart-4: oklch(0.8822 0.0403 298.1792);
  --chart-5: oklch(0.5608 0.1348 42.0584);
  --sidebar: oklch(0.9663 0.008 98.8792);
  --sidebar-foreground: oklch(0.359 0.0051 106.6524);
  --sidebar-primary: oklch(0.45 0.08 250);
  --sidebar-primary-foreground: oklch(0.9818 0.0054 95.0986);
  --sidebar-accent: oklch(0.9245 0.0138 92.9892);
  --sidebar-accent-foreground: oklch(0.325 0 0);
  --sidebar-border: oklch(0.9401 0 0);
  --sidebar-ring: oklch(0.7731 0 0);
  --font-sans:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --radius: 0.5rem;
  --messages-mobile-keyboard-offset: 0px;
  --messages-mobile-form-height: 0px;
  --messages-mobile-reply-height: 0px;
  --messages-mobile-attachments-height: 0px;
  --messages-mobile-composer-height: 0px;
  --messages-composer-form-height: 0px;
  --messages-composer-reply-height: 0px;
  --messages-composer-attachments-height: 0px;
  --messages-composer-stack-height: 0px;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
  --shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
  --shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
  --shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
  --shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 2px 4px -1px hsl(0 0% 0% / 0.1);
  --shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 4px 6px -1px hsl(0 0% 0% / 0.1);
  --shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 8px 10px -1px hsl(0 0% 0% / 0.1);
  --shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
  --spacing: 0.25rem;
  --messages-thread-custom-image: none;
  --messages-thread-default-image: url('/uploads/fon/fon.svg');
  --messages-thread-bg-blur: 0px;
  --messages-thread-bg-dim: 0;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
body.no-scroll { overflow: hidden; }
.app { display: flex; min-height: 100vh; position: relative; }
.content-wrap { flex: 1; min-width: 0; padding: 1rem; max-width: 42rem; margin: 0 auto; width: 100%; }
.page-home .content-wrap,
.page-explore .content-wrap,
.page-profile .content-wrap,
.page-search .content-wrap { max-width: 56rem; }
.page-settings .content-wrap { max-width: 84rem; }
.page-public-manage .content-wrap { max-width: 84rem; }
.page-inbox .content-wrap { max-width: 64rem; }
.page-attachments .content-wrap { max-width: 80rem; }
.page-contacts .content-wrap { max-width: 62rem; }
.page-contacts-list .content-wrap { max-width: none; padding: 0; }
.page-calendar .content-wrap { max-width: 70rem; }
.page-bot .content-wrap { max-width: 70rem; }
.page-memo-detail .content-wrap { max-width: 56rem; }

.notes-top-header { display: none; }
@media (min-width: 768px) {
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-top-header {
    position: absolute;
    top: 0;
    left: 4rem;
    right: 0;
    height: 3.5rem;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: color-mix(in oklab, var(--background) 92%, var(--card));
    backdrop-filter: blur(8px);
    z-index: 20;
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-top-header__inner {
    width: 100%;
    max-width: none;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-top-header__title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    color: var(--foreground);
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-launcher {
    position: relative;
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-trigger {
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    background: color-mix(in oklab, var(--card) 90%, var(--background));
    color: var(--foreground);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-trigger:hover {
    background: color-mix(in oklab, var(--muted) 72%, var(--card));
    border-color: color-mix(in oklab, var(--primary) 40%, var(--border));
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-trigger[aria-expanded="true"] {
    background: color-mix(in oklab, var(--primary) 14%, var(--card));
    border-color: color-mix(in oklab, var(--primary) 52%, var(--border));
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-menu {
    position: absolute;
    top: calc(100% + 0.625rem);
    right: 0;
    width: 13rem;
    padding: 0.625rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: color-mix(in oklab, var(--background) 90%, var(--card));
    box-shadow: var(--shadow-lg);
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.375rem;
    z-index: 30;
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-menu.is-open { display: grid; }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-item {
    min-height: 4.25rem;
    border: 1px solid transparent;
    border-radius: 0.75rem;
    text-decoration: none;
    color: var(--foreground);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.1;
    text-align: center;
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-item:hover {
    background: color-mix(in oklab, var(--muted) 68%, var(--card));
    border-color: var(--border);
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-item--active {
    background: color-mix(in oklab, var(--primary) 14%, var(--card));
    border-color: color-mix(in oklab, var(--primary) 45%, var(--border));
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-item-icon {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.625rem;
    background: color-mix(in oklab, var(--card) 70%, var(--muted));
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-top-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-top-header-notify {
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    background: color-mix(in oklab, var(--card) 90%, var(--background));
    color: var(--foreground);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-top-header-notify:hover {
    background: color-mix(in oklab, var(--muted) 72%, var(--card));
    border-color: color-mix(in oklab, var(--primary) 40%, var(--border));
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-top-header-notify--active {
    background: color-mix(in oklab, var(--primary) 14%, var(--card));
    border-color: color-mix(in oklab, var(--primary) 52%, var(--border));
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-top-header-notify .nav-icon-wrap { position: relative; display: inline-flex; }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-top-header-notify .nav-inbox-badge {
    top: -6px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    font-size: 9px;
    border-color: var(--background);
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .sidebar-panel,
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .content-wrap {
    padding-top: calc(1rem + 3.3rem);
  }
  @media (min-width: 1400px) {
    body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-top-header {
      padding-left: 0.5rem;
      padding-right: 0.5rem;
    }
    body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-top-header__inner {
      max-width: none;
      margin: 0;
      padding-left: 0.25rem;
      padding-right: 0.25rem;
    }
  }
}

.hidden { display: none !important; }

/* Кнопка открытия меню (только на мобильных) */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1001;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-lg);
  background: var(--sidebar);
  color: var(--sidebar-foreground);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, color 0.15s;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.sidebar-toggle:hover { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }
.sidebar-toggle::before {
  content: '';
  display: block;
  width: 1.25rem;
  height: 2px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor, 0 10px 0 currentColor;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.sidebar-overlay.is-visible { display: block; opacity: 1; pointer-events: auto; }
.app.sidebar-open-left .sidebar-overlay--left { display: block; opacity: 1; pointer-events: auto; }
.app.sidebar-open-right .sidebar-overlay--right { display: block; opacity: 1; pointer-events: auto; }

/* Левый мобильный drawer: навигация (как в оригинале Memos — BG.Hub, пункты с pill, пользователь внизу) */
.sidebar-drawer--left {
  left: 0;
  right: auto;
  transform: translateX(-100%);
  border-right: 1px solid var(--border);
  width: min(85vw, 320px);
  max-width: 320px;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.app.sidebar-open-left .sidebar-drawer--left { transform: translateX(0); }
.sidebar-drawer-left-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 1rem;
  padding-top: 1.25rem;
}
.sidebar-drawer-left-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  position: relative;
}
.sidebar-drawer-left-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--sidebar-foreground);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.125rem;
  transition: opacity 0.15s;
}
.sidebar-drawer-left-logo:hover { opacity: 0.9; }
.sidebar-drawer-left-logo svg { display: block; flex-shrink: 0; }
.sidebar-drawer-left-title { line-height: 1.2; }
.sidebar-drawer-left-close {
  position: absolute;
  top: -0.25rem;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--sidebar-foreground);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s, background 0.15s;
}
.sidebar-drawer-left-close:hover { opacity: 1; background: var(--sidebar-accent); }
.sidebar-drawer-left-close svg { display: block; }
.sidebar-drawer-left-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.sidebar-drawer-left-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  color: var(--sidebar-foreground);
  text-decoration: none;
  font-size: 1rem;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  opacity: 0.85;
}
.sidebar-drawer-left-item:hover {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
  opacity: 1;
}
.sidebar-drawer-left-item--active {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
  border-color: var(--sidebar-border);
  box-shadow: var(--shadow-sm);
  opacity: 1;
}
.sidebar-drawer-left-item svg { display: block; flex-shrink: 0; width: 24px; height: 24px; }
.sidebar-drawer-create-trigger {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.sidebar-drawer-create-trigger svg { stroke-width: 2.5; }
.sidebar-drawer-create-menu { display: none; padding-left: 0.35rem; }
.sidebar-drawer-create-menu.is-open { display: block; }
.sidebar-drawer-create-item {
  margin-top: 0.2rem;
  padding-top: 0.42rem;
  padding-bottom: 0.42rem;
  font-size: 0.92rem;
}
.sidebar-drawer-left-user {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar-drawer-left-user-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--sidebar-foreground);
  text-decoration: none;
  font-size: 0.9375rem;
  padding: 0.25rem 0;
  transition: opacity 0.15s;
}
.sidebar-drawer-left-user-link:hover { opacity: 0.9; }
.sidebar-drawer-left-user-avatar {
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  border-radius: 9999px;
  overflow: hidden;
  object-fit: cover;
  display: block;
}
.sidebar-drawer-left-user-avatar--icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--sidebar-foreground);
}
.sidebar-drawer-left-user-avatar--icon svg { display: block; width: 2rem; height: 2rem; }
.sidebar-drawer-left-user-name { font-weight: 500; }

/* Мобильный хедер: только гамбургер справа (как в оригинале Memos). Левое меню — фиксированная полоса. */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 3rem;
  padding: 0 1rem;
  background: var(--background);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.mobile-header-trigger {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem;
  min-height: 30px;
  min-width: 4px;
  border: none;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
  font: inherit;
  transition: background 0.15s, color 0.15s;
}
.mobile-header-trigger:hover { background: var(--muted); }
.mobile-header-trigger--back {
  justify-content: flex-start;
  gap: 0.35rem;
  padding: 0 0.55rem;
  margin-left: 0.25rem;
}
.mobile-header-trigger--back span {
  font-size: 0.95rem;
  line-height: 1;
}
.mobile-header-trigger--back[hidden] { display: none !important; }
.mobile-header-spacer { flex: 1; }
.mobile-header-trigger--left { justify-content: flex-start; }
.mobile-header-trigger:not(.mobile-header-trigger--left) { justify-content: flex-end; }
.mobile-header-logo-text {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--foreground);
  line-height: 1.2;
}
/* Правый drawer: календарь, поиск, теги (как в оригинале Memos) */
.sidebar-drawer {
  display: none;
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 1000;
  width: min(280px, 85vw);
  max-width: 320px;
  background: var(--background);
  border: none;
  box-shadow: var(--shadow-xl);
  overflow-y: auto;
  transition: transform 0.25s ease-out;
}
.sidebar-drawer--right {
  right: 0;
  left: auto;
  transform: translateX(100%);
  border-left: 1px solid var(--border);
}
.app.sidebar-open-right .sidebar-drawer--right { transform: translateX(0); }
.sidebar-panel--drawer {
  padding: 1rem;
  height: 100%;
}

/* Сайдбар как в Memos: узкая полоса (64px) + широкая панель (288px). Разделительная линия — как в оригинале: --border.
   Фиксированная высота экрана, чтобы аватар не съезжал вниз при длинной странице. */
.sidebar {
  display: flex;
  flex-shrink: 0;
  width: 22rem;
  height: 100vh;
  position: sticky;
  top: 0;
  align-self: flex-start;
  border-right: 1px solid var(--border);
  flex-direction: row;
}
.sidebar.sidebar--compact {
  width: 4rem !important;
  border-right: none !important;
}
/* На страницах attachments, inbox, messages, settings, profile, contacts, calendar, setup скрываем ширину sidebar-panel и границу */
.page-attachments .sidebar,
.page-lenta .sidebar,
.page-inbox .sidebar,
.page-messages .sidebar,
.page-stickers .sidebar,
.page-games .sidebar,
.page-impulses .sidebar,
.page-settings .sidebar,
.page-profile .sidebar,
.page-contacts .sidebar,
.page-calendar .sidebar,
.page-bot .sidebar,
.page-login .sidebar,
.page-register .sidebar,
.page-setup .sidebar {
  width: 4rem;
  border-right: none;
}
.page-settings .sidebar {
  width: auto !important;
  max-width: 4rem !important;
  border-right: none !important;
}
.page-games .sidebar {
  width: auto !important;
  max-width: 4rem !important;
  border-right: none !important;
}
.page-register .sidebar {
  width: auto !important;
  max-width: 4rem !important;
  border-right: none !important;
}
.page-settings #sidebar.sidebar {
  width: auto !important;
  max-width: 4rem !important;
  border-right: none !important;
}
.page-games #sidebar.sidebar {
  width: auto !important;
  max-width: 4rem !important;
  border-right: none !important;
}
.page-register #sidebar.sidebar {
  width: auto !important;
  max-width: 4rem !important;
  border-right: none !important;
}
.sidebar-strip {
  width: 4rem;
  min-width: 4rem;
  padding: 0.5rem 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}
.sidebar-panel {
  flex: 1;
  min-width: 0;
  width: 18rem;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  background: var(--background);
}
.explore-sections-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sidebar-panel .explore-sections-nav .sidebar-drawer-left-item,
.sidebar-panel--drawer .explore-sections-nav .sidebar-drawer-left-item {
  color: var(--foreground);
  border-color: var(--border);
  background: var(--muted);
  opacity: 1;
  padding: 0.375rem 0.625rem;
  gap: 0.5rem;
  font-size: 0.875rem;
}
.sidebar-panel .explore-sections-nav .sidebar-drawer-left-item:hover,
.sidebar-panel--drawer .explore-sections-nav .sidebar-drawer-left-item:hover {
  background: color-mix(in oklab, var(--muted) 65%, var(--card));
  color: var(--foreground);
}
.sidebar-panel .explore-sections-nav .sidebar-drawer-left-item svg,
.sidebar-panel--drawer .explore-sections-nav .sidebar-drawer-left-item svg {
  width: 18px;
  height: 18px;
}
.sidebar-panel .explore-sections-nav .sidebar-drawer-left-item.sidebar-drawer-left-item--active,
.sidebar-panel--drawer .explore-sections-nav .sidebar-drawer-left-item.sidebar-drawer-left-item--active {
  background: color-mix(in oklab, var(--primary) 16%, var(--card));
  border-color: color-mix(in oklab, var(--primary) 48%, var(--border));
  color: var(--foreground);
}
.logo {
  color: var(--sidebar-foreground);
  text-decoration: none;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-xl);
  transition: background 0.15s, color 0.15s;
}
.logo:hover { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }
.logo svg { display: block; }
.nav-icons {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}
.nav-item {
  color: var(--sidebar-foreground);
  text-decoration: none;
  padding: 0.5rem;
  border-radius: 1rem;
  background: transparent;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  box-sizing: border-box;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  opacity: 0.8;
  cursor: pointer;
}
.nav-item:hover {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
  border-color: var(--sidebar-border);
  opacity: 1;
}
.nav-item-active {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
  border-color: var(--sidebar-border);
  box-shadow: var(--shadow-sm);
  opacity: 1;
}
.nav-item svg { display: block; }
.sidebar-quick-create {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: 0.3rem;
}
.nav-item-add-trigger {
  border-radius: 999px;
  background: color-mix(in oklab, var(--primary) 20%, var(--sidebar));
  border-color: color-mix(in oklab, var(--primary) 45%, var(--sidebar-border));
  opacity: 1;
}
.nav-item-add-trigger:hover {
  background: color-mix(in oklab, var(--primary) 30%, var(--sidebar));
  border-color: color-mix(in oklab, var(--primary) 60%, var(--sidebar-border));
}
.sidebar-quick-create-menu {
  position: absolute;
  left: calc(100% + 10px);
  bottom: 0;
  min-width: 10.5rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--background);
  box-shadow: var(--shadow-md);
  display: none;
  z-index: 120;
}
.sidebar-quick-create-menu.is-open { display: block; }
.sidebar-quick-create-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  color: var(--foreground);
  text-decoration: none;
  font-size: 0.8125rem;
}
.sidebar-quick-create-item-icon { display: inline-flex; flex-shrink: 0; }
.sidebar-quick-create-item-icon svg { display: block; width: 0.95rem; height: 0.95rem; }
.sidebar-quick-create-item:hover { background: var(--muted); }
.nav-icon-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.nav-inbox-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 10px;
  font-weight: 600;
  border-radius: 9999px;
  border: 2px solid var(--sidebar);
}
.nav-item .nav-inbox-badge { border-color: var(--sidebar); }
.sidebar-drawer-left-item .nav-icon-wrap { display: inline-flex; }
.sidebar-drawer-left-item .nav-inbox-badge { border-color: var(--sidebar); }
.sidebar-strip-user {
  margin-top: auto;
  padding-top: 0.5rem;
}
.sidebar-user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  color: var(--sidebar-foreground);
  text-decoration: none;
  overflow: hidden;
  border: 1px solid var(--sidebar-border);
  transition: background 0.15s, opacity 0.15s;
}
.sidebar-user-avatar:hover {
  background: var(--sidebar-accent);
  opacity: 1;
}
.sidebar-user-avatar svg { display: block; }
.sidebar-user-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Меню пользователя при клике на аватар (как в оригинале Memos: Профиль, Настройки, Выйти) */
.user-menu-wrap { position: relative; display: inline-block; }
.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.25rem 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: opacity 0.15s, background 0.15s;
}
.user-menu-trigger.sidebar-user-avatar { width: 2.5rem; height: 2.5rem; min-width: 2.5rem; padding: 0; justify-content: center; }
.user-menu-trigger.sidebar-drawer-left-user-link { width: auto; min-width: 0; }
.user-menu-trigger:hover { opacity: 0.9; }
.user-menu-trigger.sidebar-user-avatar:hover { background: var(--sidebar-accent); }
.user-menu-dropdown {
  display: none;
  position: absolute;
  left: 0;
  bottom: 100%;
  margin-bottom: 0.25rem;
  min-width: 10rem;
  padding: 0.25rem;
  background: var(--popover);
  color: var(--popover-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 60;
}
.user-menu-dropdown--drawer {
  left: 0;
  bottom: 100%;
  margin-bottom: 0.5rem;
}
.user-menu-dropdown.is-open { display: block; }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.5rem 0.5rem 0.5rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--popover-foreground);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.user-menu-item:hover { background: var(--accent); color: var(--accent-foreground); }
.user-menu-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  color: var(--muted-foreground);
}
.user-menu-item-icon svg { display: block; }
.user-menu-wrap--drawer .user-menu-dropdown { background: var(--sidebar); color: var(--sidebar-foreground); border-color: var(--sidebar-border); }
.user-menu-wrap--drawer .user-menu-item { color: var(--sidebar-foreground); }
.user-menu-wrap--drawer .user-menu-item:hover { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }
.user-menu-wrap--drawer .user-menu-item-icon { color: var(--sidebar-foreground); opacity: 0.8; }
/* Поиск как в Memos: иконка лупы слева, фильтр справа */
.sidebar-search-form {
  margin-bottom: 0;
}
.sidebar-search {
  position: relative;
  margin-bottom: 0.75rem;
}
.sidebar-search-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  color: var(--muted-foreground);
  opacity: 0.6;
  pointer-events: none;
}
.sidebar-search-icon--search { left: 0; }
.sidebar-search-icon--filter {
  right: 0;
  pointer-events: auto;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.sidebar-search-icon--filter:hover { opacity: 1; }
.search-input {
  width: 100%;
  padding: 0.25rem 2rem 0.25rem 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--sidebar);
  font-size: 0.875rem;
  color: var(--foreground);
}
.search-input::placeholder { color: var(--muted-foreground); opacity: 0.8; }

/* Под полем поиска: отображение активного запроса (как в оригинале Memos — чип с текстом и сброс) */
.sidebar-search-active {
  display: none;
  margin-top: 0.375rem;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0.5rem;
  background: var(--accent);
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 0.875rem;
  line-height: 1.5rem;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.375rem;
}
.sidebar-search-active[aria-hidden="false"] {
  display: flex;
}
.sidebar-search-active-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--foreground);
  opacity: 0.9;
}
.sidebar-search-active-query {
  font-weight: 500;
}
.sidebar-search-active-remove {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-search-active-remove:hover {
  color: var(--destructive);
  background: var(--destructive);
  background: color-mix(in srgb, var(--destructive) 12%, transparent);
}

/* Календарь в сайдбаре как в Memos */
.sidebar-calendar { margin-top: 0.75rem; }
.sidebar-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.sidebar-calendar-month { font-size: 0.8125rem; font-weight: 600; color: var(--foreground); }
.sidebar-calendar-nav { display: flex; gap: 0.25rem; }
.sidebar-calendar-prev,
.sidebar-calendar-next {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}
.sidebar-calendar-prev:hover,
.sidebar-calendar-next:hover { background: var(--muted); color: var(--foreground); }
.sidebar-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
  margin-bottom: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted-foreground);
  opacity: 0.7;
  text-align: center;
}
.sidebar-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
}
.sidebar-calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--foreground);
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid transparent;
  cursor: default;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sidebar-calendar-day--other {
  color: var(--muted-foreground);
  opacity: 0.5;
}
.sidebar-calendar-day--today {
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 600;
  opacity: 1;
}
/* Подсветка дней с заметками в зависимости от количества */
.sidebar-calendar-day--has-notes {
  cursor: pointer;
}
.sidebar-calendar-day--has-notes.sidebar-calendar-day--intensity-high {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: transparent;
}
.sidebar-calendar-day--has-notes.sidebar-calendar-day--intensity-medium {
  background: oklch(0.45 0.08 45 / 0.85);
  color: var(--primary-foreground);
  border-color: transparent;
}
.sidebar-calendar-day--has-notes.sidebar-calendar-day--intensity-low {
  background: oklch(0.45 0.08 45 / 0.70);
  color: var(--primary-foreground);
  border-color: transparent;
}
.sidebar-calendar-day--has-notes.sidebar-calendar-day--intensity-minimal {
  background: oklch(0.45 0.08 45 / 0.50);
  color: var(--foreground);
  border-color: transparent;
}
.sidebar-calendar-day--has-notes:not(.sidebar-calendar-day--today):hover {
  background: var(--muted);
  opacity: 0.9;
}
.sidebar-calendar-day--has-notes.sidebar-calendar-day--today {
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 600;
  opacity: 1;
}
.sidebar-calendar-day--selected {
  border: 2px solid var(--primary);
  font-weight: 600;
}
.sidebar-calendar-day:not(.sidebar-calendar-day--other):not(.sidebar-calendar-day--today):not(.sidebar-calendar-day--has-notes):hover {
  background: var(--muted);
}

.sidebar-section { margin-top: 1rem; }
.sidebar-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.sidebar-section-head span { font-size: 0.875rem; font-weight: 500; color: var(--muted-foreground); }
.sidebar-tags-section {
  margin-top: 0.75rem;
}
.sidebar-quick-links {
  margin-top: 0.5rem;
}
.sidebar-quick-links-sep {
  height: 1px;
  background: var(--border);
  opacity: 0.45;
  margin: 0.25rem 0 0.55rem;
}
.sidebar-quick-links-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.sidebar-quick-link {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.35rem;
}
.sidebar-quick-link:hover {
  color: var(--foreground);
  background: var(--muted);
}
.sidebar-tags-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  line-height: 1.4;
}
.sidebar-tags-hint code { font-size: 0.7rem; background: var(--muted); padding: 0.1rem 0.25rem; border-radius: 2px; }
.sidebar-tags-menu-btn {
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  transition: background 0.2s, color 0.2s;
  position: relative;
}
.sidebar-tags-menu-btn:hover {
  background: var(--muted);
  color: var(--foreground);
}

/* Popover для настроек тегов */
.sidebar-tags-popover {
  position: absolute;
  z-index: 60;
  width: auto;
  min-width: 200px;
  background: var(--popover, var(--card));
  color: var(--popover-foreground, var(--foreground));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  outline: none;
}
.sidebar-tags-popover.open {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
.sidebar-tags-popover.open * {
  pointer-events: auto;
}
.sidebar-tags-popover-item {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem;
  width: 100%;
}
.sidebar-tags-popover-item span {
  font-size: 0.875rem;
  flex-shrink: 0;
  color: var(--foreground);
}

/* Switch переключатель */
.sidebar-tags-switch {
  position: relative;
  display: inline-flex;
  height: 1.15rem;
  width: 2rem;
  flex-shrink: 0;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid transparent;
  background: var(--input);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  padding: 0;
  margin: 0;
  pointer-events: auto !important;
  user-select: none;
}
.sidebar-tags-switch:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.sidebar-tags-switch.checked {
  background: var(--primary);
}
.sidebar-tags-switch-thumb {
  display: block;
  width: 1rem;
  height: 1rem;
  border-radius: 9999px;
  background: var(--background);
  transition: transform 0.2s;
  transform: translateX(0);
  pointer-events: none;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}
.sidebar-tags-switch.checked .sidebar-tags-switch-thumb {
  transform: translateX(calc(100% - 2px));
}
.sidebar-tags-container {
  width: 100%;
}
.sidebar-tags-list {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem 0.5rem;
  width: 100%;
  position: relative;
}
.sidebar-tags-list svg {
  color: inherit;
}
.sidebar-tag-item {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 0;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.5rem;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: opacity 0.2s, color 0.2s;
  user-select: none;
  flex-shrink: 0;
  width: auto;
  max-width: 100%;
}
.sidebar-tag-item > svg:first-child {
  order: 1;
  flex-shrink: 0;
}
.sidebar-tag-item > .sidebar-tag-item-text {
  order: 2;
}
.sidebar-tag-item:hover {
  opacity: 0.8;
}
.sidebar-tag-item.active {
  color: var(--primary);
}
.sidebar-tag-item.active span {
  font-weight: 500;
}
.sidebar-tag-item svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  display: block;
  color: inherit;
  vertical-align: middle;
}
.sidebar-tag-item svg line {
  stroke: currentColor;
  stroke-width: 2;
}
.sidebar-tag-item.active svg {
  color: var(--primary);
}
.sidebar-tag-item:not(.active) svg {
  color: var(--muted-foreground);
}
.sidebar-tag-item-text {
  display: inline-flex;
  flex-wrap: nowrap;
  margin-left: 0.125rem;
  gap: 0.125rem;
  max-width: calc(100% - 1rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-tag-item-count {
  font-size: 0.875rem;
  opacity: 0.6;
  flex-shrink: 0;
}
.sidebar-tag-tree {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.sidebar-tag-tree-item {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0;
  margin-top: 1px;
  font-size: 0.875rem;
  line-height: 1.5rem;
  color: var(--muted-foreground);
  user-select: none;
  flex-shrink: 0;
}
.sidebar-tag-tree-item > div:first-child {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
  margin-right: 0.25rem;
  cursor: pointer;
  transition: color 0.2s;
}
.sidebar-tag-tree-item > div:first-child svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  display: block;
  margin-right: 0.25rem;
  color: inherit;
  vertical-align: middle;
}
.sidebar-tag-tree-item > div:first-child svg line {
  stroke: currentColor;
  stroke-width: 2;
}
.sidebar-tag-tree-item.active > div:first-child {
  color: var(--primary);
}
.sidebar-tag-tree-item.active > div:first-child span {
  font-weight: 500;
}
.sidebar-tag-tree-toggle {
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s;
  cursor: pointer;
  border-radius: var(--radius);
}
/* Классы для поворота шеврона как в оригинале */
.rotate-0 {
  transform: rotate(0deg);
}
.rotate-90 {
  transform: rotate(90deg);
}
.sidebar-tag-tree-toggle svg,
.rotate-0 svg,
.rotate-90 svg {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--muted-foreground);
  transition: color 0.2s;
}
.sidebar-tag-tree-toggle:hover svg,
.rotate-0:hover svg,
.rotate-90:hover svg {
  color: var(--foreground);
}
.sidebar-tag-tree-children {
  width: calc(100% - 0.5rem);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  height: auto;
  margin-left: 0.5rem;
  padding-left: 0.5rem;
  border-left: 2px solid var(--border);
}
.sidebar-tag-tree-children.hidden {
  display: none !important;
}
/* Теги в контенте заметок */
.memo-content-wrap .memo-tag {
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s;
}
.memo-content-wrap .memo-tag:hover {
  opacity: 0.8;
  text-decoration: underline;
}
.memo-content-wrap .memo-tag.active {
  font-weight: 600;
  opacity: 1;
}

/* Попап автодополнения тегов */
.tag-suggestions-popup {
  position: absolute;
  z-index: 10000;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 12rem;
  max-height: 15rem;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.25rem;
  font-family: monospace;
  font-size: 0.875rem;
}

.tag-suggestion-item {
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s;
  color: var(--foreground);
}

.tag-suggestion-item:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.tag-suggestion-item.selected {
  background: var(--accent);
  color: var(--accent-foreground);
}

.main-area { display: flex; flex-direction: column; }

/* Карточка создания заметки как в оригинальном Memos */
.create-memo.create-memo-card {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  background: var(--card);
  padding: 0.75rem 1rem 0.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.create-memo.create-memo-card:focus-within { box-shadow: var(--shadow-sm); }
.memo-form { width: 100%; }
.memo-form-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.memo-form-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  flex: 1;
}
/* Область редактора: max-height как в Memos (50vh) */
.memo-editor-content {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  position: relative;
  width: 100%;
  background: inherit;
  height: auto;
  max-height: 50vh;
}
.memo-editor-content textarea {
  width: 100%;
  margin: 0.25rem 0;
  padding: 0;
  font-size: 1rem;
  line-height: 1.5;
  resize: none;
  overflow-x: hidden;
  overflow-y: auto;
  background: transparent;
  border: none;
  outline: none;
  font: inherit;
  color: var(--foreground);
  min-height: 1.5em;
}
.memo-editor-content textarea::placeholder { color: var(--muted-foreground); opacity: 0.7; }
.memo-editor-content textarea { white-space: pre-wrap; word-break: break-word; }
.memo-form-footer { width: 100%; display: flex; flex-direction: column; gap: 0.5rem; }

/* Фильтры заметок (активные теги) */
.memo-filters {
  width: 100%;
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.memo-filter-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 1.75rem;
  padding: 0 0.625rem;
  background: var(--accent);
  background-opacity: 0.5;
  border: 1px solid var(--border);
  border-opacity: 0.5;
  border-radius: 9999px;
  font-size: 0.875rem;
  transition: all 0.2s;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.memo-filter-item:hover {
  background: var(--accent);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}
.memo-filter-icon {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--muted-foreground);
  flex-shrink: 0;
}
.memo-filter-text {
  color: var(--foreground);
  opacity: 0.8;
  font-weight: 500;
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.memo-filter-remove {
  margin-left: 0.125rem;
  margin-right: -0.25rem;
  padding: 0.125rem;
  color: var(--muted-foreground);
  opacity: 0.6;
  background: transparent;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.memo-filter-remove:hover {
  color: var(--destructive);
  background: var(--destructive);
  opacity: 0.1;
  opacity: 1;
}
.memo-filter-remove svg {
  width: 0.75rem;
  height: 0.75rem;
}
.memo-form-toolbar {
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.memo-form-left { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 0.25rem; }
.memo-form-right { display: flex; flex-direction: row; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 0.5rem; min-width: 0; }
.memo-form-file-input { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; clip: rect(0,0,0,0); }
.memo-edit-file-input { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; clip: rect(0,0,0,0); }

/* Кнопка «+» как в Memos (size-8, shadow-none) */
.btn-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--background);
  color: var(--foreground);
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s, color 0.15s;
}
.btn-add:hover { background: var(--accent); color: var(--accent-foreground); }
.btn-add-svg { width: 1rem; height: 1rem; flex-shrink: 0; display: block; }
.btn-add-icon { font-size: 1.25rem; line-height: 1; font-weight: 300; }

/* Выпадающее меню кнопки «+»: вложение и связать с заметкой */
.add-menu-wrap { position: relative; display: inline-flex; }
.add-menu-dropdown {
  position: absolute;
  left: 0;
  top: calc(100% + 0.25rem);
  z-index: 50;
  min-width: 14rem;
  padding: 0.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: none;
}
.add-menu-dropdown.is-open { display: block; }
.add-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 0.8125rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.add-menu-item:hover { background: var(--muted); }
.add-menu-icon { display: inline-flex; flex-shrink: 0; opacity: 0.8; }
.add-menu-icon svg { display: block; width: 1rem; height: 1rem; }

/* Блок выбранных связей в форме (как в оригинале Memos: RelationList) */
.memo-form-relations-block {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 20%, transparent);
  overflow: hidden;
}
.memo-relations-editor-header {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.5rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 30%, transparent);
}
.memo-relations-editor-icon {
  flex-shrink: 0;
  color: var(--muted-foreground);
  width: 0.875rem;
  height: 0.875rem;
}
.memo-relations-editor-title {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.memo-relations-editor-list {
  padding: 0.25rem 0.375rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.memo-relations-editor-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border-radius: var(--radius);
  padding: 0.25rem 0.25rem 0.25rem 0.375rem;
  transition: background 0.15s;
}
.memo-relations-editor-item:hover { background: color-mix(in oklch, var(--accent) 20%, transparent); }
.memo-relations-editor-item-content {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  flex: 1;
}
.memo-relations-editor-badge {
  font-size: 0.5rem;
  font-family: var(--font-mono);
  padding: 0.125rem 0.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 40%, transparent);
  flex-shrink: 0;
  color: var(--muted-foreground);
}
.memo-relations-editor-item:hover .memo-relations-editor-badge {
  background: color-mix(in oklch, var(--accent) 30%, transparent);
}
.memo-relations-editor-snippet {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.memo-relations-editor-item:hover .memo-relations-editor-snippet { color: var(--foreground); }
.memo-relations-editor-remove {
  padding: 0.25rem;
  margin-left: 0.125rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.memo-relations-editor-item:hover .memo-relations-editor-remove {
  opacity: 1;
}
.memo-relations-editor-remove:hover {
  background: color-mix(in oklch, var(--destructive) 10%, transparent);
  color: var(--destructive);
}

/* Блок вложений в форме создания заметки и в форме редактирования */
.memo-form-attachments-block {
  width: 100%;
  margin-top: 0.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 20%, transparent);
  overflow: visible;
  pointer-events: auto;
}
.memo-card--editing .memo-form-attachments-block,
.memo-edit-inline .memo-form-attachments-block {
  overflow: visible;
  pointer-events: auto;
}
.memo-card--editing .memo-attachments-editor-list,
.memo-edit-inline .memo-attachments-editor-list {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-height: 0;
  overflow: visible;
  pointer-events: auto;
}
.memo-attachments-editor-header {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.5rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 30%, transparent);
}
.memo-attachments-editor-icon {
  flex-shrink: 0;
  color: var(--muted-foreground);
  width: 0.875rem;
  height: 0.875rem;
}
.memo-attachments-editor-title {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.memo-attachments-editor-list {
  padding: 0.25rem 0.375rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-height: 0;
  overflow: visible;
}
.memo-attachments-editor-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 2.5rem;
  border-radius: var(--radius);
  padding: 0.25rem 0.25rem 0.25rem 0.375rem;
  transition: background 0.15s;
  box-sizing: border-box;
}
.memo-attachments-editor-item:hover { background: color-mix(in oklch, var(--accent) 20%, transparent); }
.memo-attachments-editor-thumb {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: color-mix(in oklch, var(--muted) 40%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.memo-attachments-editor-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.memo-attachments-editor-thumb--file {
  border: 1px dashed var(--border);
}
.memo-attachments-editor-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
}
.memo-attachments-editor-item-name {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.memo-attachments-editor-item:hover .memo-attachments-editor-item-name { color: var(--foreground); }
.memo-attachments-editor-item-meta {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  opacity: 0.9;
}
.memo-attachments-editor-remove {
  padding: 0.25rem;
  margin-left: 0.125rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity 0.15s;
  pointer-events: auto;
}
.memo-attachments-editor-item:hover .memo-attachments-editor-remove { opacity: 1; }
.memo-attachments-editor-remove:hover {
  background: color-mix(in oklch, var(--destructive) 10%, transparent);
  color: var(--destructive);
}

/* Модальное окно выбора заметки для связи — выше меню редактирования (9999) */
.link-memo-dialog-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.35);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: none;
}
.link-memo-dialog-overlay.is-open {
  display: flex;
  pointer-events: auto;
}
.link-memo-dialog {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 28rem;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.link-memo-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.link-memo-dialog-title { margin: 0; font-size: 1rem; font-weight: 600; }
.link-memo-dialog-close {
  padding: 0.25rem;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}
.link-memo-dialog-close:hover { color: var(--foreground); }
.link-memo-dialog-body { padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; overflow: hidden; }
.link-memo-search-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.875rem;
}
.link-memo-list-wrap { position: relative; min-height: 8rem; max-height: 18rem; overflow: hidden; display: flex; flex-direction: column; width: 100%; }
.link-memo-list { overflow-y: auto; display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); width: 100%; }
.link-memo-list-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.75rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--foreground);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.link-memo-list-item:last-child { border-bottom: none; }
.link-memo-list-item:hover { background: var(--accent); color: var(--accent-foreground); }
.link-memo-item-time { font-size: 0.7rem; color: var(--muted-foreground); margin-bottom: 0.2rem; }
.link-memo-item-snippet { font-size: 0.8125rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; width: 100%; }
.link-memo-item-attachments {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
  min-height: 1.5rem;
}
.link-memo-att-thumb {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.35rem;
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: color-mix(in oklch, var(--muted) 45%, transparent);
}
.link-memo-att-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.link-memo-att-file,
.link-memo-att-more {
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.35rem;
  border-radius: 0.35rem;
  border: 1px solid var(--border);
  font-size: 0.625rem;
  line-height: 1.45rem;
  text-align: center;
  color: var(--muted-foreground);
  background: color-mix(in oklch, var(--muted) 35%, transparent);
  flex-shrink: 0;
}
.link-memo-att-file {
  max-width: 3.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.link-memo-att-more {
  font-weight: 700;
}
.link-memo-list-empty,
.link-memo-list-loading { padding: 2rem; text-align: center; font-size: 0.875rem; color: var(--muted-foreground); }

/* Блок напоминания в форме создания заметки */
.memo-form-reminder-block {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 20%, transparent);
  overflow: hidden;
}
.memo-reminder-editor-header {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.5rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 30%, transparent);
}
.memo-reminder-editor-icon-wrap {
  flex-shrink: 0;
  color: var(--muted-foreground);
  display: inline-flex;
}
.memo-reminder-editor-icon-wrap svg { width: 0.875rem; height: 0.875rem; }
.memo-reminder-editor-title {
  flex: 1;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.memo-reminder-editor-remove {
  padding: 0.25rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity 0.15s;
}
.memo-reminder-editor-remove:hover {
  background: color-mix(in oklch, var(--destructive) 10%, transparent);
  color: var(--destructive);
}
.memo-reminder-editor-value {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--foreground);
}

/* Модальное окно выбора даты/времени напоминания */
.reminder-dialog-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.35);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: none;
}
.reminder-dialog-overlay.is-open {
  display: flex;
  pointer-events: auto;
}
.reminder-dialog {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 22rem;
  display: flex;
  flex-direction: column;
}
.reminder-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.reminder-dialog-title { margin: 0; font-size: 1rem; font-weight: 600; }
.reminder-dialog-close {
  padding: 0.25rem;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}
.reminder-dialog-close:hover { color: var(--foreground); }
.reminder-dialog-body {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.reminder-dialog-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}
.reminder-dialog-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.reminder-dialog-row-time { gap: 0.25rem; }
.reminder-dialog-label {
  flex-shrink: 0;
  font-size: 0.875rem;
  min-width: 3.5rem;
}
.reminder-dialog-label-min { min-width: 3rem; }
.reminder-dialog-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.875rem;
}
.reminder-dialog-input-num {
  width: 3.5rem;
  flex: none;
  text-align: center;
}
.reminder-dialog-time-sep { font-size: 1.125rem; color: var(--muted-foreground); }
.reminder-dialog-error {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--destructive);
}
.reminder-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.reminder-dialog-btn-cancel,
.reminder-dialog-btn-confirm {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--foreground);
}
.reminder-dialog-btn-cancel:hover { background: var(--muted); }
.reminder-dialog-btn-confirm {
  background: var(--accent);
  color: var(--accent-foreground);
  border-color: var(--accent);
}
.reminder-dialog-btn-confirm:hover { opacity: 0.9; }

/* Модалка выбора времени в боте — адаптив */
.bot-reminder-dialog {
  max-width: min(22rem, calc(100vw - 2rem));
}
@media (max-width: 480px) {
  #bot-reminder-time-overlay {
    padding: 0.75rem;
    align-items: flex-end;
  }
  #bot-reminder-time-overlay .bot-reminder-dialog {
    max-width: none;
    width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}

.reminder-recurring-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.reminder-recurring-btn:hover {
    background: var(--muted);
    color: var(--foreground);
    border-color: var(--accent);
}
.recurrence-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.recurrence-dialog-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}
.recurrence-type-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.recurrence-type-btn {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--foreground);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
    font-size: 0.875rem;
}
.recurrence-type-btn:hover {
    background: var(--muted);
    border-color: var(--accent);
}
.memo-reminder-editor-actions {
    margin-top: 0.5rem;
}

/* Модальное окно подтверждения удаления */
.delete-confirm-dialog-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.35);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: none;
}
.delete-confirm-dialog-overlay.is-open {
  display: flex;
  pointer-events: auto;
}
.delete-confirm-dialog {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 28rem;
  display: flex;
  flex-direction: column;
}
.delete-confirm-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.delete-confirm-dialog-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.delete-confirm-dialog-body {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.delete-confirm-dialog-description {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.5;
}
.delete-confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.delete-confirm-dialog-btn-cancel,
.delete-confirm-dialog-btn-confirm {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: opacity 0.15s, background 0.15s;
}
.delete-confirm-dialog-btn-cancel {
  background: transparent;
  color: var(--foreground);
}
.delete-confirm-dialog-btn-cancel:hover {
  background: var(--muted);
}
.delete-confirm-dialog-btn-confirm {
  background: var(--destructive);
  color: var(--destructive-foreground);
  border-color: var(--destructive);
}
.delete-confirm-dialog-btn-confirm:hover {
  opacity: 0.9;
}
.delete-confirm-dialog-btn-confirm:disabled,
.delete-confirm-dialog-btn-cancel:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Блок связанных заметок в карточке (как в оригинале Memos: RelationList + RelationCard) */
.memo-relations-card {
  width: 100%;
  margin-top: 0.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 20%, transparent);
  overflow: hidden;
}
.memo-relations-card-header {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 30%, transparent);
}
.memo-relations-card-icon {
  flex-shrink: 0;
  color: var(--muted-foreground);
  width: 0.875rem;
  height: 0.875rem;
}
.memo-relations-card-title {
  font-size: 0.75rem;
  color: var(--foreground);
}
.memo-relations-card-list {
  padding: 0.375rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.memo-relations-card-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.memo-relations-card-item:hover {
  color: var(--foreground);
  background: color-mix(in oklch, var(--accent) 20%, transparent);
}
.memo-relations-card-badge {
  font-size: 0.5rem;
  font-family: var(--font-mono);
  padding: 0.125rem 0.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 40%, transparent);
  flex-shrink: 0;
  color: var(--muted-foreground);
}
.memo-relations-card-item:hover .memo-relations-card-badge {
  background: color-mix(in oklch, var(--accent) 30%, transparent);
}
.memo-relations-card-snippet {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Блок вложений в карточке заметки */
.memo-attachments-card {
  width: 100%;
  margin-top: 0.8rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 20%, transparent);
  overflow: visible;
  pointer-events: auto;
}
.memo-attachments-card-header {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 30%, transparent);
}
.memo-attachments-card-icon {
  flex-shrink: 0;
  color: var(--muted-foreground);
  width: 0.875rem;
  height: 0.875rem;
}
.memo-attachments-card-title {
  font-size: 0.75rem;
  color: var(--foreground);
}
.memo-attachments-card-list {
  padding: 0.375rem;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}
.memo-attachments-card-item {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.memo-attachments-card-item:hover {
  color: var(--accent);
  background: color-mix(in oklch, var(--accent) 20%, transparent);
}
.memo-attachments-card-photo-wrap {
  flex-shrink: 0;
}
.memo-attachments-card-photo-link {
  display: block;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 20%, transparent);
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  text-align: left;
  width: 100%;
  pointer-events: auto;
}
.memo-attachments-card-photo-link:hover {
  border-color: var(--accent);
}
.memo-attachments-card-photo {
  display: block;
  max-width: 280px;
  max-height: 240px;
  width: auto;
  height: auto;
  object-fit: contain;
  vertical-align: middle;
}

/* Лайтбокс просмотра фото (как в оригинальной сборке) */
.image-preview-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}
.image-preview-overlay.is-open {
  display: flex;
}
.image-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}
.image-preview-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2001;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.image-preview-close:hover {
  background: rgba(255, 255, 255, 0.25);
}
.image-preview-content {
  position: relative;
  z-index: 2001;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.image-preview-content .image-preview-img {
  max-width: 100%;
  max-height: calc(100vh - 2rem);
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: auto;
}

/* Селектор видимости как в Memos: кнопка + выпадающая панель */
.visibility-dropdown-wrap { position: relative; }
.visibility-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.visibility-trigger:hover { opacity: 1; }
.visibility-trigger-icon,
.visibility-option-icon { display: inline-flex; flex-shrink: 0; opacity: 0.6; }
.visibility-trigger-icon svg,
.visibility-option-icon svg { display: block; }
.visibility-trigger-chevron { width: 1rem; height: 1rem; margin-left: 0.125rem; opacity: 0.6; display: inline-block; }
.visibility-dropdown {
  position: absolute;
  left: 0;
  top: calc(100% + 0.25rem);
  z-index: 50;
  min-width: 12rem;
  padding: 0.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: none;
}
.visibility-dropdown.is-open { display: block; }
/* При редактировании заметки список видимости поверх карточки (не обрезается) */
.memo-edit-visibility-dropdown.is-open {
  position: fixed;
  z-index: 9999;
  left: var(--vis-dropdown-fixed-left, 0);
  top: var(--vis-dropdown-fixed-top, 0);
}
.visibility-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 0.8125rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.visibility-option:hover { background: var(--muted); }
.visibility-option-text { flex: 1; }
.visibility-option-check {
  flex-shrink: 0;
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
}
.memo-meta-left { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.memo-visibility-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  color: var(--muted-foreground);
  opacity: 0.85;
  flex-shrink: 0;
  cursor: default;
}
.memo-meta-right .memo-visibility-indicator,
.memo-actions .memo-visibility-indicator {
  width: 1rem;
  height: 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.memo-meta-right .memo-visibility-indicator:hover,
.memo-actions .memo-visibility-indicator:hover { opacity: 0.8; }
.memo-visibility-indicator svg { display: block; }
.memo-visibility-indicator:hover { opacity: 1; }
.memo-meta-right .memo-visibility-indicator svg,
.memo-actions .memo-visibility-indicator svg { width: 1rem; height: 1rem; }

.memo-comment-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-width: 1rem;
  height: 1rem;
  color: var(--muted-foreground);
  opacity: 0.85;
  text-decoration: none;
  border-radius: var(--radius-md);
}
.memo-comment-indicator:hover {
  color: var(--foreground);
  opacity: 1;
}
.memo-comment-indicator-icon {
  display: block;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}
.memo-comment-indicator-count {
  font-size: 0.75rem;
  line-height: 1;
  min-width: 0.75rem;
  text-align: left;
}

.memo-visibility-badge {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  background: var(--muted);
}
.btn-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  padding: 0 0.75rem;
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  transition: opacity 0.15s;
}
.btn-save:hover { opacity: 0.9; }
.btn-save:active { opacity: 0.85; }
.btn-save:disabled { opacity: 0.5; pointer-events: none; cursor: not-allowed; }

/* Explore — как в оригинале Memos: слева аватар + колонка (имя автора, время), справа реакции + видимость + меню */
.memo-meta-left--explore {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.explore-avatar {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--muted);
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
}
.explore-avatar:hover { opacity: 0.9; }
.explore-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.explore-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.explore-avatar-placeholder svg { display: block; }
.explore-creator-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 0.125rem;
  min-width: 0;
}
.explore-creator-line {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  max-width: 100%;
}
.memo-card--explore .explore-creator {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: none;
  line-height: 1.2;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.memo-card--explore .explore-creator:hover { color: var(--foreground); }
.explore-creator-line .messages-verified-badge {
  margin-top: 0;
}
.memo-time-btn--explore {
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--muted-foreground);
  text-decoration: none;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: color 0.15s;
  -webkit-user-select: none;
  user-select: none;
}
.memo-time-btn--explore:hover { color: var(--foreground); }
.memo-card--explore .memo-meta-left { gap: 0.5rem; }
.memo-card--explore .memo-reactions:empty { display: none; }

/* Лента: общие стили для /lenta и блока Ленты в профиле */
.lenta-feed-wrap {
  display: grid;
  gap: 0.625rem;
  min-width: 0;
}
.lenta-feed-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.lenta-feed-tab {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  border-radius: 999px;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  cursor: pointer;
}
.lenta-feed-tab.is-active { border-color: var(--foreground); }

.lenta-post-share-actions {
  display: flex;
  gap: 0.375rem;
  margin-top: 0.625rem;
}
.lenta-post-share-btn {
  width: 1.875rem;
  height: 1.875rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted-foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.lenta-post-share-btn:hover { color: var(--foreground); }
.lenta-post-share-btn[data-action="toggle-comments"] {
  width: auto;
  min-width: 30px;
  padding: 0 8px;
  gap: 2px;
}
.lenta-post-share-btn .lenta-comment-count {
  font-size: 11px;
  line-height: 1;
  margin-left: 4px;
  min-width: 10px;
}

.lenta-post-footer-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.lenta-post-footer-row .memo-reactions {
  margin-top: 0;
  flex: 1 1 auto;
}
.lenta-post-footer-right {
  flex: 0 0 auto;
  margin-left: auto;
  display: flex;
  justify-content: flex-end;
}
.lenta-post-footer-right .lenta-post-share-actions { margin-top: 0; }

.lenta-photo-gallery {
  margin-top: 0.625rem;
  border-radius: 0.75rem;
  overflow: hidden;
  background: var(--card);
  width: 100%;
  min-width: 0;
}
.lenta-photo-gallery-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  background: var(--border);
}
.lenta-photo-gallery-main--single { grid-template-columns: 1fr; }
.lenta-photo-gallery-main--single .lenta-photo-main-btn {
  width: 100%;
  height: clamp(260px, 46vw, 420px);
  background: var(--muted);
  padding: 0;
}
.lenta-photo-main-btn,
.lenta-photo-thumb-btn {
  border: 0;
  padding: 0;
  margin: 0;
  background: var(--muted);
  cursor: pointer;
  min-width: 0;
}
.lenta-photo-main-btn { position: relative; }
.lenta-photo-main-btn img {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
}
.lenta-photo-gallery-main--single .lenta-photo-main-btn img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  object-fit: cover;
  object-position: center center;
}
.lenta-photo-thumbs {
  display: grid;
  grid-template-columns: repeat(var(--thumb-count, 1), minmax(0, 1fr));
  gap: 2px;
}
.lenta-photo-thumb-btn img {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  opacity: 0.9;
}
.lenta-photo-thumb-btn:hover img { opacity: 1; }

.page-lenta #lenta-posts,
.page-profile #profile-lenta-posts {
  min-width: 0;
}
.page-profile #profile-lenta-posts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.page-lenta #lenta-posts .memo-card,
.page-profile #profile-lenta-posts .memo-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
@media (min-width: 900px) {
  .page-profile #profile-lenta-posts {
    grid-template-columns: 1fr;
    align-items: start;
  }
}
.page-lenta #lenta-posts .memo-content,
.page-profile #profile-lenta-posts .memo-content,
.page-lenta #lenta-posts .memo-attachments-card-item,
.page-profile #profile-lenta-posts .memo-attachments-card-item {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 768px) {
  .lenta-post-footer-row { align-items: flex-start; }
  .lenta-photo-thumbs {
    display: grid;
    grid-template-columns: repeat(var(--thumb-count, 1), minmax(0, 1fr));
    gap: 2px;
    overflow-x: visible;
    padding: 0;
  }
  .lenta-photo-thumb-btn { min-width: 0; }
  .lenta-photo-gallery-main--single .lenta-photo-main-btn { height: clamp(220px, 62vw, 340px); }
  /* Мобильная лента: посты не выходят за экран */
  .page-lenta .main-area {
    min-width: 0;
  }
  .page-lenta .create-memo.create-memo-card {
    min-width: 0;
    max-width: 100%;
  }
  .page-lenta #lenta-posts {
    min-width: 0;
    max-width: 100%;
  }
  .page-lenta .lenta-feed-wrap {
    min-width: 0;
  }
  .page-lenta #lenta-posts .memo-card {
    box-sizing: border-box;
    max-width: 100%;
  }
  .page-lenta #lenta-posts .memo-meta {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .page-lenta #lenta-posts .memo-meta-left {
    flex: 1 1 0;
    max-width: 100%;
    min-width: 0;
  }
  .page-lenta #lenta-posts .memo-meta-right {
    margin-left: auto;
    min-width: 0;
  }
  .page-lenta #lenta-posts .memo-content-wrap {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
  }
  .page-lenta #lenta-posts .memo-content {
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
  }
  .page-lenta #lenta-posts .memo-meta,
  .page-lenta #lenta-posts .memo-meta-left,
  .page-lenta #lenta-posts .memo-meta-right,
  .page-lenta #lenta-posts .explore-creator-block,
  .page-lenta #lenta-posts .memo-attachments-card,
  .page-lenta #lenta-posts .memo-attachments-card-list,
  .page-lenta #lenta-posts .memo-relations-card,
  .page-lenta #lenta-posts .memo-relations-card-list,
  .page-lenta #lenta-posts .memo-relations-card-item {
    min-width: 0;
    max-width: 100%;
  }
  .page-lenta #lenta-posts .memo-time-btn--explore {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .page-lenta #lenta-posts .memo-relations-card-snippet {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
  }
  .page-lenta #lenta-posts .lenta-photo-gallery,
  .page-lenta #lenta-posts .lenta-photo-gallery-main,
  .page-lenta #lenta-posts .lenta-photo-thumbs,
  .page-lenta #lenta-posts .lenta-photo-main-btn,
  .page-lenta #lenta-posts .lenta-photo-thumb-btn {
    min-width: 0;
    max-width: 100%;
  }
  .page-lenta #lenta-posts .memo-attachments-card-item {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .page-lenta #lenta-posts .lenta-post-footer-row {
    flex-wrap: wrap;
  }
  .page-lenta #lenta-posts .lenta-post-footer-right {
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
  }
  .page-lenta .lenta-photo-gallery,
  .page-lenta .lenta-photo-gallery img {
    max-width: 100%;
  }
}

/* Profile — как в оригинале Memos (UserProfile.tsx) */
.main-area--profile { padding-top: 0; }
.profile-header {
  border-bottom: 1px solid color-mix(in oklch, var(--border) 10%, transparent);
  padding: 2rem 1rem;
}
@media (min-width: 640px) {
  .profile-header { padding-left: 1.5rem; padding-right: 1.5rem; }
}
.profile-header-inner {
  max-width: 42rem;
}
.page-profile .profile-header-inner {
  max-width: 56rem;
  margin: 0 auto;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
@media (min-width: 640px) {
  .profile-header-inner { gap: 1.5rem; }
}
.profile-avatar {
  width: 5rem;
  height: 5rem;
  min-width: 5rem;
  flex-shrink: 0;
  border-radius: 9999px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.profile-avatar svg { display: block; }
.profile-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-description {
  font-size: 0.875rem;
  color: color-mix(in oklch, var(--foreground) 70%, transparent);
  margin: 0;
  line-height: 1.4;
  max-width: 32rem;
}

.profile-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.profile-name-block { display: flex; flex-direction: column; gap: 0; }
.profile-name-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.profile-name { font-size: 1.5rem; font-weight: 700; margin: 0; color: var(--foreground); }
.profile-name-block .profile-username { margin-top: 0; }
.profile-header-menu-wrap { position: relative; display: inline-flex; }
.profile-header-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--background);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.profile-header-menu-trigger:hover { background: var(--accent); color: var(--accent-foreground); }
.profile-header-menu-trigger svg { display: block; width: 1rem; height: 1rem; }
.profile-header-menu {
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  display: none;
  min-width: 11rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--background);
  box-shadow: var(--shadow-md);
  z-index: 50;
}
.profile-header-menu.is-open { display: block; }
.profile-header-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--foreground);
  padding: 0.4rem 0.5rem;
  font-size: 0.8125rem;
  cursor: pointer;
  text-align: left;
}
.profile-header-menu-item:hover { background: var(--muted); }
.profile-header-menu-icon { display: inline-flex; flex-shrink: 0; }
.profile-header-menu-icon svg { display: block; width: 0.875rem; height: 0.875rem; }

@media (min-width: 640px) {
  .profile-avatar { width: 6rem; height: 6rem; min-width: 6rem; }
  .profile-name { font-size: 1.875rem; }
}
.profile-username { font-size: 0.875rem; color: var(--muted-foreground); margin: 0; }
.profile-followers { font-size: 0.875rem; color: var(--muted-foreground); margin: 0.1rem 0 0; }
.profile-followers-link { text-decoration: none; display: inline-block; cursor: pointer; }
.profile-followers-link:hover { color: var(--foreground); }
.profile-followers-link--disabled { cursor: default; pointer-events: none; }
.profile-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.profile-message-btn,
.profile-gift-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 1.9rem;
  min-width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--background);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: background 0.15s, color 0.15s;
}
.profile-message-btn:hover,
.profile-gift-btn:hover,
.profile-follow-btn:hover { background: var(--accent); color: var(--accent-foreground); opacity: 1; }
.profile-message-btn svg,
.profile-gift-btn svg,
.profile-follow-btn svg { display: block; width: 1rem; height: 1rem; flex-shrink: 0; }
.profile-follow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 1.9rem;
  min-width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--background);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}
.profile-follow-btn:disabled { opacity: 0.6; cursor: default; }
.profile-follow-btn--active {
  background: var(--background);
  color: var(--foreground);
  border-color: var(--border);
}
.profile-tabs-outer {
  border-bottom: 1px solid color-mix(in oklch, var(--border) 10%, transparent);
  margin-bottom: 1rem;
}
.profile-follows-head {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0 1rem 0.5rem;
  min-height: 2.1rem;
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr) 1.75rem;
  align-items: center;
  gap: 0.5rem;
}
@media (min-width: 640px) {
  .profile-follows-head { padding-left: 1.5rem; padding-right: 1.5rem; }
}
.profile-follows-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--muted-foreground);
  text-decoration: none;
}
.profile-follows-back:hover { color: var(--foreground); background: var(--muted); }
.profile-follows-back svg { display: block; }
.profile-follows-head-spacer { width: 1.75rem; height: 1.75rem; display: inline-block; }
.profile-follows-title { margin: 0; font-size: 1.125rem; color: var(--foreground); text-align: center; }
.profile-follows-list-wrap {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0 1rem;
}
@media (min-width: 640px) {
  .profile-follows-list-wrap { padding-left: 1.5rem; padding-right: 1.5rem; }
}
.profile-tabs.profile-follows-tabs {
  width: 100%;
  max-width: none;
  margin: 0;
}
.profile-follows-panel { width: 100%; }
.profile-follows-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}
.profile-follows-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  text-decoration: none;
  color: inherit;
}
.profile-follows-item:hover { background: var(--muted); }
.profile-follows-item-avatar {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--muted-foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.profile-follows-item-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-follows-item-avatar svg { width: 1rem; height: 1rem; display: block; }
.profile-follows-item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.profile-follows-item-name {
  font-size: 0.9rem;
  color: var(--foreground);
  line-height: 1.2;
}
.profile-follows-item-username {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  line-height: 1.2;
}
.profile-tabs {
  display: flex;
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1rem;
}
@media (min-width: 640px) {
  .profile-tabs { padding-left: 1.5rem; padding-right: 1.5rem; }
}
.profile-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  color: var(--muted-foreground);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.profile-tab:hover { color: var(--foreground); background: color-mix(in oklch, var(--muted) 50%, transparent); }
.profile-tab--active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: color-mix(in oklch, var(--primary) 5%, transparent);
}
.profile-tab svg { display: block; width: 1rem; height: 1rem; }
.memos-list--profile {
  max-width: 42rem;
}
.page-profile .memos-list--profile {
  max-width: 56rem;
  margin: 0 auto;
  width: 100%;
  padding: 0 1rem;
}
@media (min-width: 640px) {
  .memos-list--profile { padding-left: 1.5rem; padding-right: 1.5rem; }
}
.memo-card--profile { padding: 0.75rem 1rem; }
.memo-pin-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  color: var(--muted-foreground);
}
.memo-pin-indicator svg { display: block; }
.main-area--profile-not-found {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-not-found { color: var(--muted-foreground); text-align: center; padding: 2rem; margin: 0; }

/* ——— Страница настроек (как в Memos): адаптивная обёртка + контейнер ——— */
.settings-wrap {
  width: 100%;
  max-width: 64rem;
  min-height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem 2rem;
}
@media (max-width: 639px) {
  .settings-wrap { padding: 0 0 2rem; }
}
@media (min-width: 901px) {
  .settings-wrap { max-width: 84rem; }
}
@media (min-width: 640px) {
  .settings-wrap { padding: 1rem 1.5rem 2rem; }
}
@media (min-width: 768px) {
  .settings-wrap { padding-top: 1.5rem; padding-bottom: 2rem; }
}
.settings-container {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--background);
  color: var(--muted-foreground);
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  box-sizing: border-box;
}
@media (max-width: 639px) {
  .settings-container { padding: 0.75rem 0; }
}
@media (min-width: 640px) {
  .settings-container { padding: 0.75rem 0.3rem; }
}
@media (min-width: 640px) {
  .page-settings-profile .settings-container { padding: 0.75rem 1.4rem; }
}
@media (min-width: 640px) {
  .page-settings-public-create .settings-container { padding: 0.75rem 0.8rem; }
}
@media (max-width: 639px) {
  .page-settings-public-create .settings-container { padding: 0.75rem 0.5rem; }
}
.settings-container--narrow { width: 100%; min-width: 0; }
.settings-create-title { font-size: 1.125rem; font-weight: 600; margin: 0 0 0.25rem 0; color: var(--foreground); }
.settings-create-desc { font-size: 0.875rem; color: var(--muted-foreground); margin: 0 0 1rem 0; }
.settings-create-form { display: flex; flex-direction: column; gap: 0.75rem; }
.settings-create-label { font-size: 0.875rem; font-weight: 500; color: var(--foreground); display: block; margin-bottom: 0.25rem; }
.settings-create-input { width: 100%; max-width: 20rem; }
.settings-create-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.25rem; }
.settings-error { font-size: 0.875rem; color: var(--destructive); margin: 0 0 0.5rem 0; }

/* Редактирование профиля */
.profile-edit-title { font-size: 1.125rem; font-weight: 600; margin: 0 0 1rem 0; color: var(--foreground); }
.profile-edit-errors { list-style: none; padding: 0; margin: 0 0 1rem 0; font-size: 0.875rem; color: var(--destructive); }
.profile-edit-errors li { margin-bottom: 0.25rem; }
.profile-edit-form { display: flex; flex-direction: column; gap: 1rem; }
.profile-edit-field { display: flex; flex-direction: column; gap: 0.25rem; }
.profile-edit-label { font-size: 0.875rem; font-weight: 500; color: var(--foreground); }
.profile-edit-optional { font-weight: 400; color: var(--muted-foreground); font-size: 0.8125rem; }
.profile-edit-required { color: var(--destructive); }
.profile-edit-hint { font-size: 0.75rem; color: var(--muted-foreground); margin: 0; }
.profile-edit-input, .profile-edit-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--background);
  color: var(--foreground);
  font: inherit;
}
.password-field { position: relative; width: 100%; }
.password-field input { padding-right: 2.5rem; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
}
.password-toggle:hover { color: var(--foreground); }
.password-toggle:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.password-toggle-eye { display: block; }
.password-toggle-eye-off { display: none; }
.password-field.is-visible .password-toggle-eye-on { display: none; }
.password-field.is-visible .password-toggle-eye-off { display: block; }
.profile-edit-textarea { min-height: 6rem; resize: vertical; }
.profile-edit-counter { font-size: 0.75rem; color: var(--muted-foreground); }
.profile-edit-counter-row { font-size: 0.75rem; color: var(--muted-foreground); text-align: right; margin-top: 0.25rem; white-space: nowrap; }
.profile-edit-avatar-row { display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }
.profile-edit-avatar-wrap { display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }
.profile-edit-avatar-row--center { width: 100%; align-items: center; justify-content: center; }
.profile-edit-avatar-wrap--center { width: 100%; align-items: center; justify-content: center; }
.page-contacts .profile-edit-avatar-row,
.page-contacts .profile-edit-avatar-wrap {
  align-items: center;
}
.profile-edit-avatar-img, .profile-edit-avatar-placeholder {
  width: 6rem; height: 6rem; border-radius: 9999px; overflow: hidden;
  background: var(--muted); color: var(--muted-foreground);
  display: flex; align-items: center; justify-content: center;
  object-fit: cover; object-position: center;
}
.profile-edit-avatar-placeholder svg { width: 3rem; height: 3rem; }
.profile-edit-avatar-click { cursor: pointer; display: inline-block; }
.profile-edit-avatar-preview-wrap { position: relative; display: inline-block; }
.profile-edit-avatar-delete {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--destructive);
  color: var(--destructive-foreground);
  cursor: pointer;
  border: none;
  padding: 0;
  transition: opacity 0.15s;
}
.profile-edit-avatar-delete:hover { opacity: 0.9; }
.profile-edit-avatar-delete svg { display: block; }
.profile-edit-avatar-input-hidden { position: absolute; width: 0; height: 0; opacity: 0; overflow: hidden; clip: rect(0,0,0,0); }
.profile-edit-hint--muted { font-size: 0.7rem; opacity: 0.85; }
.profile-edit-hint--muted code { font-size: 0.65rem; background: var(--muted); padding: 0.1rem 0.25rem; border-radius: 2px; }
.profile-edit-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.profile-edit-contact-delete {
  width: 100%;
  margin-top: 0.75rem;
  justify-content: center;
  color: var(--destructive);
  border-color: var(--destructive);
}
.profile-edit-contact-delete:hover {
  background: color-mix(in oklch, var(--destructive) 12%, transparent);
  color: var(--destructive);
}

.settings-nav {
  display: none;
  flex-direction: column;
  width: 10rem;
  flex-shrink: 0;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
@media (min-width: 640px) {
  .settings-nav { display: flex; }
}
.settings-nav-label {
  font-size: 0.875rem;
  margin-top: 0.125rem;
  padding-left: 0.75rem;
  font-family: var(--font-mono);
  user-select: none;
  color: var(--muted-foreground);
}
.settings-nav-list { width: 100%; display: flex; flex-direction: column; margin-top: 0.25rem; }
.settings-sections-strip {
  display: none;
  padding: 0 0.75rem;
}
@media (min-width: 640px) {
  .settings-sections-strip { display: block; }
}
.settings-nav-list-inline {
  margin-top: 0;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.settings-nav-item {
  width: auto;
  max-width: 100%;
  padding: 0 0.75rem;
  line-height: 2rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  cursor: pointer;
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  border: none;
  background: none;
  font: inherit;
  transition: opacity 0.15s;
}
.settings-nav-item:hover { opacity: 0.8; }
.settings-nav-item.is-selected { background: var(--accent); box-shadow: var(--shadow-sm); color: var(--accent-foreground); }
.settings-nav-item.is-selected:hover { opacity: 1; }
.settings-nav-item svg { width: 1rem; height: 1rem; margin-right: 0.5rem; flex-shrink: 0; opacity: 0.8; }
.settings-nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-nav-version { padding: 0 0.75rem; margin-top: 0.5rem; font-size: 0.875rem; opacity: 0.7; }
/* Без overflow — как в оригинале: скроллится страница, не контейнер; меню «три точки» не обрезается */
.settings-content {
  flex: 1;
  min-width: 0;
  overflow: visible;
  padding: 0.5rem 0 0 0;
}
@media (min-width: 640px) {
  .settings-content { padding: 0.5rem 0 0 0; }
}
.settings-content-vk {
  padding: 0;
}
.settings-vk-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}
@media (min-width: 960px) {
  .settings-vk-layout {
    grid-template-columns: minmax(17rem, 20rem) minmax(0, 1fr);
    align-items: start;
  }
}
.settings-vk-menu,
.settings-vk-panel {
  border-radius: var(--radius-xl);
  background: var(--background);
}
.settings-vk-menu {
  padding: 0.75rem;
}
.settings-vk-panel {
  padding: 0 0.75rem 0.75rem;
}
.settings-vk-panel.is-loading {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.settings-vk-back {
  display: none;
  align-items: center;
  gap: 0.4rem;
  width: fit-content;
  margin: 0.75rem 0 0.25rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius);
  color: var(--foreground);
  text-decoration: none;
  background: var(--accent);
}
.settings-vk-back:hover {
  opacity: 0.9;
}
.settings-vk-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.25rem 0.5rem;
}
.settings-vk-profile-avatar {
  width: 3.5rem;
  height: 3.5rem;
  min-width: 3.5rem;
  border-radius: 9999px;
  overflow: hidden;
  background: var(--muted);
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
}
.settings-vk-profile-avatar svg {
  width: 1.5rem;
  height: 1.5rem;
}
.settings-vk-profile-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.settings-vk-profile-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}
.settings-vk-profile-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-vk-profile-username {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}
.settings-vk-profile-link {
  font-size: 0.875rem;
  color: var(--primary);
  text-decoration: none;
}
.settings-vk-profile-link:hover {
  text-decoration: underline;
}
@media (max-width: 639px) {
  .page-public-manage .settings-vk-profile {
    align-items: flex-start;
  }
  .page-public-manage .settings-vk-profile-info {
    width: 100%;
  }
  .page-public-manage .settings-vk-profile-name,
  .page-public-manage .settings-vk-profile-username,
  .page-public-manage .settings-vk-profile-link {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}
.settings-nav-list-vk {
  margin-top: 0.25rem;
  gap: 0.15rem;
}
.settings-nav-item-vk {
  width: 100%;
  padding: 0.6rem 0.5rem;
  line-height: 1.25rem;
  border-radius: var(--radius);
  color: var(--foreground);
}
.settings-nav-item-vk svg {
  color: var(--primary);
  opacity: 1;
}
.settings-nav-item-vk:hover {
  opacity: 1;
  background: var(--accent);
}
.settings-nav-item-vk.is-selected {
  background: color-mix(in oklch, var(--primary) 12%, transparent);
  color: var(--foreground);
  box-shadow: none;
}
.settings-nav-item-arrow {
  margin-left: auto;
  color: var(--muted-foreground);
  font-size: 1.25rem;
  line-height: 1;
}
@media (max-width: 639px) {
  .settings-vk-menu,
  .settings-vk-panel {
    border-radius: var(--radius-lg);
  }
}
@media (max-width: 959px) {
  .settings-vk-layout.is-menu-only .settings-vk-panel { display: none; }
  .settings-vk-layout.is-section-open .settings-vk-menu { display: none; }
  .settings-vk-layout.is-section-open .settings-vk-panel { display: block; }
  .settings-vk-back { display: inline-flex; }
  .page-settings .settings-vk-back,
  .page-public-manage .settings-vk-back { display: none !important; }
}
@media (min-width: 960px) {
  .settings-vk-back { display: none !important; }
}
.settings-select-wrap {
  display: block;
  margin: 0.5rem 0;
  padding: 0 0.75rem;
}
@media (min-width: 640px) {
  .settings-select-wrap { display: none; margin: 0; }
}
.settings-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--background);
  color: var(--foreground);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}
.settings-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 0.5rem;
  padding-bottom: 1rem;
}
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.settings-group + .settings-group-sep { margin-top: 0.75rem; }
.settings-group-sep {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0;
}
.settings-group-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  margin: 0 0 0.25rem 0;
}
.profile-verification-block {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.profile-verification-title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
}
.profile-verification-text {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}
.profile-verification-status {
  margin: 0.85rem 0 0;
  font-size: 0.875rem;
  color: var(--foreground);
  font-weight: 500;
}
.profile-verification-action-form { margin-top: 0.75rem; }
.settings-group-desc { font-size: 0.75rem; color: var(--muted-foreground); margin: 0 0 0.25rem 0; }
.settings-balance-note {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted-foreground);
  line-height: 1.45;
}
.settings-balance-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.settings-balance-total-label {
  font-size: 0.95rem;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.settings-balance-total-value {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--foreground);
  white-space: nowrap;
}
.settings-balance-action-row {
  display: flex;
  justify-content: flex-start;
}
.settings-balance-history-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--border);
}
.settings-balance-history-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.settings-balance-history-icon {
  width: 2.2rem;
  height: 2.2rem;
  min-width: 2.2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  background: color-mix(in oklch, var(--muted) 85%, transparent);
  border: 1px solid var(--border);
}
.settings-balance-history-main {
  min-width: 0;
  flex: 1;
}
.settings-balance-history-title {
  color: var(--foreground);
  font-size: 0.80rem;
  line-height: 1.25;
}
.settings-balance-history-date {
  margin-top: 0.1rem;
  color: var(--muted-foreground);
  font-size: 0.82rem;
}
.settings-balance-history-amount {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.settings-balance-history-amount.is-topup {
  color: #3fb950;
}
.settings-balance-history-amount.is-expense {
  color: var(--foreground);
}
@media (max-width: 639px) {
  .settings-balance-total-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}
.settings-promo-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.35);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: none;
}
.settings-promo-modal-overlay.is-open {
  display: flex;
  pointer-events: auto;
}
.settings-promo-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 28rem;
  display: flex;
  flex-direction: column;
}
.settings-promo-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.settings-promo-modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.settings-promo-modal-close {
  padding: 0.25rem;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.settings-promo-modal-close:hover {
  color: var(--foreground);
}
.settings-promo-modal-body {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.settings-promo-modal-text {
  margin: 0;
  color: var(--muted-foreground);
  line-height: 1.45;
  text-align: center;
  font-size: 0.9375rem;
}
.settings-promo-modal-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.settings-promo-modal-input {
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 0.08em;
}
.settings-promo-modal-submit {
  align-self: stretch;
  width: 100%;
  min-width: 0;
  justify-content: center;
  text-align: center;
}
.settings-more-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 0.5rem;
}
.settings-row {
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
@media (max-width: 479px) {
  .settings-row { flex-direction: column; align-items: stretch; }
}
@media (max-width: 479px) {
  .page-settings #bonus-plus .settings-row {
    flex-direction: row;
    align-items: center;
  }

  .page-settings #bonus-plus .settings-row .settings-row-control {
    width: auto;
    margin-left: auto;
  }
}
.settings-row-label { flex: 1; min-width: 0; font-size: 0.875rem; }
.settings-row-control { flex-shrink: 0; }
.settings-bonus-plus-features {
  margin: 0.2rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}
.settings-bonus-plus-feature-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}
.settings-bonus-plus-feature-icon {
  width: 1.25rem;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.settings-bonus-plus-feature-icon img,
.settings-bonus-plus-feature-icon svg,
.settings-bonus-plus-feature-icon video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
@media (max-width: 479px) {
  .settings-row-control { width: 100%; }
}
@media (max-width: 479px) {
  .settings-row.settings-section-item {
    flex-direction: row;
    align-items: center;
  }
  .settings-row.settings-section-item .settings-row-control {
    width: auto;
    margin-left: auto;
  }
}

/* Переключатель (switch) как в Memos */
.settings-switch {
  position: relative;
  display: inline-block;
  width: 2.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}
.settings-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.settings-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--muted);
  border-radius: 9999px;
  transition: background 0.2s;
}
.settings-switch-slider::before {
  content: '';
  position: absolute;
  height: 1rem;
  width: 1rem;
  left: 0.125rem;
  bottom: 0.125rem;
  background: var(--background);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}
.settings-switch input:checked + .settings-switch-slider {
  background: var(--primary);
}
.settings-switch input:checked + .settings-switch-slider::before {
  transform: translateX(1rem);
}
.settings-switch input:focus-visible + .settings-switch-slider {
  box-shadow: 0 0 0 2px var(--ring);
}

@media (max-width: 767px) {
  .page-settings #notifications .settings-row {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
  }

  .page-settings #notifications .settings-row .settings-row-control {
    width: auto;
    display: flex;
    justify-content: flex-end;
    margin-left: auto;
  }

  .page-settings #settings-section-privacy .settings-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }

  .page-settings #settings-section-privacy .settings-row .settings-row-control {
    width: 100%;
  }

  .page-settings #settings-section-privacy .settings-select-theme {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }
}

.settings-input-number {
  width: 6rem;
  min-width: 6rem;
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
}
.settings-input-number:focus {
  outline: none;
  border-color: var(--primary);
}

/* Реакции в настройках заметок (как в Memos) */
.settings-reactions-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.settings-reactions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.settings-reaction-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 2rem;
  padding: 0 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
}
.settings-reaction-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  width: 1rem;
  height: 1rem;
  border: none;
  background: none;
  color: var(--muted-foreground);
  cursor: pointer;
  font-size: 1.125rem;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.settings-reaction-remove:hover {
  color: var(--destructive);
  background: var(--muted);
}
.settings-reactions-add {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.settings-input-reaction {
  width: 8rem;
  min-width: 8rem;
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
}
.settings-input-reaction:focus {
  outline: none;
  border-color: var(--primary);
}
.settings-reaction-add-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.settings-memo-related-actions {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.settings-account-row {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
  padding: 0.65rem 0;
}
.settings-account-row + .settings-account-row { border-top: 1px solid var(--border); }
@media (max-width: 479px) {
  .settings-account-row { flex-direction: column; align-items: flex-start; }
}
.settings-account-avatar {
  width: 3rem;
  height: 3rem;
  min-width: 3rem;
  border-radius: 9999px;
  background: var(--muted);
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.settings-account-avatar svg { width: 1.5rem; height: 1.5rem; }
.settings-account-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.settings-account-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 0.25rem; }
.settings-account-name-row { width: 100%; }
.settings-account-name { font-size: 0.9rem; font-weight: 600; color: var(--foreground); }
.settings-account-verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  color: #3b82f6;
  vertical-align: middle;
}
.settings-account-verified-badge svg { width: 1rem; height: 1rem; display: block; }
.settings-account-username { font-size: 0.875rem; color: var(--muted-foreground); margin-left: 0.5rem; }
.settings-account-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}
@media (max-width: 479px) {
  .settings-account-actions { width: 100%; }
}
@media (max-width: 479px) {
  .page-settings .settings-account-row {
    flex-direction: row;
    align-items: center;
  }
  .page-settings .settings-account-row > .settings-account-actions {
    width: auto;
    margin-left: auto;
  }
}
.settings-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  min-height: 1.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--foreground);
  font: inherit;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.settings-btn:hover { background: var(--muted); }
.settings-btn-outline {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--foreground);
}
.settings-btn-outline:hover { background: var(--muted); }
.settings-btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: transparent;
}
.settings-btn-primary:hover { opacity: 0.9; }
.settings-btn:disabled,
.settings-btn[disabled] {
  background: var(--muted);
  color: var(--muted-foreground);
  border-color: var(--border);
  cursor: not-allowed;
  opacity: 1;
}
.settings-btn:disabled:hover,
.settings-btn[disabled]:hover,
.settings-btn-primary:disabled:hover,
.settings-btn-primary[disabled]:hover {
  background: var(--muted);
  color: var(--muted-foreground);
  border-color: var(--border);
  opacity: 1;
}
.settings-btn-primary svg { color: var(--primary-foreground); fill: none; stroke: currentColor; }
.settings-btn-sm { min-height: 1.75rem; font-size: 0.875rem; font-weight: 500; padding: 0.25rem 0.5rem; gap: 0.25rem; }
.settings-btn-sm svg { width: 1rem; height: 1rem; margin-right: 0.375rem; flex-shrink: 0; }
.settings-btn-ghost { border-color: transparent; }
.settings-btn-ghost:hover { background: var(--muted); }
.settings-btn svg { width: 0.875rem; height: 0.875rem; flex-shrink: 0; }
.settings-success { font-size: 0.875rem; color: var(--muted-foreground); margin: 0 0 0.5rem 0; }
.page-setup .content-wrap { max-width: 84rem; }
.setup-content { padding-left: 0; }
.setup-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
}
.setup-subtitle {
  margin: 0.35rem 0 0 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}
.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.setup-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--background);
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.setup-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.setup-card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--foreground);
}
.setup-status-badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.125rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.setup-status-badge.is-connected {
  border-color: color-mix(in oklch, var(--primary) 40%, var(--border));
  color: var(--primary);
  background: color-mix(in oklch, var(--primary) 10%, transparent);
}
.setup-status-badge.is-disconnected {
  border-color: color-mix(in oklch, var(--destructive) 40%, var(--border));
  color: var(--destructive);
  background: color-mix(in oklch, var(--destructive) 8%, transparent);
}
.setup-steps {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--foreground);
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.setup-note {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}
.setup-file-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.setup-file-name {
  color: var(--foreground);
  font-weight: 500;
}
.setup-empty-file {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  font-style: italic;
}
.setup-upload-form {
  margin-top: 0.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.setup-upload-label {
  font-size: 0.8125rem;
  color: var(--foreground);
  font-weight: 500;
}
.setup-upload-form .profile-edit-input {
  width: 100%;
}
@media (max-width: 900px) {
  .setup-grid { grid-template-columns: 1fr; }
}
.settings-member-form { margin-top: 0.5rem; }
.settings-member-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.75rem 1rem;
  align-items: end;
}
.settings-member-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.settings-member-label-text { font-size: 0.8125rem; font-weight: 500; color: var(--foreground); }
.settings-member-form .settings-input {
  width: 100%;
  min-width: 0;
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
}
.settings-member-form .settings-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
}
.settings-select-inline { min-width: 10rem; }
.settings-member-submit { grid-column: 1 / -1; margin-top: 0.25rem; }
.settings-member-archived { font-style: italic; color: var(--muted-foreground); margin-left: 0.25rem; }
.settings-member-yourself { color: var(--muted-foreground); font-size: 0.875rem; }
.settings-table-actions { width: 1%; white-space: nowrap; text-align: right; vertical-align: middle; }
.settings-member-menu-wrap { position: relative; display: inline-block; z-index: 1; }
.settings-member-menu-wrap.is-open { z-index: 1101; }
/* Иконки действий вместо меню три точки */
.settings-member-actions-icons { display: inline-flex; align-items: center; gap: 0.25rem; }
.settings-member-action-btn { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; padding: 0; border: none; border-radius: var(--radius); background: transparent; color: var(--muted-foreground); cursor: pointer; transition: background 0.15s, color 0.15s; text-decoration: none; }
.settings-member-action-btn:hover { background: var(--muted); color: var(--foreground); }
.settings-member-action-btn--archive:hover { color: var(--destructive); }
.settings-member-action-btn--delete { color: var(--muted-foreground); }
.settings-member-action-btn--delete:hover { background: var(--destructive); color: var(--destructive-foreground); }
.settings-member-action-form { margin: 0; padding: 0; display: inline-flex; }
/* Ячейка с меню не обрезает выпадающее меню */
.settings-table td.settings-table-actions { overflow: visible; }
.settings-member-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.settings-member-menu-btn:hover { background: var(--muted); color: var(--foreground); }
.settings-member-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.25rem;
  min-width: 10rem;
  padding: 0.25rem 0;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1100;
  display: flex;
  flex-direction: column;
}
.settings-member-menu[hidden] { display: none; }
.settings-member-menu-item,
.settings-member-menu-item-btn {
  display: block;
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  text-align: left;
  background: none;
  border: none;
  color: var(--foreground);
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  transition: background 0.15s;
}
.settings-member-menu-item:hover,
.settings-member-menu-item-btn:hover { background: var(--muted); }
.settings-member-menu-item-destructive { color: var(--destructive); }
.settings-member-menu-item-destructive:hover { background: var(--destructive); color: var(--destructive-foreground); }
.settings-member-menu-item-form { margin: 0; padding: 0; }
.settings-token-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
@media (min-width: 640px) {
  .settings-token-header { flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
}
.settings-token-create {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.settings-token-input {
  min-width: 12rem;
  max-width: 20rem;
  padding: 0.25rem 0.5rem;
  min-height: 1.75rem;
  font-size: 0.8125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--background);
  color: var(--foreground);
  font: inherit;
}
.settings-token-input::placeholder { color: var(--muted-foreground); opacity: 0.8; }
@media (max-width: 479px) {
  .settings-token-create { flex-direction: column; align-items: stretch; }
  .settings-token-input { max-width: none; }
}
.settings-token-title { font-size: 0.875rem; font-weight: 500; color: var(--muted-foreground); margin: 0 0 0.25rem 0; }
.settings-token-desc { font-size: 0.75rem; color: var(--muted-foreground); margin: 0 0 0.5rem 0; }
.settings-token-header-text { display: flex; flex-direction: column; gap: 0.25rem; }
/* Как в оригинале: таблица без своего скролла — скроллится страница, меню «три точки» не обрезается */
.settings-table-wrap { width: 100%; overflow-x: auto; margin-top: 0.5rem; }
/* Таблица участников: без overflow, чтобы выпадающее меню было видно и не было двойных скроллов (как в оригинале) */
.settings-table-wrap--member { overflow: visible; }
.settings-table-wrap--member .settings-table,
.settings-table-wrap--member .settings-table tbody { overflow: visible; }
.settings-table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 0.8125rem;
}
.settings-table thead tr {
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
  color: var(--foreground);
}
.settings-table th {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.settings-table th:first-child { border-radius: var(--radius-lg) 0 0 0; }
.settings-table th:nth-child(3) { text-align: center; }
.settings-table th:last-child { text-align: right; width: 2.25rem; }
.settings-table thead tr th:last-child { border-radius: 0 var(--radius-lg) 0 0; }
/* Колонка «Действия» липкая справа — кнопка «три точки» всегда видна без горизонтального скролла */
.settings-table th.settings-table-actions,
.settings-table td.settings-table-actions {
  position: sticky;
  right: 0;
  background: var(--background);
  z-index: 1;
  border-left: 1px solid var(--border);
  padding-left: 0.75rem;
}
.settings-table thead th.settings-table-actions {
  z-index: 2;
}
.settings-table tbody tr td.settings-table-actions {
  background: var(--background);
}
.settings-table tbody tr:hover td.settings-table-actions {
  background: var(--muted);
}
.settings-table tbody { border: 0; }
.settings-table tbody tr { border-bottom: 1px solid var(--border); }
.settings-table tbody tr:last-child { border-bottom: none; }
.settings-table td {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}
.settings-table td:nth-child(3) { text-align: center; }
.settings-table td:last-child { text-align: right; }
.settings-table--devices th:nth-child(3),
.settings-table--devices td:nth-child(3),
.settings-table--devices th:last-child,
.settings-table--devices td:last-child { text-align: left; }
.settings-table--devices th:last-child { width: auto; }
.settings-devices-list {
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--background);
  overflow: hidden;
}
.settings-device-card {
  border-bottom: 1px solid var(--border);
  background: var(--background);
}
.settings-device-card:last-child { border-bottom: none; }
.settings-device-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  list-style: none;
  cursor: pointer;
}
.settings-device-card-head::-webkit-details-marker { display: none; }
.settings-device-icon {
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--foreground);
  flex-shrink: 0;
  margin-top: 0.0625rem;
}
.settings-device-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.settings-device-name {
  font-size: 0.9375rem;
  line-height: 1.35;
  color: var(--foreground);
  font-weight: 500;
  word-break: break-word;
}
.settings-device-meta {
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--muted-foreground);
}
.settings-device-side {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.settings-device-time {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.settings-device-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  transition: transform 0.2s ease;
}
.settings-device-card[open] .settings-device-chevron { transform: rotate(90deg); }
.settings-device-card-body {
  padding: 0 0.875rem 0.75rem 3.125rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.settings-device-current {
  display: inline-flex;
  align-items: center;
  min-height: 1.25rem;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--foreground);
  background: var(--muted);
  white-space: nowrap;
}
.settings-device-ua-full {
  max-width: 40rem;
  font-size: 0.75rem;
  line-height: 1.25;
  color: var(--muted-foreground);
  word-break: break-word;
}
.settings-device-history {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.settings-device-history li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--muted-foreground);
}
@media (max-width: 639px) {
  .settings-device-card-head {
    flex-wrap: wrap;
    padding: 0.6875rem 0.75rem;
  }
  .settings-device-side {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
    gap: 0.375rem;
  }
  .settings-device-card-body {
    padding: 0 0.75rem 0.6875rem 0.75rem;
  }
  .settings-device-history li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.0625rem;
  }
}
.settings-table .cell-foreground { color: var(--foreground); }
.settings-table .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.settings-table .btn-icon:hover { color: var(--foreground); background: var(--muted); }
.settings-table .btn-icon.btn-destructive:hover { color: var(--destructive); }
.settings-empty { padding: 0.75rem 1rem; text-align: center; font-size: 0.875rem; color: var(--muted-foreground); }
.settings-account-menu-wrap { position: relative; display: inline-flex; }
.settings-account-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  cursor: pointer;
  font: inherit;
}
.settings-account-menu-btn:hover { background: var(--muted); }
.settings-account-menu-btn svg { width: 0.875rem; height: 0.875rem; }
.settings-account-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.25rem;
  min-width: 10rem;
  padding: 0.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: 50;
  display: none;
}
.settings-account-menu.is-open { display: block; }
.settings-account-menu a {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--foreground);
  text-decoration: none;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.settings-account-menu a:hover { background: var(--muted); }
.settings-select-theme {
  min-width: 10rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--background);
  color: var(--foreground);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.memos-list { display: flex; flex-direction: column; gap: 0.5rem; }
.memos-list--single { max-width: 100%; }

/* Страница одной заметки — ширина как на главной (56rem) */
.page-memo-detail .memo-detail-layout {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  align-items: flex-start;
  max-width: 56rem;
  margin: 0 auto;
  width: 100%;
}
.page-memo-detail .memo-detail-main {
  flex: 1;
  min-width: 0;
  width: 100%;
}
@media (min-width: 768px) {
  .page-memo-detail .memo-detail-main { width: calc(100% - 15rem); }
}
@media (max-width: 768px) {
  .page-memo-detail .memo-detail-main { width: 100%; }
}
.page-memo-detail .memo-detail-sidebar {
  width: 14rem;
  flex-shrink: 0;
  position: sticky;
  top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.page-memo-detail .memo-detail-sidebar-block { margin: 0; }
.page-memo-detail .memo-detail-sidebar-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  margin: 0 0 0.25rem 0;
}
.page-memo-detail .memo-detail-sidebar-value {
  font-size: 0.8125rem;
  color: var(--foreground);
  margin: 0;
}
@media (max-width: 768px) {
  .page-memo-detail .memo-detail-layout { flex-direction: column; }
  .page-memo-detail .memo-detail-sidebar { width: 100%; position: static; flex-direction: row; flex-wrap: wrap; gap: 0.75rem; }
  .page-memo-detail .memo-detail-sidebar-block { flex: 1 1 auto; }
}

/* Комментарии к заметке — как в MemoDetail оригинальной сборки */
.page-memo-detail .memo-detail-comments {
  margin-top: 2rem;
  width: 100%;
}
.page-memo-detail .memo-detail-comments-empty {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  padding: 1.5rem 0;
}
.page-memo-detail .memo-detail-comment-write-btn {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted-foreground);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: var(--radius);
  transition: color 0.15s;
}
.page-memo-detail .memo-detail-comment-write-btn:hover {
  color: var(--foreground);
}
.page-memo-detail .memo-detail-comment-write-btn--center {
  padding: 0.5rem 0.75rem;
}
.page-memo-detail .memo-detail-comment-write-btn-icon {
  flex-shrink: 0;
  opacity: 0.8;
}
.page-memo-detail .memo-detail-comment-write-btn--inline {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}
.page-memo-detail .memo-detail-comments-header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  min-height: 2rem;
  margin-bottom: 0.5rem;
  padding-left: 0.25rem;
}
.page-memo-detail .memo-detail-comments-header-left {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.page-memo-detail .memo-detail-comments-icon {
  flex-shrink: 0;
  color: var(--muted-foreground);
}
.page-memo-detail .memo-detail-comments-title {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin: 0;
}
.page-memo-detail .memo-detail-comments-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
/* Карточка комментария — как MemoView (compact): rounded-lg border px-4 py-3 mb-2 */
.page-memo-detail .memo-detail-comment-item {
  background: var(--card);
  color: var(--card-foreground);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.page-memo-detail .memo-detail-comment-item:hover {
  box-shadow: var(--shadow-sm);
}
.page-memo-detail .memo-detail-comment-item:last-child {
  margin-bottom: 0;
}
.page-memo-detail .memo-detail-comment-meta {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  position: relative;
}
.page-memo-detail .memo-detail-comment-menu-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  margin-left: auto;
}
.page-memo-detail .memo-detail-comment-visibility-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  color: var(--muted-foreground);
  flex-shrink: 0;
}
.page-memo-detail .memo-detail-comment-visibility-indicator svg {
  display: block;
  width: 1rem;
  height: 1rem;
}
.page-memo-detail .memo-detail-comment-visibility-indicator:hover {
  opacity: 0.9;
}
.page-memo-detail .memo-detail-comment-item .memo-reaction-wrap {
  position: relative;
}
.page-memo-detail .memo-detail-comment-item .memo-reaction-trigger {
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  min-width: 1.5rem;
  min-height: 1.5rem;
}
.page-memo-detail .memo-detail-comment-item .memo-reaction-trigger .memo-reaction-icon {
  width: 1rem;
  height: 1rem;
}
.page-memo-detail .memo-detail-comment-reactions {
  margin-top: 0.35rem;
  flex-wrap: wrap;
}
.page-memo-detail .memo-detail-comment-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted-foreground);
  cursor: pointer;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}
.page-memo-detail .memo-detail-comment-menu-trigger:hover {
  color: var(--foreground);
  background: var(--accent);
}
.page-memo-detail .memo-detail-comment-menu-trigger svg,
.page-memo-detail .memo-detail-comment-menu-icon {
  display: block;
  width: 1rem;
  height: 1rem;
  pointer-events: none;
}
.page-memo-detail .memo-detail-comment-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  z-index: 50;
  min-width: 11rem;
  padding: 0.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.page-memo-detail .memo-detail-comment-menu.is-open {
  display: block;
}
.page-memo-detail .memo-detail-comment-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.35rem 0.6rem;
  font-size: 0.8125rem;
  text-align: left;
  border: none;
  background: none;
  color: var(--foreground);
  cursor: pointer;
  border-radius: var(--radius);
}
.page-memo-detail .memo-detail-comment-menu-item:hover {
  background: var(--muted);
}
.page-memo-detail .memo-detail-comment-menu-item .memo-detail-comment-menu-icon {
  flex-shrink: 0;
}
.page-memo-detail .memo-detail-comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.page-memo-detail .memo-detail-comment-avatar--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: var(--accent-foreground);
  font-size: 0.8125rem;
  font-weight: 600;
}
.page-memo-detail .memo-detail-comment-meta-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  min-width: 0;
  flex: 1;
}
.page-memo-detail .memo-detail-comment-author {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted-foreground);
  line-height: 1.2;
}
.page-memo-detail .memo-detail-comment-time {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  line-height: 1.2;
}
.page-memo-detail .memo-detail-comment-content {
  font-size: 0.875rem;
  color: var(--foreground);
  white-space: pre-wrap;
  word-break: break-word;
  padding-left: 2.5rem;
  margin: 0;
  line-height: 1.5;
}
.page-memo-detail .memo-comment-form-wrap {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}
/* Кнопка «Отмена» в форме добавления комментария — как в форме заметки */
.page-memo-detail .memo-comment-form-wrap .memo-form-footer .memo-edit-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--background);
  color: var(--foreground);
  font-size: 0.875rem;
  cursor: pointer;
}
.page-memo-detail .memo-comment-form-wrap .memo-form-footer .memo-edit-cancel:hover {
  background: var(--muted);
  color: var(--foreground);
}
/* Блок редактирования комментария — как inline-редактирование заметки (без рамки, прозрачный фон) */
.page-memo-detail .memo-detail-comment-edit-wrap.create-memo.memo-edit-inline {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0.5rem 0 0;
  margin-top: 0.5rem;
  margin-bottom: 0;
}
.page-memo-detail .memo-detail-comment-edit-wrap.create-memo.memo-edit-inline .memo-form,
.page-memo-detail .memo-detail-comment-edit-wrap.create-memo.memo-edit-inline .memo-form-body {
  width: 100%;
  max-width: 100%;
}
.page-memo-detail .memo-detail-comment-edit-wrap.create-memo.memo-edit-inline .memo-form {
  background: transparent;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.memo-card {
  background: var(--card);
  color: var(--card-foreground);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.memo-card:hover { box-shadow: var(--shadow-sm); }
/* Шапка карточки как в оригинале: слева время, справа реакция + видимость + меню */
.memo-meta {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  width: 100%;
}
.memo-meta-left {
  width: auto;
  max-width: calc(100% - 8rem);
  min-width: 0;
  flex-grow: 1;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
}
.memo-time-btn {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  line-height: 1.25;
  color: var(--muted-foreground);
  cursor: pointer;
  text-align: left;
  transition: color 0.15s;
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.memo-time-btn:hover { color: var(--foreground); }
a.memo-time-btn { text-decoration: none; }
a.memo-time-btn:hover { color: var(--foreground); }
.memo-time-btn--detail { cursor: default; }
.memo-time { font-size: 0.8125rem; color: var(--muted-foreground); }
.memo-meta-left .memo-time { margin: 0; }
.memo-meta-right,
.memo-actions {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.5rem;
  flex-shrink: 0;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
}
/* Кнопка реакций: как в оригинале — block на мобильном, sm:hidden sm:group-hover:block на десктопе */
.memo-reaction-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.memo-reaction-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: opacity 0.15s;
  vertical-align: middle;
}
.memo-reaction-trigger:hover { opacity: 0.8; }
.memo-reaction-icon { width: 1rem; height: 1rem; display: block; }
@media (min-width: 640px) {
  /* Всегда резервируем место под кнопку — только скрываем визуально, чтобы не дёргалась шапка при hover */
  .memo-reaction-trigger {
    visibility: hidden;
    opacity: 0;
  }
  .memo-card.group:hover .memo-reaction-trigger {
    visibility: visible;
    opacity: 1;
  }
  .page-memo-detail .memo-detail-comment-item .memo-reaction-trigger {
    visibility: visible;
    opacity: 1;
  }
}
@media (max-width: 639px) {
  .memo-reaction-trigger { display: inline-flex; }
}
/* Поповер выбора реакции */
.memo-reaction-popover {
  position: absolute;
  right: 0;
  left: auto;
  top: calc(100% + 0.25rem);
  z-index: 50;
  min-width: 10rem;
  max-width: min(90vw, 18rem);
  padding: 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: none;
}
.memo-reaction-popover.is-open { display: block; }
.memo-reaction-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.25rem;
  max-height: min(16rem, 70vh);
  overflow-y: auto;
}
@media (max-width: 639px) {
  .memo-reaction-popover {
    left: auto;
    right: 0;
    max-width: calc(100vw - 1rem);
    min-width: 0;
  }
  .memo-reaction-grid {
    grid-template-columns: repeat(4, 1fr);
    max-height: min(14rem, 60vh);
  }
}
.memo-reaction-emoji-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  font-size: 1.25rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.memo-reaction-emoji-btn:hover { background: var(--muted); color: var(--foreground); }
/* Список реакций под заметкой */
.memo-reactions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.5rem;
  -webkit-user-select: none;
  user-select: none;
}
.memo-reaction-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  height: 1.75rem;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: transparent;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.memo-reaction-chip:hover { opacity: 0.9; }
.memo-reaction-chip--mine { background: var(--accent); border-color: var(--border); color: var(--accent-foreground); }
.memo-reaction-emoji { font-size: 1rem; }
.memo-reaction-count { opacity: 0.7; font-size: 0.75rem; }
.memo-actions { gap: 0.25rem; }
.memo-pin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.memo-pin-btn:hover { color: var(--foreground); background: var(--muted); }
.memo-pin-btn svg { display: block; }
.memo-card-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  min-height: 1rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.memo-card-menu-trigger:hover { color: var(--foreground); background: var(--accent); }
.memo-card-menu-trigger svg,
.memo-card-menu-icon { display: block; width: 1rem; height: 1rem; pointer-events: none; }
.memo-card-menu {
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  z-index: 50;
  min-width: 12rem;
  padding: 0.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: none;
}
.memo-card-menu.is-open { display: block; }
.memo-card-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 0.8125rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.memo-card-menu-item:hover { background: var(--muted); }
.memo-card-menu-item--has-sub { justify-content: space-between; }
.memo-card-menu-icon { display: inline-flex; flex-shrink: 0; }
.memo-card-menu-icon svg { display: block; }
.memo-card-menu-arrow { opacity: 0.6; margin-left: auto; }
.memo-card-menu-sub {
  display: none;
  padding-left: 1.5rem;
}
.memo-card-menu-sub.is-open { display: block; }
.memo-card-menu-sub .memo-card-menu-item { padding: 0.35rem 0.6rem; font-size: 0.75rem; }
/* Редактирование заметки — как в оригинале Memos: текст без тяжёлой рамки, вложения в одну строку, панель внизу с фоном */
.memo-edit-textarea {
  width: 100%;
  min-height: 4rem;
  max-height: 70vh;
  padding: 0.5rem 0;
  border: none;
  border-radius: 0;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
  background: transparent;
  color: var(--foreground);
  box-shadow: none;
  outline: none;
}

/* При редактировании: убрать ограничение высоты и эффект «длинный текст» */
.memo-card--editing .memo-meta { display: none; }
.memo-card--editing .memo-content-wrap {
  max-height: none !important;
  overflow: visible !important;
  width: 100%;
}
.memo-card--editing .memo-content-gradient {
  display: none !important;
}
/* Убрать эффект «карточка в карточке»: форма редактирования внутри карточки без своей обводки, на всю ширину */
.memo-card--editing .create-memo.memo-edit-inline {
  border: none;
  box-shadow: none;
  background: transparent;
  margin-bottom: 0;
  width: 100%;
  max-width: 100%;
  align-self: stretch;
}
.memo-card--editing .create-memo.memo-edit-inline .memo-form,
.memo-card--editing .create-memo.memo-edit-inline .memo-form-body {
  width: 100%;
  max-width: 100%;
}
.memo-card--editing .create-memo.memo-edit-inline .memo-form {
  background: transparent;
}
/* Блок вложений при редактировании — лёгкое разделение без тяжёлой рамки */
.memo-edit-inline .memo-form-attachments-block {
  border: 1px solid color-mix(in oklch, var(--border) 50%, transparent);
  background: color-mix(in oklch, var(--muted) 15%, transparent);
}
/* Редактирование заметки — та же структура и классы, что у формы создания (как в оригинале Memos) */
.memo-edit-inline .memo-edit-textarea {
  width: 100%;
  margin: 0;
  padding: 0.25rem 0;
  min-height: 4rem;
  resize: none;
  border: none;
  border-radius: 0;
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  background: transparent;
  color: var(--foreground);
}
.memo-edit-inline .memo-form-footer .memo-edit-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--background);
  color: var(--foreground);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.memo-edit-inline .memo-form-footer .memo-edit-cancel:hover {
  background: var(--muted);
  color: var(--foreground);
}
.memo-edit-inline .memo-form-footer .memo-edit-save.btn-save {
  display: inline-flex;
  height: 2rem;
  padding: 0 0.75rem;
}
.memo-content-wrap {
  position: relative;
  width: 100%;
}
.memo-content-wrap.memo-content-wrap--collapsed {
  max-height: 60vh;
  overflow: hidden;
}
.memo-content-wrap.memo-content-wrap--collapsed .memo-content-gradient {
  display: block;
}
.memo-content-gradient {
  display: none;
  position: absolute;
  inset: auto 0 0 0;
  height: 6rem;
  pointer-events: none;
  background: linear-gradient(to top, var(--background) 0%, color-mix(in oklch, var(--background) 60%, transparent) 40%, transparent 100%);
}
.memo-expand-btn {
  display: none;
  /* margin-top: 0.5rem; */
  width: 100%;
  justify-content: center;
  text-align: center;
  padding: 0.1rem 0.1rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  transition: color 0.15s;
}
.memo-expand-btn:hover { color: var(--foreground); }
.memo-expand-btn[data-visible="true"] { display: flex; align-items: center; justify-content: center; gap: 0.25rem; }
.memo-content {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 1rem;
  line-height: 1.5;
  margin: 0;
}
.memo-reminder { font-size: 0.8125rem; color: var(--muted-foreground); margin-top: 0.5rem; display: flex; align-items: center; gap: 0.375rem; }
.memo-reminder--with-layout { justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
.memo-reminder--with-layout .memo-reminder-left { display: flex; align-items: center; gap: 0.375rem; }
.memo-reminder-contact { color: var(--primary); text-decoration: none; white-space: nowrap; }
.memo-reminder-contact:hover { text-decoration: underline; }
.memo-reminder-icon-wrap { display: inline-flex; flex-shrink: 0; }
.memo-reminder-icon { vertical-align: middle; }

/* Пустое состояние как в Memos: иллюстрация птицы + «Здесь ничего нет» */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
}
.empty-state-illustration {
  width: 8rem;
  max-width: 160px;
  margin-bottom: 1.25rem;
  color: var(--muted-foreground);
  opacity: 0.6;
}
.empty-state-bird { width: 100%; height: auto; }
.empty-state-text {
  margin: 0;
  font-size: 1rem;
  color: var(--muted-foreground);
}

.auth-box {
  max-width: 500px;
  margin: 2rem auto;
  background: var(--card);
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.auth-box h1 { margin-top: 0; }
.auth-box-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.auth-box-header svg { flex-shrink: 0; color: var(--primary); }
.auth-box-title {
  font-size: 2rem;
  font-weight: 600;
  color: var(--foreground);
  opacity: 0.9;
}
.auth-box label { display: block; margin-bottom: 1rem; font-size: 0.875rem; }
.auth-box form > button[type="submit"] {
  margin-top: 1.5rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-box input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font: inherit;
  background: var(--background);
  color: var(--foreground);
}
.auth-box button:not(.password-toggle) {
  padding: 0.5rem 1.5rem;
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font: inherit;
}
.auth-box button:not(.password-toggle):hover { opacity: 0.9; }
.auth-box .auth-remember-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.auth-box .auth-remember-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}
.auth-box .error { color: var(--destructive); font-size: 0.875rem; }
.auth-box a { color: var(--primary); text-decoration: none; }
.auth-box a:hover { opacity: 0.85; }
.auth-box .profile-edit-form { gap: 1rem; }
.auth-box .profile-edit-actions { margin-top: 1.5rem; }
.page-register .auth-box .profile-edit-actions button[type="submit"] {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.page-register .auth-box .profile-edit-actions button[type="submit"][disabled] {
  background: var(--muted) !important;
  color: var(--muted-foreground) !important;
  border-color: var(--border) !important;
  cursor: not-allowed;
  opacity: 1;
}
.page-register .auth-box .profile-edit-actions button[type="submit"][disabled]:hover {
  background: var(--muted) !important;
  color: var(--muted-foreground) !important;
  border-color: var(--border) !important;
  opacity: 1;
}

.password-requirements { margin-top: 0.5rem; }
.password-requirements-title {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.password-strength-value { font-weight: 600; }
.password-strength-value.is-weak { color: var(--destructive); }
.password-strength-value.is-medium { color: #d18a00; }
.password-strength-value.is-strong { color: #1d8f4e; }
.password-requirements-subtitle {
  margin: 0.35rem 0 0.2rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.password-rules-list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.1rem;
}
.password-rules-list li {
  font-size: 0.7rem;
  line-height: 1.25;
  color: var(--muted-foreground);
}
.password-rules-list li.is-met { color: #1d8f4e; }
.password-rules-list li.is-unmet {
  color: var(--destructive);
  font-weight: 700;
}

.page-content { max-width: 560px; }
.page-content h1 { margin-top: 0; }
.card {
  background: var(--card);
  color: var(--card-foreground);
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  margin-bottom: 1rem;
}
.card h2 { font-size: 1rem; margin-top: 0; }
.success { color: #2a7; }
.error { color: var(--destructive); font-size: 0.875rem; }
.token-display { word-break: break-all; margin-top: 1rem; font-size: 0.875rem; }
.token-display code { background: var(--muted); padding: 0.25rem 0.5rem; border-radius: var(--radius-sm); border: 1px solid var(--border); }

.content-wrap a:not(.nav-item):not(.logo):not(.settings-btn):not(.contacts-list-fab) { color: var(--primary); text-decoration: none; }
.content-wrap a:not(.nav-item):not(.logo):not(.settings-btn):not(.contacts-list-fab):hover { opacity: 0.85; }
.card button[type="submit"], .auth-box button[type="submit"] {
  padding: 0.5rem 1.25rem;
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
}
.card button[type="submit"]:hover, .auth-box button[type="submit"]:hover { opacity: 0.9; }

/* ——— Страница Inbox (уведомления) — дизайн как в оригинале Memos ——— */
.inbox-section {
  width: 100%;
  max-width: 64rem;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding-top: 0.75rem;
  padding-bottom: 2rem;
}
@media (min-width: 640px) {
  .inbox-section { padding-top: 0.75rem; }
}
@media (min-width: 768px) {
  .inbox-section { padding-top: 1.5rem; }
}
.inbox-container {
  width: 100%;
}
.inbox-card {
  width: 100%;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  border-radius: var(--radius-xl);
  background: var(--background);
  color: var(--foreground);
  overflow: hidden;
}
.inbox-header {
  width: 100%;
  padding: 1rem 1rem;
  border-bottom: 1px solid var(--border);
}
.inbox-header-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.inbox-header-icon {
  flex-shrink: 0;
  color: var(--muted-foreground);
}
.inbox-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--foreground);
}
.inbox-unread-badge {
  margin-left: 0.25rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  background: var(--primary);
  color: var(--primary-foreground);
}
.inbox-filter-tabs {
  width: 100%;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 30%, transparent);
}
.inbox-filter-row {
  display: flex;
  flex-direction: row;
  gap: 0.25rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.inbox-filter-row::-webkit-scrollbar { display: none; }
.inbox-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 500;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted-foreground);
  text-decoration: none;
  border: none;
  cursor: pointer;
  font: inherit;
  transition: background 0.15s, color 0.15s;
}
.inbox-filter-btn:hover {
  color: var(--foreground);
  background: color-mix(in oklch, var(--background) 50%, transparent);
}
.inbox-filter-btn--active {
  background: var(--background);
  color: var(--foreground);
  box-shadow: var(--shadow-sm);
}
.inbox-filter-icon {
  flex-shrink: 0;
}
.inbox-list {
  width: 100%;
}
.inbox-empty {
  width: 100%;
  padding: 4rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.inbox-empty-illustration {
  width: 6rem;
  max-width: 96px;
  margin-bottom: 1rem;
  color: var(--muted-foreground);
  opacity: 0.6;
}
.inbox-empty-bird {
  width: 100%;
  height: auto;
}
.inbox-empty-text {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* Элемент уведомления (MemoCommentMessage) — для будущего использования */
.inbox-item {
  width: 100%;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid color-mix(in oklch, var(--border) 60%, transparent);
  transition: background 0.2s;
  position: relative;
}
.inbox-item:last-child { border-bottom: none; }
.inbox-item:hover { background: color-mix(in oklch, var(--muted) 30%, transparent); }
.inbox-item--unread {
  background: color-mix(in oklch, var(--primary) 3%, transparent);
}
.inbox-item--unread:hover {
  background: color-mix(in oklch, var(--primary) 5%, transparent);
}
.inbox-item--unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--primary), color-mix(in oklch, var(--primary) 60%, transparent));
}
.inbox-item-inner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.inbox-item-avatar {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  overflow: hidden;
  background: var(--muted);
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in oklch, var(--border) 40%, transparent);
  text-decoration: none;
}
.inbox-item-avatar:hover { opacity: 0.9; }
.inbox-item-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inbox-item-avatar-placeholder { display: flex; align-items: center; justify-content: center; }
.inbox-item-avatar-placeholder svg { display: block; }
.inbox-item-content { flex: 1; min-width: 0; }
.inbox-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}
.inbox-item-sender {
  font-size: 0.875rem;
  font-weight: 600;
  color: color-mix(in oklch, var(--foreground) 95%, transparent);
}
.inbox-item-meta {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  opacity: 0.8;
}
.inbox-item-meta-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.5rem;
  min-width: 0;
}
.inbox-item-text {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  opacity: 0.9;
}
.inbox-item-reaction {
  font-size: 1rem;
  vertical-align: middle;
}
.inbox-item-time {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  opacity: 0.6;
}
.inbox-item-actions {
  flex-shrink: 0;
  opacity: 1;
}
.inbox-item-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 1.75rem;
  padding: 0.2rem 0.5rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.inbox-item-btn:hover { color: var(--foreground); }
.inbox-item-btn-read {
  border: 1px solid color-mix(in oklch, var(--border) 70%, transparent);
  background: color-mix(in oklch, var(--muted) 40%, transparent);
  width: 1.9rem;
  min-width: 1.9rem;
  min-height: 1.9rem;
  padding: 0;
  border-radius: 9999px;
}
.inbox-item-btn-read svg {
  width: 0.9rem;
  height: 0.9rem;
  flex-shrink: 0;
}
.inbox-item-btn-read:hover {
  color: var(--primary);
  border-color: color-mix(in oklch, var(--primary) 45%, transparent);
  background: color-mix(in oklch, var(--primary) 10%, transparent);
}
.inbox-item-btn-read--done,
.inbox-item-btn-read:disabled {
  color: color-mix(in oklch, var(--foreground) 60%, transparent);
  border-color: color-mix(in oklch, var(--primary) 40%, transparent);
  background: color-mix(in oklch, var(--primary) 12%, transparent);
  cursor: default;
}
.inbox-clear-wrap {
  width: 100%;
  padding: 1rem 1.25rem 1.25rem;
}
.inbox-clear-btn {
  width: 100%;
  min-height: 2.25rem;
  border: 1px solid color-mix(in oklch, var(--border) 75%, transparent);
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--muted) 35%, transparent);
  color: var(--muted-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.inbox-clear-btn:hover {
  color: var(--foreground);
  border-color: color-mix(in oklch, var(--foreground) 25%, transparent);
  background: color-mix(in oklch, var(--muted) 55%, transparent);
}
.inbox-clear-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.inbox-item-memo-link {
  text-decoration: none;
  color: inherit;
  display: block;
  margin-top: 0.5rem;
}
.inbox-item-memo-link:hover .inbox-item-original-text { color: var(--foreground); }
.inbox-item-original {
  padding-left: 0.75rem;
  border-left: 2px solid color-mix(in oklch, var(--muted-foreground) 20%, transparent);
  margin-bottom: 0.75rem;
}
.inbox-item-original-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  opacity: 0.5;
  margin-right: 0.5rem;
}
.inbox-item-original-text {
  font-size: 0.875rem;
  color: color-mix(in oklch, var(--foreground) 60%, transparent);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inbox-gift-original {
  display: grid;
  gap: 0.45rem;
}
.inbox-gift-media {
  width: 8.5rem;
  height: 8.5rem;
  border: 1px solid color-mix(in oklch, var(--border) 70%, transparent);
  border-radius: 0.75rem;
  background: var(--background);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.inbox-gift-media img,
.inbox-gift-media video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.inbox-gift-message {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: color-mix(in oklch, var(--foreground) 80%, transparent);
  white-space: pre-wrap;
}
.inbox-item-comment {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(to bottom right, color-mix(in oklch, var(--primary) 6%, transparent), color-mix(in oklch, var(--primary) 3%, transparent));
  border: 1px solid color-mix(in oklch, var(--primary) 30%, transparent);
  cursor: pointer;
  transition: all 0.2s;
}
@media (min-width: 640px) {
  .inbox-item-comment { padding: 0.75rem 1rem; }
}
.inbox-item-comment:hover {
  background: linear-gradient(to bottom right, color-mix(in oklch, var(--primary) 10%, transparent), color-mix(in oklch, var(--primary) 6%, transparent));
  border-color: color-mix(in oklch, var(--primary) 50%, transparent);
  box-shadow: var(--shadow-sm);
}
.inbox-item-comment-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  opacity: 0.6;
  margin-bottom: 0.25rem;
}
.inbox-item-comment-text {
  font-size: 0.875rem;
  color: color-mix(in oklch, var(--foreground) 90%, transparent);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ——— Страница бота (чат) ——— */
.main-area--bot {
  padding: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: calc(100vh - 4rem);
  min-height: calc(100dvh - 4rem);
}
.content-wrap--bot {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: 2rem;
  padding-bottom: 2rem;
}
.bot-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-height: 280px;
  max-height: calc(100vh - 8rem);
  max-height: calc(100dvh - 8rem);
}
.bot-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 260px;
  max-height: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.bot-header {
  flex-shrink: 0;
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.bot-header-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.bot-header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}
.bot-header-icon svg { display: block; }
.bot-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--foreground);
}
.bot-flow-hint {
  flex: 1;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--muted-foreground);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bot-header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}
.bot-header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.bot-header-btn:hover {
  background: color-mix(in oklch, var(--muted) 60%, transparent);
  color: var(--foreground);
}
.bot-header-settings-wrap {
  position: relative;
}
.bot-header-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.25rem;
  min-width: 12rem;
  padding: 0.5rem 0;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: 50;
}
.bot-header-dropdown.hidden {
  display: none;
}
.bot-header-dropdown-section {
  padding: 0 0;
}
.bot-header-dropdown-section + .bot-header-dropdown-section {
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
  padding-top: 0.25rem;
}
.bot-header-dropdown-label {
  display: block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.bot-header-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  background: none;
  font-size: 0.9375rem;
  color: var(--foreground);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.bot-header-dropdown-item:hover {
  background: color-mix(in oklch, var(--muted) 50%, transparent);
}
.bot-header-dropdown-item--active {
  color: var(--primary);
  font-weight: 500;
}
.bot-header-dropdown-item--active::before {
  content: '✓ ';
  font-weight: 600;
}
.bot-header-dropdown-item--danger:hover {
  background: color-mix(in oklch, var(--destructive) 15%, transparent);
  color: var(--destructive);
}
.bot-subtitle {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.4;
}
.bot-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.bot-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  -webkit-overflow-scrolling: touch;
}
.bot-msg {
  max-width: 85%;
  align-self: flex-start;
}
.bot-msg--user {
  align-self: flex-end;
}
.bot-msg-content {
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  line-height: 1.45;
  word-wrap: break-word;
}
.bot-msg--bot .bot-msg-content {
  background: color-mix(in oklch, var(--muted) 50%, transparent);
  color: var(--foreground);
  border: 1px solid color-mix(in oklch, var(--border) 60%, transparent);
}
.bot-msg--user .bot-msg-content {
  background: color-mix(in oklch, var(--primary) 15%, transparent);
  color: var(--foreground);
  border: 1px solid color-mix(in oklch, var(--primary) 35%, transparent);
}
.bot-quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.bot-quick-btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.bot-quick-btn:hover {
  background: color-mix(in oklch, var(--primary) 12%, transparent);
  border-color: color-mix(in oklch, var(--primary) 40%, transparent);
}
.bot-input-wrap {
  flex-shrink: 0;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  background: color-mix(in oklch, var(--background) 80%, var(--card));
}
.bot-attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  max-height: 6rem;
  overflow-y: auto;
}
.bot-attachment-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  background: color-mix(in oklch, var(--muted) 30%, transparent);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bot-attachment-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.bot-attachment-item-remove {
  flex-shrink: 0;
  padding: 0.15rem;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  border-radius: 2px;
  line-height: 1;
}
.bot-attachment-item-remove:hover {
  color: var(--foreground);
  background: color-mix(in oklch, var(--destructive) 15%, transparent);
}
.bot-attach-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--muted-foreground);
  cursor: pointer;
}
.bot-attach-btn:hover {
  color: var(--foreground);
  border-color: var(--primary);
}
.bot-form {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.bot-input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  height: 2.5rem;
  box-sizing: border-box;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  font-size: 0.9375rem;
}
.bot-input::placeholder { color: var(--muted-foreground); }
.bot-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--primary) 25%, transparent);
}
.bot-attach-btn {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
}
.bot-send {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.875rem;
  height: 2.5rem;
  box-sizing: border-box;
}
.bot-send-icon { display: none; }

@media (max-width: 767px) {
  .page-bot .main-area.main-area--bot {
    padding-top: 0;
    min-height: 0;
    height: calc(100vh - 3rem);
    height: calc(100dvh - 3rem);
    max-height: calc(100vh - 3rem);
    max-height: calc(100dvh - 3rem);
    overflow: hidden;
    box-sizing: border-box;
  }
  .page-bot .content-wrap--bot {
    padding: 0.15rem;
    padding-bottom: 0.75rem;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .page-bot .content-wrap {
    padding: 0.15rem;
  }
  .page-bot .bot-section {
    min-height: 0;
    flex: 1;
    max-height: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .page-bot .bot-card {
    min-height: 0;
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--radius);
  }
  .page-bot .bot-chat {
    min-height: 0;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .page-bot .bot-messages {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .bot-header { padding: 0.2rem 1rem; }
  .bot-title { font-size: 1.125rem; }
  .bot-flow-hint { font-size: 0.75rem; }
  .bot-subtitle { font-size: 0.8125rem; margin-top: 0.35rem; }
  .bot-messages { padding: 0.75rem 1rem; }
  .bot-msg { max-width: 92%; }
  .bot-msg-content { padding: 0.5rem 0.75rem; font-size: 0.875rem; }
  .bot-input-wrap { padding: 0.5rem 1rem; flex-shrink: 0; }
  .bot-form { gap: 0.35rem; align-items: stretch; }
  .page-bot .bot-form .bot-attach-btn,
  .page-bot .bot-form .bot-input,
  .page-bot .bot-form .bot-send {
    min-height: 2.5rem;
    height: 2.5rem;
    box-sizing: border-box;
  }
  .page-bot .bot-form .bot-input { height: 2.5rem; }
  .page-bot .bot-form .bot-attach-btn { width: 2.5rem; }
  .bot-send-text { display: none; }
  .bot-send-icon { display: block; }
}

/* ——— Адаптив под мобильные: как в оригинале Memos — левое меню = drawer (BG.Hub, навигация, пользователь), правое = drawer (поиск, календарь, теги) ——— */
@media (max-width: 767px) {
  .app { flex-direction: column; align-items: stretch; }
  .mobile-header { display: flex; margin-left: 0; }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-launcher--mobile { position: relative; }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-launcher--mobile .notes-apps-trigger[aria-expanded="true"] { background: var(--muted); }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-launcher--mobile .notes-apps-menu {
    position: fixed;
    top: calc(3rem + 0.5rem);
    right: 0.75rem;
    width: min(72vw, 14rem);
    padding: 0.625rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: color-mix(in oklab, var(--background) 94%, var(--card));
    box-shadow: var(--shadow-xl);
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.375rem;
    z-index: 1100;
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-launcher--mobile .notes-apps-menu.is-open { display: grid; }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-launcher--mobile .notes-apps-item {
    min-height: 4.125rem;
    border: 1px solid transparent;
    border-radius: 0.75rem;
    text-decoration: none;
    color: var(--foreground);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.1;
    text-align: center;
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-launcher--mobile .notes-apps-item:hover {
    background: color-mix(in oklab, var(--muted) 68%, var(--card));
    border-color: var(--border);
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-launcher--mobile .notes-apps-item--active {
    background: color-mix(in oklab, var(--primary) 14%, var(--card));
    border-color: color-mix(in oklab, var(--primary) 45%, var(--border));
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-apps-launcher--mobile .notes-apps-item-icon {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.625rem;
    background: color-mix(in oklab, var(--card) 70%, var(--muted));
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-header-notify { text-decoration: none; }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-header-notify .nav-icon-wrap { position: relative; display: inline-flex; }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-header-notify .nav-inbox-badge {
    top: -6px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    font-size: 9px;
    border-color: var(--background);
  }
  body:is(.page-home, .page-calendar, .page-attachments, .page-bot, .page-inbox, .page-contacts, .page-explore, .page-search, .page-settings, .page-profile, .page-foto) .notes-header-notify--active {
    background: color-mix(in oklab, var(--primary) 14%, var(--card));
    border-color: color-mix(in oklab, var(--primary) 52%, var(--border));
  }
  /* Только на мобильном: без отступов у content-wrap, подстройка под экран; у бота отступы задаёт .page-bot .content-wrap--bot выше */
  .content-wrap {
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0;
    margin-left: 0;
    flex: 1;
    min-width: 0;
    max-width: 42rem;
    margin: 0 auto;
    width: 100%;
  }
  .sidebar { display: none; }
  .sidebar-drawer { display: flex; flex-direction: column; }
  .sidebar-drawer--left { display: flex; }
  .sidebar-drawer--right .sidebar-panel--drawer { background: var(--background); }
  .create-memo.create-memo-card { padding: 0.75rem 1rem 0.25rem; }
  .memo-card { padding: 0.75rem 1rem; }
  /* Панель управления в одну строку: (+), видимость, Отменить, Сохранить — компактно под экран */
  .memo-form-toolbar { flex-wrap: nowrap; gap: 0.25rem; margin-bottom: 0.5rem; min-width: 0; }
  .memo-form-left { flex: 0 0 auto; gap: 0.125rem; min-width: 0; }
  .memo-form-right { flex: 1 1 auto; justify-content: flex-end; gap: 0.25rem; min-width: 0; flex-wrap: nowrap; }
  .memo-form-toolbar .btn-add { width: 1.75rem; min-width: 1.75rem; height: 1.75rem; min-height: 1.75rem; }
  .memo-form-toolbar .btn-add-svg { width: 0.875rem; height: 0.875rem; }
  .memo-form-toolbar .visibility-dropdown-wrap { min-width: 0; }
  .memo-form-toolbar .visibility-trigger { padding: 0.2rem 0.35rem; font-size: 0.75rem; gap: 0.125rem; min-width: 0; }
  .memo-form-toolbar .visibility-trigger-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .memo-form-toolbar .visibility-trigger-chevron { width: 0.75rem; height: 0.75rem; margin-left: 0.0625rem; flex-shrink: 0; }
  .memo-form-toolbar .memo-edit-cancel,
  .memo-form-toolbar .btn-save { height: 1.75rem; padding: 0 0.5rem; font-size: 0.8125rem; }
  .memo-card--editing .create-memo.memo-edit-inline { padding-left: 0; padding-right: 0; max-width: 100%; }
  /* Меню «+» при редактировании — поверх карточки (position: fixed), не обрезается */
  .memo-edit-add-dropdown.is-open {
    position: fixed;
    z-index: 9999;
    left: var(--add-menu-fixed-left, 0);
    top: var(--add-menu-fixed-top, 0);
  }
  /* Меню карточки заметки на мобильных — поверх карточки (position: fixed), не обрезается */
  .memo-card-menu.is-open {
    position: fixed !important;
    z-index: 9999;
    left: var(--memo-menu-fixed-left, 0) !important;
    top: var(--memo-menu-fixed-top, 0) !important;
    right: auto !important;
  }
  .memo-meta { flex-wrap: nowrap; }
  .memo-meta-right,
  .memo-actions {
    flex-shrink: 0;
  }
  .memo-reaction-trigger,
  .memo-meta-right .memo-visibility-indicator,
  .memo-actions .memo-visibility-indicator,
  .memo-card-menu-trigger {
    min-width: 1rem;
    min-height: 1rem;
    width: 1rem;
    height: 1rem;
  }
  .auth-box { margin: 1rem auto; padding: 1.25rem; }
  .page-content { padding: 0; }
  .card { padding: 1rem; }
  /* Профиль на мобильных — как главная: один уровень отступов от content-wrap, без сжатия; меньше отступ от шапки сайта */
  .page-profile .profile-header { padding: 0.5rem 0 2rem 1rem; }
  .page-profile .profile-name-row { padding-right: 0.35rem; }
  .page-profile .profile-tabs-outer {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .page-profile .profile-tabs {
    width: max-content;
    min-width: 100%;
    flex-wrap: nowrap;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .page-profile .memos-list--profile { padding-left: 0; padding-right: 0; }
  /* Фото во вложениях заметки: в ряд помещается 2–3 миниатюры */
  .memo-attachments-card-photo-wrap {
    flex: 0 1 calc((100% - 1rem) / 3);
    min-width: 0;
  }
  .memo-attachments-card-photo-link { width: 100%; }
  .memo-attachments-card-photo {
    width: 100%;
    max-width: 100%;
    max-height: 6rem;
    object-fit: cover;
  }
}

@media (min-width: 768px) {
  .content-wrap { padding: 1.5rem 1.5rem 0rem; }
}

/* Всплывающие уведомления (как react-hot-toast в оригинале Memos: top-right) */
.toast-container {
  position: fixed;
  top: 1.1rem;
  right: 1.1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  min-width: 17rem;
  max-width: 24rem;
  padding: 0.65rem 0.7rem 0.65rem 0.8rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--card) 94%, #4a76a8 6%);
  color: var(--card-foreground);
  font-size: 0.86rem;
  line-height: 1.35;
  box-shadow: 0 8px 30px rgba(13, 25, 44, 0.2);
  border: 1px solid color-mix(in srgb, var(--border) 80%, #4a76a8 20%);
  border-left: 3px solid #4a76a8;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.toast--visible {
  opacity: 1;
  transform: translateX(0);
}
.toast__text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
.toast__close {
  border: 0;
  background: transparent;
  color: color-mix(in srgb, var(--muted-foreground) 70%, var(--card-foreground) 30%);
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}
.toast__close:hover {
  background: color-mix(in srgb, var(--border) 70%, transparent 30%);
  color: var(--card-foreground);
}
.toast-container:empty { display: none; }

/* --- Контакты (трёхколоночная страница) --- */
/* Только на странице списка /contacts: без общего скролла, высота под viewport, скролл только в блоке списка */
body.page-contacts-list { overflow: hidden; }
.page-contacts-list .app { height: 100vh; max-height: 100vh; min-height: 0; overflow: hidden; }
.main-area--contacts { padding: 0; min-height: 0; }
.page-contacts-list .content-wrap { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.page-messages .content-wrap { max-width: none; }
.main-area--contacts { flex: 1; min-height: 0; display: flex; overflow: hidden; }
.contacts-page {
  display: grid;
  grid-template-columns: 200px 280px 1fr;
  min-height: 0;
  flex: 1;
  max-width: 100%;
  overflow: hidden;
}
@media (max-width: 900px) {
  body.page-contacts-list { overflow-y: auto; }
  .page-contacts-list .app {
    height: auto;
    max-height: none;
    min-height: 100dvh;
    overflow: visible;
  }
  .page-contacts-list .content-wrap,
  .page-contacts-list .main-area--contacts,
  .page-contacts-list .contacts-page {
    overflow: visible;
  }
  .contacts-page {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }
  .contacts-page--mobile-detail .contacts-categories-panel,
  .contacts-page--mobile-detail .contacts-list-panel {
    display: none;
  }
  .contacts-page--mobile-detail .contacts-detail-panel {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    min-height: 0;
    overflow: visible;
  }
  .contacts-page--mobile-detail .contacts-detail-content {
    overflow: visible;
  }
  .contacts-page--mobile-detail .contacts-detail-body {
    overflow-y: visible;
    padding-bottom: 4rem;
  }
  .contacts-categories-panel {
    padding: 0.25rem 0.5rem;
  }
  .contacts-categories-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.09rem 0;
    border: none;
    background: transparent;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-align: left;
    border-radius: var(--radius);
    transition: background 0.15s;
  }
  .contacts-categories-toggle:hover {
    background: color-mix(in oklch, var(--primary) 18%, var(--background));
  }
  .contacts-categories-toggle-icon {
    flex-shrink: 0;
    transition: transform 0.2s;
  }
  .contacts-categories-panel--open .contacts-categories-toggle-icon {
    transform: rotate(180deg);
  }
  .contacts-categories-collapse-content {
    display: none;
    padding-top: 0.25rem;
  }
  .contacts-categories-panel--open .contacts-categories-collapse-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }
}

.contacts-categories-panel {
  background: color-mix(in oklch, var(--primary) 12%, var(--background));
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
@media (min-width: 901px) {
  .contacts-categories-panel {
    padding: 1rem 0.75rem;
  }
}
.contacts-categories-toggle-label {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--foreground);
}
@media (min-width: 901px) {
  .contacts-categories-toggle {
    display: none;
  }
  .contacts-categories-collapse-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }
}
.contacts-categories-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.contacts-category-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  transition: background 0.15s, color 0.15s;
}
.contacts-category-item:hover {
  background: color-mix(in oklch, var(--primary) 18%, var(--background));
  color: var(--foreground);
}
.contacts-category-item--active {
  background: color-mix(in oklch, var(--primary) 18%, var(--background));
  color: var(--primary);
  font-weight: 500;
}
.contacts-category-add-btn {
  margin-top: 0.5rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: var(--primary-foreground);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.contacts-category-add-btn:hover { opacity: 0.9; }
.contacts-category-add-btn svg { display: block; }

.contacts-list-panel {
  position: relative;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.contacts-list-toolbar {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.contacts-list-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 1.75rem;
}
.contacts-list-search-icon {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted-foreground);
  flex-shrink: 0;
}
.contacts-list-search-input {
  width: 100%;
  height: 1.75rem;
  padding: 0 0.5rem 0 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--background);
  color: var(--foreground);
  font-size: 0.8125rem;
}
.contacts-list-search-input::placeholder {
  color: var(--muted-foreground);
}
.contacts-list-search-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px var(--ring);
}
.contacts-list-sorts {
  display: flex;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}
.contacts-list-sort-label { cursor: default; }
.contacts-list-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.contacts-list-inner { padding: 0.5rem; }
.contacts-list-empty {
  padding: 1rem;
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  text-align: center;
}
.contacts-list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 2px;
}
.contacts-list-item:hover {
  background: var(--muted);
}
.contacts-list-item--active {
  background: color-mix(in oklch, var(--primary) 15%, transparent);
  color: var(--primary);
}
.contacts-list-item-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.contacts-list-item-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.contacts-list-item-registered-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.contacts-list-item-registered-badge svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.contacts-list-item-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.contacts-list-item-avatar-icon {
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
}
.contacts-list-item-avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--foreground);
}
.contacts-list-item-avatar-icon svg { display: block; }
.contacts-list-item-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.contacts-list-item-name {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contacts-list-item-name-icon {
  width: 0.78rem;
  height: 0.78rem;
  min-width: 0.78rem;
  color: rgb(255, 86, 56);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.contacts-list-item-name-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.contacts-list-item-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contacts-list-item-sub {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contacts-list-item-tag {
  font-size: 0.7rem;
  color: var(--primary);
  margin-top: 0.125rem;
}
/* Плавающая кнопка «Новый контакт» — всегда фиксирована, не скроллится со страницей */
.contacts-list-fab {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: opacity 0.15s, box-shadow 0.15s;
  z-index: 10;
  text-decoration: none;
}
.contacts-list-fab:hover {
  opacity: 0.9;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
  color: var(--primary-foreground);
}
.contacts-list-fab svg {
  display: block;
  color: inherit;
}

.contacts-detail-panel {
  background: var(--card);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.contacts-detail-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.9375rem;
}
.contacts-detail-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.contacts-detail-header {
  padding: 1rem 1.25rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  border-bottom: 1px solid var(--border);
}
.contacts-detail-name-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  width: 100%;
  margin: 0 0 0.25rem 0;
}
.contacts-detail-name {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}
.contacts-detail-name--under-avatar {
  margin-top: 0.5rem;
  font-size: 1rem;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}
.contacts-detail-name-row .contacts-detail-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
.contacts-detail-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.contacts-detail-action-btn:hover { color: var(--foreground); background: var(--muted); }
.contacts-detail-action-btn.contacts-detail-delete { color: var(--destructive); border-color: var(--destructive); }
.contacts-detail-action-btn.contacts-detail-delete:hover { background: color-mix(in oklch, var(--destructive) 15%, transparent); }
.contacts-detail-action-btn--text {
  width: auto;
  min-width: 2rem;
  padding: 0 0.65rem;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
}
.contacts-back-btn {
  display: none;
}
@media (max-width: 900px) {
  .contacts-detail-header {
    padding: 0.3rem 1rem 0;
  }
  .contacts-detail-name-row {
    justify-content: space-between;
  }
  .contacts-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    margin: 0 0 0.25rem 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--muted-foreground);
    cursor: pointer;
  }
  .contacts-back-btn svg {
    display: block;
  }
}
.contacts-detail-tabs {
  display: flex;
  gap: 0;
  margin-bottom: -1px;
}
.contacts-detail-tab {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-bottom: none;
  background: var(--background);
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.contacts-detail-tab:hover { color: var(--foreground); }
.contacts-detail-tab--active {
  background: var(--muted);
  color: var(--foreground);
  border-color: var(--border);
  border-bottom: 1px solid var(--muted);
  margin-bottom: -1px;
}
.contacts-detail-delete { color: var(--destructive) !important; border-color: var(--destructive) !important; }
.contacts-detail-delete:hover { background: color-mix(in oklch, var(--destructive) 15%, transparent) !important; }

.contacts-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}
.contacts-detail-avatar-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.contacts-detail-avatar-wrap {
  position: relative;
  width: 8rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.contacts-detail-profile-link-wrap {
  flex-shrink: 0;
}
.contacts-detail-link-actions {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
}
.contacts-detail-profile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.contacts-detail-profile-btn:hover {
  background: var(--muted);
  color: var(--foreground);
  border-color: var(--border);
}
.contacts-detail-profile-btn-icon {
  flex-shrink: 0;
  color: var(--muted-foreground);
}
.contacts-detail-profile-btn:hover .contacts-detail-profile-btn-icon {
  color: inherit;
}
.contacts-detail-message-btn {
  border-color: color-mix(in oklch, var(--primary) 35%, var(--border));
}
.contacts-detail-registered-badge {
  position: absolute;
  right: -0.1rem;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  overflow: hidden;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
}
.contacts-detail-registered-badge svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.contacts-detail-avatar {
  width: 8rem;
  height: 8rem;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.contacts-detail-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.contacts-detail-avatar--placeholder {
  color: var(--muted-foreground);
}
.contacts-detail-avatar--placeholder svg { display: block; }
.contacts-detail-avatar-initials {
  font-size: 2.4rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
}
.messages-page {
  width: 100%;
  height: calc(100vh - 1.5rem);
  min-height: 34rem;
  display: grid;
  grid-template-columns: minmax(17rem, 29%) 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  overflow: hidden;
}
.messages-dialogs-panel,
.messages-thread-panel {
  min-height: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}
.messages-dialogs-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
}
.messages-dialogs-header {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  min-height: 2.7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.messages-dialogs-header h2 {
  margin: 0;
  font-size: 1rem;
}
.messages-dialogs-header-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.messages-dialogs-header .messages-thread-settings-btn,
.messages-dialogs-add-btn {
  width: 1.9rem;
  height: 1.9rem;
  min-width: 1.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.messages-dialogs-header .messages-thread-settings-btn:hover,
.messages-dialogs-add-btn:hover {
  background: color-mix(in oklch, var(--muted) 45%, transparent);
}
.messages-dialogs-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.messages-dialog-item {
  width: 100%;
  border: none;
  border-bottom: 1px solid color-mix(in oklch, var(--border) 70%, transparent);
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0.75rem;
  display: flex;
  gap: 0.625rem;
  cursor: pointer;
}
.messages-dialog-item:hover {
  background: color-mix(in oklch, var(--muted) 40%, transparent);
}
.messages-dialog-item--active {
  background: color-mix(in oklch, var(--primary) 12%, transparent);
}
.messages-dialog-avatar {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  overflow: hidden;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  flex-shrink: 0;
}
.messages-dialog-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.messages-dialog-main {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-width: 0;
  flex: 1;
}
.messages-dialog-top,
.messages-dialog-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.messages-dialog-name {
  font-size: 0.9rem;
  font-weight: 500;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.messages-dialog-name-text {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messages-dialog-time {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  flex-shrink: 0;
}
.messages-dialog-preview {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messages-dialog-unread {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  flex-shrink: 0;
}
.messages-dialog-meta-right {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  flex-shrink: 0;
}
.messages-dialog-status {
  line-height: 1;
}
.messages-thread-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.messages-thread-empty,
.messages-empty {
  color: var(--muted-foreground);
  font-size: 0.9rem;
  margin: 0;
  padding: 1rem;
}
.messages-thread-empty {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.messages-thread-empty-card {
  width: min(34rem, 100%);
  margin: 0 auto;
  display: grid;
  justify-items: center;
  gap: 0.5rem;
}
.messages-thread-empty-icon {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  background: color-mix(in oklch, var(--primary) 8%, transparent);
}
.messages-thread-empty-title {
  margin: 0;
  color: var(--foreground);
  font-size: 1.02rem;
  font-weight: 600;
}
.messages-thread-empty-note {
  margin: 0;
  max-width: 32rem;
  font-size: 0.84rem;
  line-height: 1.45;
}
.messages-thread-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  position: relative;
}
.messages-thread-bg-layer {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--messages-thread-head-height, 2.7rem);
  bottom: calc(var(--messages-composer-form-height, 4.9rem) + var(--messages-mobile-keyboard-offset, 0px));
  pointer-events: none;
  z-index: 0;
  background-image: var(--messages-thread-custom-image), var(--messages-thread-default-image);
  background-repeat: no-repeat, no-repeat;
  background-size: cover, cover;
  background-position: center, center;
}
.messages-thread-bg-layer::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: url('/uploads/fon/car.svg') center / cover no-repeat;
  opacity: 0.2;
}
.messages-thread-wrap--custom-bg .messages-thread-bg-layer::before {
  display: none;
}
.messages-thread-bg-layer::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgb(0 0 0 / var(--messages-thread-bg-dim));
  backdrop-filter: blur(var(--messages-thread-bg-blur));
  -webkit-backdrop-filter: blur(var(--messages-thread-bg-blur));
}
.messages-thread-head {
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 2.7rem;
  box-sizing: border-box;
  position: relative;
  z-index: 2;
}
.messages-thread-head-actions {
  margin-left: auto;
  position: relative;
}
.messages-thread-menu-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.messages-thread-menu-btn:hover {
  background: color-mix(in oklch, var(--muted) 45%, transparent);
}
.messages-thread-head-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.38rem);
  min-width: 11rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 0.35rem;
  z-index: 15;
}
.messages-thread-head-menu-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--foreground);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.45rem 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  cursor: pointer;
}
.messages-thread-head-menu-item:hover {
  background: color-mix(in oklch, var(--muted) 45%, transparent);
}
.messages-thread-head-menu-item-icon {
  width: 1rem;
  height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.messages-thread-head-menu-item--danger {
  color: color-mix(in oklch, var(--destructive) 75%, var(--foreground));
}
.messages-thread-settings-btn {
  margin-left: auto;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.messages-back-btn {
  display: none;
  border: 1px solid var(--border);
  background: var(--background);
  border-radius: var(--radius);
  color: var(--foreground);
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.45rem;
}
.messages-thread-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}
.messages-thread-user-texts {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 2rem;
}
.messages-thread-user-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  overflow: hidden;
  background: var(--muted);
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.messages-thread-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.messages-thread-user-name {
  font-size: 0.9rem;
  font-weight: 600;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
}
.messages-thread-user-name-text {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messages-verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.95rem;
  height: 0.95rem;
  flex: 0 0 auto;
}
.messages-verified-badge svg {
  width: 100%;
  height: 100%;
  display: block;
}
.messages-bonus-plus-gift-icon {
  display: inline-flex;
  width: 0.95rem;
  height: 0.95rem;
  overflow: hidden;
  border-radius: 999px;
  flex: 0 0 auto;
}
.messages-bonus-plus-gift-icon img,
.messages-bonus-plus-gift-icon video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.messages-thread-user-username {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.messages-thread-user-username--online {
  color: var(--primary);
  font-weight: 600;
}
.messages-thread-typing {
  position: absolute;
  left: 50%;
  top: 2.95rem;
  transform: translateX(-50%);
  z-index: 6;
  display: inline-flex;
  gap: 0.15rem;
  align-items: center;
  padding: 0.22rem 0.5rem;
  font-size: 0.76rem;
  color: var(--primary);
  border: 1px solid color-mix(in oklch, var(--primary) 35%, var(--border));
  background: color-mix(in oklch, var(--card) 90%, transparent);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.messages-thread-typing.is-visible { opacity: 1; visibility: visible; }
.messages-thread-typing-dots::after {
  content: '.';
  display: inline-block;
  width: 1.25rem;
  text-align: left;
  animation: messages-typing-dots 1.2s steps(1, end) infinite;
}
@keyframes messages-typing-dots {
  0% { content: '.'; }
  34% { content: '..'; }
  67% { content: '...'; }
  100% { content: '.'; }
}
.messages-thread-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 0.9rem;
  padding-bottom: calc(var(--messages-composer-stack-height, 4.9rem) + 0.8rem);
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: transparent;
  z-index: 1;
}
.messages-thread-body::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.messages-thread-body > * {
  position: relative;
  z-index: 1;
}
.messages-thread-wrap--custom-bg .messages-bubble {
  background: color-mix(in oklch, var(--card) 86%, var(--background));
  border-color: color-mix(in oklch, var(--border) 85%, var(--card));
}
.messages-thread-wrap--custom-bg .messages-bubble-row--me .messages-bubble {
  background: color-mix(in oklch, var(--primary) 20%, var(--card));
}
.messages-load-older-hint {
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
}
.messages-unread-divider {
  align-self: center;
  margin: 0.25rem 0;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid color-mix(in oklch, var(--primary) 35%, var(--border));
  background: color-mix(in oklch, var(--primary) 12%, transparent);
  color: var(--foreground);
  font-size: 0.72rem;
}
.messages-jump-unread {
  position: absolute;
  right: 0.8rem;
  bottom: calc(var(--messages-composer-stack-height, 4.9rem) + 0.6rem);
  z-index: 8;
  border: 1px solid color-mix(in oklch, var(--primary) 40%, var(--border));
  background: var(--card);
  color: var(--foreground);
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.messages-bubble-row {
  display: flex;
  position: relative;
}
.messages-service-row {
  display: flex;
  justify-content: center;
  margin: 0.2rem 0;
}
.messages-service-note {
  font-size: 0.72rem;
  color: var(--muted-foreground);
  border: 1px solid color-mix(in oklch, var(--border) 85%, transparent);
  background: color-mix(in oklch, var(--card) 85%, transparent);
  border-radius: 999px;
  padding: 0.2rem 0.58rem;
  line-height: 1.35;
  text-align: center;
}
.messages-bubble-row--swipe-anim .messages-bubble {
  transition: transform 0.2s ease;
}
.messages-swipe-reply-indicator {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: color-mix(in oklch, var(--card) 86%, transparent);
  border: 1px solid color-mix(in oklch, var(--primary) 40%, var(--border));
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) scale(0.86);
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 2;
}
.messages-swipe-reply-indicator--pulse {
  animation: messagesSwipeReplyPulse 0.2s ease-out;
}
@keyframes messagesSwipeReplyPulse {
  0% { transform: translateY(-50%) scale(1); }
  50% { transform: translateY(-50%) scale(1.12); }
  100% { transform: translateY(-50%) scale(1); }
}
.messages-swipe-reply-indicator svg {
  width: 0.8rem;
  height: 0.8rem;
  display: block;
}
.messages-bubble-row--me {
  justify-content: flex-end;
}
.messages-bubble-row--swiping {
  z-index: 3;
}
.messages-bubble-row--swiping .messages-bubble {
  background: color-mix(in oklch, var(--card) 88%, var(--background));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}
.messages-bubble-row--swiping.messages-bubble-row--me .messages-bubble {
  background: color-mix(in oklch, var(--primary) 22%, var(--card));
}
.messages-bubble {
  max-width: min(36rem, 85%);
  border-radius: var(--radius-lg);
  background: color-mix(in oklch, var(--muted) 65%, transparent);
  padding: 0.55rem 0.7rem;
}
.messages-bubble-row--me .messages-bubble {
  background: color-mix(in oklch, oklch(0.73 0.07 45.09) 65%, transparent);
}
.messages-bubble-sender {
  display: flex;
  align-items: center;
  gap: 0.36rem;
  margin-bottom: 0.32rem;
}
.messages-bubble-sender-avatar {
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--muted);
  color: var(--muted-foreground);
}
.messages-bubble-sender-avatar img,
.messages-bubble-sender-avatar svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.messages-bubble-sender-name {
  font-size: 0.72rem;
  color: var(--muted-foreground);
  font-weight: 600;
  max-width: 14rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messages-bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
}
.messages-bubble-reply {
  width: 100%;
  border: 1px solid color-mix(in oklch, var(--primary) 35%, var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: color-mix(in oklch, var(--card) 80%, transparent);
  text-align: left;
  padding: 0.34rem 0.46rem;
  margin-bottom: 0.36rem;
  cursor: pointer;
  display: grid;
  gap: 0.08rem;
}
.messages-bubble-reply-owner {
  font-size: 0.7rem;
  color: var(--primary);
  font-weight: 600;
}
.messages-bubble-reply-text {
  font-size: 0.78rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messages-bubble-reply--deleted {
  border-style: dashed;
}
.messages-bubble-row--reply-target .messages-bubble {
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--primary) 30%, transparent);
}
.messages-bubble-text--emoji-only {
  line-height: 1.25;
}
.messages-bubble-text--emoji-only-1 {
  font-size: 1.99rem;
}
.messages-bubble-text--emoji-only-2 {
  font-size: 1.7rem;
}
.messages-bubble-text--emoji-only-3plus {
  font-size: 1.45rem;
}
.messages-bubble-text--emoji-only .messages-inline-custom-emoji {
  vertical-align: -0.18em;
  margin: 0 0.04em;
}
.messages-bubble-text--emoji-only-1 .messages-inline-custom-emoji {
  width: 1.3em;
  height: 1.3em;
}
.messages-bubble-text--emoji-only-2 .messages-inline-custom-emoji {
  width: 1.25em;
  height: 1.25em;
}
.messages-bubble-text--emoji-only-3plus .messages-inline-custom-emoji {
  width: 1.18em;
  height: 1.18em;
}
.messages-new-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  z-index: 1002;
}
.messages-new-dialog-modal {
  position: fixed;
  z-index: 1003;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(28rem, calc(100vw - 1.2rem));
  max-height: min(76vh, 34rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.messages-new-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.72rem 0.86rem;
  border-bottom: 1px solid var(--border);
}
.messages-new-dialog-head h3 {
  margin: 0;
  font-size: 0.94rem;
}
.messages-new-dialog-close {
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.messages-new-dialog-body {
  overflow-y: auto;
  padding: 0.42rem;
  display: grid;
  gap: 0.3rem;
}
.messages-new-dialog-item {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: inherit;
  text-align: left;
  padding: 0.5rem 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.messages-new-dialog-item:hover {
  background: color-mix(in oklch, var(--muted) 35%, transparent);
}
.messages-new-dialog-item-avatar {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--muted);
  color: var(--muted-foreground);
  flex-shrink: 0;
}
.messages-new-dialog-item-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.messages-new-dialog-item-text {
  min-width: 0;
  flex: 1;
}
.messages-new-dialog-item-name {
  display: block;
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messages-new-dialog-item-username {
  display: block;
  font-size: 0.72rem;
  color: var(--muted-foreground);
}
.messages-dialog-group-icon {
  display: inline-flex;
  width: 0.9rem;
  height: 0.9rem;
  margin-right: 0.16rem;
  color: var(--muted-foreground);
  vertical-align: -0.08rem;
}
.messages-dialog-group-icon svg {
  width: 100%;
  height: 100%;
}
.messages-new-dialog-empty {
  color: var(--muted-foreground);
  font-size: 0.82rem;
  padding: 0.5rem;
}
.messages-new-dialog-create-group {
  width: 100%;
  border: 1px solid color-mix(in oklch, var(--primary) 45%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--primary) 12%, var(--card));
  color: inherit;
  text-align: left;
  padding: 0.62rem 0.68rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}
.messages-group-create-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1004;
}
.messages-group-create-modal {
  position: fixed;
  z-index: 1005;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(30rem, calc(100vw - 1rem));
  max-height: min(90vh, 42rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.messages-group-create-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.72rem 0.88rem;
  border-bottom: 1px solid var(--border);
}
.messages-group-create-head h3 {
  margin: 0;
  font-size: 0.95rem;
}
.messages-group-create-close {
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.messages-group-create-body {
  padding: 0.75rem;
  overflow-y: auto;
  display: grid;
  gap: 0.58rem;
}
.messages-group-create-top {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.1rem 0;
}
.messages-group-create-avatar-trigger {
  width: 4rem;
  height: 4rem;
  padding: 0;
  border-radius: 999px;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--muted-foreground);
  cursor: pointer;
}
.messages-group-create-avatar-preview {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.messages-group-create-avatar-preview img,
.messages-group-create-avatar-preview svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 999px;
}
.messages-group-avatar-placeholder.profile-edit-avatar-placeholder {
  width: 100%;
  height: 100%;
}
.messages-group-avatar-placeholder.profile-edit-avatar-placeholder svg {
  width: 2rem;
  height: 2rem;
}
.messages-group-create-top-name {
  display: grid;
  gap: 0.24rem;
  font-size: 0.82rem;
  color: var(--muted-foreground);
}
.messages-group-create-top-name input[type="text"] {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: inherit;
  padding: 0.34rem 0.05rem;
  font-size: 1.02rem;
}
.messages-group-create-top-name input[type="text"]:focus {
  outline: none;
  border-bottom-color: color-mix(in oklch, var(--primary) 55%, var(--border));
}
.messages-group-create-members-head {
  margin-top: 0.15rem;
  font-size: 0.8rem;
  color: var(--muted-foreground);
}
.messages-group-create-members {
  display: grid;
  gap: 0.35rem;
}
.messages-group-create-member {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.5rem;
  background: var(--background);
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.messages-group-create-member.is-selected {
  border-color: color-mix(in oklch, var(--primary) 60%, var(--border));
  background: color-mix(in oklch, var(--primary) 14%, var(--card));
}
.messages-group-create-member-avatar {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--muted);
}
.messages-group-create-member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.messages-group-create-member-text {
  min-width: 0;
  flex: 1;
}
.messages-group-create-member-name {
  display: block;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messages-group-create-member-username {
  display: block;
  font-size: 0.72rem;
  color: var(--muted-foreground);
}
.messages-group-create-member-check {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--primary);
  opacity: 0;
  transition: opacity .16s ease;
}
.messages-group-create-member.is-selected .messages-group-create-member-check {
  opacity: 1;
}
.messages-group-create-actions {
  border-top: 1px solid var(--border);
  padding: 0.68rem 0.75rem;
}
.messages-group-create-btn {
  width: 100%;
  border: 1px solid color-mix(in oklch, var(--primary) 60%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--primary) 28%, var(--card));
  color: inherit;
  cursor: pointer;
  padding: 0.58rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.messages-group-manage-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1010;
}
.messages-group-manage-modal,
.messages-group-sheet {
  position: fixed;
  z-index: 1011;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(28rem, calc(100vw - 1rem));
  max-height: min(88vh, 42rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.messages-group-manage-head,
.messages-group-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.72rem 0.85rem;
  border-bottom: 1px solid var(--border);
}
.messages-group-manage-head h3,
.messages-group-sheet-head h3 {
  margin: 0;
  font-size: 0.95rem;
}
.messages-group-manage-close,
.messages-group-sheet-close {
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 1.25rem;
  cursor: pointer;
}
.messages-group-manage-body {
  padding: 0.75rem;
  display: grid;
  gap: 0.58rem;
}
.messages-group-manage-top {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.1rem 0;
}
.messages-group-manage-avatar-trigger {
  width: 4rem;
  height: 4rem;
  padding: 0;
  border-radius: 999px;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--muted-foreground);
  cursor: pointer;
}
.messages-group-manage-avatar-preview {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.messages-group-manage-avatar-preview img,
.messages-group-manage-avatar-preview svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 999px;
}
.messages-group-manage-top-name {
  display: grid;
  gap: 0.24rem;
  font-size: 0.82rem;
  color: var(--muted-foreground);
}
.messages-group-manage-top-name input[type="text"] {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: inherit;
  padding: 0.34rem 0.05rem;
  font-size: 1.02rem;
}
.messages-group-manage-top-name input[type="text"]:focus {
  outline: none;
  border-bottom-color: color-mix(in oklch, var(--primary) 55%, var(--border));
}
.messages-group-manage-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: inherit;
  padding: 0.55rem 0.62rem;
  cursor: pointer;
}
.messages-group-manage-actions,
.messages-group-sheet-actions {
  border-top: 1px solid var(--border);
  padding: 0.62rem 0.75rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.messages-group-manage-btn {
  border: 1px solid color-mix(in oklch, var(--primary) 60%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--primary) 28%, var(--card));
  color: inherit;
  cursor: pointer;
  padding: 0.48rem 0.7rem;
  font-size: 0.84rem;
  font-weight: 600;
}
.messages-group-manage-btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted-foreground);
}
.messages-group-sheet-list {
  padding: 0.55rem;
  overflow-y: auto;
  display: grid;
  gap: 0.35rem;
}
.messages-group-member-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.52rem;
}
.messages-group-member-avatar {
  width: 1.95rem;
  height: 1.95rem;
  border-radius: 999px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--muted);
}
.messages-group-member-avatar img,
.messages-group-member-avatar svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.messages-group-member-main {
  min-width: 0;
  flex: 1;
}
.messages-group-member-name {
  display: block;
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messages-group-member-meta {
  display: block;
  font-size: 0.73rem;
  color: var(--muted-foreground);
}
.messages-group-member-actions {
  display: inline-flex;
  gap: 0.28rem;
}
.messages-group-member-action {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.72rem;
  padding: 0.2rem 0.44rem;
  cursor: pointer;
}
@media (max-width: 900px) {
  .messages-new-dialog-modal {
    width: min(26rem, calc(100vw - 0.9rem));
  }
  .messages-group-create-modal {
    inset: 0;
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    transform: none;
    left: 0;
    top: 0;
  }
  .messages-group-manage-modal,
  .messages-group-sheet {
    inset: 0;
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    transform: none;
    left: 0;
    top: 0;
  }
}
.messages-bubble-time {
  margin-top: 0.22rem;
  text-align: right;
  color: var(--muted-foreground);
  font-size: 0.72rem;
  display: flex;
  gap: 0.56rem;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  flex-wrap: nowrap;
  min-width: 0;
}
.messages-bubble-time-value {
  white-space: nowrap;
  margin-left: auto;
}
.messages-bubble--attachments .messages-bubble-time {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  margin-left: 0;
  justify-self: end;
  justify-content: flex-end;
}
.messages-bubble--attachments .messages-bubble-time-value {
  margin-left: 0;
}
.messages-bubble-status {
  letter-spacing: -0.05em;
  font-size: 0.74rem;
  line-height: 1;
}
.messages-bubble-status--sent {
  color: var(--muted-foreground);
}
.messages-bubble-status--read {
  color: var(--primary);
}
.messages-bubble-edited {
  opacity: 0.86;
  white-space: nowrap;
}
.messages-bubble-reactions-inline {
  display: inline-flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 0.24rem;
  margin-right: 0.18rem;
  min-width: 0;
  max-width: min(100%, 16rem);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.messages-bubble-reactions-inline::-webkit-scrollbar {
  display: none;
}
.messages-bubble-reaction {
  border: 1px solid color-mix(in oklch, var(--border) 80%, transparent);
  background: color-mix(in oklch, var(--muted) 36%, transparent);
  border-radius: 999px;
  padding: 0.06rem 0.36rem;
  font-size: 0.76rem;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  flex-shrink: 0;
}
.messages-bubble-reaction--mine {
  border-color: color-mix(in oklch, var(--primary) 45%, var(--border));
  background: color-mix(in oklch, var(--primary) 12%, transparent);
}
.messages-thread-form {
  border-top: 1px solid var(--border);
  padding: 0.65rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  column-gap: 0.5rem;
  row-gap: 0.5rem;
  align-items: end;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--card);
}
.messages-thread-form-restricted {
  grid-column: 1 / -1;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--muted-foreground);
  font-size: 0.88rem;
  text-align: center;
  padding: 0.65rem 0.7rem;
}
.messages-thread-form--readonly {
  grid-template-columns: 1fr;
  align-items: center;
}
.messages-thread-form--readonly > :not(.messages-thread-form-restricted) {
  display: none !important;
}
.messages-add-menu-wrap {
  grid-column: 1;
  align-self: end;
}
.messages-attach-btn {
  width: 2.45rem;
  height: 2.45rem;
  min-width: 2.45rem;
  min-height: 2.45rem;
}
.messages-add-menu-dropdown {
  min-width: 12.75rem;
  top: auto;
  bottom: calc(100% + 0.25rem);
  left: 0;
}
.messages-thread-file-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
.messages-thread-input {
  grid-column: 2;
  min-height: 2.45rem;
  max-height: 8rem;
  resize: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  padding: 0.55rem 0.65rem;
  width: auto;
  min-width: 0;
  overflow-y: auto;
  transition: height 120ms ease;
}
.messages-thread-send {
  grid-column: 4;
  border: 1px solid color-mix(in oklch, var(--primary) 40%, var(--border));
  background: color-mix(in oklch, var(--primary) 15%, transparent);
  color: var(--foreground);
  border-radius: 999px;
  width: 2.45rem;
  min-width: 2.45rem;
  padding: 0;
  cursor: pointer;
  min-height: 2.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.messages-thread-send:disabled {
  opacity: 0.6;
  cursor: default;
}
.messages-thread-send svg {
  width: 1rem;
  height: 1rem;
  display: block;
}
.messages-emoji-btn {
  grid-column: 3;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  border-radius: 999px;
  width: 2.45rem;
  min-width: 2.45rem;
  min-height: 2.45rem;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.messages-emoji-btn:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}
.messages-emoji-btn svg {
  width: 1rem;
  height: 1rem;
  display: block;
}
.messages-emoji-popover {
  position: absolute;
  right: 0.65rem;
  bottom: calc(100% + 0.45rem);
  z-index: 35;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.messages-emoji-picker {
  width: min(22rem, calc(100vw - 1.2rem));
  max-width: 22rem;
}
.messages-emoji-picker em-emoji-picker {
  width: min(22rem, calc(100vw - 1.2rem)) !important;
  height: min(18rem, 46vh) !important;
  min-height: min(18rem, 46vh) !important;
}
.messages-picker-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  padding: 0.35rem;
}
.messages-picker-tab {
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  cursor: pointer;
  padding: 0.42rem 0.45rem;
  font-size: 0.78rem;
}
.messages-picker-tab + .messages-picker-tab { border-left: none; }
.messages-picker-tab:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.messages-picker-tab:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.messages-picker-tab.is-active {
  background: color-mix(in oklch, var(--primary) 14%, transparent);
  border-color: color-mix(in oklch, var(--primary) 50%, var(--border));
}
.messages-picker-panel {
  display: block;
}
#messages-picker-panel-custom-emoji {
  width: min(22rem, calc(100vw - 1.2rem));
  max-width: 22rem;
  height: min(18rem, 46vh);
  max-height: min(18rem, 46vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.messages-custom-emoji-head {
  padding: 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.messages-custom-emoji-search {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--background);
  color: var(--foreground);
  font-size: 0.82rem;
  padding: 0.46rem 0.74rem;
  width: 7.2rem;
  flex: 0 0 auto;
}
.messages-custom-emoji-categories {
  flex: 1;
  min-width: 0;
  padding: 0;
  display: flex;
  gap: 0.34rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  white-space: nowrap;
}
.messages-custom-emoji-categories::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.messages-custom-emoji-cat {
  width: 1.7rem;
  height: 1.7rem;
  min-width: 1.7rem;
  border: 1px solid color-mix(in oklch, var(--border) 82%, transparent);
  border-radius: 999px;
  background: var(--background);
  color: inherit;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}
.messages-custom-emoji-cat img,
.messages-custom-emoji-cat video {
  width: 80%;
  height: 80%;
  object-fit: contain;
}
.messages-custom-emoji-cat.is-active {
  border-color: color-mix(in oklch, var(--primary) 50%, var(--border));
  background: color-mix(in oklch, var(--primary) 12%, transparent);
}
.messages-custom-emoji-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 0.45rem 0.5rem;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.3rem;
  scrollbar-width: none;
}
.messages-custom-emoji-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.messages-custom-emoji-item {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border);
  border-radius: 0.48rem;
  background: var(--background);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.messages-custom-emoji-item img,
.messages-custom-emoji-item video {
  width: 82%;
  height: 82%;
  object-fit: contain;
}
.messages-custom-emoji-item-char {
  font-size: 1rem;
  line-height: 1;
}
.messages-custom-emoji-sets {
  border-top: 1px solid var(--border);
  padding: 0.36rem 0.45rem;
  display: flex;
  gap: 0.34rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.messages-custom-emoji-sets::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.messages-custom-emoji-set {
  width: 1.8rem;
  height: 1.8rem;
  min-width: 1.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--background);
  color: inherit;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}
.messages-custom-emoji-set img,
.messages-custom-emoji-set video {
  width: 80%;
  height: 80%;
  object-fit: contain;
}
.messages-custom-emoji-set.is-active {
  border-color: color-mix(in oklch, var(--primary) 50%, var(--border));
  background: color-mix(in oklch, var(--primary) 12%, transparent);
}
.messages-inline-custom-emoji {
  display: inline-flex;
  width: 1.35em;
  height: 1.35em;
  vertical-align: -0.22em;
  margin: 0 0.02em;
}
.messages-inline-custom-emoji img,
.messages-inline-custom-emoji video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.messages-dialog-preview .messages-inline-custom-emoji {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.18em;
}
.messages-sticker-picker {
  width: min(22rem, calc(100vw - 1.2rem));
  max-width: 22rem;
  height: min(18rem, 46vh);
  max-height: min(18rem, 46vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.messages-sticker-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.45rem;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.messages-sticker-content::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.messages-sticker-empty {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.8rem;
  padding: 0.35rem;
}
.messages-sticker-empty-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.45rem;
  padding: 0.9rem;
}
.messages-sticker-empty-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.messages-sticker-empty-link:hover {
  text-decoration: underline;
}
.messages-sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 0.35rem;
}
.messages-sticker-item {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  width: 100%;
  aspect-ratio: 1 / 1;
  background: color-mix(in oklch, var(--muted) 30%, transparent);
  overflow: hidden;
  padding: 0;
  cursor: pointer;
}
.messages-sticker-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.messages-sticker-item video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.messages-sticker-sets {
  border-top: 1px solid var(--border);
  background: var(--card);
  padding: 0.35rem;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 2.65rem;
  gap: 0.35rem;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 3.35rem;
  max-height: 3.35rem;
  align-items: center;
  -ms-overflow-style: none;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.messages-sticker-sets::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.messages-sticker-set {
  width: 2.65rem;
  height: 2.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  padding: 0.08rem;
  overflow: hidden;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.messages-sticker-set.is-active {
  border-color: color-mix(in oklch, var(--primary) 55%, var(--border));
  background: color-mix(in oklch, var(--primary) 14%, transparent);
}
.messages-sticker-set img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.messages-sticker-set video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.messages-sticker-set span {
  font-size: 0.74rem;
  color: var(--muted-foreground);
}
.messages-thread-attachment-draft {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--card) 84%, transparent);
  padding: 0.4rem 0.45rem;
  display: grid;
  gap: 0.42rem;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 22;
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: calc(var(--messages-composer-form-height, 0px) + var(--messages-composer-reply-height, 0px) + 0.42rem);
}
.messages-thread-attachment-draft-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.messages-thread-attachment-draft-label {
  font-size: 0.74rem;
  color: var(--muted-foreground);
}
.messages-thread-attachment-draft-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 0.35rem;
}
.messages-thread-attachment-draft-item {
  position: relative;
}
.messages-thread-attachment-draft-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--background);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--muted-foreground);
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
}
.messages-thread-attachment-draft-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.messages-thread-attachment-draft-name {
  display: block;
  margin-top: 0.16rem;
  font-size: 0.66rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messages-thread-attachment-draft-remove {
  position: absolute;
  right: 0.18rem;
  top: 0.18rem;
  width: 1.2rem;
  height: 1.2rem;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.86rem;
}
.messages-thread-attachment-draft-remove:hover {
  opacity: 0.9;
}
.messages-bubble-attachment {
  margin-bottom: 0.4rem;
  display: grid;
  gap: 0.35rem;
  width: fit-content;
  max-width: 100%;
  justify-items: start;
}
.messages-bubble-photo-gallery {
  border-radius: calc(var(--radius) - 1px);
  overflow: hidden;
  background: var(--card);
  width: fit-content;
  max-width: min(100%, var(--messages-photo-max, 23rem));
  min-width: 0;
}
.messages-bubble-photo-gallery-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  background: var(--border);
}
.messages-bubble-photo-gallery-main--single {
  grid-template-columns: 1fr;
}
.messages-bubble-photo-main-btn,
.messages-bubble-photo-thumb-btn {
  border: 0;
  padding: 0;
  margin: 0;
  background: #000;
  min-width: 0;
  display: block;
}
.messages-bubble-photo-main-btn {
  position: relative;
}
.messages-bubble-photo-main-btn img {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
}
.messages-bubble-photo-gallery-main--single .messages-bubble-photo-main-btn {
  width: 100%;
  height: clamp(170px, 32vw, 250px);
}
.messages-bubble-photo-gallery-main--single .messages-bubble-photo-main-btn img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  object-fit: cover;
  object-position: center center;
}
.messages-bubble-photo-thumbs {
  display: grid;
  grid-template-columns: repeat(var(--thumb-count, 1), minmax(0, 1fr));
  gap: 2px;
  background: var(--border);
  border-top: 2px solid var(--border);
}
.messages-bubble-photo-thumb-btn img {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  opacity: 0.92;
}
.messages-bubble-photo-thumb-btn:hover img {
  opacity: 1;
}
.messages-bubble-attachments-grid {
  --messages-attachment-size: 88px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--messages-attachment-size), var(--messages-attachment-size)));
  gap: 0.32rem;
  width: fit-content;
  max-width: min(100%, calc(var(--messages-attachment-size) * 4 + 0.32rem * 3));
}
.messages-bubble--attachments {
  display: inline-grid;
  width: fit-content;
  max-width: min(88vw, 42rem);
}
.messages-bubble--photos {
  --messages-photo-max: 23rem;
  max-width: min(88vw, calc(var(--messages-photo-max) + 1.4rem));
}
.messages-bubble--sticker {
  width: fit-content;
}
.messages-bubble-sticker {
  display: block;
  border: none;
  background: transparent;
  padding: 0;
  margin-bottom: 0.25rem;
  cursor: default;
}
.messages-bubble-sticker img {
  width: min(8rem, 42vw);
  height: auto;
  max-height: 10rem;
  object-fit: contain;
  display: block;
}
.messages-bubble-sticker video {
  width: min(8rem, 42vw);
  height: auto;
  max-height: 10rem;
  object-fit: contain;
  display: block;
}
.messages-bubble-attachment-card {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: color-mix(in oklch, var(--muted) 25%, transparent);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}
.messages-bubble-attachment-card-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
}
.messages-bubble-attachment-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.messages-bubble-attachment-card-name {
  display: block;
  font-size: 0.66rem;
  line-height: 1.2;
  padding: 0.2rem 0.28rem 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messages-bubble-attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--primary);
  text-decoration: none;
}
.messages-bubble-attachment-link:hover {
  opacity: 0.85;
}
.messages-bubble-attachment-link svg {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
}
.messages-bubble-attachment-deleted {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted-foreground);
}
.messages-bubble-attachment-deleted-list {
  display: grid;
  gap: 0.32rem;
}
.messages-bubble-attachment-deleted svg {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
}
.messages-attachments-picker-modal {
  position: fixed;
  z-index: 1002;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(32rem, calc(100vw - 1.2rem));
  max-height: min(72vh, 36rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.messages-attachments-picker-head {
  padding: 0.72rem 0.86rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.messages-attachments-picker-head h3 {
  margin: 0;
  font-size: 0.94rem;
}
.messages-attachments-picker-close {
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.messages-attachments-picker-body {
  overflow-y: auto;
  padding: 0.4rem;
  display: block;
}
.messages-attachments-picker-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.messages-attachments-picker-tab {
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  padding: 0.42rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.messages-attachments-picker-tab:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}
.messages-attachments-picker-tab:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
  border-left: none;
}
.messages-attachments-picker-tab.is-active {
  background: color-mix(in oklch, var(--primary) 14%, transparent);
  border-color: color-mix(in oklch, var(--primary) 50%, var(--border));
}
.messages-attachments-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 0.45rem;
}
.messages-attachments-picker-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
}
.messages-attachments-picker-card:hover {
  background: color-mix(in oklch, var(--muted) 30%, transparent);
}
.messages-attachments-picker-card.is-selected {
  border-color: color-mix(in oklch, var(--primary) 60%, var(--border));
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--primary) 60%, var(--border));
}
.messages-attachments-picker-card-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in oklch, var(--muted) 30%, transparent);
  color: var(--muted-foreground);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}
.messages-attachments-picker-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.messages-attachments-picker-card-name {
  display: block;
  font-size: 0.72rem;
  line-height: 1.2;
  padding: 0.32rem 0.38rem 0.2rem;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messages-attachments-picker-card-meta {
  display: block;
  font-size: 0.67rem;
  color: var(--muted-foreground);
  padding: 0 0.38rem 0.36rem;
}
.messages-attachments-picker-upload {
  display: grid;
  gap: 0.5rem;
  padding: 0.5rem 0.2rem 0.2rem;
}
.messages-attachments-picker-upload-btn {
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  text-align: left;
  font-size: 0.8rem;
  cursor: pointer;
}
.settings-select-theme--privacy {
  width: auto;
  min-width: 12rem;
  max-width: 18rem;
}

@media (max-width: 767px) {
  .page-settings #settings-section-privacy .settings-select-theme.settings-select-theme--privacy {
    width: auto;
    max-width: 18rem;
  }
}
.messages-attachments-picker-upload-btn:hover {
  background: color-mix(in oklch, var(--muted) 35%, transparent);
}
.messages-attachments-picker-upload-hint {
  font-size: 0.72rem;
  color: var(--muted-foreground);
}
.messages-image-preview {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.messages-image-preview[aria-hidden="false"] {
  display: flex;
}
.messages-image-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.84);
}
.messages-image-preview-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 2;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  border: 1px solid color-mix(in oklch, #fff 35%, transparent);
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}
.messages-image-preview-content {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.messages-image-preview-content img {
  max-width: 100%;
  max-height: calc(100vh - 2rem);
  object-fit: contain;
}
.messages-attachments-picker-item {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: inherit;
  text-align: left;
  padding: 0.56rem 0.62rem;
  display: grid;
  gap: 0.1rem;
  cursor: pointer;
}
.messages-attachments-picker-item:hover {
  background: color-mix(in oklch, var(--muted) 35%, transparent);
}
.messages-attachments-picker-item-name {
  font-size: 0.82rem;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messages-attachments-picker-item-meta {
  font-size: 0.72rem;
  color: var(--muted-foreground);
}
.messages-attachments-picker-empty {
  color: var(--muted-foreground);
  font-size: 0.82rem;
  padding: 0.55rem;
}
.messages-settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.24);
  z-index: 1000;
}
.messages-settings-menu {
  position: fixed;
  z-index: 1001;
  min-width: 0;
  width: fit-content;
  max-width: calc(100vw - 1rem);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.messages-settings-item {
  width: auto;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--foreground);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.45rem 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  cursor: pointer;
}
.messages-settings-item-icon {
  width: 1rem;
  height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  flex-shrink: 0;
}
.messages-settings-item-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.messages-settings-item:hover {
  background: color-mix(in oklch, var(--muted) 45%, transparent);
}
.messages-context-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 1002;
}
.messages-reactions-popover {
  position: fixed;
  z-index: 1003;
  min-width: 10.5rem;
  max-width: min(20rem, calc(100vw - 1rem));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.32rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}
.messages-reactions-popover-item {
  border: 1px solid color-mix(in oklch, var(--border) 80%, transparent);
  background: color-mix(in oklch, var(--muted) 30%, transparent);
  border-radius: 999px;
  min-width: 2rem;
  padding: 0.26rem 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.messages-reactions-popover-item:hover {
  background: color-mix(in oklch, var(--muted) 56%, transparent);
}
.messages-reactions-popover-item.is-active {
  border-color: color-mix(in oklch, var(--primary) 50%, var(--border));
  background: color-mix(in oklch, var(--primary) 14%, transparent);
}
.messages-context-menu {
  position: fixed;
  z-index: 1003;
  min-width: 10.5rem;
  max-width: min(20rem, calc(100vw - 1rem));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.28rem;
  box-sizing: border-box;
}
.messages-context-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--foreground);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.5rem 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  text-align: left;
}
.messages-context-item:hover {
  background: color-mix(in oklch, var(--muted) 55%, transparent);
}
.messages-context-item--danger {
  color: #dc2626;
}
.messages-context-item--danger:hover {
  background: color-mix(in oklch, #dc2626 13%, transparent);
}
.messages-thread-reply-draft {
  margin: 0;
  border: 1px solid color-mix(in oklch, var(--primary) 40%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--card) 84%, transparent);
  padding: 0.42rem 2rem 0.42rem 0.55rem;
  position: relative;
  display: grid;
  gap: 0.12rem;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 21;
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: calc(var(--messages-composer-form-height, 0px) + 0.42rem);
}
.messages-thread-reply-draft-meta {
  font-size: 0.7rem;
  color: var(--primary);
  font-weight: 600;
}
.messages-thread-reply-draft-text {
  font-size: 0.8rem;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messages-thread-reply-draft-close {
  position: absolute;
  right: 0.38rem;
  top: 0.38rem;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}
.messages-thread-edit-draft {
  margin: 0;
  border: 1px solid color-mix(in oklch, var(--primary) 34%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--card) 84%, transparent);
  padding: 0.42rem 2rem 0.42rem 0.55rem;
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: calc(var(--messages-composer-form-height, 0px) + 0.42rem);
  display: grid;
  gap: 0.12rem;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 21;
}
.messages-thread-edit-draft-meta {
  font-size: 0.7rem;
  color: var(--primary);
  font-weight: 600;
}
.messages-thread-edit-draft-text {
  font-size: 0.8rem;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messages-thread-edit-draft-close {
  position: absolute;
  right: 0.38rem;
  top: 0.38rem;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}
.messages-delete-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  z-index: 1003;
}
.messages-delete-modal {
  position: fixed;
  z-index: 1004;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(25rem, calc(100vw - 1.4rem));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-xl);
}
.messages-delete-modal-head {
  padding: 0.8rem 0.95rem 0.5rem;
}
.messages-delete-modal-head h3 {
  margin: 0;
  font-size: 0.95rem;
}
.messages-delete-modal-body {
  padding: 0 0.95rem 0.7rem;
}
.messages-delete-modal-body p {
  margin: 0;
  color: var(--foreground);
  font-size: 0.86rem;
}
.messages-delete-check {
  margin-top: 0.7rem;
  display: inline-flex;
  gap: 0.45rem;
  align-items: flex-start;
  color: var(--muted-foreground);
  font-size: 0.83rem;
}
.messages-delete-check input {
  margin-top: 0.08rem;
}
.messages-delete-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  padding: 0.75rem 0.95rem;
  border-top: 1px solid var(--border);
}
.messages-delete-btn {
  border: 1px solid color-mix(in oklch, #dc2626 55%, var(--border));
  background: color-mix(in oklch, #dc2626 12%, transparent);
  color: #dc2626;
  border-radius: var(--radius);
  padding: 0.42rem 0.64rem;
  cursor: pointer;
}
.messages-delete-btn--ghost {
  border-color: var(--border);
  color: var(--foreground);
  background: var(--background);
}
.messages-history-modal {
  position: fixed;
  z-index: 1002;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(26rem, calc(100vw - 1.4rem));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-xl);
}
.messages-history-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
.messages-history-modal-head h3 {
  margin: 0;
  font-size: 0.95rem;
}
.messages-history-modal-close {
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.messages-history-options {
  padding: 0.6rem;
  display: grid;
  gap: 0.45rem;
}
.messages-history-option {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  border-radius: var(--radius);
  padding: 0.5rem 0.65rem;
  cursor: pointer;
}
.messages-history-option--active {
  border-color: color-mix(in oklch, var(--primary) 45%, var(--border));
  background: color-mix(in oklch, var(--primary) 14%, transparent);
}
.messages-bg-modal {
  position: fixed;
  z-index: 1003;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(36rem, calc(100vw - 1rem));
  max-height: min(82vh, 42rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.messages-bg-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
.messages-bg-modal-head h3 {
  margin: 0;
  font-size: 0.95rem;
}
.messages-bg-modal-close {
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.messages-bg-modal-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem 0.3rem;
}
.messages-bg-modal-btn {
  border: 1px solid color-mix(in oklch, var(--primary) 45%, var(--border));
  background: color-mix(in oklch, var(--primary) 14%, transparent);
  color: var(--foreground);
  border-radius: var(--radius);
  padding: 0.42rem 0.62rem;
  cursor: pointer;
}
.messages-bg-modal-btn--ghost {
  border-color: var(--border);
  background: var(--background);
}
.messages-bg-modal-btn--icon {
  width: 2rem;
  min-width: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.messages-bg-upload-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
.messages-bg-modal-note {
  padding: 0 0.9rem 0.55rem;
  color: var(--muted-foreground);
  font-size: 0.76rem;
}
.messages-bg-share-toggle {
  margin: 0 0.9rem 0.55rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--muted-foreground);
}
.messages-bg-share-toggle .settings-switch input:disabled + .settings-switch-slider {
  opacity: 0.45;
  cursor: default;
}
.messages-bg-share-toggle .settings-switch input:disabled + .settings-switch-slider::before {
  box-shadow: none;
}
.messages-bg-shared-note {
  margin: 0 0.9rem 0.45rem;
  padding: 0.38rem 0.5rem;
  border: 1px solid color-mix(in oklch, var(--primary) 30%, var(--border));
  border-radius: var(--radius);
  font-size: 0.75rem;
  color: var(--muted-foreground);
  background: color-mix(in oklch, var(--primary) 10%, transparent);
}
.messages-bg-effects {
  padding: 0 0.9rem 0.5rem;
  display: grid;
  gap: 0.3rem;
}
.messages-bg-effects-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted-foreground);
}
.messages-bg-effects input[type="range"] {
  width: 100%;
}
.messages-bg-grid {
  padding: 0.3rem 0.9rem 0.9rem;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}
.messages-bg-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
.messages-bg-item.is-active {
  border-color: color-mix(in oklch, var(--primary) 52%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--primary) 34%, transparent) inset;
}
.messages-bg-item-preview {
  aspect-ratio: 10 / 10;
  background: var(--muted);
}
.messages-bg-item-preview--default {
  position: relative;
  background-image: var(--messages-thread-default-image);
  background-size: cover;
  background-position: center;
}
.messages-bg-item-preview--default::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('/uploads/fon/car.svg') center / cover no-repeat;
  opacity: 0.2;
}
.messages-bg-item-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.messages-bg-item-remove {
  position: absolute;
  top: 0.24rem;
  right: 0.24rem;
  width: 1.1rem;
  height: 1.1rem;
  border: none;
  border-radius: 999px;
  background: color-mix(in oklch, black 45%, transparent);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  line-height: 1;
  z-index: 2;
}
.messages-bg-item-check {
  position: absolute;
  left: 0.3rem;
  bottom: 0.3rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: color-mix(in oklch, var(--primary) 90%, black);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.messages-bg-item.is-active .messages-bg-item-check {
  display: inline-flex;
}
.messages-bg-empty {
  grid-column: 1 / -1;
  color: var(--muted-foreground);
  font-size: 0.82rem;
  padding: 0.5rem 0;
}
.messages-empty-thread {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.85rem;
}
.contacts-detail-sections { display: flex; flex-direction: column; gap: 1rem; }
.contacts-detail-section-head {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 0.25rem;
}
.contacts-detail-section-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.875rem;
}
.contacts-detail-section-list li { margin-bottom: 0.25rem; }
.contacts-detail-section-list a { color: var(--primary); text-decoration: none; }
.contacts-detail-section-list a:hover { text-decoration: underline; }
.contacts-detail-section-text { margin: 0; font-size: 0.875rem; }
.contacts-detail-section-text--block { white-space: pre-wrap; }
.contacts-detail-section--collapsible { margin-top: 0.5rem; }
.contacts-detail-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.5rem 0;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
  cursor: pointer;
  text-align: left;
}
.contacts-detail-section-toggle svg {
  transition: transform 0.2s;
  flex-shrink: 0;
}
.contacts-detail-section-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.contacts-detail-section-content { padding-left: 0; padding-top: 0.25rem; font-size: 0.875rem; }
.contacts-detail-section-content p { margin: 0 0 0.25rem 0; }

.contacts-detail-tab-content { display: block; }
.contacts-detail-tab-content.hidden { display: none; }
.contacts-detail-tab-content.contacts-detail-tab-content--active { display: block; }

.contacts-notes-create {
  margin-bottom: 1.25rem;
}
.contacts-notes-list.memos-list { padding: 0; }
.contacts-notes-empty {
  margin: 1.5rem 0;
  padding: 1rem;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.9375rem;
}
.contacts-notes-list .memo-card { margin-bottom: 1rem; }

@media (max-width: 900px) {
  body.page-messages {
    overflow: hidden;
  }
  .page-messages .app {
    height: 100dvh;
    overflow: hidden;
  }
  .page-messages .content-wrap {
    padding: 0;
    overflow: hidden;
  }
  .page-messages .main-area--messages {
    height: 100%;
    min-height: 0;
  }
  .contacts-detail-link-actions {
    gap: 0.45rem;
  }
  .messages-page {
    display: block;
    height: 100%;
    max-height: 100%;
    min-height: 0;
  }
  .messages-dialogs-panel,
  .messages-thread-panel {
    height: 100%;
  }
  .messages-page .messages-thread-panel {
    display: none;
  }
  .messages-page--mobile-thread .messages-dialogs-panel {
    display: none;
  }
  .messages-page--mobile-thread .messages-thread-panel {
    display: flex;
    min-height: 0;
    flex-direction: column;
    padding-top: 0;
  }
  .messages-page--mobile-thread .messages-thread-wrap {
    min-height: 0;
    flex: 1;
  }
  .messages-page--mobile-thread .messages-thread-body {
    padding-top: 0.8rem;
    padding-bottom: calc(var(--messages-composer-stack-height, 5.5rem) + var(--messages-mobile-keyboard-offset, 0px) + 0.8rem);
  }
  .messages-page--mobile-thread .messages-thread-form {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--messages-mobile-keyboard-offset, 0px);
    background: var(--card);
    z-index: 20;
    border-top: 1px solid var(--border);
    padding-bottom: calc(0.65rem + env(safe-area-inset-bottom));
  }
  .messages-page--mobile-thread .messages-thread-reply-draft {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--messages-composer-form-height, 5.3rem) + var(--messages-mobile-keyboard-offset, 0px));
    margin: 0;
    border-radius: 0;
    z-index: 21;
  }
  .messages-page--mobile-thread .messages-thread-attachment-draft {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--messages-composer-form-height, 5.3rem) + var(--messages-composer-reply-height, 0px) + var(--messages-mobile-keyboard-offset, 0px));
    margin: 0;
    border-radius: 0;
    z-index: 22;
  }
  .messages-page--mobile-thread .messages-back-btn {
    display: inline-flex;
  }
  .messages-jump-unread {
    bottom: calc(var(--messages-composer-stack-height, 5.3rem) + var(--messages-mobile-keyboard-offset, 0px) + 0.6rem);
  }
}

@media (max-width: 767px) {
  .page-profile .profile-header {
    padding: 0.1rem 0 1rem 1rem;
  }
}
@media (max-width: 767px) {
  .page-messages .content-wrap {
    height: calc(100dvh - 3rem);
    max-height: calc(100dvh - 3rem);
  }
}

.contacts-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.contacts-modal-overlay.hidden { display: none; }
.contacts-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  min-width: 20rem;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1001;
}
.contacts-modal.hidden { display: none; }
.contacts-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.contacts-modal-header h3 { margin: 0; font-size: 1rem; }
.contacts-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0 0.25rem;
}
.contacts-modal-close:hover { color: var(--foreground); }
.contacts-modal-body { padding: 1rem 1.25rem; }
.contacts-modal-body .profile-edit-label { margin-bottom: 0.25rem; }
.contacts-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

.contact-add-row-hidden { display: none !important; }
.contact-multi-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.contact-multi-row .contact-label { max-width: 10rem; }
.contact-birth-date-row {
  display: grid;
  grid-template-columns: 4rem 1fr 5.5rem;
  gap: 0.5rem;
  align-items: center;
}
.contact-birth-date-row .contact-birth-day,
.contact-birth-date-row .contact-birth-month,
.contact-birth-date-row .contact-birth-year { margin-bottom: 0; }
.contact-single-row { margin-bottom: 0.5rem; }
.contact-single-row .profile-edit-input { margin-bottom: 0; }
.contact-add-btn {
  display: inline-block;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--background);
  color: var(--muted-foreground);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  margin-top: 0.25rem;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.contact-add-btn:hover {
  background: var(--muted);
  color: var(--foreground);
  border-color: var(--input);
}

.stickers-page {
  margin: 0 auto;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  padding: 0.9rem;
}
.page-stickers .content-wrap {
  max-width: 62rem;
}
.stickers-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}
.stickers-page-title-row {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.stickers-page-head h1 {
  margin: 0;
  font-size: 1.05rem;
}
.stickers-page-back {
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--foreground);
  display: none;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: var(--background);
}
.stickers-page-back:hover {
  background: var(--muted);
}
.stickers-search {
  width: min(18rem, 48vw);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  padding: 0.48rem 0.62rem;
}
.stickers-page-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 0.72rem;
  gap: 0;
}
.stickers-page-tab {
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  padding: 0.48rem 0.6rem;
  cursor: pointer;
}
.stickers-page-tab:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}
.stickers-page-tab:last-child {
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.stickers-page-tab.is-active {
  background: color-mix(in oklch, var(--primary) 14%, transparent);
}
.stickers-page-list {
  display: grid;
  gap: 0.72rem;
  margin-top: 0.72rem;
}
.stickers-page-empty {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.88rem;
  padding: 0.85rem 0.2rem;
}
.stickers-page-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.56rem;
  background: var(--background);
}
.stickers-page-item.is-hidden-by-page { display: none; }
.stickers-page-item-head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}
.stickers-page-item-head h3 {
  margin: 0;
  font-size: 0.9rem;
}
.stickers-page-item-head p {
  margin: 0.12rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.75rem;
}
.stickers-page-item-head-right {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted-foreground);
  font-size: 0.74rem;
}
.stickers-page-item-btn {
  border: 1px solid color-mix(in oklch, var(--primary) 45%, var(--border));
  background: color-mix(in oklch, var(--primary) 15%, transparent);
  color: var(--foreground);
  border-radius: 999px;
  padding: 0.28rem 0.52rem;
  cursor: pointer;
}
.stickers-page-item-btn--ghost {
  border-color: var(--border);
  background: var(--background);
}
.stickers-page-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 0.35rem;
}
.stickers-page-item-sticker {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: color-mix(in oklch, var(--muted) 25%, transparent);
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
}
.stickers-page-item-sticker img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.stickers-page-item-sticker video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.stickers-page-item-sticker.is-hidden { display: none; }
.stickers-page-item-more {
  border: 1px dashed color-mix(in oklch, var(--primary) 50%, var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: color-mix(in oklch, var(--primary) 10%, transparent);
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  color: var(--foreground);
  cursor: pointer;
}
.stickers-page-item-more-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.stickers-page-item-more-text {
  font-size: 0.72rem;
  color: var(--muted-foreground);
}
.stickers-page-load-more-wrap { display: flex; justify-content: center; margin-top: 0.2rem; }
.stickers-page-load-more[hidden] { display: none !important; }
@media (max-width: 767px) {
  .stickers-page-back {
    display: inline-flex;
  }
}
.contact-add-btn.hidden { display: none !important; }
.contact-block-toggle-wrap { margin-top: 1rem; }
.contact-block-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.5rem 0;
  border: none;
  background: transparent;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--foreground);
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.contact-block-toggle:hover { background: var(--muted); }
.contact-block-toggle svg { transition: transform 0.2s; flex-shrink: 0; }
.contact-block-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.contact-block-content { padding-left: 0; padding-top: 0.25rem; }
.contact-block-content.hidden { display: none; }

/* --- Страница календаря (заметки, напоминания, дни рождения) --- */
.main-area--calendar { padding: 0; display: flex; flex-direction: column; }
.calendar-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.5rem 0;
}
.calendar-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.calendar-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--foreground);
}
.calendar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.calendar-controls-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.calendar-select {
  padding: 0.35rem 0.5rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  cursor: pointer;
}
.calendar-nav-arrows { display: flex; gap: 0.25rem; }
.calendar-nav-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.calendar-nav-btn:hover {
  background: var(--muted);
  color: var(--foreground);
}
.calendar-month-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
}
.calendar-grid-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
}
.calendar-weekday--weekend { color: oklch(0.55 0.12 15); }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, minmax(0, 1fr));
  gap: 2px;
  aspect-ratio: 7/6;
  max-height: 420px;
}
.calendar-day-cell {
  min-height: 0;
  padding: 0.25rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  border: 2px solid transparent;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.calendar-day-cell:hover { background: var(--muted); }
.calendar-day-cell--other { color: var(--muted-foreground); opacity: 0.7; }
.calendar-day-cell--weekend:not(.calendar-day-cell--other) { background: color-mix(in oklch, oklch(0.55 0.12 15) 12%, var(--card)); }
.calendar-day-cell--today {
  background: var(--primary);
  color: var(--primary-foreground);
}
.calendar-day-cell--today:hover { background: var(--primary); color: var(--primary-foreground); opacity: 0.95; }
.calendar-day-cell--selected {
  border-color: var(--primary);
  font-weight: 600;
}
.calendar-day-cell-inner {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-height: 0;
  overflow: hidden;
  flex: 1;
}
.calendar-day-num {
  font-size: 0.875rem;
  font-weight: 600;
  flex-shrink: 0;
}
.calendar-day-event {
  font-size: 0.7rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}
.calendar-day-event--reminder { color: var(--foreground); }
.calendar-day-event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: oklch(0.75 0.15 85);
  flex-shrink: 0;
}
.calendar-day-event--birthday { color: oklch(0.55 0.15 25); }
.calendar-day-event-icon { flex-shrink: 0; display: inline-flex; align-items: center; }
.calendar-icon-birthday { display: block; color: inherit; }
/* Точки только на мобильной и только в днях с событиями (блок рендерится только при hasReminder || hasBirthday) */
.calendar-day-dots--mobile {
  display: none;
}
.calendar-day-more {
  position: absolute;
  right: 0.3rem;
  bottom: 0.2rem;
  font-size: 0.65rem;
  line-height: 1;
  color: var(--muted-foreground);
  background: color-mix(in oklch, var(--card) 85%, transparent);
  padding: 0.05rem 0.2rem;
  border-radius: 999px;
}
.calendar-day-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.calendar-day-dot--reminder { background: oklch(0.75 0.15 85); }
.calendar-day-dot--birthday { background: oklch(0.55 0.18 25); }
.calendar-day-panel {
  margin-top: 0.5rem;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.calendar-day-panel-title {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
}
.calendar-day-panel-empty {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.9375rem;
}
.calendar-day-panel-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.calendar-day-panel-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  color: var(--foreground);
}
.calendar-day-panel-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: oklch(0.75 0.15 85);
  flex-shrink: 0;
}
.calendar-day-panel-item-icon { flex-shrink: 0; display: inline-flex; align-items: center; }
.calendar-day-panel-item--birthday .calendar-icon-birthday { color: oklch(0.55 0.15 25); }
.calendar-day-panel-item-link {
  color: var(--primary);
  text-decoration: none;
}
.calendar-day-panel-item-link:hover { text-decoration: underline; }

/* Мобильный календарь: одинаковые ячейки, точки только при наличии событий */
@media (max-width: 768px) {
  .calendar-header {
    padding-left: 0.5rem;
  }
  .calendar-controls {
    padding-left: 0.25rem;
  }
  .calendar-month-label--desktop { display: none; }
  .calendar-controls-row {
    flex-wrap: wrap;
  }
  .calendar-grid-wrap { padding: 0.5rem; }
  .calendar-grid {
    aspect-ratio: 7/6;
    max-height: 320px;
  }
  .calendar-day-cell {
    padding: 0.2rem;
  }
  .calendar-day-cell-inner .calendar-day-event {
    display: none;
  }
  .calendar-day-dots--mobile {
    display: flex;
    position: absolute;
    bottom: 0.15rem;
    right: 0.15rem;
    gap: 3px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .calendar-day-more {
    display: none;
  }
  .calendar-day-num {
    font-size: 0.8rem;
  }
}
