/* CRM Uchebka — production-bundle-compatible window-width navigation patch.
 * Designed against the exact index-by-vehicle-log-assigned-20261112.js build.
 * Only installed after a pinned QA browser gate; no backend or API edits.
 */
@media (min-width: 768px) and (max-width: 1279.98px) {
  [data-admin-shell] > header {
    box-sizing: border-box;
    display: grid !important;
    grid-template-columns: minmax(0,1fr) auto !important;
    grid-template-rows: 52px minmax(36px,auto) !important;
    align-items: center !important;
    height: auto !important;
    min-height: 88px !important;
    max-height: none !important;
    width: 100%;
    padding-inline: clamp(8px,1.5vw,18px) !important;
    gap: 0 8px !important;
  }
  [data-admin-shell] > header > div:first-child {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    width: auto !important;
    max-width: min(242px, 36vw) !important;
    overflow: hidden;
    display: flex !important;
    flex-shrink: 1 !important;
  }
  [data-admin-shell] > header button[aria-label="Открыть меню"] {
    display: inline-flex !important;
    flex-shrink: 0 !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
  }
  [data-admin-shell] > header > nav {
    display: none !important;
  }
  [data-admin-shell] > header > div:nth-child(3) {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex !important;
    min-width: 0 !important;
    width: 100%;
    max-height: 48px;
    padding: 2px 5px 4px !important;
    overflow-x: auto !important;
    scrollbar-width: thin;
    scrollbar-color: var(--ui-muted, #94a3b8) transparent;
    scroll-behavior: smooth;
    border-top: 1px solid var(--ui-border, #334155);
    overscroll-behavior-x: contain;
  }
  [data-admin-shell] > header > div:nth-child(3):focus-visible {
    outline: 2px solid var(--ui-accent, #63c833);
    outline-offset: -2px;
  }
  [data-admin-shell] > header > div:last-child {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    flex-shrink: 0;
    gap: clamp(3px,0.7vw,10px) !important;
    justify-content: flex-end;
  }
  [data-admin-shell] > div > aside.ui-panel {
    position: fixed !important;
    left: 0 !important;
    top: 92px !important;
    bottom: calc(64px + env(safe-area-inset-bottom,0px)) !important;
    height: auto !important;
    max-height: calc(100dvh - 156px - env(safe-area-inset-bottom,0px)) !important;
    width: min(288px,85vw) !important;
    translate: none !important;
    transform: translateX(-105%) !important;
    z-index: 50;
  }
  [data-admin-shell] > div > aside.ui-panel.translate-x-0 {
    transform: translateX(0) !important;
  }
  [data-admin-shell] > div > .fixed.inset-0 {
    display: block !important;
  }
  [data-admin-shell] > nav.ui-mobile-nav {
    display: block !important;
    padding-bottom: env(safe-area-inset-bottom,0px);
    z-index: 40;
  }
  [data-admin-shell] > div.flex.flex-1 {
    padding-bottom: calc(64px + env(safe-area-inset-bottom,0px));
  }
  html:has([data-admin-shell] > div > aside.ui-panel) {
    --app-shell-left: 0px !important;
  }
  html:has([data-admin-shell]) {
    --app-shell-top: 92px !important;
  }
}
@media (max-width:767.98px) {
  /* Preserve the approved iOS single-row header hotfix (60px).
     Only safeguard the actual header height used by scoped modals. */
  html:has([data-admin-shell]) {
    --app-shell-top: 60px !important;
    --app-shell-left: 0px !important;
  }
}
@media (max-width: 1279.98px) {
  [data-admin-shell] > nav.ui-mobile-nav .ui-nav-item {
    min-width: 0;
  }
  [data-admin-shell] > nav.ui-mobile-nav :is(a,button) > span:last-child {
    overflow: hidden;
    max-width: 100%;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}
