/**
 * Layout Pierini — cabeçalho mobile (fonte única)
 * Sincronizar em: assets/css/pierini-header-mobile.css de cada sistema + link após fluent.css (ou @import).
 * Pacote canônico: htdocs/LAYOUT PADRÃO PIERINI (atualizado 2026).
 */

/* Mobile: menu, logo e usuário/sair na mesma linha; título da página na linha de baixo */
@media (max-width: 1024px) {
  .app-header__bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "menu brand tools"
      "page page page";
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.35rem 0.45rem;
    row-gap: 0.35rem;
  }

  .app-header__start {
    display: contents;
  }

  .menu-toggle {
    grid-area: menu;
    align-self: center;
  }

  .app-header__brand {
    grid-area: brand;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
  }

  .app-header__brand .company-logo--header,
  .app-header__brand .company-logo-image,
  .app-header__brand img,
  .app-header__brand svg.company-logo-image--svg {
    max-width: 100%;
  }

  .app-header__page {
    grid-area: page;
    flex: none;
    width: 100%;
    padding-top: 0.35rem;
    margin-top: 0.05rem;
    border-top: 1px solid var(--border, var(--card-border));
  }

  .app-header__tools {
    grid-area: tools;
    flex: 0 0 auto !important;
    flex-wrap: nowrap;
    width: auto;
    max-width: min(52vw, 12.5rem);
    margin-left: 0;
    gap: 0.2rem;
    justify-content: flex-end;
    align-self: center;
  }

  .app-header__tools .btn-sugestao-header,
  .app-header__tools .btn-header-tool--sugestoes {
    display: none;
  }

  /* Tema: só ícone; select nativo cobre a área (clique confiável no toque) */
  .app-header__tools .theme-select-wrap {
    display: inline-flex;
    width: var(--header-tool-h, 2.35rem);
    min-width: var(--header-tool-h, 2.35rem);
    padding: 0;
    justify-content: center;
    overflow: hidden;
  }

  .app-header__tools .theme-select-wrap .theme-select {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    max-width: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    background-image: none;
  }

  .app-header__tools .theme-select-wrap__icon {
    margin: 0;
  }

  .app-header__user-block {
    max-width: 100%;
    height: 2.35rem;
  }

  .app-header__user-block .app-header__user {
    max-width: min(24vw, 4.5rem);
    font-size: 0.65rem;
    padding: 0 0.35rem;
  }

  .app-header__user-block .btn-header-perfil {
    display: none;
  }

  .btn-header-logout {
    min-width: 2.15rem;
    padding: 0 0.4rem;
  }

  .btn-header-logout__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

@media (max-width: 400px) {
  .app-header__user-block .app-header__user {
    display: none;
  }

  .app-header__tools {
    max-width: 2.75rem;
  }
}

.app-header__brand {
  min-width: 0;
}
