/*
 * v0.99.67 — consolidação de superfície para notebook/Safari.
 * Escopo: app oficial e DEMO. Não tocar no site público, checkout ou portal.
 * Esta camada é carregada após os estilos históricos para neutralizar apenas
 * conflitos comprovados de largura/rolagem e alinhamento das ações.
 */
#stef-demo-runtime.stef16-app{min-width:0;min-height:100dvh;height:auto!important}
#stef-demo-runtime.stef16-app .demo-layout{min-width:0;min-height:100dvh;height:auto!important;max-height:none!important;overflow:visible!important}
#stef-demo-runtime.stef16-app #demo-main{
  box-sizing:border-box!important;min-width:0!important;
  min-height:0!important;height:auto!important;max-height:none!important;
  overflow:visible!important;padding-bottom:max(72px,env(safe-area-inset-bottom))!important;
}
#stef-demo-runtime.stef16-app :is(.demo-panel,.demo-section-head,.demo-item,.stef32-consult-card,.stef24-appointment,.stef38-history-row){min-width:0;max-width:100%}
#stef-demo-runtime.stef16-app :is(.demo-panel h1,.demo-panel h2,.demo-panel h3,.demo-page-head h1,.demo-section-head h2,.demo-item-body strong,.stef24-appointment-body strong){
  writing-mode:horizontal-tb!important;word-break:normal!important;overflow-wrap:break-word!important;
}
/* Alinhamento horizontal de ações. O formulário é um ITEM e não uma linha 100%. */
#stef-demo-runtime.stef16-app :is(
  .stef42-action-group,.demo-item-actions,.stef24-appointment-actions,
  .stef25-consult-header-actions,.stef27-user-actions,.stef37-patient-actions,
  .stef38-history-actions,.stef39-archive-actions,.stef48-archive-actions,
  .stef51-header-actions,.stef51-form-actions,.stef54-issue-actions
){
  display:flex!important;flex-direction:row!important;flex-wrap:nowrap!important;
  align-items:center!important;align-content:center!important;gap:9px!important;
  min-width:0!important;max-width:100%!important;
}
#stef-demo-runtime.stef16-app :is(
  .stef42-action-group,.demo-item-actions,.stef24-appointment-actions,
  .stef25-consult-header-actions,.stef27-user-actions,.stef37-patient-actions,
  .stef38-history-actions,.stef39-archive-actions,.stef48-archive-actions,
  .stef51-header-actions,.stef51-form-actions,.stef54-issue-actions
) > :is(form,a,button,details){
  flex:0 0 auto!important;align-self:center!important;width:auto!important;
  min-width:0!important;max-width:100%!important;margin:0!important;
}
#stef-demo-runtime.stef16-app :is(
  .stef42-action-group,.demo-item-actions,.stef24-appointment-actions,
  .stef25-consult-header-actions,.stef27-user-actions,.stef37-patient-actions,
  .stef38-history-actions,.stef39-archive-actions,.stef48-archive-actions,
  .stef51-header-actions,.stef51-form-actions,.stef54-issue-actions
) > form{display:inline-flex!important;flex-direction:row!important;align-items:center!important;justify-content:center!important}
#stef-demo-runtime.stef16-app :is(.stef42-action-group,.stef54-issue-actions,.stef51-header-actions,.stef51-form-actions) :is(a.demo-btn,button.demo-btn){
  display:inline-flex!important;align-items:center!important;justify-content:center!important;
  white-space:nowrap!important;width:auto!important;min-height:42px!important;line-height:1.2!important;
}
/* Quando falta espaço horizontal de verdade, rolagem apenas NA FAIXA de ações,
 * em vez de quebrar um botão para baixo e comprimir o nome do paciente. */
@media(min-width:721px){
  #stef-demo-runtime.stef16-app :is(.stef42-action-group,.stef54-issue-actions,.stef51-header-actions,.stef51-form-actions):not(:has(.stef37-reschedule[open])){
    overflow-x:auto!important;scrollbar-width:thin;
  }
  #stef-demo-runtime.stef16-app .stef42-action-group:has(.stef37-reschedule[open]){
    flex-wrap:wrap!important;overflow:visible!important;
  }
  #stef-demo-runtime.stef16-app .stef42-action-group > .stef37-reschedule[open]{
    flex:1 1 100%!important;width:100%!important;
  }
}
/* Formulários abertos (reagendamento) devem ter seus próprios campos e rolagem,
 * sem herdar a largura de botão do grupo principal. */
#stef-demo-runtime.stef16-app .stef37-reschedule[open] > form{
  display:flex!important;flex-wrap:wrap!important;width:100%!important;
  max-width:100%!important;min-width:0!important;
}
/* A altura visível do MacBook é menor que a resolução física: a página continua
 * rolando e os painéis modais possuem rolagem própria. */
@media(max-height:800px) and (min-width:721px){
  #stef-demo-runtime.stef16-app .demo-sidebar{
    position:sticky!important;top:0!important;height:100dvh!important;
    max-height:100dvh!important;overflow-y:auto!important;
  }
  #stef-demo-runtime.stef16-app #demo-main{padding-top:clamp(16px,2.2vh,30px)!important}
  #stef-demo-runtime .stef25-user-overlay .stef21-user-detail,
  body > .stef25-user-overlay.stef26-dialog-portalled > .stef21-user-detail{
    max-height:calc(100dvh - 24px)!important;overflow-y:auto!important;
    overscroll-behavior:contain;
  }
}
@media(max-width:720px){
  #stef-demo-runtime.stef16-app .demo-sidebar{position:relative!important;height:auto!important;max-height:none!important;overflow:visible!important}
  #stef-demo-runtime.stef16-app :is(.stef42-action-group,.demo-item-actions,.stef24-appointment-actions,.stef25-consult-header-actions,.stef54-issue-actions){
    flex-wrap:wrap!important;justify-content:flex-start!important;overflow:visible!important;
  }
  #stef-demo-runtime.stef16-app :is(.stef42-action-group,.demo-item-actions,.stef24-appointment-actions,.stef25-consult-header-actions,.stef54-issue-actions) > form{
    flex:0 0 auto!important;width:auto!important;
  }
  #stef-demo-runtime.stef16-app .stef54-issue-actions > form,
  #stef-demo-runtime.stef16-app .stef54-issue-actions > a{flex:1 1 165px!important}
  #stef-demo-runtime.stef16-app .stef54-issue-actions .demo-btn{width:100%!important;white-space:normal!important}
}
/* Evitar cortes de modais em zoom alto sem interferir nos estados de abertura. */
#stef-demo-runtime.stef16-app .stef25-user-overlay .stef21-user-detail,
body > .stef25-user-overlay.stef26-dialog-portalled > .stef21-user-detail{
  overscroll-behavior:contain;scrollbar-gutter:stable;
}
