/* MarFlores Anotar Pedidos R2 — somente modo tradicional HML.
   A BASE Nativa embutida NÃO recebe estas regras. */
#compras-order-notes-panel:not([data-native-embedded]) .mf-on-section-badge{
  display:inline-flex;flex:0 0 auto;align-items:center;justify-content:center;
  max-width:44%;min-height:23px;padding:3px 9px;border-radius:999px;
  border:1px solid #d0d5dd;background:#f2f4f7;color:#344054;
  font:700 10px/15px var(--mf-ta-font,Outfit,sans-serif);
  white-space:nowrap;letter-spacing:.015em;
}
#compras-order-notes-panel:not([data-native-embedded]) .mf-on-section-badge.is-veiling{
  color:#9a3412;border-color:#fdba74;background:#ffedd5;
}
/* Sessões adicionais: cores distintas, sem herdar o laranja VEILING. */
#compras-order-notes-panel:not([data-native-embedded]) .mf-on-section-badge.is-session-0{
  color:#166534;border-color:#86efac;background:#dcfce7;
}
#compras-order-notes-panel:not([data-native-embedded]) .mf-on-section-badge.is-session-1{
  color:#1e40af;border-color:#93c5fd;background:#dbeafe;
}
#compras-order-notes-panel:not([data-native-embedded]) .mf-on-section-badge.is-session-2{
  color:#6b21a8;border-color:#d8b4fe;background:#f3e8ff;
}
#compras-order-notes-panel:not([data-native-embedded]) .mf-on-section-badge.is-session-3{
  color:#0f766e;border-color:#5eead4;background:#ccfbf1;
}
#compras-order-notes-panel:not([data-native-embedded]) .mf-on-section-badge.is-session-4{
  color:#9d174d;border-color:#f9a8d4;background:#fce7f3;
}
#compras-order-notes-panel:not([data-native-embedded]) .mf-on-section-badge.is-session-5{
  color:#334155;border-color:#94a3b8;background:#e2e8f0;
}
#compras-order-notes-panel:not([data-native-embedded]) .mf-on-result-top>strong{
  min-width:0;overflow-wrap:anywhere;
}
#compras-order-notes-panel:not([data-native-embedded]) .mf-on-admin-manage{
  display:inline-flex;align-items:center;justify-content:center;
  min-height:32px;padding:5px 11px;border:1px solid #d0d5dd;border-radius:8px;
  background:#fff;color:#344054;font:600 11px/16px var(--mf-ta-font,Outfit,sans-serif);
  cursor:pointer;white-space:nowrap;
}
#compras-order-notes-panel:not([data-native-embedded]) .mf-on-admin-manage[hidden]{display:none!important}
#compras-order-notes-panel:not([data-native-embedded]) .mf-on-admin-manage:hover{
  border-color:#d884a5;background:#fff1f5;color:#9f164a;
}
/* Só para admin autenticado que recebeu acesso ao endpoint HML de piloto:
   ciclo/planilha não ocupa uma linha permanente. "Gerenciar" mostra o card
   como painel flutuante sem trocar a estrutura nem a identidade da BASE. */
#compras-order-notes-panel:not([data-native-embedded])[data-legacy-can-manage-cycle="true"]{
  position:relative;
}
#compras-order-notes-panel:not([data-native-embedded])[data-legacy-can-manage-cycle="true"] .mf-on-layout{
  grid-template-rows:0 auto minmax(0,1fr) auto auto;
}
#compras-order-notes-panel:not([data-native-embedded])[data-legacy-can-manage-cycle="true"] .mf-on-cycle-card{
  position:absolute;top:46px;right:18px;left:auto;z-index:105;
  width:min(670px,calc(100% - 36px));max-width:calc(100% - 36px);
  box-shadow:0 16px 38px rgba(16,24,40,.16);
}
#compras-order-notes-panel:not([data-native-embedded])[data-legacy-cycle-config-collapsed="true"] .mf-on-cycle-card{
  display:none!important;
}
/* A rolagem externa é evitada ao deixar a grade ocupar somente o espaço real
   do workspace. Pedido atual mantém área interna independente, com ações fixas.
   Não modificar o comportamento do iframe da BASE ou de outras telas. */
@media(min-width:1051px){
  #view-compras-veiling .compras-workspace:has(> #compras-order-notes-panel:not([hidden]):not([data-native-embedded])){
    overflow:hidden!important;min-height:0!important;
  }
  #view-compras-veiling #compras-order-notes-panel:not([data-native-embedded]):not([hidden]){
    display:flex;flex:1 1 auto;min-height:0;max-height:100%;flex-direction:column;
    overflow:hidden;
  }
  #compras-order-notes-panel:not([data-native-embedded])>.mf-on-head{flex:0 0 auto}
  #compras-order-notes-panel:not([data-native-embedded])>.mf-on-layout{
    flex:1 1 auto;min-height:0;grid-template-rows:auto auto minmax(170px,1fr) auto auto;
  }
  #compras-order-notes-panel:not([data-native-embedded]) .mf-on-stack>.mf-on-card:nth-child(3){
    min-height:0!important;
  }
  #compras-order-notes-panel:not([data-native-embedded]) .mf-on-stack>.mf-on-order-card{
    height:auto!important;max-height:none!important;min-height:0!important;
  }
  #compras-order-notes-panel:not([data-native-embedded]) .mf-on-order-card>.mf-on-order-scroll{
    flex:1 1 auto;min-height:0;overflow-x:hidden;overflow-y:auto;
    overscroll-behavior:contain;scrollbar-width:thin;
  }
  #compras-order-notes-panel:not([data-native-embedded]) .mf-on-order-card>.mf-on-order-actions{
    flex:0 0 auto;
  }
  #compras-order-notes-panel:not([data-native-embedded]) .mf-on-summary>.mf-on-card:nth-child(2){
    overflow:hidden;
  }
}
/* Em tablets estreitos, preservar o reflow aprovado sem cortar o formulário. */

#compras-order-notes-panel:not([data-native-embedded]) .mf-on-anotar-rev{
  display:inline-flex;vertical-align:middle;align-items:center;
  margin-left:10px;padding:3px 7px;border-radius:6px;
  background:#fff1f5;color:#9d174d;border:1px solid #f9a8d4;
  font:700 10px/14px var(--mf-ta-font,Outfit,sans-serif);letter-spacing:.04em;
}

@media(min-width:1051px){
  #view-compras-veiling #compras-order-notes-panel:not([data-native-embedded])[data-legacy-can-manage-cycle="true"]>.mf-on-layout{
    grid-template-rows:0 auto minmax(170px,1fr) auto auto;
  }
}


/* HML R4 — paridade visual com PROD 0.0.819, exclusivamente Anotar tradicional.
   A BASE Nativa embutida e demais módulos conservam seus próprios rodapés. */
@media (min-width:1051px) and (min-height:720px) {
  #app-screen.compras-veiling-mode:has(#compras-order-notes-panel:not([hidden]):not([data-native-embedded]))
    > .mf-ta-build-footer {
    position:fixed;
    inset:auto 10px 4px auto;
    z-index:12;
    width:max-content;
    max-width:calc(100vw - 20px);
    min-height:0;
    margin:0;
    padding:2px 8px;
    border:1px solid var(--mf-ta-line,#e4e7ec);
    border-radius:6px;
    background:var(--mf-ta-bg,#f9fafb);
    color:var(--mf-ta-muted,#667085);
    font:400 10px/14px var(--mf-ta-font,Outfit,sans-serif);
    box-shadow:0 1px 3px rgba(16,24,40,.04);
    pointer-events:none;
  }
}

/* HML R4: em HML o shell é um GRID de altura natural, diferente de PROD.
   Fixar a altura apenas no Anotar tradicional; nunca no Anotar Nativo. */
@media (min-width:1051px) and (min-height:720px) {
  #view-compras-veiling #compras-app-shell:has(#compras-order-notes-panel:not([hidden]):not([data-native-embedded])) {
    height:100dvh!important;
    max-height:100dvh!important;
    min-height:0!important;
    grid-template-rows:minmax(0,1fr)!important;
    overflow:hidden!important;
  }
  #view-compras-veiling #compras-workspace:has(> #compras-order-notes-panel:not([hidden]):not([data-native-embedded])) {
    height:100%!important;
    min-height:0!important;
    overflow:hidden!important;
  }
  #compras-order-notes-panel:not([hidden]):not([data-native-embedded])>.mf-on-layout {
    grid-template-rows:auto auto minmax(0,1fr) auto auto!important;
  }
}
