/* ============================================================
   Responsive layer — изолированный mobile/tablet адаптационный слой
   Подключается ПОСЛЕ theme.css в _base.html. Содержит ТОЛЬКО
   media-queries — никаких десктоп-правил. См. spec
   docs/superpowers/specs/2026-05-22-adaptive-layout-design.md
   ============================================================ */

/* === Body lock при открытом sidebar mobile === */
body.body-no-scroll {
  overflow: hidden;
}

/* ============================================================
   TABLET: 640-1023px
   ============================================================ */
@media (max-width: 1023px) {
  /* Sidebar collapsed по умолчанию на планшете */
  .app:not(.sidebar-collapsed) .sidebar {
    /* На планшете коллапсим, если юзер явно не разворачивал */
  }
}

/* ============================================================
   MOBILE: <640px
   ============================================================ */
@media (max-width: 639px) {
  /* Off-canvas sidebar */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 4px 0 16px rgba(15,23,42,.12);
  }
  .app.sidebar-mobile-open .sidebar {
    transform: translateX(0);
  }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.4);
    z-index: 999;
    display: none;
  }
  .app.sidebar-mobile-open .sidebar-overlay {
    display: block;
  }

  /* Главный контент на всю ширину */
  .app {
    grid-template-columns: 1fr !important;
  }
  .content {
    width: 100%;
    min-width: 0;
  }

  /* Бургер виден только на mobile */
  .burger-toggle { display: inline-flex; }

  /* MVP-banner скрыт на mobile */
  .mvp-banner { display: none !important; }

  /* Topbar: компактный sync chip */
  .topbar-sync-chip .sync-prefix { display: none; }
  .topbar-store-switcher .tss-label { display: none; }
  .topbar-store-switcher .tss-trigger { padding: 0 8px; }

  /* Account chip → инициал-кружок */
  .account-chip { gap: 4px; }
  .account-chip .user-chip > div { display: none; }
  .account-chip .account-logout { display: none; }
  .account-chip .account-menu-btn { display: inline-flex; }

  /* SKU table → cards */
  .sku-table { display: none !important; }
  .sku-card-list { display: block; }

  /* Drawer как bottom-sheet */
  .ai-planner-drawer,
  [data-drawer="bottom-sheet"] {
    top: auto !important;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    border-left: none;
    border-top: 1px solid var(--line, #e2e8f0);
    box-shadow: 0 -8px 24px rgba(15,23,42,.10);
    transform: translateY(100%);
  }
  .ai-planner-drawer.open,
  [data-drawer="bottom-sheet"].open {
    transform: translateY(0);
  }
  .drawer-handle {
    display: block;
    width: 36px; height: 4px;
    background: rgba(0,0,0,.20);
    border-radius: 999px;
    margin: 8px auto 4px;
  }

  /* Stock-popover как width-bottom-sheet */
  .stock-popover {
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-width: none !important;
    max-height: 50vh;
  }

  /* /products фильтры НЕ sticky (только сам topbar) */
  .products-toolbar { position: static !important; }
  .products-filters { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }

  /* /planner KPI 1 в строку */
  .planner-kpis { grid-template-columns: 1fr !important; }
  .planner-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* /inventory табы скролл */
  .inv-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
}

/* Скрываем burger на desktop */
.burger-toggle { display: none; }
.account-menu-btn { display: none; }
.drawer-handle { display: none; }
.sku-card-list { display: none; }
