/* 9.8.0 / v22 — readable desktop rows, centered filters + popup, iOS phone scroll */

/* —— Phone: body is the only scroller. html must NOT also scroll. —— */
@media (max-width: 1023px) {
  html {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  html body.bu-board-page:not(.bu-nalog-page) {
    display: block !important;
    flex-direction: unset !important;
    height: auto !important;
    max-height: none !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: scroll !important;
    position: static !important;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch !important;
    background: #f8fafc !important;
  }

  html body.bu-board-page:not(.bu-nalog-page) .bu-board-shell-wrap,
  html body.bu-board-page:not(.bu-nalog-page) .bu-board-main-col,
  html body.bu-board-page:not(.bu-nalog-page) .bu-board,
  html body.bu-board-page:not(.bu-nalog-page) .bu-term-grid,
  html body.bu-board-page:not(.bu-nalog-page) .bu-board-body,
  html body.bu-board-page:not(.bu-nalog-page) #bu-list-pane,
  html body.bu-board-page:not(.bu-nalog-page) .bu-board-list-scroll {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    flex: none !important;
    position: relative !important;
  }

  html body.bu-board-page:not(.bu-term-view-map) #bu-map-pane,
  html body.bu-board-page:not(.bu-term-view-map) #bu-map-pane .leaflet-container {
    display: none !important;
    pointer-events: none !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    touch-action: pan-y !important;
  }

  html body.bu-board-page #bu-feed {
    padding-bottom: 120px !important;
    overflow: visible !important;
  }

  html body.bu-board-page #bu-feed .bu-mload {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 14px 16px !important;
    background: #fff !important;
    color: #0f172a !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
  }

  html body.bu-board-page:not(.bu-mobile-detail-open):not(.bu-ai-open):not(.bu-filters-sheet-open) {
    overflow-y: scroll !important;
  }
}

@media (min-width: 1024px) {
  html body.bu-board-page #bu-feed .bu-item.compact,
  html body.bu-board-page #bu-feed .bu-item.bu-row.compact {
    display: block !important;
    grid-template-columns: none !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 0 6px !important;
    box-shadow: none !important;
  }

  html body.bu-board-page #bu-feed .bu-item.is-demo::before {
    content: none !important;
    display: none !important;
  }

  html body.bu-board-page #bu-feed .bu-mload {
    display: none !important;
  }

  html body.bu-board-page #bu-feed .bu-desk-row,
  html body.bu-board-page #bu-feed .bu-cols-head {
    display: grid !important;
    grid-template-columns: 32px minmax(118px, 1.35fr) minmax(58px, 0.5fr) minmax(118px, 1.35fr) minmax(58px, 0.5fr) minmax(72px, 0.7fr) minmax(44px, 0.38fr) minmax(52px, 0.42fr) minmax(58px, 0.5fr) !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  html body.bu-board-page #bu-feed .bu-desk-row {
    padding: 8px 10px !important;
    background: #fff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
  }

  html body.bu-board-page #bu-feed .bu-desk-row > .bu-c,
  html body.bu-board-page #bu-feed .bu-desk-row > .bu-c-from,
  html body.bu-board-page #bu-feed .bu-desk-row > .bu-c-to,
  html body.bu-board-page #bu-feed .bu-desk-row > .bu-c-ldate,
  html body.bu-board-page #bu-feed .bu-desk-row > .bu-c-udate,
  html body.bu-board-page #bu-feed .bu-desk-row > .bu-c-veh,
  html body.bu-board-page #bu-feed .bu-desk-row > .bu-c-w,
  html body.bu-board-page #bu-feed .bu-desk-row > .bu-c-ldm,
  html body.bu-board-page #bu-feed .bu-desk-row > .bu-c-price {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    min-width: 0 !important;
    max-width: 100% !important;
    color: #0f172a !important;
    font-size: 13px !important;
    font-weight: 650 !important;
    line-height: 1.25 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    transform: none !important;
    padding: 0 !important;
    border: 0 !important;
  }

  html body.bu-board-page #bu-feed .bu-desk-row > .bu-c::before {
    content: none !important;
    display: none !important;
  }

  html body.bu-board-page #bu-feed .bu-desk-row .bu-city {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    min-width: 0 !important;
    max-width: 100% !important;
    writing-mode: horizontal-tb !important;
  }

  html body.bu-board-page #bu-feed .bu-desk-row .bu-city b {
    display: block !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
  }

  html body.bu-board-page #bu-feed .bu-desk-row .bu-city small {
    display: block !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #64748b !important;
  }

  html body.bu-board-page #bu-feed .bu-desk-row > .bu-c-from .bu-city b {
    color: #15803d !important;
  }

  html body.bu-board-page #bu-feed .bu-desk-row > .bu-c-to .bu-city b {
    color: #b91c1c !important;
  }

  html body.bu-board-page #bu-feed .bu-desk-row .bu-demo-ribbon {
    display: inline-flex !important;
    margin-right: 6px !important;
    padding: 1px 6px !important;
    background: #fef3c7 !important;
    color: #b45309 !important;
    font-size: 9px !important;
    font-weight: 800 !important;
    letter-spacing: 0.02em !important;
    border-radius: 4px !important;
    flex-shrink: 0 !important;
  }

  html body.bu-board-page #bu-feed .bu-cols-head {
    display: grid !important;
    padding: 4px 10px !important;
    background: transparent !important;
    border: 0 !important;
    color: #64748b !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
  }

  /* Centered filter modal — 2 lane cards, metrics row, actions */
  html body.bu-board-page #bu-filter-fold.open {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    grid-template-areas: none !important;
    position: fixed !important;
    top: 72px !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: min(920px, calc(100vw - 48px)) !important;
    max-width: 920px !important;
    max-height: calc(100dvh - 96px) !important;
    overflow: auto !important;
    gap: 14px !important;
    padding: 18px 20px 16px !important;
    background: #fff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 20px !important;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22) !important;
    z-index: 9000 !important;
  }

  html body.bu-board-page #bu-filter-fold.open .bu-filter-sheet-head {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 2px 4px !important;
    border: 0 !important;
  }

  html body.bu-board-page #bu-filter-fold.open .bu-filter-sheet-head strong {
    font-size: 18px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
  }

  html body.bu-board-page #bu-filter-fold.open .bu-lanes {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-areas: none !important;
    gap: 14px !important;
  }

  html body.bu-board-page #bu-filter-fold.open .bu-lane {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    padding: 14px 16px !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
    min-width: 0 !important;
  }

  html body.bu-board-page #bu-filter-fold.open .bu-lane-load {
    border-left: 3px solid #22c55e !important;
  }

  html body.bu-board-page #bu-filter-fold.open .bu-lane-unload {
    border-left: 3px solid #ef4444 !important;
  }

  html body.bu-board-page #bu-filter-fold.open .bu-metrics-row {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
  }

  html body.bu-board-page #bu-filter-fold.open .bu-metrics-row > * {
    background: #fff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 14px !important;
    padding: 10px 12px !important;
    min-width: 0 !important;
  }

  html body.bu-board-page #bu-filter-fold.open .bu-search-row {
    display: flex !important;
    justify-content: stretch !important;
    gap: 12px !important;
    margin: 4px 0 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
  }

  html body.bu-board-page #bu-filter-fold.open .bu-search-row #f-reset {
    order: 1 !important;
    flex: 1 1 0 !important;
    height: 44px !important;
    border-radius: 12px !important;
    background: #fff !important;
    color: #0f172a !important;
    border: 1px solid #e2e8f0 !important;
  }

  html body.bu-board-page #bu-filter-fold.open .bu-search-row #f-go {
    order: 2 !important;
    flex: 1 1 0 !important;
    height: 44px !important;
    border-radius: 12px !important;
    background: #0066ff !important;
    color: #fff !important;
    border: 0 !important;
  }

  html body.bu-detail-open {
    overflow: hidden !important;
  }

  html body #bu-detail:not([hidden]),
  html body.bu-detail-open #bu-detail.bu-detail-modal {
    position: fixed !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 28px 32px !important;
    pointer-events: auto !important;
    background: transparent !important;
    z-index: 9000 !important;
  }

  html body #bu-detail[hidden] {
    display: none !important;
  }

  html body #bu-detail-backdrop:not([hidden]) {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 8990 !important;
    background: rgba(15, 23, 42, 0.55) !important;
    backdrop-filter: blur(8px) !important;
  }

  html body .bu-detail-stage {
    display: block !important;
    width: min(1040px, calc(100vw - 64px)) !important;
    max-height: 86vh !important;
    margin: 0 auto !important;
    pointer-events: auto !important;
  }

  html body .bu-detail-modal-sheet {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-height: 86vh !important;
    overflow: hidden !important;
    background: #fff !important;
    color: #0f172a !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 20px !important;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28) !important;
  }

  html body .bu-detail-modal-head {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 12px !important;
    padding: 16px 22px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    background: #fff !important;
  }

  html body .bu-detail-modal-headtxt h2,
  html body #bu-detail-title {
    margin: 0 !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
  }

  html body .bu-detail-modal-body {
    display: grid !important;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 340px) !important;
    gap: 20px !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 20px 22px 24px !important;
    background: #fff !important;
  }

  html body .bu-detail-modal-main {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    min-width: 0 !important;
  }

  html body .bu-detail-modal-mapwrap {
    display: none !important;
  }

  html body #bu-detail #bu-v13-fuel {
    display: none !important;
  }

  html body .bu-dpro-route-pair {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) !important;
    gap: 10px !important;
    align-items: stretch !important;
  }

  html body .bu-dpro-route-leg {
    background: #fff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
    padding: 14px 16px !important;
    box-shadow: none !important;
  }

  html body .bu-dpro-route-leg h3 {
    margin: 0 0 8px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    color: #64748b !important;
  }

  html body .bu-dpro-addr {
    margin: 0 !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
  }

  html body .bu-dpro-cc {
    color: #64748b !important;
    font-weight: 800 !important;
  }

  html body .bu-gmaps {
    display: inline-flex !important;
    margin-top: 10px !important;
    padding: 8px 12px !important;
    border: 1px solid #99f6e4 !important;
    border-radius: 10px !important;
    background: #f0fdfa !important;
    color: #0f766e !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
  }

  html body .bu-dpro-route-arrow {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #94a3b8 !important;
    font-size: 16px !important;
  }

  html body .bu-dpro-specs {
    background: #fff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
    padding: 14px 16px 8px !important;
  }

  html body .bu-dpro-specs h3 {
    margin: 0 0 8px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    color: #64748b !important;
  }

  html body .bu-dpro-dl-2 {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    column-gap: 28px !important;
    row-gap: 0 !important;
    margin: 0 !important;
  }

  html body .bu-dpro-dl-2 .bu-dpro-row {
    display: grid !important;
    grid-template-columns: minmax(88px, 38%) minmax(0, 1fr) !important;
    gap: 8px !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 9px 0 !important;
    border-bottom: 1px solid #eef2f7 !important;
  }

  html body .bu-dpro-dl-2 .bu-dpro-row dt {
    margin: 0 !important;
    color: #64748b !important;
    font-size: 12px !important;
    font-weight: 700 !important;
  }

  html body .bu-dpro-dl-2 .bu-dpro-row dd {
    margin: 0 !important;
    color: #0f172a !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    text-align: right !important;
  }

  html body .bu-detail-fuel-aside {
    position: sticky !important;
    top: 0 !important;
    align-self: start !important;
    width: auto !important;
    flex: none !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
    box-shadow: none !important;
    padding: 16px !important;
  }
}
