:root {
    --primary-color: #0d47a1; /* Глубокий синий */
    --secondary-color: #1976d2; /* Светлее синий */
    --text-color: #212529; /* Почти черный для текста */
    --light-bg: #f8f9fa; /* Очень светлый фон */
    --white: #ffffff;
    --border-color: #dee2e6;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --- Общие сбросы и стили --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
  font-family: var(--font-family);
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--light-bg);
}

.container {
  max-width: 1100px;
  margin: 20px auto;
  padding: 0 20px;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  line-height: 1.2;
}

a {
  color: var(--secondary-color);
  text-decoration: none;
  transition: color 0.2s ease-in-out;
}

a:hover, a:focus {
  text-decoration: underline;
  color: var(--primary-color);
}

address {
    font-style: normal;
    line-height: 1.7;
}

/* --- Шапка сайта --- */
header {
  background: var(--white);
  padding: 1rem 20px;
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
  overflow: visible; /* Предотвращаем обрезание содержимого */
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
}

.logo a {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  margin-bottom: 0.5rem;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0;
}

.header-icons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: -0.2rem; /* Поднимаем иконки выше на десктопе */
}

.header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px; /* Делаем по высоте как поле поиска */
  border-radius: 1.5em;
  background: #f8fbff;
  border: 1.5px solid #c3d0e6;
  transition: all 0.2s;
  color: #1976d2;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.07);
  flex-shrink: 0;
  margin: 0;
  padding: 0;
}

.header-icon:hover {
  background: #e3eaf7;
  border-color: #1976d2;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(33, 150, 243, 0.13);
}

.header-icon svg {
  transition: transform 0.2s;
  width: 20px;
  height: 20px;
}

.header-icon:hover svg {
  transform: scale(1.1);
}

.logo .site-search {
  max-width: 220px;
  margin-top: 0;
  padding: 0 2px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.logo .site-search input[type="text"] {
  font-size: 0.92em;
  padding: 0.35em 0.5em 0.35em 0.5em;
  border: none;
  flex: 1 1 auto;
  min-width: 0;
}

.logo .site-search button {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  max-width: 32px;
  max-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1em;
  padding: 0;
  margin-left: 2px;
  border-radius: 50%;
  background: none;
  border: none;
}

.logo .site-search button svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* --- Меню сайта (главное и подменю) --- */
.main-nav {
  display: flex;
  gap: 1.2em;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.97em;
  margin-left: 2em;
}
.menu-item {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0.13em 0.5em;
  border-radius: 7px;
  transition: background 0.18s;
  min-width: 0;
}
.menu-item > a {
  color: #1976d2;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  font-size: 1em;
  transition: color 0.18s;
}
.menu-item > a:hover, .menu-item > a.active {
  color: #0d47a1;
  text-decoration: underline;
}

/* --- Новые, объединенные стили для подменю с плавной анимацией --- */
.submenu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(5px);
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 220px;
  background: #fff;
  border: 1.5px solid #e3eaf7;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(25, 118, 210, 0.13);
  z-index: 1000;
  margin-top: 0.3em;
  padding: 0.5em 0.2em;
  max-height: 340px;
  overflow-y: auto;
  transition: opacity 0.25s ease-in-out, transform 0.25s ease-in-out, visibility 0s linear 0.25s;
}

.menu-item:hover > .submenu,
.menu-item:focus-within > .submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition-delay: 0s; /* Показываем подменю без задержки */
}
.submenu li, .submenu .menu-item {
  padding: 0.13em 0.7em;
  white-space: normal;
  font-size: 0.93em;
}
@media (max-width: 900px) {
  .main-nav {
    gap: 0.5em;
    font-size: 0.98em;
    margin-left: 0.5em;
  }
  .menu-item {
    padding: 0.2em 0.3em;
  }
}
@media (max-width: 700px) {
  .main-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0.2em;
    margin-left: 0;
  }
  .menu-item {
    padding: 0.2em 0.2em;
  }
}

/* --- Карточки контента --- */
.card {
    background: var(--white);
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.feedback-card {
    /* Этот хак предотвращает "растягивание" страницы по горизонтали, 
       если встроенный виджет (например, Госуслуги) пытается стать шире родителя. */
    overflow: hidden;
}

.sidebar {
    display: flex;
    flex-direction: column;
}

/* --- Баннеры --- */
.banners {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  align-items: center;
}

.banners a {
    display: block;
}

.banners img {
  width: 100%;
  height: auto;
  max-height: 80px;
  object-fit: contain;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.banners img:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}

/* --- Списки --- */
.card ul {
  list-style: none;
  padding: 0;
}

.card ul li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.card ul li:last-child {
    border-bottom: none;
}

/* --- Подвал --- */
footer {
  text-align: center;
  padding: 2rem 1rem;
  margin-top: 2rem;
  background: var(--white);
  border-top: 1px solid var(--border-color);
  color: #6c757d;
}

.footer-content {
  max-width: 1100px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .footer-content {
    text-align: center;
  }
}

/* --- Адаптивность: кнопка-гамбургер --- */
.nav-toggle {
    display: block; /* Показать на мобильных */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.hamburger, .hamburger::before, .hamburger::after {
    content: '';
    display: block;
    background-color: var(--primary-color);
    height: 3px;
    width: 25px;
    border-radius: 3px;
    transition: all 0.3s ease-in-out;
}

.hamburger::before { transform: translateY(-8px); }
.hamburger::after { transform: translateY(8px); }

.nav-open .hamburger { background-color: transparent; }
.nav-open .hamburger::before { transform: rotate(45deg); }
.nav-open .hamburger::after { transform: rotate(-45deg); }

.main-content-with-sidebar {
    display: grid;
    grid-template-columns: 1fr 300px; /* Основной контент и фиксированная ширина сайдбара */
    gap: 2rem;
}

.main-content-with-sidebar .sidebar .card {
    margin-bottom: 0;
}

/* Медиа-запрос для мобильных: сайдбар под контентом */
@media (max-width: 767px) {
    .main-content-with-sidebar {
        grid-template-columns: 1fr;
    }
}

/* Медиа-запрос для экранов шире 768px (планшеты и десктопы) */
@media (min-width: 768px) {
    .nav-toggle {
        display: none;
    }

    .main-nav, .main-nav.active-mobile {
        display: flex;
        position: static;
        width: auto;
        background: none;
        box-shadow: none;
        flex-direction: row;
        gap: 0.5rem;
    }
}

/* --- Динамическое меню и подменю --- */
.menu-item {
  position: relative;
  display: inline-block;
}
.menu-item.has-children > a::after {
  content: '▼';
  font-size: 0.7em;
  margin-left: 0.4em;
  color: var(--secondary-color);
}
.menu-item .submenu .menu-item {
  display: block;
}
.menu-item .submenu a {
  display: block;
  padding: 0.5rem 1.2rem;
  color: var(--primary-color);
  border-radius: 0;
  font-weight: 400;
}
.menu-item .submenu a:hover {
  background: var(--light-bg);
  color: var(--secondary-color);
}
.main-nav a.active {
  background: var(--secondary-color);
  color: #fff !important;
  font-weight: 700;
}

/* Делаем таблицы в контенте горизонтально-прокручиваемыми на мобильных */
@media (max-width: 768px) {
    .main-content table, .card table {
        display: block;
        width: 100%;
        overflow-x: auto;
    }
}

/* --- Кружок-админка (admin-fab) --- */
.admin-fab {
  position: fixed;
  right: 12px;
  bottom: 12px;
  width: 24px;
  height: 24px;
  background: transparent;
  color: transparent;
  border-radius: 50%;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  z-index: 2000;
  cursor: pointer;
  opacity: 0.1;
  transition: background 0.2s, opacity 0.2s, box-shadow 0.2s, color 0.2s;
  border: 1px solid transparent;
}
.admin-fab:hover, .admin-fab:focus {
  background: var(--primary-color);
  color: #fff;
  opacity: 0.7;
  box-shadow: 0 2px 8px rgba(33,150,243,0.18);
  border: 1px solid var(--primary-color);
}
.admin-fab::before {
  content: '';
}
@media (max-width: 600px) {
  .admin-fab {
    display: none;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
  body {
    font-size: 0.9rem;
    line-height: 1.5;
  }
  .container {
    padding: 0 10px;
  }
  .card {
    padding: 1rem;
  }
  .main-content-with-sidebar {
    gap: 1rem;
  }
  .banners {
    grid-template-columns: repeat(2, 1fr);
  }
  .banners img {
    max-height: 60px;
  }
  .main-nav a, .menu-item .submenu a {
    padding: 0.8rem 1rem;
  }
  .nav-toggle {
    padding: 0.4rem;
  }
  h1, h2, h3 {
    font-size: 1.2rem;
  }
  .news-item {
    font-size: 1em;
    margin-bottom: 1em;
  }
  .feedback-card {
    padding: 0.7rem 0.5rem;
  }
  .banner-caption {
    font-size: 0.95em;
  }
  .main-content-with-sidebar,
  .main-content,
  .sidebar,
  .card,
  .banners,
  .feedback-card {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }
  .hero h1 {
    font-size: 0.85rem;
    text-align: center;
    word-break: break-word;
  }
  .news-item, .news-title, .news-date, .news-text {
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
  }
  
  /* Дополнительные стили для мобильной шапки на очень маленьких экранах */
  .header-container {
    padding: 0.4rem 0.5rem; /* Уменьшаем padding */
    gap: 0.3rem; /* Уменьшаем отступы */
    min-height: 52px; /* Уменьшаем высоту */
  }
  
  .header-controls {
    gap: 0.3rem; /* Уменьшаем отступы */
    display: flex !important;
  }
  
  .site-search {
    max-width: 140px; /* Уменьшаем максимальную ширину */
    display: flex !important;
  }
  
  .site-search input[type="text"] {
    padding: 0.35rem 0.5rem; /* Уменьшаем padding */
    font-size: 0.8rem; /* Уменьшаем размер шрифта */
  }
  
  .site-search button {
    padding: 0.35rem; /* Уменьшаем padding */
  }
  
  .header-icons {
    gap: 0.2rem; /* Уменьшаем отступы */
    display: flex !important;
    margin-top: -0.4rem; /* Поднимаем иконки выше */
    align-items: center;
  }
  
  .header-icon {
    width: 28px; /* Уменьшаем размер */
    height: 28px;
    padding: 0.25rem; /* Уменьшаем padding */
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .header-icon svg {
    width: 14px; /* Уменьшаем размер иконок */
    height: 14px;
  }
  
  .nav-toggle {
    padding: 0.25rem; /* Уменьшаем padding */
    width: 28px; /* Уменьшаем размер */
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -1.1rem; /* Поднимаем кнопку меню на тот же уровень */
  }
  
  .nav-toggle .hamburger,
  .nav-toggle .hamburger::before,
  .nav-toggle .hamburger::after {
    width: 14px; /* Уменьшаем размер */
    height: 2px;
  }
  
  .nav-toggle .hamburger::before {
    transform: translateY(-3px);
  }
  
  .nav-toggle .hamburger::after {
    transform: translateY(3px);
  }
}

/* --- Кнопка версии для слабовидящих --- */
#special-version-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 3000;
  background: #222;
  color: #ffe600;
  border: none;
  border-radius: 8px;
  padding: 0.7em 1.2em;
  font-size: 1.1em;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
#special-version-toggle:hover, #special-version-toggle:focus {
  background: #ffe600;
  color: #222;
}
@media (max-width: 480px) {
  #special-version-toggle {
    right: 8px;
    bottom: 8px;
    font-size: 1em;
    padding: 0.5em 0.8em;
  }
}

/* --- Спецверсия для слабовидящих --- */
body.special-version {
  background: #000 !important;
  color: #ffe600 !important;
  font-size: 1.18em !important;
  letter-spacing: 0.03em;
}
body.special-version a {
  color: #ffe600 !important;
  text-decoration: underline !important;
  font-weight: 700;
}
body.special-version header,
body.special-version footer,
body.special-version .card,
body.special-version .main-content,
body.special-version .sidebar,
body.special-version .container {
  background: #000 !important;
  color: #ffe600 !important;
  box-shadow: none !important;
  border: none !important;
}
body.special-version .card,
body.special-version .main-content,
body.special-version .sidebar,
body.special-version .container {
  border-radius: 0 !important;
}
body.special-version img, body.special-version svg {
  filter: grayscale(1) contrast(1.2) !important;
}
body.special-version * {
  outline: none !important;
  box-shadow: none !important;
  transition: none !important;
  animation: none !important;
}
body.special-version .main-nav a.active {
  background: #ffe600 !important;
  color: #000 !important;
}
body.special-version .banner-caption {
  color: #ffe600 !important;
}
@media (max-width: 480px) {
  body.special-version {
    font-size: 1.05em !important;
  }
}

/* --- Виджет для слабовидящих --- */
#special-widget {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
#special-widget-btn {
  background: #222;
  color: #ffe600;
  border: none;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  font-size: 1.5em;
  padding: 0;
}
#special-widget-btn:hover, #special-widget-btn:focus {
  background: #ffe600;
  color: #222;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
#special-panel {
  margin-top: 8px;
  background: #222;
  color: #ffe600;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  padding: 1em 1em 0.5em 1em;
  min-width: 180px;
  display: none;
  flex-direction: column;
  align-items: stretch;
  font-size: 1em;
}
.special-panel-title {
  font-weight: 700;
  margin-bottom: 0.7em;
  text-align: center;
}
.special-panel-btn {
  background: #ffe600;
  color: #222;
  border: none;
  border-radius: 6px;
  margin-bottom: 0.5em;
  padding: 0.5em 0.7em;
  font-size: 1em;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.special-panel-btn:hover, .special-panel-btn:focus {
  background: #fff200;
  color: #000;
}
@media (max-width: 480px) {
  #special-widget {
    right: 8px;
    bottom: 8px;
  }
  #special-widget-btn {
    width: 44px;
    height: 44px;
    font-size: 1.1em;
  }
  #special-panel {
    min-width: 140px;
    font-size: 0.95em;
    padding: 0.7em 0.5em 0.3em 0.5em;
  }
}

/* --- Дополнительные классы для спецверсии --- */
body.special-bw {
  filter: grayscale(1) !important;
}
body.special-underline a {
  text-decoration: underline !important;
}

/* --- Компактный виджет для слабовидящих --- */
#special-widget-root {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  user-select: none;
}
#special-widget-btn {
  background: var(--white);
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  font-size: 1.2em;
  padding: 0;
}
#special-widget-btn:hover, #special-widget-btn:focus {
  background: var(--primary-color);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
#special-panel {
  margin-top: 7px;
  background: var(--white);
  color: var(--primary-color);
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.13);
  padding: 0.7em 0.7em 0.4em 0.7em;
  min-width: 120px;
  display: none;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.3em;
  align-items: center;
  font-size: 1em;
}
.special-panel-btn {
  background: var(--primary-color);
  color: var(--white);
  border: none;
  border-radius: 6px;
  margin: 0 0.1em 0.3em 0.1em;
  padding: 0.3em 0.6em;
  font-size: 1em;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  min-width: 2.1em;
}
.special-panel-btn:hover, .special-panel-btn:focus {
  background: var(--secondary-color);
  color: var(--white);
}
@media (max-width: 480px) {
  #special-widget-root {
    right: 16px !important;
    bottom: 16px !important;
  }
  #special-widget-btn {
    width: 48px !important;
    height: 48px !important;
    font-size: 1.2em !important;
  }
  #special-panel {
    min-width: 120px !important;
    font-size: 1em !important;
    padding: 0.7em 0.5em 0.3em 0.5em !important;
  }
}
/* Не применять фильтры спецверсии к виджету */
#special-widget-root, #special-widget-root * {
  filter: none !important;
  color-scheme: light dark;
}

/* --- Современная форма поиска под логотипом (компактная) --- */
.site-search {
  width: 100%;
  max-width: 320px;
  margin: 0.5em 0 1em 0;
  display: flex;
  align-items: center;
  background: var(--white);
  border-radius: 1.5em;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.07);
  border: 1.5px solid var(--border-color);
  padding: 1px 6px 1px 10px;
  transition: box-shadow 0.2s, border 0.2s;
}
.site-search:focus-within {
  box-shadow: 0 4px 16px rgba(33, 150, 243, 0.13);
  border-color: var(--primary-color);
}
.site-search input[type="text"] {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.98em;
  padding: 0.5em 0.3em 0.5em 0;
  color: var(--text-color);
}
.site-search input[type="text"]::placeholder {
  color: #b0b8c1;
  opacity: 1;
}
.site-search button {
  background: none;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 0 0.3em;
  display: flex;
  align-items: center;
  color: var(--primary-color);
  border-radius: 50%;
  transition: background 0.18s;
  font-size: 0.98em;
}
.site-search button:hover, .site-search button:focus {
  background: var(--light-bg);
}
@media (max-width: 767px) {
  .site-search {
    flex: 1;
    min-width: 0;
    max-width: 180px; /* Уменьшаем максимальную ширину */
    display: flex !important;
  }
  .site-search input[type="text"] {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    border-radius: 8px;
  }
  .logo .site-search {
    display: none;
  }
  
  /* Мобильная версия шапки - все в один ряд */
  .header-container {
    flex-direction: row;
    gap: 0.4rem; /* Уменьшаем отступы */
    padding: 0.5rem 0.6rem; /* Уменьшаем padding */
    align-items: center;
    min-height: 60px;
  }
  
  /* Убираем принудительное скрытие логотипа */
  .logo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
  }
  
  .logo a {
    font-size: 1.1rem; /* Уменьшаем размер логотипа */
    font-weight: 800;
    letter-spacing: 0.01em;
    margin-bottom: 0.2rem; /* Уменьшаем отступ */
  }
  
  /* Показываем элементы управления на мобильных */
  .header-controls {
    display: flex !important;
    align-items: center;
    gap: 0.4rem; /* Уменьшаем отступы */
    flex: 1;
    order: 1;
    margin-top: 0;
  }
  
  .header-icons {
    display: flex;
    gap: 0.25rem; /* Уменьшаем отступы между иконками */
    flex-shrink: 0;
    order: 2;
    margin-top: -0.5rem; /* Поднимаем иконки выше */
    align-items: center;
  }
  
  .header-icon {
    width: 32px; /* Уменьшаем размер */
    height: 32px;
    padding: 0.3rem; /* Уменьшаем padding */
    border-radius: 6px;
    background: rgba(25, 118, 210, 0.08);
    border: 1px solid rgba(25, 118, 210, 0.15);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .header-icon:hover {
    background: rgba(25, 118, 210, 0.15);
    border-color: #1976d2;
    transform: translateY(-1px);
  }
  
  .header-icon svg {
    width: 16px; /* Уменьшаем размер иконок */
    height: 16px;
  }
  
  /* Навигация на мобильных */
  .main-nav {
    order: 4;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--white);
    box-shadow: var(--shadow);
    display: none;
    /* --- Новые стили для исправления прокрутки и отступов --- */
    flex-direction: column;
    align-items: stretch;
    max-height: calc(100vh - 70px); /* Высота экрана минус ~высота шапки */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Плавная прокрутка на iOS */
  }
  
  .main-nav.active-mobile {
    display: flex;
  }

  .menu-item {
    display: block;
    border-bottom: 1px solid #f0f0f0;
  }
  .menu-item:last-child {
    border-bottom: none;
  }

  .menu-item .submenu {
    /* Сбрасываем стили десктопа и скрываем по умолчанию */
    position: static;
    display: none; 
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: rgba(25, 118, 210, 0.04);
    padding: 0.5em 0 0.5em 1.5em;
    margin-top: 0.3em;
    max-height: none;
  }

  /* Показываем подменю по клику (класс добавляется JS) */
  .menu-item.submenu-open > .submenu {
    display: block;
  }

  /* Анимация стрелочки в мобильном меню */
  .menu-item.has-children > a::after {
    transition: transform 0.2s ease-in-out;
  }
  .menu-item.submenu-open.has-children > a::after {
    transform: rotate(-180deg);
  }
  
  .nav-toggle {
    order: 3;
    margin: 0;
    padding: 0.3rem; /* Уменьшаем padding */
    background: rgba(25, 118, 210, 0.08);
    border: 1px solid rgba(25, 118, 210, 0.15);
    border-radius: 6px;
    transition: all 0.2s ease;
    width: 32px; /* Уменьшаем размер */
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1.1rem; /* Поднимаем кнопку меню на тот же уровень */
  }
  
  .nav-toggle:hover {
    background: rgba(25, 118, 210, 0.15);
    border-color: #1976d2;
  }
  
  .nav-toggle .hamburger,
  .nav-toggle .hamburger::before,
  .nav-toggle .hamburger::after {
    width: 16px; /* Уменьшаем размер */
    height: 2px;
    border-radius: 1px;
  }
  
  .nav-toggle .hamburger::before {
    transform: translateY(-4px);
  }
  
  .nav-toggle .hamburger::after {
    transform: translateY(4px);
  }
}

/* --- Стили для результатов поиска --- */
.search-list {
  list-style: none;
  padding: 0;
  margin: 0.5em 0 0 0;
}
.search-list li {
  margin-bottom: 1.1em;
  padding-bottom: 0.7em;
  border-bottom: 1px solid var(--border-color);
}
.search-list li:last-child {
  border-bottom: none;
}
.search-list a {
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.18s;
}
.search-list a:hover, .search-list a:focus {
  color: var(--secondary-color);
  text-decoration: underline;
}
.search-snippet {
  color: #444;
  font-size: 0.98em;
  margin-top: 0.2em;
  line-height: 1.5;
  word-break: break-word;
}
.search-list mark {
  background: #fff9c4;
  color: #c62828;
  padding: 0 2px;
  border-radius: 2px;
}
.search-file-post {
  color: #888;
  font-size: 0.93em;
  margin-left: 0.5em;
}
@media (max-width: 600px) {
  .search-list li {
    font-size: 0.98em;
    padding-bottom: 0.5em;
  }
  .search-snippet {
    font-size: 0.93em;
  }
}

/* Стили для хлебных крошек */
.breadcrumbs {
    margin-bottom: 1.5rem;
    padding: 0.8rem 0;
    font-size: 0.95em;
    color: #666;
}

.breadcrumbs a {
    color: #1976d2;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumbs a:hover {
    color: #0d47a1;
    text-decoration: underline;
}

.breadcrumbs .separator {
    margin: 0 0.5rem;
    color: #ccc;
}

.breadcrumbs span:last-child {
    color: #333;
    font-weight: 500;
}

@media (max-width: 768px) {
    .breadcrumbs {
        font-size: 0.9em;
        margin-bottom: 1rem;
    }
}
