/* ================================================================
   Водолей-информ — декоративные элементы
   Подключается после style.css
   ================================================================ */

/* ================= Фоновый «водный» градиент ================= */
body {
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, var(--c-primary-glow), transparent 60%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(0, 180, 216, .06), transparent 60%),
    var(--c-bg);
  background-attachment: fixed;
  min-height: 100vh;
}

[data-theme="dark"] body {
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(77, 184, 255, .08), transparent 60%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(0, 229, 255, .05), transparent 60%),
    var(--c-bg);
  background-attachment: fixed;
}

/* ================= Плавные анимации ================= */

/* Ripple на кнопках */
button:not(:disabled),
.btn-primary-link {
  position: relative;
  overflow: hidden;
}
button:not(:disabled)::after,
.btn-primary-link::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,.35), transparent 60%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
button:not(:disabled):active::after,
.btn-primary-link:active::after {
  opacity: 1;
  transition: opacity 0s;
}

/* Плавный hover карточек */
.card {
  transition: box-shadow .25s, border-color .25s, transform .2s;
}
.card:hover {
  transform: translateY(-1px);
}

/* Пульс для точки бренда в топбаре (уже в style.css — усиливаем) */
.topbar .brand .dot {
  animation: brandPulse 3s ease-in-out infinite;
}

/* ================= Вертикальные закладки (sidebar) ================= */
/* Компактная колонка с фоном-подложкой */

.tabs-sidebar {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: start;
  margin-bottom: 24px;
}

/* Левая колонка — «книжка» с закладками */
.tabs-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  position: sticky;
  top: 84px;
  align-self: start;
  background: var(--c-bg-card);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* Заголовок колонки (опционально, но добавим надпись сверху) */
.tabs-nav::before {
  content: 'Разделы';
  display: block;
  padding: 4px 12px 8px;
  font-size: 0.65625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--c-text-muted);
}

.tabs-nav button {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--c-text-soft);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: color .15s, background .15s;
  width: 100%;
  overflow: hidden;
}
.tabs-nav button svg {
  flex-shrink: 0;
  opacity: .75;
  transition: opacity .15s, transform .15s;
}
.tabs-nav button span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hover — мягкий, без резких скачков */
.tabs-nav button:hover {
  color: var(--c-text);
  background: var(--c-bg-hover);
}
.tabs-nav button:hover svg { opacity: 1; }

/* Активная закладка — заливка + цветная полоска слева */
.tabs-nav button.active {
  color: var(--c-primary-dark);
  background: linear-gradient(90deg, var(--c-primary-soft) 0%, transparent 100%);
  font-weight: 700;
}
.tabs-nav button.active svg {
  opacity: 1;
  color: var(--c-primary);
}
.tabs-nav button.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--c-primary), var(--c-accent));
  box-shadow: 0 0 10px var(--c-primary-glow);
}

/* Содержимое справа */
.tabs-content {
  min-width: 0;
}

/* Скрываем все pane, показываем только активную */
.tabs-content > .tab-pane {
  display: none;
}
.tabs-content > .tab-pane.active {
  display: block;
  animation: fadeTabIn .22s ease;
}

@keyframes fadeTabIn {
  from { opacity: 0; transform: translateX(4px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ================= Планшет: узкие закладки ================= */
@media (max-width: 900px) and (min-width: 641px) {
  .tabs-sidebar { grid-template-columns: 64px 1fr; gap: 14px; }
  .tabs-nav { padding: 8px; }
  .tabs-nav::before { display: none; }
  .tabs-nav button {
    padding: 11px 0;
    justify-content: center;
  }
  .tabs-nav button span { display: none; }
  .tabs-nav button.active::before {
    top: 25%;
    bottom: 25%;
  }
}

/* ================= Мобильный: горизонтальный таб-бар ================= */
@media (max-width: 640px) {
  .tabs-sidebar {
    display: block;
  }
  .tabs-nav {
    flex-direction: row;
    position: static;
    padding: 6px;
    gap: 4px;
    overflow-x: auto;
    margin-bottom: 14px;
    border-radius: var(--radius);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .tabs-nav::-webkit-scrollbar { display: none; }
  .tabs-nav::before { display: none; }
  .tabs-nav button {
    flex-shrink: 0;
    width: auto;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    gap: 7px;
  }
  .tabs-nav button span {
    flex: 0 0 auto;
    overflow: visible;
    white-space: nowrap;
  }
  .tabs-nav button.active {
    background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
    color: #fff;
    box-shadow: 0 4px 12px var(--c-primary-glow);
  }
  .tabs-nav button.active svg { color: #fff; }
  .tabs-nav button.active::before { display: none; }
}

/* ================= Стилизация Яндекс.Карты ================= */
#map, #map-modal-map {
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius);
}

[data-theme="dark"] #map,
[data-theme="dark"] #map-modal-map {
  filter: invert(0.92) hue-rotate(180deg) brightness(0.95) contrast(0.9);
}
[data-theme="dark"] #map * ,
[data-theme="dark"] #map-modal-map * {
  /* инвертируем назад балуны/контролы */
  color-scheme: dark;
}

/* ================= Секция «нет связи» ================= */
#no-connection {
  background:
    radial-gradient(ellipse at center, var(--c-primary-glow), transparent 70%),
    var(--c-bg-card);
  border: 1px dashed var(--c-border);
}

/* ================= Стилизация алертов ================= */
.alert {
  position: relative;
  overflow: hidden;
}
.alert::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: currentColor;
  opacity: .5;
}

/* ================= Баннеры бытового насоса ================= */
#domestic-banners .banner-box {
  position: relative;
  transition: transform .2s;
}
#domestic-banners .banner-box:hover {
  transform: translateY(-2px);
}
#domestic-banners .banner-value {
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ================= Плавное появление страниц ================= */
#content,
.container > .card:first-child {
  animation: pageFadeIn .35s ease;
}
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================= Скрыть скроллбар в навигации ================= */
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav { scrollbar-width: none; }

/* ================= Баннеры бытового насоса (5 штук в ряд) ================= */
#domestic-banners {
  padding: 20px 16px;
}
#domestic-banners > div {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 12px !important;
}
#domestic-banners .banner-box {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  transition: background .15s, transform .2s;
}
#domestic-banners .banner-box:hover {
  background: var(--c-bg-hover);
  transform: translateY(-2px);
}

/* На планшетах — 3 колонки */
@media (max-width: 900px) and (min-width: 641px) {
  #domestic-banners > div {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* На мобильных — 2 колонки */
@media (max-width: 640px) {
  #domestic-banners > div {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  #domestic-banners .banner-value { font-size: 1.125rem; }
  #domestic-banners .banner-label { font-size: 0.625rem; }
}

/* ================================================================
   Layout: sidebar слева + контент справа
   ================================================================ */

.page-layout {
  display: block;
  min-height: 100vh;
  padding-top: 64px;
}

/* Sidebar */
#sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  width: 240px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 20px 14px;
  background: var(--c-bg-card);
  border-right: 1px solid var(--c-border-soft);
  transition: background .25s, border-color .25s;
  z-index: 90;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--c-text-soft);
  font-size: 0.90625rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, color .15s, transform .08s;
  position: relative;
}
.sidebar-item svg {
  flex-shrink: 0;
  opacity: .8;
  transition: opacity .15s, color .15s;
}
.sidebar-item:hover {
  background: var(--c-bg-hover);
  color: var(--c-text);
}
.sidebar-item:hover svg { opacity: 1; }

.sidebar-item.active {
  background: linear-gradient(90deg, var(--c-primary-soft) 0%, transparent 100%);
  color: var(--c-primary-dark);
  font-weight: 700;
}
.sidebar-item.active svg {
  opacity: 1;
  color: var(--c-primary);
}
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--c-primary), var(--c-accent));
  box-shadow: 0 0 10px var(--c-primary-glow);
}

/* Основная область */
.page-main {
  margin-left: 240px;
  min-width: 0;
  background: transparent;
  position: relative;
  z-index: 1;
}

/* Убираем внутренний .container ограничение (grid уже сжимает) */
.page-main .container {
  padding: 28px 28px 48px;
}

/* ================================================================
   Гамбургер (виден только на мобильных)
   ================================================================ */

.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  padding: 6px;
  color: var(--c-text-soft);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
.menu-toggle:hover {
  background: var(--c-bg-hover);
  color: var(--c-text);
}

/* ================================================================
   Топбар: brand теперь ссылка
   ================================================================ */

.topbar .brand {
  text-decoration: none;
  color: var(--c-text);
}
.topbar .brand:hover { color: var(--c-primary); }

/* ================================================================
   Мобильный режим: выдвижной sidebar
   ================================================================ */

@media (max-width: 900px) {
  .page-layout {
    display: block;
  }

  #sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 260px;
    height: auto;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 200;
    box-shadow: var(--shadow-xl);
    padding: 20px 14px 80px;
  }

  body.sidebar-open #sidebar {
    transform: translateX(0);
  }

  /* Затемнение фона при открытом sidebar */
  body.sidebar-open::after {
    content: '';
    position: fixed;
    inset: 0;
    top: 56px;
    background: rgba(10, 25, 40, .45);
    z-index: 150;
    animation: fadeIn .2s ease;
    pointer-events: none;
  }

  .menu-toggle { display: inline-flex; align-items: center; }

  .page-main .container {
    padding: 18px 14px 32px;
  }
  .page-main { margin-left: 0; }

}

@media (min-width: 901px) {
  /* На десктопе sidebar всегда открыт */
  .menu-toggle { display: none; }
}

/* ================================================================
   Внутренние закладки насоса (в карточке /device)
   ================================================================ */

.device-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  background: var(--c-bg-card);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.device-tabs::-webkit-scrollbar { display: none; }

.device-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--c-text-soft);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color .15s, background .15s;
}
.device-tabs button svg { flex-shrink: 0; opacity: .75; transition: opacity .15s; }
.device-tabs button:hover {
  background: var(--c-bg-hover);
  color: var(--c-text);
}
.device-tabs button:hover svg { opacity: 1; }

.device-tabs button.active {
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  color: #fff;
  box-shadow: 0 4px 12px var(--c-primary-glow);
}
.device-tabs button.active svg { opacity: 1; color: #fff; }

/* На мобильных внутренние закладки — компактнее */
@media (max-width: 640px) {
  .device-tabs button {
    padding: 8px 12px;
    font-size: 0.78125rem;
  }
  .device-tabs button svg { width: 14px; height: 14px; }
}

/* ================================================================
   Мобильная адаптация — доработки
   ================================================================ */

/* ---------- Универсально: убираем возможные горизонтальные вылеты ---------- */
@media (max-width: 900px) {
  html, body {
    overflow-x: hidden;
  }
  .page-main {
    overflow-x: hidden;
  }
}

/* ---------- Топбар на мобильных ---------- */
@media (max-width: 640px) {
  .topbar {
    padding: 0 12px;
    gap: 8px;
    height: 56px;
  }
  .topbar .brand {
    font-size: 0.875rem;
    gap: 7px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar .user-box {
    gap: 6px;
  }
  .topbar .theme-toggle {
    padding: 6px 7px;
  }
  .topbar .btn-logout {
    padding: 5px 10px;
    font-size: 0.75rem;
  }
  .menu-toggle {
    padding: 4px;
  }

  /* Sidebar — при открытии пусть будет пошире и покомфортнее */
  #sidebar {
    width: 82vw;
    max-width: 300px;
    padding-top: 18px;
  }

  /* Тост — прижимаем по-другому, не перекрывает контент */
  .toast {
    top: auto;
    bottom: 16px;
    right: 12px;
    left: 12px;
    max-width: none;
    border-left: none;
    border-top: 4px solid transparent;
  }
  .toast.ok   { border-top-color: #064e3b; }
  .toast.err  { border-top-color: #7f1d1d; }
  .toast.info { border-top-color: var(--c-primary-dark); }

  .page-layout {
    padding-top: 56px;
  }
}

/* ---------- Главная: таблица + карта ---------- */
@media (max-width: 900px) {
  /* Когда карта уходит под таблицу, ограничиваем её высоту */
  #map {
    height: 340px !important;
    min-height: 0 !important;
  }
}

/* ---------- Device: баннеры бытового насоса ---------- */
@media (max-width: 640px) {
  #domestic-banners {
    padding: 14px 12px !important;
  }
  #domestic-banners > div {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  #domestic-banners .banner-box {
    padding: 8px 4px !important;
  }
  #domestic-banners .banner-value {
    font-size: 1.125rem !important;
  }
  #domestic-banners .banner-label {
    font-size: 0.625rem !important;
  }
  #domestic-banners .banner-unit {
    font-size: 0.65625rem !important;
  }
}

/* ---------- Device: заголовок устройства ---------- */
@media (max-width: 640px) {
  .device-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px !important;
  }
  .device-header .back {
    font-size: 0.8125rem;
  }
  .device-header h1 {
    font-size: 1.0625rem !important;
    line-height: 1.3;
    word-break: break-word;
  }
  .device-header .device-sub {
    font-size: 0.78125rem;
  }
  .device-icon {
    width: 40px !important;
    height: 40px !important;
  }
  .device-icon svg {
    width: 22px !important;
    height: 22px !important;
  }
  /* Часы и статус — переносим на новую строку */
  .device-header > div:last-child {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ---------- Device: график Chart.js ---------- */
@media (max-width: 640px) {
  #pane-monitoring .card-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  #pane-monitoring .card-header h2 {
    font-size: 0.9375rem;
  }
  #pane-monitoring .card-header > div {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px !important;
  }
  /* Сам график — 240px высотой, иначе занимает полэкрана */
  #pane-monitoring div[style*="height:320px"],
  #pane-monitoring > .card > div[style*="height"] {
    height: 240px !important;
  }
}

/* ---------- Device: переключатели (бытовой) ---------- */
@media (max-width: 640px) {
  .switch-row {
    flex-wrap: wrap;
  }
  .switch-btn {
    padding: 9px 14px;
    font-size: 0.8125rem;
    flex: 1 1 auto;
  }
}

/* ---------- Device: поля слайдеров + чисел ---------- */
@media (max-width: 640px) {
  #pane-settings input[type="range"] {
    min-width: 0 !important;
    flex: 1 1 100% !important;
    width: 100% !important;
  }
  #pane-settings input[type="number"] {
    width: 100px !important;
  }
  /* Селекты на всю ширину */
  #pane-settings .full-input {
    max-width: 100% !important;
    width: 100% !important;
  }
}

/* ---------- Device: журнал событий ---------- */
@media (max-width: 640px) {
  #events-container table {
    display: block;
    overflow-x: auto;
  }
  #events-container table thead,
  #events-container table tbody {
    display: table;
    width: 100%;
    min-width: 500px;
  }
}

/* ---------- Profile: таблицы ---------- */
@media (max-width: 640px) {
  #pane-user table,
  #pane-service table {
    display: block;
    overflow-x: auto;
  }
  #pane-user table thead,
  #pane-user table tbody,
  #pane-service table thead,
  #pane-service table tbody {
    display: table;
    width: 100%;
    min-width: 640px;
  }
}

/* ---------- Admin: формы создания ---------- */
@media (max-width: 640px) {
  .card .row {
    flex-direction: column;
    gap: 8px;
  }
  .card .row > * {
    width: 100% !important;
    flex: 1 1 100% !important;
    max-width: none !important;
  }
  /* Селект multiple — на всю ширину */
  #new-devices {
    min-height: 100px !important;
  }
}

/* ---------- Модалки на мобильных ---------- */
@media (max-width: 640px) {
  .modal-backdrop {
    padding: 10px;
    align-items: flex-start !important;
  }
  .modal {
    padding: 20px 18px !important;
    border-radius: 14px !important;
    max-height: 92vh;
    margin: 10px auto !important;
    width: 100%;
  }
  .modal h3 {
    font-size: 1rem !important;
  }
  /* Карта в модалке — не 400px, а 300px */
  #map-modal-map {
    height: 300px !important;
  }
}

/* ---------- Footer на мобильных ---------- */
@media (max-width: 640px) {
  .site-footer {
    padding: 16px 14px 20px !important;
    margin-top: 24px !important;
    font-size: 0.71875rem !important;
  }
  .site-footer-inner {
    flex-direction: column !important;
    gap: 4px !important;
  }
  .site-footer .dot {
    display: none !important;
  }
}

/* ================= Мобильные графики ================= */
@media (max-width: 640px) {
  /* Контейнер графика — фиксируем высоту */
  #pane-monitoring > .card > div[style*="height"] {
    height: 240px !important;
    min-height: 240px;
  }
  #pane-monitoring > .card > div[style*="height"] canvas {
    max-width: 100% !important;
    height: 100% !important;
  }
}

/* Модальная карта — на мобильном ниже */
@media (max-width: 640px) {
  #map-modal-map {
    height: 300px !important;
  }
}

/* ================= Контейнер графика ================= */
/* Адаптивная высота: 320px на десктопе, 240px на планшете, 220px на телефоне */

.chart-container {
  position: relative;
  height: 320px;
  width: 100%;
}

.chart-container canvas {
  display: block;
  max-width: 100%;
}

@media (max-width: 900px) {
  .chart-container {
    height: 280px;
  }
}

@media (max-width: 640px) {
  .chart-container {
    height: 240px;
  }
  /* Уменьшаем шрифты на осях, чтобы влезало больше данных */
  .chart-container canvas {
    font-size: 0.6875rem !important;
  }
}

/* На очень маленьких телефонах */
@media (max-width: 420px) {
  .chart-container {
    height: 220px;
  }
}

/* ================= Защита от «распирания» картой ================= */
/* Если карта на мгновение рендерит контент с большей шириной,
   чем её контейнер — grid не должен это подхватывать. */

.main-split {
  /* Явно фиксируем минимальные и максимальные размеры колонок */
  min-width: 0;
  max-width: 100%;
}

.main-split-left,
.main-split-right {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;   /* ← это главный фикс: скрываем всё, что вылезает */
}

/* Карта внутри — не может быть шире контейнера */
#map {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Дополнительно: если карта в fullscreen — игнорируем её размеры */
#map:fullscreen,
#map:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
}

/* ================= Водяные знаки с логотипом ================= */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.10;
  mix-blend-mode: multiply;

  background-image:
    url('/logo.svg'), url('/logo.svg'), url('/logo.svg'),
    url('/logo.svg'), url('/logo.svg'), url('/logo.svg'),
    url('/logo.svg'), url('/logo.svg'), url('/logo.svg'),
    url('/logo.svg'), url('/logo.svg'), url('/logo.svg');

  background-repeat: no-repeat;

  background-position:
     5%  10%, 25%  35%, 45%  15%,
    65%  40%, 85%  20%, 15%  65%,
    35%  85%, 55%  60%, 75%  80%,
    90%  65%, 10%  90%, 50%  40%;

  /* Увеличили размеры примерно в 1.5 раза */
  background-size:
    180px 135px, 210px 150px, 150px 120px,
    195px 142px, 165px 127px, 187px 138px,
    157px 117px, 202px 147px, 172px 132px,
    195px 142px, 150px 112px, 225px 165px;

  filter: blur(0.4px);
}

[data-theme="dark"] body::before {
  opacity: 0.16;
  mix-blend-mode: screen;
  /* Усиливаем яркость логотипа, чтобы светлые части выделялись на тёмном */
  filter: blur(0.4px) brightness(1.8) saturate(0.9);
}

@media (max-width: 700px) {
  body::before {
    opacity: 0.12;
    background-size:
      110px 82px, 130px 98px, 100px 75px,
      120px 90px, 105px 79px, 115px 86px,
      100px 75px, 125px 94px, 110px 82px,
      120px 90px, 100px 75px, 140px 105px;
  }
}

@media (max-width: 700px) {
  [data-theme="dark"] body::before {
    opacity: 0.16;
    filter: blur(0.4px) brightness(1.8) saturate(0.9);
  }
}

/* ================= Иллюстрация в sidebar'е (только пром. насос) ================= */

/* ================= Иллюстрация в sidebar'е (только пром. насос) ================= */

.sidebar-hero {
  margin-top: 16px;
  padding: 12px 8px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-top: 1px solid var(--c-border-soft);
}

/* Картинка вертикальная — сжимаем по ВЫСОТЕ, ширина подстраивается.
   Так силуэт остаётся пропорциональным и не «торчит» вниз.
   Основное ограничение — max-height (чтобы не вылезала за экран). */
.sidebar-hero img {
  display: block;
  max-height: 380px;       /* основное ограничение — по высоте */
  max-width: 100px;        /* страховка: если картинка вдруг станет широкой */
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0.85;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Тёмная тема — лёгкое голубое свечение, чтобы силуэт читался */
[data-theme="dark"] .sidebar-hero img {
  filter: drop-shadow(0 0 6px rgba(120, 200, 255, 0.35))
          brightness(1.05);
  opacity: 0.75;
}

/* На средних экранах по высоте — картинка меньше */
@media (max-height: 750px) {
  .sidebar-hero img {
    max-height: 130px;
  }
}

/* На низких экранах — ещё меньше */
@media (max-height: 620px) {
  .sidebar-hero img {
    max-height: 90px;
  }
}

/* На очень низких экранах — скрываем совсем, чтобы не мешать меню */
@media (max-height: 520px) {
  .sidebar-hero {
    display: none !important;
  }
}

/* На мобильных sidebar выдвижной — картинку скрываем полностью */
@media (max-width: 900px) {
  .sidebar-hero {
    display: none !important;
  }
}