/* Berza Utovara 8.0.2 — empty-state wrap, overlay stack, slim chrome */

html body.bu-board-page,
html body.bu-board-page * {
  box-sizing: border-box;
}

/* 1. Empty / loading feed items must NOT inherit 9-col desktop grid */
@media (max-width: 899px) {
  html body.bu-board-page .bu-feed,
  html body.bu-board-page.bu-board-cargo .bu-feed,
  html body.bu-board-page.bu-board-truck .bu-feed,
  html body.bu-board-page .bu-board-list {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-template-columns: none !important;
  }

  html body.bu-board-page.bu-board-cargo .bu-feed .bu-item:not(.compact),
  html body.bu-board-page .bu-board-cargo .bu-feed .bu-item:not(.compact),
  html body.bu-board-page.bu-board-truck .bu-feed .bu-item:not(.compact),
  html body.bu-board-page .bu-board-truck .bu-feed .bu-item:not(.compact),
  html body.bu-board-page .bu-feed .bu-item:not(.compact),
  html body.bu-board-page .bu-feed .bu-item.bu-launch-empty-feed,
  html body.bu-board-page.bu-board-cargo .bu-feed .bu-item.bu-launch-empty-feed,
  html body.bu-board-page.bu-board-truck .bu-feed .bu-item.bu-launch-empty-feed,
  html body.bu-lista-chrome .bu-item.bu-launch-empty-feed {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-template-columns: none !important;
    grid-template-areas: none !important;
    grid-auto-flow: row !important;
    gap: 10px !important;
    padding: 16px 14px !important;
    margin: 8px 10px !important;
    overflow: visible !important;
    white-space: normal !important;
  }

  html body.bu-board-page .bu-feed .bu-item:not(.compact) > *,
  html body.bu-board-page .bu-feed .bu-item.bu-launch-empty-feed > *,
  html body.bu-board-page .bu-feed .bu-item.bu-launch-empty-feed p,
  html body.bu-board-page .bu-feed .bu-item:not(.compact) p,
  html body.bu-board-page .bu-empty-state,
  html body.bu-board-page .bu-empty-state p,
  html body.bu-nalog-page .bu-empty-state,
  html body.bu-nalog-page .bu-empty-state p {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 0 1 auto !important;
    grid-column: 1 / -1 !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
    word-wrap: break-word !important;
    writing-mode: horizontal-tb !important;
  }

  html body.bu-board-page .bu-launch-empty,
  html body.bu-board-page .bu-launch-empty strong,
  html body.bu-board-page .bu-launch-empty p {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
  }

  html body.bu-board-page .bu-empty-cta-row {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    min-width: 0 !important;
    justify-content: center;
    gap: 8px;
  }

  html body.bu-board-page #bu-dispo .bu-bubble,
  html body.bu-board-page #bu-dispo .bu-dispo-log,
  html body.bu-board-page #bu-dispo p {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
    white-space: normal !important;
  }

  /* Compact cards still horizontal, but never 1-ch cells */
  html body.bu-board-page .bu-feed .bu-item.compact,
  html body.bu-board-page .bu-feed .bu-item.bu-row.compact {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  html body.bu-board-page .bu-feed .bu-item.compact .bu-mcard-route,
  html body.bu-board-page .bu-feed .bu-item.compact .bu-mcard-meta,
  html body.bu-board-page .bu-feed .bu-item.compact .bu-mcard-route b {
    min-width: 0 !important;
    overflow-wrap: anywhere;
  }

  /* 2. Overlay stack — filter never over AI / modal / inbox */
  html body .bu-mfilter-strip,
  html body.bu-board-page .bu-mfilter-strip,
  html body.bu-board-page .bu-twin-bars {
    position: relative;
    z-index: 20 !important;
  }
  html body .bu-mshell,
  html body .bu-mshell-bar,
  html body.bu-board-page .bu-mshell-bar {
    z-index: 30 !important;
    min-height: 48px !important;
    max-height: 56px !important;
  }
  html body .bu-app-banner,
  html body .bu-app-banner.is-on {
    z-index: 25 !important;
    position: relative !important;
    min-height: 36px !important;
    max-height: 36px !important;
    padding: 4px 8px !important;
    gap: 6px !important;
  }
  html body .bu-app-banner-copy span { display: none !important; }
  html body .bu-app-banner-pair img:last-child { display: none !important; }
  html body .bu-app-banner-ico { width: 20px !important; height: 20px !important; }
  html body .bu-app-banner-copy strong { font-size: 12px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html body .bu-app-banner-cta { min-height: 28px !important; padding: 0 10px !important; font-size: 11px !important; }
  html body.bu-banner-away .bu-app-banner { display: none !important; }

  html body.bu-board-page #bu-filter-fold,
  html body.bu-board-page .bu-filter-fold {
    z-index: 11000 !important;
  }
  html body .bu-filter-scrim { z-index: 10900 !important; }
  html body .bu-fresh,
  html body .bu-fresh-toast {
    z-index: 500 !important;
  }

  html body.bu-ai-open .bu-mfilter-strip,
  html body.bu-ai-open .bu-twin-bars,
  html body.bu-ai-open .bu-app-banner,
  html body.bu-ai-open .bu-fresh,
  html body.bu-ai-open .bu-fresh-toast,
  html body.bu-chat-sheet-open .bu-mfilter-strip,
  html body.bu-notes-open .bu-mfilter-strip,
  html body.bu-detail-open .bu-mfilter-strip,
  html body.bu-mobile-detail-open .bu-mfilter-strip,
  html body.bu-post-open .bu-mfilter-strip {
    display: none !important;
  }

  html body.bu-board-page #bu-dispo,
  html body #bu-dispo,
  html body.bu-ai-open #bu-dispo {
    z-index: 26000 !important;
  }
  html body .bu-ai-scrim,
  html body #bu-ai-scrim {
    z-index: 25900 !important;
    background: rgba(8, 20, 28, 0.62) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  html body #bu-detail,
  html body .bu-detail-modal,
  html body #bu-mobile-detail-sheet {
    z-index: 27000 !important;
  }
  html body #bu-detail-backdrop,
  html body .bu-detail-modal-backdrop,
  html body #bu-mobile-detail-backdrop {
    z-index: 26900 !important;
    background: rgba(8, 20, 28, 0.6) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  /* 4. Inbox / Sistem sheet */
  html body.bu-notes-open::before {
    z-index: 24800 !important;
    background: rgba(8, 20, 28, 0.6) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
  }
  html body .bu-notes,
  html body.bu-board-page .bu-notes,
  html body.bu-nalog-page .bu-notes,
  html body.bu-notes-open #bu-notes:not([hidden]) {
    z-index: 25000 !important;
    inset: auto 0 0 !important;
    top: auto !important;
    width: 100% !important;
    max-height: min(85dvh, 720px) !important;
    border-radius: 22px 22px 0 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  html body #bu-chat-sheet.bu-chat-drawer-wrap,
  html body.bu-chat-sheet-open #bu-chat-sheet,
  html body.bu-nalog-chat-docked #bu-chat-sheet,
  html body.bu-nalog-chat-docked #bu-chat-sheet.bu-chat-drawer-wrap {
    z-index: 25000 !important;
    align-items: flex-end !important;
    justify-content: center !important;
    background: transparent !important;
  }
  html body .bu-chat-drawer-backdrop {
    background: rgba(8, 20, 28, 0.6) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  html body #bu-chat-sheet .bu-chat-drawer,
  html body.bu-chat-sheet-open .bu-chat-drawer,
  html body.bu-nalog-chat-docked .bu-chat-drawer {
    width: 100% !important;
    max-width: none !important;
    height: min(85dvh, 720px) !important;
    max-height: min(85dvh, 720px) !important;
    border-radius: 22px 22px 0 0 !important;
    margin: 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  html body #bu-post,
  html body #bu-post.bu-chat.is-open {
    z-index: 25500 !important;
  }
  html body #bu-post .bu-post-panel {
    width: 100% !important;
    max-width: none !important;
    margin-top: auto;
    border-radius: 22px 22px 0 0 !important;
    max-height: min(85dvh, 720px) !important;
  }

  /* 3. Chrome height — DEMO u dock, ne full strip */
  html body .bu-mobchrome-status {
    display: none !important;
  }
  html body .bu-mobdock {
    position: relative;
  }
  html body .bu-dock-demo {
    display: inline-flex !important;
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f59e0b;
    color: #1f1300;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.08em;
    line-height: 1.2;
    pointer-events: none;
  }
  html body.bu-board-page,
  html body.bu-nalog-page,
  html body.bu-lista-chrome {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
  }
}
