/**
 * Mobile (≤767px): busca com ícone ao lado do campo e altura tátil confortável.
 * Especificidade alta (html body …) para prevalecer sobre <style> inline das páginas.
 */

@media (max-width: 767px) {
  /* Toolbar: busca em largura total */
  html body .stock-page__toolbar,
  html body .org-page__toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  html body form.stock-page__search,
  html body form.org-page__search {
    max-width: none;
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    position: relative;
  }

  html body .users-page__search {
    max-width: none;
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    position: relative;
  }

  html body .org-detail__search {
    max-width: none;
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    position: relative;
  }

  /* Ícone fora do input, caixa própria */
  html body form.stock-page__search .stock-page__search-label,
  html body .stock-page__assets-row1 > .stock-page__search-label,
  html body form.org-page__search .org-page__search-label,
  html body .users-page__search-label,
  html body .org-detail__search-label {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    flex: 0 0 48px;
    width: 48px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    color: #94a3b8;
    font-size: 1rem;
    pointer-events: none;
    box-sizing: border-box;
  }

  html body form.stock-page__search .stock-page__search-input,
  html body form.org-page__search .org-page__search-input,
  html body .users-page__search-input,
  html body .org-detail__search-input {
    flex: 1;
    min-width: 0;
    width: auto;
    min-height: 48px;
    height: auto;
    padding: 0.65rem 1rem;
    font-size: 1rem;
    line-height: 1.35;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
  }

  /* Ativos em estoque: lupa | campo; botão “Novo ativo” em linha inteira */
  html body .stock-page__assets-row1 {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 0.5rem 0.65rem;
    align-items: stretch;
    width: 100%;
  }

  html body .stock-page__assets-row1 > .stock-page__search-label {
    grid-column: 1;
    grid-row: 1;
  }

  html body .stock-page__assets-row1 > .stock-page__search-input {
    grid-column: 2;
    grid-row: 1;
    min-height: 48px;
    height: auto;
    padding: 0.65rem 1rem;
    font-size: 1rem;
    line-height: 1.35;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
  }

  html body .stock-page__assets-row1 > .stock-page__btn {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }

  /* Listas de ativos / licenças: primeira linha = lupa + busca; selects ocupam largura total */
  html body .asset-page__filters-primary {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 0.5rem 0.65rem;
    align-items: stretch;
    width: 100%;
  }

  html body .asset-page__filters-primary > .asset-page__search-label {
    grid-column: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    width: 48px;
    margin: 0;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    color: #94a3b8;
    font-size: 1rem;
    box-sizing: border-box;
  }

  html body .asset-page__filters-primary > .asset-page__search-input {
    grid-column: 2;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    height: auto;
    padding: 0.65rem 1rem;
    font-size: 1rem;
    line-height: 1.35;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
  }

  html body .asset-page__filters-primary > .asset-page__filter-select {
    grid-column: 1 / -1;
  }

  html body .asset-page__filters-primary > .asset-page__filters-clear--inline {
    grid-column: 1 / -1;
    justify-self: end;
    margin-left: 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  html body .asset-page__filters-primary > button[type="submit"].asset-page__btn {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }
}
