/* DIMI Gestão v7.95.6 — cabeçalho profissional sem sobreposição */
.topbar{
  height:auto!important;
  min-height:96px!important;
  padding:10px 18px!important;
  display:grid!important;
  grid-template-columns:minmax(250px,1fr) minmax(540px,auto)!important;
  gap:12px 18px!important;
  align-items:center!important;
}
.topbar>div:first-child{
  grid-column:1!important;
  grid-row:1!important;
  min-width:0!important;
  align-self:center!important;
}
.topbar-right{
  grid-column:2!important;
  grid-row:1!important;
  display:grid!important;
  grid-template-columns:auto auto minmax(220px,280px)!important;
  grid-template-areas:
    "appearance tools user"
    "actions actions actions"!important;
  justify-content:end!important;
  justify-items:end!important;
  align-items:center!important;
  gap:6px 8px!important;
  width:min(100%,900px)!important;
  max-width:900px!important;
  min-width:0!important;
  margin-left:auto!important;
}
#dimi674-top-customize{grid-area:appearance!important;margin:0!important}
.d650-top{grid-area:tools!important;display:flex!important;align-items:center!important;gap:6px!important}
#current-user-btn{grid-area:user!important;justify-self:end!important;max-width:280px!important}
#top-actions{
  grid-area:actions!important;
  width:100%!important;
  max-width:100%!important;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  flex-wrap:wrap!important;
  gap:6px!important;
  overflow:visible!important;
  padding:0!important;
  min-width:0!important;
}
#top-actions:empty{display:none!important}
#top-actions .btn,#top-actions .context-back-btn,#top-actions summary{
  flex:0 0 auto!important;
  min-height:36px!important;
  height:36px!important;
  padding:6px 10px!important;
  border-radius:10px!important;
  font-size:11.5px!important;
  line-height:1!important;
  white-space:nowrap!important;
  word-break:keep-all!important;
  overflow-wrap:normal!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:5px!important;
}
#top-actions .btn.small{min-height:34px!important;height:34px!important;padding:5px 9px!important;font-size:11px!important}
.d650-icon,#dimi674-top-customize{width:38px!important;height:38px!important;min-width:38px!important;border-radius:12px!important}
.topbar-user-btn{min-height:44px!important;padding:5px 9px!important;border-radius:14px!important}
.topbar-user-copy b{max-width:155px!important;font-size:12px!important}
.topbar-user-copy small{max-width:155px!important;font-size:9.8px!important}

/* ações internas das fichas: quebram por botão, nunca dentro do texto */
.gc-top-row>.actions,.v752-stock-toolbar .right,.d743-toolbar>div:last-child{
  display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:7px!important;flex-wrap:wrap!important;min-width:0!important;
}
.gc-top-row>.actions .btn,.v752-stock-toolbar .right .btn,.d743-toolbar .btn{
  white-space:nowrap!important;word-break:keep-all!important;overflow-wrap:normal!important;
}

@media(max-width:1320px){
  .topbar{grid-template-columns:minmax(220px,1fr) minmax(480px,auto)!important;padding-left:14px!important;padding-right:14px!important}
  .topbar-right{grid-template-columns:auto auto minmax(200px,250px)!important;max-width:760px!important}
  #top-actions .btn,#top-actions .context-back-btn,#top-actions summary{padding-left:8px!important;padding-right:8px!important;font-size:10.8px!important}
  .topbar-user-copy b,.topbar-user-copy small{max-width:130px!important}
}
@media(max-width:1100px){
  .topbar{grid-template-columns:1fr!important;min-height:0!important;gap:8px!important;padding:10px 12px!important}
  .topbar>div:first-child{grid-column:1!important;grid-row:1!important}
  .topbar-right{grid-column:1!important;grid-row:2!important;width:100%!important;max-width:none!important;grid-template-columns:auto auto minmax(190px,240px)!important;justify-content:end!important}
}
@media(min-width:761px) and (max-width:1100px){
  /* R13.1: mantém título e ações na mesma linha (antes empilhava e o cabeçalho ficava com ~120px). */
  .topbar{grid-template-columns:minmax(0,1fr) auto!important;min-height:0!important;gap:8px!important;padding:8px 12px!important;align-items:center!important}
  .topbar>div:first-child{grid-column:1!important;grid-row:1!important}
  .topbar-right{grid-column:2!important;grid-row:1!important;width:auto!important;max-width:none!important;display:flex!important;flex-wrap:nowrap!important;gap:8px!important;justify-content:flex-end!important;align-items:center!important}
  .topbar-right>*{grid-area:auto!important;grid-column:auto!important;grid-row:auto!important}
  .topbar-right>*{flex:0 0 auto!important;min-width:max-content!important;max-width:none!important}
  .topbar-right>*:first-child{display:flex!important;gap:6px!important}
  .topbar-user-copy b,.topbar-user-copy small{max-width:110px!important}
}
@media(max-width:760px){
  .topbar-right{grid-template-columns:auto auto 1fr!important;grid-template-areas:"appearance tools user" "actions actions actions"!important}
  #top-actions{justify-content:flex-start!important;overflow-x:auto!important;flex-wrap:nowrap!important;padding-bottom:2px!important;scrollbar-width:none!important}
  #top-actions::-webkit-scrollbar{display:none!important}
  .topbar-user-copy{display:none!important}
  #current-user-btn{min-width:50px!important;width:auto!important}
}
