/* Sidebar stays in place while the page scrolls.
   html/body had "overflow-x: hidden", which turns body into a scroll container and silently breaks
   "position: sticky" (the sidebar then scrolled away with the page and left an empty gap).
   "clip" hides horizontal overflow the same way without creating a scroll container. */
html, body { overflow-x: clip; overflow-y: visible; }
.app-main-content { min-width: 0; flex: 1 1 auto; align-self: stretch; }

/* Desktop only (wider than 1024 px). On phones and tablets style.css turns the sidebar into a slide-in
   drawer (position: fixed); a global "sticky" here would force it back into the page and squeeze the content. */
@media (min-width: 1025px) {
  .app-layout { align-items: flex-start; }
  .app-sidebar { position: sticky; top: 0; height: 100vh; max-height: 100vh; align-self: flex-start; overflow-y: auto; overscroll-behavior: contain; }
}

/* Breadcrumb: keep the items together (they were spread across the whole bar) */
.view-breadcrumb-bar { justify-content: flex-start; gap: 6px 8px; flex-wrap: wrap; }

/* mobile_polish.css — keeps every page inside the phone screen (loaded last on purpose) */

/* A grid column written as "1fr" grows to its widest content and pushes the card off screen.
   minmax(0, 1fr) lets it shrink to the screen. */
@media (max-width: 1100px) {
  .ov-middle-grid, .pd-body-grid, .ov-bottom-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .ov-middle-grid > *, .ov-bottom-grid > *, .pd-body-grid > *, .ov-kpi-grid > * { min-width: 0; }
  .ov-panel-card { max-width: 100%; box-sizing: border-box; }
}

@media (max-width: 768px) {
  /* Five KPI cards: two per row, the last one full width */
  .ov-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .ov-kpi-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .ov-kpi-value { font-size: 22px; }

  /* Top bar: icons only, nothing cut off the right edge */
  .app-topbar { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .topbar-left { min-width: 0; flex: 1 1 auto; }
  .topbar-search-box { min-width: 0; flex: 1 1 auto; }
  .topbar-search-box input { min-width: 0; width: 100%; }
  .topbar-right { gap: 6px; min-width: 0; flex: 0 0 auto; }
  #btn-topbar-add-target span, #btn-topbar-help span { display: none; }
  #btn-topbar-add-target, #btn-topbar-help { padding-left: 9px; padding-right: 9px; min-width: 38px; justify-content: center; }
  .topbar-user-wrap .user-badge { display: none; }
  .topbar-user-wrap { gap: 0; }

  /* Overview header: title, period tabs and help stack cleanly */
  .ov-header-row { flex-wrap: wrap; gap: 10px; }
  .ov-workspace { padding-left: 12px; padding-right: 12px; }
  .ov-alert-item { flex-wrap: wrap; gap: 8px; }
  .ov-link-btn { white-space: nowrap; }
  .ov-alert-left, .ov-alert-content { min-width: 0; flex: 1 1 100%; max-width: 100%; }
  .ov-alert-meta-line { flex-wrap: wrap; }
  .ov-alert-quote {
    white-space: normal; overflow-wrap: anywhere; overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  }
}

@media (max-width: 420px) {
  #btn-topbar-help { display: none; }  /* the bottom menu and the page itself already offer help */
}

@media (max-width: 768px) {
  .crumb-details { display: none; }
  .board-filter-pill-group { flex-wrap: wrap; row-gap: 6px; }
  .board-filter-pill { flex: 0 0 auto; }
}
