/* HF Pacientes v278 — quatro ações no topo e alinhamento final da antropometria. */

/* A ação de adicionar foi movida do rodapé para a barra principal. */
body:has(main.admin) .diet-primary-actions-hf {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

body:has(main.admin) .diet-primary-actions-hf:not(:has(.hf-diet-pdf-button)) {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

body:has(main.admin) .diet-primary-actions-hf > .diet-main-add {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  min-height: 34px !important;
  height: 34px !important;
  margin: 0 !important;
  padding: 5px 7px !important;
  border: 1px solid #0a0a0c !important;
  border-radius: 9px !important;
  background: #0a0a0c !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  box-shadow: none !important;
  font-size: 10px !important;
  white-space: nowrap !important;
}

html[data-theme="dark"] body:has(main.admin) .diet-primary-actions-hf > .diet-main-add {
  border-color: #5c6169 !important;
  background: #050607 !important;
}

body:has(main.admin) .diet-primary-actions-hf > .diet-main-add:hover {
  border-color: #303237 !important;
  background: #24262a !important;
}

/* Protocolo e Minimizar sempre compartilham a linha, com respiro entre ambos. */
body:has(main.admin) .anthro-head-actions {
  display: grid !important;
  column-gap: 16px !important;
}

body:has(main.admin) .anthro-head-actions > .anthro-protocol-picker {
  grid-column: 1 !important;
  grid-row: 1 !important;
  min-width: 0 !important;
}

body:has(main.admin) .anthro-head-actions > .anthro-section-toggle {
  grid-column: 2 !important;
  grid-row: 1 !important;
  justify-self: end !important;
  margin: 0 !important;
}

/* Retrato aprovado: muda apenas a barra, agora com as quatro ações. */
@media (orientation: portrait) {
  body:has(main.admin) .diet-primary-actions-hf {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  body:has(main.admin) .diet-primary-actions-hf:not(:has(.hf-diet-pdf-button)) {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body:has(main.admin) .diet-primary-actions-hf > .diet-main-action {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 34px !important;
    height: 34px !important;
    margin: 0 !important;
    padding: 5px 6px !important;
    font-size: 10px !important;
  }
}

/* Paisagem: quatro botões iguais, compactos e agrupados à direita. */
@media (orientation: landscape) and (min-width: 761px) {
  body:has(main.admin) .diet-builder:has(> .diet-builder-meal) > .diet-primary-actions-hf {
    right: 10px !important;
    grid-template-columns: repeat(4, minmax(118px, 140px)) !important;
    justify-content: end !important;
    gap: 7px !important;
    width: 68% !important;
  }

  body:has(main.admin) .diet-builder:has(> .diet-builder-meal) > .diet-primary-actions-hf:not(:has(.hf-diet-pdf-button)) {
    grid-template-columns: repeat(3, minmax(118px, 140px)) !important;
  }

  body:has(main.admin) .diet-primary-actions-hf > .diet-main-action {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 36px !important;
    height: 36px !important;
    margin: 0 !important;
    padding: 5px 7px !important;
    font-size: 10px !important;
  }
}

/* Em telas realmente estreitas, evita esmagar os textos. */
@media (orientation: portrait) and (max-width: 620px) {
  body:has(main.admin) .diet-primary-actions-hf,
  body:has(main.admin) .diet-primary-actions-hf:not(:has(.hf-diet-pdf-button)) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
