/* ============================================
   БОКОВОЕ МЕНЮ (в стиле брендбука)
   ============================================ */

/* Кружок-аватарка слева внизу */
.app-avatar {
  position: fixed;
   left: 20px;
  top: 20px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10110;
  transition: all 0.2s ease;
  color: #94a3b8;
}

.app-avatar:hover {
  color: #0000ff;
  background: rgba(0, 0, 255, 0.06);
}

.app-avatar:hover {
  transform: scale(1.02);
  border-color: #0000ff;
  box-shadow: 
    0 12px 24px -8px rgba(0, 0, 255, 0.18),
    0 4px 10px -4px rgba(0, 0, 255, 0.08);
  background: #f6f8ff;
}

.app-avatar:active {
  transform: scale(0.98);
}

.avatar-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Боковое меню (оверлей) */
.app-sidebar {
  position: fixed;
  top: 0;
  left: -340px;
  width: 320px;
  height: 100dvh;
  max-height: 100dvh;
  background: #ffffff;
  box-shadow: 
    8px 0 30px -12px rgba(0, 0, 0, 0.12),
    2px 0 8px -4px rgba(0, 0, 0, 0.04);
  z-index: 10000;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(0, 0, 255, 0.06);
}

.app-sidebar.active {
  left: 0;
}

/* Dim overlay behind sidebar */
.app-sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: rgba(15, 23, 42, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.app-sidebar-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 769px) {
  body:has(.app-sidebar.active) .app-avatar {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

/* Кнопка меню всегда доступна поверх интерфейса */
.app-avatar {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

/* Шапка меню */
.sidebar-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid #eef2ff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  gap: 12px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #0000ff;
}

.sidebar-logo img {
  height: 22px;
  width: auto;
  flex-shrink: 0;
}

.sidebar-close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #646b75;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.sidebar-close:hover {
  background: #f6f7f9;
  border-color: #0000ff;
  color: #0000ff;
}

/* Тело сайдбара: режимы sessions / hub */
.sidebar-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-view {
  flex: 1 1 auto;
  min-height: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-view.is-active {
  display: flex;
}

/* ============================================
   МОДАЛКА НАСТРОЕК И АККАУНТА
   ============================================ */

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 10600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.settings-modal[hidden] {
  display: none !important;
}

.settings-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.settings-modal.is-open .settings-modal__backdrop {
  opacity: 1;
}

.settings-modal__dialog {
  position: relative;
  width: min(880px, 100%);
  height: min(620px, 100%);
  background: #ffffff;
  border-radius: 20px;
  box-shadow:
    0 24px 60px -16px rgba(15, 23, 42, 0.28),
    0 8px 24px -12px rgba(15, 23, 42, 0.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.settings-modal.is-open .settings-modal__dialog {
  opacity: 1;
  transform: none;
}

.settings-modal__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid #eef2ff;
}

.settings-modal__title {
  flex: 1;
  font-size: 15px;
  font-weight: 650;
  color: #1b1f24;
}

.settings-modal__back {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
  color: #646b75;
  cursor: pointer;
  transition: all 0.15s ease;
}

.settings-modal__back:hover {
  background: #f6f8ff;
  border-color: rgba(0, 0, 255, 0.25);
  color: #0000ff;
}

.settings-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
  color: #646b75;
  cursor: pointer;
  transition: all 0.15s ease;
}

.settings-modal__close:hover {
  background: #f6f7f9;
  border-color: #0000ff;
  color: #0000ff;
}

.settings-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.settings-modal__nav {
  width: 250px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 12px;
  border-right: 1px solid #eef2ff;
  background: #fafbff;
  overflow-y: auto;
  box-sizing: border-box;
}

.settings-modal__nav .sidebar-hub-section {
  margin-bottom: 0;
}

.settings-modal__nav .sidebar-hub-section--auth-only:last-child {
  margin-top: auto;
}

.settings-modal__content {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  padding: 20px 24px;
  box-sizing: border-box;
}

.settings-modal__nav .hub-nav-item.is-active {
  background: #eef2ff;
  color: #0000ff;
}

.settings-modal__nav .hub-nav-item.is-active .hub-nav-item__icon {
  color: #0000ff;
}

@media (max-width: 768px) {
  .settings-modal {
    padding: 0;
  }

  .settings-modal__dialog {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }

  .settings-modal__body {
    position: relative;
  }

  .settings-modal__nav {
    position: absolute;
    inset: 0;
    width: 100%;
    z-index: 2;
    border-right: none;
    transform: translateX(0);
    transition: transform 0.22s ease;
  }

  .settings-modal:not([data-settings-page="menu"]) .settings-modal__nav {
    transform: translateX(-100%);
    pointer-events: none;
  }

  .settings-modal:not([data-settings-page="menu"]) .settings-modal__back {
    display: inline-flex;
  }
}

.sidebar-hub-section {
  margin-bottom: 24px;
}

.sidebar-hub-lead {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
  color: #646b75;
}

.sidebar-hub-cta {
  display: inline-block;
  margin-right: 8px;
  margin-bottom: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  background: #0000ff;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.sidebar-hub-cta--ghost {
  background: #ffffff;
  color: #0000ff;
  border: 1px solid rgba(0, 0, 255, 0.2);
}

.sidebar-hub-profile {
  padding: 12px 14px;
  border-radius: 14px;
  background: #f6f8ff;
  border: 1px solid rgba(0, 0, 255, 0.08);
}

.sidebar-hub-profile-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  line-height: 1.4;
}

.sidebar-hub-profile-row + .sidebar-hub-profile-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 255, 0.08);
}

.sidebar-hub-profile-label {
  color: #646b75;
}

.sidebar-hub-profile-value {
  color: #1b1f24;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

.hub-inline-state {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: #646b75;
}

.hub-inline-state--error {
  color: #ef4444;
}

.hub-inline-hint {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
  color: #646b75;
}

.hub-inline-subtitle {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: #1b1f24;
}

.hub-inline-panel .btn {
  width: 100%;
  margin-top: 12px;
}

.hub-security-box {
  padding: 14px;
  border-radius: 14px;
  background: #f6f8ff;
  border: 1px solid rgba(0, 0, 255, 0.08);
  margin-bottom: 12px;
}

.hub-security-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-top: 10px;
}

.hub-status--ok {
  color: #10b981;
}

.hub-status--off {
  color: #ef4444;
}

.hub-tariffs-lead {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.4;
  color: #5b6470;
}

.hub-tariffs-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hub-tariff-compare {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.hub-tariff-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
}

.hub-tariff-card.is-current {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.hub-tariff-card--pro {
  border-color: #c9d0db;
  background: linear-gradient(180deg, #f7f8fa 0%, #ffffff 55%);
  box-shadow: inset 2px 0 0 #1b1f24;
}

.hub-tariff-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 20px;
}

.hub-tariff-title {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: #1b1f24;
}

.hub-tariff-current {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.hub-tariff-price {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #1b1f24;
  line-height: 1.1;
}

.hub-tariff-price small {
  margin-left: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #7b8491;
  letter-spacing: 0;
}

.hub-tariff-subtitle {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: #64748b;
}

.hub-tariff-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
}

.hub-tariff-features li {
  position: relative;
  padding-left: 14px;
  font-size: 11.5px;
  line-height: 1.35;
  color: #475569;
}

.hub-tariff-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.4em;
  width: 7px;
  height: 4px;
  border-left: 1.5px solid #1b1f24;
  border-bottom: 1.5px solid #1b1f24;
  transform: rotate(-45deg);
  opacity: 0.65;
}

.hub-tariff-pack-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.hub-tariff-pack-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #1b1f24;
}

.hub-tariff-pack-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.hub-tariff-pack-option:has(input:checked) {
  border-color: #1b1f24;
  background: #f1f5f9;
}

.hub-tariff-buy-btn {
  width: 100%;
  margin-top: auto;
  min-height: 36px;
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: 13px;
}

.hub-tariff-card .btn-secondary {
  border: 1px solid #d0d7e2;
  background: #ffffff;
  color: #1b1f24;
  box-shadow: none;
  transform: none;
}

.hub-tariff-card .btn-secondary:hover:not(:disabled) {
  border-color: #1b1f24;
  background: #f8fafc;
  box-shadow: none;
  transform: none;
}

.hub-tariff-card .btn-secondary:disabled,
.hub-tariff-card .btn-primary:disabled {
  opacity: 0.7;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.hub-tariffs-footnote {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.4;
  color: #7b8491;
}

.hub-purchases-section {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid #e8ecf1;
}

.hub-purchases-heading {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7b8491;
}

@media (max-width: 560px) {
  .hub-tariff-compare {
    grid-template-columns: 1fr;
  }
}

.hub-purchases-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hub-purchase-item {
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid #e8ecf1;
  background: #ffffff;
}

.hub-purchase-item__main {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #1b1f24;
}

.hub-purchase-item__minutes {
  color: #334155;
  font-variant-numeric: tabular-nums;
}

.hub-purchase-item__meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  font-size: 11px;
  color: #7b8491;
}

.hub-purchase-item__desc {
  margin-top: 4px;
  font-size: 11px;
  color: #646b75;
  line-height: 1.35;
}

.sidebar-hub-logout {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: #fff5f5;
  color: #ef4444;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sidebar-hub-logout:hover {
  background: #fee2e2;
}

/* Stack-навигация хаба */
.hub-stack {
  position: relative;
}

.hub-page {
  display: block;
}

.hub-page[hidden] {
  display: none !important;
}

.hub-page.is-active {
  display: block;
}

.hub-menu-profile-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  padding-right: 32px;
  position: relative;
  border: 1px solid rgba(0, 0, 255, 0.12);
  border-radius: 14px;
  background: #f6f8ff;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.hub-menu-profile-card:hover {
  background: #eef2ff;
  border-color: rgba(0, 0, 255, 0.25);
}

.hub-menu-profile-email {
  font-size: 14px;
  font-weight: 600;
  color: #1b1f24;
  word-break: break-word;
}

.hub-menu-profile-balance {
  font-size: 12px;
  color: #646b75;
}

.hub-menu-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: #94a3b8;
  line-height: 1;
}

.hub-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hub-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  padding-right: 32px;
  position: relative;
  border: none;
  border-radius: 12px;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #1b1f24;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.hub-nav-item:hover {
  background: #f6f8ff;
}

.hub-nav-item__icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #646b75;
}

.hub-nav-item__icon svg {
  display: block;
}

.hub-nav-item:hover .hub-nav-item__icon {
  color: #0000ff;
}

.hub-purchase-item__minutes--spent {
  color: #ef4444;
}

.hub-page--enter {
  animation: hubPageEnter 0.22s ease-out;
}

.hub-stack--back .hub-page--enter {
  animation: hubPageEnterBack 0.22s ease-out;
}

@keyframes hubPageEnter {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes hubPageEnterBack {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.hub-nav-item__text {
  flex: 1;
}

.hub-purchase-item--usage .hub-purchase-item__minutes--spent {
  color: #64748b;
}

.hub-usage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-modal__content .hub-usage-session {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fafbfc;
  overflow: hidden;
}

.settings-modal__content .hub-usage-session__toggle {
  width: 100%;
  margin: 0;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: #1b1f24;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
}

.settings-modal__content .hub-usage-session__toggle:hover {
  background: #eef2ff;
}

.settings-modal__content .hub-usage-session__chevron {
  flex: 0 0 18px;
  margin-top: 2px;
  color: #94a3b8;
  transition: transform 0.18s ease;
}

.settings-modal__content .hub-usage-session__chevron svg {
  display: block;
}

.settings-modal__content .hub-usage-session.is-expanded .hub-usage-session__chevron {
  transform: rotate(90deg);
  color: #0000ff;
}

.settings-modal__content .hub-usage-session__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.settings-modal__content .hub-usage-session__main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  font-size: 13px;
  font-weight: 600;
}

.settings-modal__content .hub-usage-session__title {
  color: #1b1f24;
}

.settings-modal__content .hub-usage-session__minutes {
  color: #ef4444;
  flex-shrink: 0;
}

.settings-modal__content .hub-usage-session__meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
  font-size: 11px;
  color: #646b75;
}

.settings-modal__content .hub-usage-session__details {
  border-top: 1px solid #e5e7eb;
  background: #fff;
  padding: 6px 10px 8px 36px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-modal__content .hub-usage-session__details[hidden] {
  display: none !important;
}

.settings-modal__content .hub-usage-detail {
  padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
}

.settings-modal__content .hub-usage-detail:last-child {
  border-bottom: 0;
}

.settings-modal__content .hub-usage-detail__main {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
}

.settings-modal__content .hub-usage-detail__title {
  color: #334155;
}

.settings-modal__content .hub-usage-detail__minutes {
  color: #64748b;
  flex-shrink: 0;
}

.settings-modal__content .hub-usage-detail__meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
  font-size: 11px;
  color: #94a3b8;
}

.hub-security-box--spaced {
  margin-top: 20px;
}

.hub-password-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.hub-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  box-sizing: border-box;
}

.hub-input:focus {
  outline: none;
  border-color: rgba(0, 0, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(0, 0, 255, 0.08);
}

.hub-export-btn {
  width: 100%;
  margin-top: 12px;
}

.hub-danger-zone {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #fecaca;
}

.hub-inline-subtitle--danger {
  color: #ef4444;
}

.hub-delete-confirm {
  margin-top: 8px;
}

.hub-delete-account-btn {
  width: 100%;
  margin-top: 8px;
}

.settings-modal__content .sidebar-item {
  margin-bottom: 4px;
}

/* Контент меню — без собственной прокрутки, скролл только у списка заметок */
.sidebar-content {
  flex: 1 1 auto;
  overflow: hidden;
  padding: 12px 16px 8px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-content--main {
  padding-top: 12px;
  padding-bottom: 8px;
}

.sidebar-section--history {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

.sidebar-section--history .section-title {
  flex-shrink: 0;
}

.sidebar-section--history .session-history-list {
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-width: thin;
}

.sidebar-section--history.is-trash-open .session-history-list,
.sidebar-section--history.is-trash-open .session-history-search-wrap {
  display: none;
}

.session-notes-trash {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-notes-trash[hidden] {
  display: none !important;
}

.session-notes-trash-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 2px 2px 6px;
}

.session-notes-trash-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: #0000ff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
}

.session-notes-trash-back:hover {
  background: rgba(0, 0, 255, 0.06);
}

.session-notes-trash-title {
  font-size: 13px;
  font-weight: 700;
  color: #1b1f24;
}

.session-notes-trash-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 12px;
}

.session-trash-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fafc;
}

.session-trash-row-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.session-trash-title {
  font-size: 13px;
  font-weight: 600;
  color: #1b1f24;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-trash-date {
  font-size: 11px;
  color: #94a3b8;
}

.session-trash-actions {
  display: flex;
  gap: 6px;
}

.session-trash-btn {
  border: 0;
  background: rgba(0, 0, 255, 0.06);
  color: #0000ff;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.session-trash-btn:hover {
  background: rgba(0, 0, 255, 0.12);
}

.session-trash-btn--danger {
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
}

.session-trash-btn--danger:hover {
  background: rgba(220, 38, 38, 0.14);
}

.session-history-row.is-keyboard-focus,
.session-folder-row.is-keyboard-focus {
  outline: 2px solid rgba(0, 0, 255, 0.35);
  outline-offset: 1px;
  background: rgba(0, 0, 255, 0.04);
}

.session-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.session-history-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.session-history-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.session-history-toolbar[hidden] {
  display: none !important;
}

.session-toolbar-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.session-toolbar-btn:hover {
  background: #f1f5f9;
  color: #334155;
}

.session-toolbar-btn.is-active {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
}

.session-toolbar-btn.has-filter::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6366f1;
}

.session-history-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-bottom: 8px;
}

.session-history-search-wrap[hidden] {
  display: none !important;
}

.session-history-search {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: #1b1f24;
}

.session-history-search:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.session-history-search::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.session-history-search-close {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.session-history-search-close:hover {
  background: #f1f5f9;
  color: #64748b;
}

.session-history-count {
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
}

.sidebar-section--history.is-guest .session-toolbar-btn:not(#sidebarNewSessionBtn),
.sidebar-section--history.is-guest .session-history-search-wrap,
.sidebar-section--history.is-guest .session-history-list,
.sidebar-section--history.is-guest .session-history-count,
.sidebar-section--history.is-guest #sidebarTrashBtn,
.sidebar-section--history.is-guest .session-notes-trash {
  display: none !important;
}

.sidebar-section--history.is-guest .session-history-header {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .session-toolbar-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
  }

  .session-history-search-close {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
}

.sidebar-guest-hint-text {
  margin: 0 0 10px;
  padding: 0 12px;
  font-size: 13px;
  line-height: 1.45;
  color: #646b75;
}

.sidebar-guest-hint-link {
  display: inline-block;
  margin-left: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #0000ff;
  text-decoration: none;
}

.sidebar-guest-hint-link:hover {
  text-decoration: underline;
}

/* Секции меню */
.sidebar-section {
  margin-bottom: 28px;
}

.sidebar-section.sidebar-section--history {
  margin-bottom: 0;
}

.sidebar-section.sidebar-section--new-session {
  margin-bottom: 18px;
}

.sidebar-create-actions {
  display: flex;
  gap: 8px;
}

.sidebar-create-actions .sidebar-new-session-btn,
.sidebar-create-actions .sidebar-new-folder-btn {
  flex: 1 1 0;
  min-width: 0;
}

.sidebar-new-folder-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  min-height: 40px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  color: #475569;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.sidebar-new-folder-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.sidebar-new-session-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 8px 12px;
  min-height: 40px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #0000ff 0%, #3333ff 100%);
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 255, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.sidebar-new-session-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 0, 255, 0.28);
  background: linear-gradient(135deg, #0000e6 0%, #2d2dff 100%);
}

.sidebar-new-session-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(0, 0, 255, 0.2);
}

.sidebar-new-session-btn:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.sidebar-new-session-btn__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.sidebar-new-session-btn__icon svg {
  display: block;
}

.sidebar-new-session-btn__label {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94a3b8;
  margin-bottom: 12px;
  padding-left: 12px;
}

/* Элементы меню */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  color: #1b1f24;
  text-decoration: none;
  font-size: 15px;
  font-weight: 450;
  transition: all 0.15s ease;
  margin-bottom: 4px;
}

.sidebar-item:hover {
  background: #f6f8ff;
  color: #0000ff;
}

.sidebar-item-danger {
  color: #b91c1c;
}

.sidebar-item-danger:hover {
  background: #fef2f2;
  color: #991b1b;
}

.sidebar-item.active {
  background: #eef2ff;
  color: #0000ff;
  font-weight: 550;
}

.item-icon {
  font-size: 20px;
  min-width: 24px;
  text-align: center;
  opacity: 0.8;
}

.sidebar-item:hover .item-icon,
.sidebar-item.active .item-icon {
  opacity: 1;
}

.item-text {
  flex: 1;
}

/* Аккаунт внизу сайдбара */
.sidebar-account-foot {
  position: relative;
  flex-shrink: 0;
  padding: 10px 12px 0;
  border-top: 1px solid #eef2ff;
  background: #fafbfc;
}

.sidebar-account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding-bottom: 5px;
}

.sidebar-account-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-account-sub {
  font-size: 12px;
  font-weight: 600;
  color: #0000ff;
  text-decoration: none;
}

.sidebar-account-sub:hover {
  text-decoration: underline;
}

.sidebar-account-text .balance-info--compact {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  text-align: left;
}

.sidebar-account-text .balance-info--compact .balance-caption {
  font-size: 12px;
  font-weight: 500;
  color: #646b75;
}

.sidebar-account-text .balance-info--compact .balance-value {
  font-size: 13px;
  font-weight: 600;
  color: #1b1f24;
}

.sidebar-account-text .balance-info--compact .balance-label {
  font-size: 12px;
  margin-left: 0;
  color: #646b75;
}

.sidebar-account-text .balance-info--compact .balance-demo-timer {
  font-size: 11px;
  color: #f59e0b;
}

.sidebar-account-text .balance-info--compact.balance-info--zero .balance-value {
  color: #ef4444;
}

.sidebar-account-text .balance-info--compact.balance-info--low .balance-value {
  color: #f59e0b;
}

.balance-info--clickable {
  border: none;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: opacity 0.15s ease;
}

.balance-info--clickable:hover {
  opacity: 0.85;
}

.balance-info--clickable:focus-visible {
  outline: 2px solid rgba(0, 0, 255, 0.35);
  outline-offset: 2px;
  border-radius: 6px;
}

.sidebar-settings-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
  color: #646b75;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sidebar-settings-btn:hover {
  background: #f6f8ff;
  border-color: rgba(0, 0, 255, 0.25);
  color: #0000ff;
}

.auth-menu-trigger {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
  color: #646b75;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.auth-menu-trigger:hover,
.auth-menu-trigger[aria-expanded="true"] {
  background: #f6f8ff;
  border-color: rgba(0, 0, 255, 0.25);
  color: #0000ff;
}

.auth-dropdown {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% + 6px);
  z-index: 2;
  padding: 6px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
}

.auth-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #1b1f24;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.auth-dropdown-item:hover {
  background: #f6f8ff;
  color: #0000ff;
}

.auth-dropdown-item--danger {
  color: #b91c1c;
}

.auth-dropdown-item--danger:hover {
  background: #fef2f2;
  color: #991b1b;
}

.auth-dropdown-item-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #eef2ff;
  color: #0000ff;
}

.auth-dropdown-item-icon--to-main {
  display: none;
}

.app-sidebar[data-sidebar-panel="nav"] .auth-dropdown-item-icon--to-nav {
  display: none;
}

.app-sidebar[data-sidebar-panel="nav"] .auth-dropdown-item-icon--to-main {
  display: flex;
}

.auth-dropdown-item[hidden] {
  display: none !important;
}

/* Футер меню */
.sidebar-footer {
  padding: 8px 24px 14px;
  border-top: none;
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  flex-shrink: 0;
  background: #fafbfc;
}

.sidebar-version {
  font-weight: 500;
}

/* ===== АККАУНТ ===== */
.auth-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: #eef2ff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0000ff;
}

.auth-email {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: #1b1f24;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Блок баланса */
.balance-info {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: #ffffff;
  border-radius: 16px;
  text-align: center;
  border: 1px solid rgba(0, 0, 255, 0.08);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  transition: background 0.2s ease;
}

.balance-icon {
  font-size: 14px;
  margin-right: 4px;
  opacity: 0.7;
}

.balance-value {
  font-weight: 700;
  font-size: 20px;
  color: #1b1f24;
}

.balance-label {
  font-size: 12px;
  color: #646b75;
  margin-left: 4px;
  font-weight: 450;
}

/* Меню справа вверху (модель + материал в Мыслях) */
.thought-menu {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

.conversation-menu-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 255, 0.12);
  background: rgba(255, 255, 255, 0.95);
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(8px);
  transition: all 0.15s ease;
}

.conversation-menu-btn.is-foreign-llm {
  color: #0000ff;
  border-color: rgba(0, 0, 255, 0.35);
  box-shadow: 0 0 0 2px rgba(0, 0, 255, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
}

.llm-provider-badge {
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translate(-50%, 100%);
  max-width: 96px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #0000ff;
  color: #fff;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.llm-provider-badge.is-research-provider {
  background: #0f766e;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.25);
}

.conversation-menu-btn.is-research-provider {
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
}

.thought-menu.is-research-mode .conversation-menu-btn {
  border-color: rgba(15, 118, 110, 0.35);
}

.thought-menu:not(.mode-thoughts) .thought-menu-material {
  display: none;
}

.llm-provider-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 2px;
}

.llm-provider-item {
  align-items: flex-start;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid transparent;
}

.llm-provider-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.llm-provider-name {
  font-size: 14px;
  font-weight: 550;
  line-height: 1.3;
  color: inherit;
}

.llm-provider-hint {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  color: #94a3b8;
}

.llm-provider-check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  display: grid;
  place-items: center;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.llm-provider-item:hover .llm-provider-check {
  border-color: rgba(0, 0, 255, 0.45);
}

.llm-provider-item.is-selected {
  color: #0000ff;
  background: #f4f6ff;
  border-color: rgba(0, 0, 255, 0.14);
}

.llm-provider-item.is-selected .llm-provider-name {
  font-weight: 650;
}

.llm-provider-item.is-selected .llm-provider-hint {
  color: rgba(0, 0, 255, 0.55);
}

.llm-provider-item.is-selected .llm-provider-check {
  border-color: #0000ff;
  background: #0000ff;
  box-shadow: 0 0 0 3px rgba(0, 0, 255, 0.12);
}

.llm-provider-item.is-selected .llm-provider-check::after {
  content: '';
  width: 9px;
  height: 5px;
  margin-top: -1px;
  border-left: 1.75px solid #fff;
  border-bottom: 1.75px solid #fff;
  transform: rotate(-45deg);
}

.conversation-menu-btn:hover {
  color: #0000ff;
  background: #f6f8ff;
  border-color: rgba(0, 0, 255, 0.2);
}

.conversation-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid rgba(0, 0, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  padding: 6px;
  z-index: 10000;
}

.conversation-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #1b1f24;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.conversation-menu-item:hover {
  background: #f6f8ff;
  color: #0000ff;
}

.conversation-menu-item svg {
  flex-shrink: 0;
  color: #64748b;
}

.conversation-menu-item:hover svg {
  color: #0000ff;
}

.conversation-menu-divider {
  height: 1px;
  margin: 4px 8px;
  background: #eef2ff;
}

.conversation-menu-section {
  padding: 6px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.03em;
}

.conversation-menu-variant {
  font-size: 13px;
}

.conversation-menu-variant.active {
  background: #f0f4ff;
  color: #0000ff;
  font-weight: 600;
}

.conversation-menu-variant.active::after {
  content: '✓';
  margin-left: auto;
  font-size: 12px;
}

.conversation-menu-item--danger {
  color: #b91c1c;
}

.conversation-menu-item--danger svg {
  color: #dc2626;
}

.conversation-menu-item--danger:hover {
  background: #fef2f2;
  color: #991b1b;
}

.conversation-menu-item--danger:hover svg {
  color: #991b1b;
}

/* ===== АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ ===== */
@media (max-width: 768px) {
   /* На мобильных кнопку меню показываем внизу, рядом с кнопкой записи
      (см. .record-aux-btn--menu). Верхний плавающий гамбургер прячем,
      но оставляем в DOM — его click() переиспользует нижняя кнопка. */
   .app-avatar {
    display: none !important;
  }
  
  .app-sidebar {
    width: 300px;
    left: -300px;
    height: 100dvh;
    max-height: 100dvh;
    padding-bottom: var(--safe-bottom, env(safe-area-inset-bottom, 0px));
  }

  .sidebar-account-foot {
    padding-bottom: 0;
  }

  .sidebar-account-row {
    padding-bottom: 5px;
  }

  .sidebar-footer {
    padding-bottom: calc(8px + var(--safe-bottom, env(safe-area-inset-bottom, 0px)));
  }
  
  .avatar-icon {
    width: 24px;
    height: 24px;
  }
  
  .thought-menu {
    top: max(10px, env(safe-area-inset-top, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
  }
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: #0000ff;
}


.item-icon svg,
.auth-icon svg,
.balance-icon svg,
.auth-dropdown-item-icon svg {
  display: block;
}

/* Убираем старые стили для эмодзи */
.item-icon, .auth-icon, .balance-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-avatar-icon {
  display: block;
  pointer-events: none;
}