/* Dra. Stefânia v0.99.38: layout de consultas, contas e formulários.
   Complementa CSS anterior sem alterar dados, autenticação ou lógica clínica. */

/* Não deixar cabeçalhos ou actions encolherem o nome até uma letra por linha. */
#stef-demo-runtime.stef16-app :is(.stef38-archive-row,.stef38-family-row,.stef38-history-row,.stef32-consult-card){
  box-sizing:border-box!important;
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  gap:clamp(12px,1.6vw,22px)!important;
  align-items:center!important;
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  padding:16px 0!important;
  margin:0!important;
  border-bottom:1px solid #e6ece7!important;
  text-align:left!important;
}
#stef-demo-runtime.stef16-app .stef32-consult-card{
  grid-template-columns:94px minmax(0,1fr) auto!important;
}
#stef-demo-runtime.stef16-app :is(.stef38-archive-row,.stef38-family-row,.stef38-history-row,.stef32-consult-card) :is(.demo-item-body,.stef38-archive-info){
  min-width:0!important;
  max-width:none!important;
  width:100%!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:flex-start!important;
  justify-content:center!important;
  gap:5px!important;
  flex:initial!important;
  overflow-wrap:normal!important;
  text-align:left!important;
}
#stef-demo-runtime.stef16-app :is(.stef38-archive-info,.stef38-family-row .demo-item-body,.stef38-history-row .demo-item-body,.stef32-consult-card .demo-item-body) :is(strong,span,small){
  display:block!important;
  max-width:100%!important;
  min-width:0!important;
  width:auto!important;
  white-space:normal!important;
  word-break:normal!important;
  overflow-wrap:break-word!important;
  line-height:1.45!important;
  letter-spacing:normal!important;
}
#stef-demo-runtime.stef16-app .stef38-archive-info strong{
  font-size:14px!important;
  font-weight:700!important;
  color:#244b44!important;
}
#stef-demo-runtime.stef16-app .stef38-archive-info :is(span,small){font-size:12px!important;color:#687f75!important;}
#stef-demo-runtime.stef16-app .stef38-archive-list{width:100%;min-width:0;display:grid;gap:0;margin-top:10px;}
#stef-demo-runtime.stef16-app .stef38-archive :is(summary){cursor:pointer;font-weight:650;color:#244b44;line-height:1.5;}
#stef-demo-runtime.stef16-app :is(.stef38-archive-row,.stef38-family-row,.stef38-history-row) :is(form,.stef38-history-actions){
  width:auto!important;
  max-width:100%!important;
  min-width:0!important;
  margin:0!important;
  display:flex!important;
  flex-wrap:wrap!important;
  justify-content:flex-end!important;
  align-items:center!important;
  gap:8px!important;
}
#stef-demo-runtime.stef16-app :is(.stef38-archive-row,.stef38-family-row,.stef38-history-row,.stef32-consult-card) .demo-btn{
  min-height:40px!important;
  padding:10px 14px!important;
  white-space:nowrap!important;
  width:auto!important;
  min-width:max-content!important;
  margin:0!important;
  line-height:1.3!important;
  text-align:center!important;
}
#stef-demo-runtime.stef16-app .stef32-consult-card .stef32-consult-time{
  width:94px!important;
  min-width:0!important;
  text-align:left!important;
  display:grid!important;
  gap:5px!important;
  order:initial!important;
}
#stef-demo-runtime.stef16-app .stef32-consult-card .stef32-card-actions{
  justify-content:flex-end!important;
  align-items:center!important;
  flex-wrap:nowrap!important;
  display:flex!important;
  width:auto!important;
  min-width:0!important;
  order:initial!important;
}
#stef-demo-runtime.stef16-app .stef32-card-actions form{margin:0!important;width:auto!important;}

/* Cabeçalho do prontuário: Acessar ficha e Arquivar sempre agrupados. */
#stef-demo-runtime.stef16-app .stef25-consult-header-actions{
  display:flex!important;flex-wrap:wrap!important;align-items:center!important;
  justify-content:flex-end!important;gap:9px!important;
  width:auto!important;max-width:100%!important;min-width:0!important;
}
#stef-demo-runtime.stef16-app .stef25-consult-header-actions form{display:inline-flex!important;width:auto!important;max-width:100%!important;margin:0!important;}
#stef-demo-runtime.stef16-app .stef38-archive-button{
  color:#8a5d37!important;background:#fff8ef!important;border:1px solid #d9bd9a!important;
  border-radius:9px!important;font-weight:650!important;white-space:nowrap!important;
  padding:10px 14px!important;min-height:40px!important;
}
#stef-demo-runtime.stef16-app .stef38-archive-button:hover{background:#fcebd7!important;}
/* Respeitar o estado de confirmação: script do plugin habilita o botão. */
#stef-demo-runtime.stef16-app .stef38-archive-button:disabled{opacity:.5;cursor:not-allowed;}

/* Faixa compacta de filtros, com datas legíveis e alinhamento único. */
#stef-demo-runtime.stef16-app .stef25-filterbar{
  display:flex!important;
  flex-wrap:nowrap!important;
  align-items:flex-end!important;
  gap:10px!important;
  width:100%!important;
  max-width:100%!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  padding:6px 2px 14px!important;
  scrollbar-width:thin;
}
#stef-demo-runtime.stef16-app .stef25-filterbar .demo-field{
  flex-shrink:0!important;
}
#stef-demo-runtime.stef16-app .stef25-filterbar .demo-field:has(.stef37-datetime-control){
  flex:0 0 155px!important;width:155px!important;
}
#stef-demo-runtime.stef16-app .stef25-filterbar .stef37-date-launch{
  min-width:0!important;min-height:36px!important;height:36px!important;
  white-space:nowrap!important;text-overflow:ellipsis!important;overflow:hidden!important;
  padding:7px 9px!important;font-size:11px!important;
}
#stef-demo-runtime.stef16-app .stef25-filterbar .stef37-date-launch::after{
  flex-shrink:0;margin-left:7px;font-size:14px;
}
#stef-demo-runtime.stef16-app .stef25-filterbar .stef24-filter-actions{
  display:flex!important;flex:0 0 auto!important;justify-content:flex-end!important;
  align-items:center!important;gap:7px!important;min-height:36px!important;
}

/* Acessibilidade, rolagem e alinhamento refinados no celular. */
@media(max-width:720px){
  #stef-demo-runtime.stef16-app :is(.stef38-archive-row,.stef38-family-row,.stef38-history-row,.stef32-consult-card){
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    align-items:start!important;
    gap:11px!important;
    padding:15px 0!important;
  }
  #stef-demo-runtime.stef16-app .stef32-consult-card .stef32-consult-time{
    width:100%!important;display:flex!important;gap:10px!important;align-items:baseline!important;
    justify-content:flex-start!important;
  }
  #stef-demo-runtime.stef16-app :is(.stef38-archive-row,.stef38-family-row,.stef38-history-row,.stef32-consult-card) :is(.demo-item-body,.stef38-archive-info){
    width:100%!important;flex-basis:auto!important;text-align:left!important;align-items:flex-start!important;
  }
  #stef-demo-runtime.stef16-app :is(.stef38-archive-row,.stef38-family-row,.stef38-history-row,.stef32-consult-card) :is(form,.stef38-history-actions,.stef32-card-actions){
    display:flex!important;justify-content:flex-start!important;flex-wrap:wrap!important;
    width:100%!important;gap:8px!important;
  }
  #stef-demo-runtime.stef16-app .stef25-consult-header-actions{width:100%!important;justify-content:flex-start!important;}
  #stef-demo-runtime.stef16-app .stef25-consult-header-actions .demo-btn,
  #stef-demo-runtime.stef16-app .stef25-consult-header-actions form{max-width:100%!important;}
  #stef-demo-runtime.stef16-app .stef25-filterbar{margin-left:0!important;margin-right:0!important;}
}

/* Ajuste específico mobile: horário → nome → ações, botões sempre no mesmo grupo. */
@media(max-width:720px){
  #stef-demo-runtime.stef16-app .stef32-consult-card .stef32-consult-time{order:0!important}
  #stef-demo-runtime.stef16-app .stef32-consult-card .demo-item-body{order:1!important}
  #stef-demo-runtime.stef16-app .stef32-consult-card .stef32-card-actions{order:2!important}
  #stef-demo-runtime.stef16-app .stef32-consult-card .stef32-card-actions>form{
    width:auto!important;min-width:0!important;display:inline-flex!important;
    flex:0 0 auto!important;margin:0!important;
  }
}
