

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

/* Шапка сайта — фиксированная */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  z-index: 100;
  height: 60px;
  box-sizing: border-box;
}

/* Отступ для основного контента, чтобы не уходил под шапку */
body {
  padding-top: 60px; /* Высота шапки, подстрой под свою */
}
.tagline { margin: 0; font-size: 1rem; color: var(--text-2); }
.tagline .accent { color: var(--link); font-weight: 600; }

.user-avatar { width: 36px; height: 36px; background: var(--info); color: var(--on-accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; }
.logout-btn { color: var(--danger); text-decoration: none; font-weight: 500; border: none; background: none; cursor: pointer; }
.logout-btn:hover { text-decoration: underline; }

.lk-layout {
  min-height: calc(100%); /* fallback */
  height: calc(100%);
  display: flex;
  overflow: hidden; /* чтобы внутренние скроллы работали корректно */
}
.lk-sidebar { width: 140px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; transition: width 0.3s; flex-shrink: 0; z-index: 10; }
.lk-sidebar.collapsed { width: 62px; }
.lk-sidebar.collapsed .lk-nav-label { display: none; }
.lk-sidebar-toggle {
  display: flex; justify-content: center; align-items: center;
  padding: 14px 0; font-weight: 800; font-size: 18px; color: var(--brand-text);
  border: none; background: none; cursor: pointer; border-bottom: 1px solid var(--border);
}
.lk-nav { display: flex; flex-direction: column; padding: 8px 0; flex: 1; }
/* Публичная страница + поддержка TG — блок прижат к низу навбара */
.lk-nav-public { margin-top: auto; }
.lk-nav-support { border-top: 1px solid var(--border); }
.lk-nav-disabled { pointer-events: none; opacity: 0.45; cursor: default; }
.lk-nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: var(--text-2); text-decoration: none; cursor: pointer; transition: all 0.2s; border-left: 3px solid transparent; }
.lk-nav-item:hover { background: var(--surface-3); }
.lk-nav-item.active { background: var(--info-soft); color: var(--brand-text); border-left-color: var(--brand); font-weight: 700; }
.lk-nav-icon {
  color: var(--brand-text); width: 20px; height: 20px; flex-shrink: 0; display: inline-flex;
}
.lk-nav-icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lk-content {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

@media (max-width: 925px) {
    body {
      padding-top: 60px; /* убираем, т.к. на мобиле шапка может быть не фиксированной? Нет, оставим фикс, но нужно проверить */
    }
  .lk-sidebar { position: fixed; left: 0; top: 60px; bottom: 0; transform: translateX(-100%); box-shadow: 4px 0 24px rgba(0,0,0,0.1); }
  .lk-sidebar.open { transform: translateX(0); }
  .lk-sidebar-toggle { position: fixed; top: 70px; left: 12px; z-index: 20; background: var(--surface); border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); border: 1px solid var(--border); }
  .lk-content { padding: 16px; }}
.lk-nav-item { font-size: 16px; padding: 10px 20px; }

.chat-placeholder {
  border: 1px solid var(--border-strong); /* Заменяет box-shadow */
  border-radius: 3px !important;
  height: 100%; background: var(--surface);
  display: flex; align-items: center; justify-content: center;
}
.settings-window {
    width: calc(100% - 10px) !important; max-width: none !important;
    margin: 5px auto !important; max-height: 90vh !important; border-radius: 12px !important;
  }
/* 🔸 Кнопка назад (по умолчанию скрыта) */
.chat-back-btn {
  display: none; align-items: center; justify-content: center; width: 36px; height: 36px;
  border: none; background: transparent; cursor: pointer; color: var(--brand-text); font-size: 22px;
  flex-shrink: 0; z-index: 5; margin-right: 8px;
}
/* 🔸 1. ГЛОБАЛЬНО: убираем бутерброд, оставляем только иконки */
.lk-sidebar-toggle { display: none !important; }
.lk-sidebar { width: 62px !important; transition: none; }
.lk-nav-label { display: none !important; }
.lk-nav-item { padding: 14px 0 !important; justify-content: center; }
.lk-nav-icon { margin: 0 !important; }
#chat-root { position: relative; overflow: hidden; background: var(--surface); }

/* Плитки досок */
.board-tile-new:hover { transform: scale(1.03); }
.board-tile-mine:hover, .board-tile-shared:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.board-tile-mine { border-color: var(--success) !important; }
.board-tile-shared { border-color: var(--on-accent) !important; }

/* Iframe-контейнер */
#boards-iframe-container { background: var(--surface-2); }

/* 🔸 МОБИЛЬНЫЙ РЕЖИМ (<925px) — единый чистый блок */
@media (max-width: 925px) {
  body, html { margin: 0 !important; padding: 0 !important; overflow-x: hidden; overscroll-behavior: auto !important;}
  #chat-left-panel {
      padding-top: 60px;
      box-sizing: border-box;
  }
  /* Отзывы и настройки профиля: контент не должен уезжать под фиксированную шапку
     (паттерн как у календаря: margin-top + высота за вычетом шапки) */
  #reviews-root, #account-root {
      margin-top: 60px !important;
      height: calc(100dvh - 60px) !important;
      box-sizing: border-box;
  }
  .lk-sidebar {
    padding-top: 60px;
    box-sizing: border-box;
  }
  .lk-content {
      padding: 0 !important;
      height: 100dvh !important;
      display: flex !important;
      flex-direction: column !important;
  }
  .lk-sidebar { position: static !important; top: 60px !important; transform: none !important; box-shadow: none !important; }
  body.lk-chat-open .lk-sidebar { display: none !important; }
  #typingIndicator { left: 0 !important; }
  #chat-root {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    flex: 1 !important;
    min-height: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
  }
  #chat-left-panel > div:first-child,
  #chatHeader {
      position: sticky !important;
      top: 0px !important;
      z-index: 25 !important;
      background: var(--surface) !important;
      border-bottom: 1px solid var(--border) !important;
  }
  #roomsList, #messagesList {
      overscroll-behavior-y: auto !important;
      scroll-behavior: auto !important;
  }
  #boards-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); padding: 12px; }
  .board-tile { padding: 8px; }
  #chat-left-panel { width: 100% !important; border-right: none; }
  .chat-mobile-active #chat-left-panel { display: none !important; }

  #chat-right-panel {
    position: fixed !important;

    top: 60px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: calc(100dvh - 60px) !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 30 !important;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    overscroll-behavior: contain !important;
  }
  #chatHeader {
    flex-shrink: 0 !important;
  }
  #messageInput {
    flex-shrink: 0 !important;
  }
  .chat-mobile-active #chat-right-panel { transform: translateX(0) !important; }

  .chat-back-btn { display: flex !important; align-items: center; justify-content: center; width: 32px; height: 32px; border: none; background: transparent; cursor: pointer; color: var(--brand-text); font-size: 20px; flex-shrink: 0; }
}

/* 🔸 3. ДЕСКТОП (≥926px) — жесткий возврат */
@media (min-width: 926px) {
    .lk-content {
        display: flex;
        justify-content: center;
    }
  .chat-back-btn { display: none !important; }
  #chat-root { margin-left: 55px !important; transform: translateX(-60px); display: flex; align-items: center; justify-content: center; width: 100%; max-width: 1300px !important; height: calc(100vh - 60px) !important; border-radius: 12px !important; box-shadow: 0 2px 12px rgba(0,0,0,0.05) !important; }
  #chat-left-panel { width: 380px !important; display: flex !important; border-right: 1px solid var(--border) !important; }
  #chat-right-panel { position: relative !important; transform: none !important; z-index: auto !important; }
  .chat-mobile-active #chat-right-panel { transform: none !important; }
  .chat-mobile-active #chat-left-panel { display: flex !important; }
  .settings-window { width: 520px !important; }
  #chat-right-panel {
    position: relative !important; /* перебиваем inline, если нужно */
  }
  #boards-root {
    margin-left: 40 !important;
    width: 100% !important;
    max-width: none !important;
    align-self: stretch !important;
  }
  /* .lk-content здесь display:flex (row) — flex-item без ширины размерируется по контенту:
     с «отзывов пока нет» вкладка схлопывалась в полоску шириной с текст (в светлой теме не видно,
     в остальных — фон --surface выдаёт). То же лекарство, что у #account-root в account.js */
  #reviews-root { width: 100%; }
  #boards-iframe-container {
      transform: none !important;
      max-width: none !important;
      width: 100% !important;
      margin: 0 !important;
      border-radius: 0 !important;
      box-shadow: none !important;
    }
  #roomsList, #messagesList {
      overscroll-behavior-y: auto !important;
      scroll-behavior: auto !important;
  }
}

/* Стилизованный селект для фильтра досок */
.board-filter-select {
  padding: 6px 32px 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  transition: all 0.2s ease;
}

.board-filter-select:hover {
  border-color: var(--brand);
}

/* Стили для выпадающего списка (option) – ограниченно, но аккуратно */
.board-filter-select option {
  background-color: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
}

/* Для браузеров, поддерживающих стилизацию option при наведении */
.board-filter-select option:hover {
  background-color: var(--info-soft);
  color: var(--brand-text);
}

#calendar-root {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  height: calc(100vh - 60px) !important;
  align-self: stretch !important;
}
/* ===== Кастомный дропдаун для фильтра досок ===== */
.custom-board-filter {
  position: relative;
  display: inline-block;
  font-size: 14px;
  font-family: inherit;
}

.filter-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 28px 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.filter-trigger:hover {
  border-color: var(--brand);
}

.filter-selected-label {
  color: var(--text);
  font-weight: 500;
}

.filter-arrow {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-2);
  transition: transform 0.2s;
}

.filter-trigger.open .filter-arrow {
  transform: rotate(180deg);
}

.filter-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  list-style: none;
  padding: 6px 0;
  margin: 0;
  z-index: 1000;
  max-height: 280px;
  overflow-y: auto;
}

.filter-dropdown li {
  padding: 8px 16px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
  font-size: 14px;
}

.filter-dropdown li:hover {
  background: var(--surface-3);
}

.filter-dropdown li.active {
  background: var(--info-soft);
  color: var(--brand-text);
  font-weight: 500;
}
/* Стиль для выпадающих списков ролей (кастомный) */
.participant-role-select {
    padding: 4px 24px 4px 8px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 10px;
}
/* Индикатор печатания — обычный блок внутри чата */

.participant-role-select:hover {
    border-color: var(--brand);
}

/* Контекстное меню для досок */
.board-context-menu {
    animation: fadeInScale 0.12s ease-out;
    transform-origin: top left;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.board-context-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    transition: background 0.15s;
}

.board-context-item:hover {
    background: var(--surface-3);
}

.board-context-item:active {
    background: var(--surface-4);
}

/* Индикатор печатания — позиционируем относительно панели чата */

#typingIndicator {
  position: absolute;
  top: 64px; /* высота шапки чата */
  left: 0;
  right: 0;
  z-index: 15;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 6px 20px;
  font-size: 13px;
  color: var(--brand-text);
  font-weight: 700;
  display: none;
  pointer-events: none;
  transition: opacity 0.2s;
  box-sizing: border-box;
  margin: 0;
}

.add-trial-btn {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    z-index: 5;
    border-top: 1px solid var(--border);
}

/* === АДАПТИВ ДОСОК НА МОБИЛКАХ === */
@media (max-width: 925px) {
    /* Фиксируем кнопки управления доской ниже шапки сайта */
    .board-controls-bar {
        position: absolute !important;
        top: 72px !important; /* Шапка 60px + отступ 12px */
        left: 16px !important;
        right: 16px !important;
        z-index: 1000 !important;
    }

    /* Модалка участников */
    .board-modal-inner {
        width: 95vw !important;
        max-height: 90vh !important;
        border-radius: 12px !important;
    }
    /* Разрешаем перенос кнопок и имен в списке участников */
    .participant-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }
    .participant-row > div:last-child {
        width: 100%;
        justify-content: flex-start !important;
        flex-wrap: wrap;
    }
}
