/* Reflow the header controls without squeezing the page title on narrow screens. */
@media (max-width: 720px) {
  body[data-view="visao-geral"] .topbar,
  body[data-view="equipe"] .topbar,
  body[data-view="leads"] .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    width: 100%;
    height: auto;
    min-width: 0;
  }

  body[data-view="visao-geral"] .topbar > :first-child,
  body[data-view="equipe"] .topbar > :first-child,
  body[data-view="leads"] .topbar > :first-child {
    min-width: 0;
    width: 100%;
  }

  body[data-view="visao-geral"] .topbar > .controls,
  body[data-view="equipe"] .topbar > .top-actions,
  body[data-view="leads"] .topbar > .controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    min-width: 0;
  }

  body[data-view="visao-geral"] .topbar :is(.controls > button, .controls > .control),
  body[data-view="equipe"] .topbar .top-actions > .ctrl,
  body[data-view="leads"] .topbar .controls > .control {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    height: auto;
    min-height: 40px;
    margin-left: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body[data-view="visao-geral"] .topbar .controls > :first-child,
  body[data-view="equipe"] .topbar .top-actions > :first-child,
  body[data-view="leads"] .topbar .controls > :first-child {
    grid-column: 1 / -1;
  }

  /* Explanation popovers belong to their cards, not outside the viewport. */
  body[data-view="rotacao"] .rotation-explainer > small {
    width: min(340px, 100%);
    max-width: 100%;
  }
}
