/* Talerum V26.68 — workspace width recovery + queue/card alignment polish */

/* --------------------------------------------------------------------------
   Fixed sidebar without reserving a second layout column.
   -------------------------------------------------------------------------- */
html body[data-talerum-layout="private"] :where(.shell,.talerum-shell){
  display:block!important;
  grid-template-columns:1fr!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  padding-left:0!important;
  margin:0!important;
  overflow:visible!important;
}
html body[data-talerum-layout="private"] :where(.shell,.talerum-shell) > .workspace,
html body[data-talerum-layout="private"] main.workspace{
  grid-column:1!important;
  grid-row:auto!important;
  position:relative!important;
  left:auto!important;
  right:auto!important;
  transform:none!important;
  box-sizing:border-box!important;
  margin-left:var(--talerum-sidebar-width)!important;
  width:calc(100% - var(--talerum-sidebar-width))!important;
  max-width:calc(100% - var(--talerum-sidebar-width))!important;
  min-width:0!important;
}
html.talerum-sidebar-collapsed body[data-talerum-layout="private"] :where(.shell,.talerum-shell) > .workspace,
html.talerum-sidebar-collapsed body[data-talerum-layout="private"] main.workspace,
html body.talerum-sidebar-collapsed[data-talerum-layout="private"] main.workspace{
  margin-left:var(--talerum-sidebar-collapsed)!important;
  width:calc(100% - var(--talerum-sidebar-collapsed))!important;
  max-width:calc(100% - var(--talerum-sidebar-collapsed))!important;
}
html body[data-talerum-layout="private"] main.workspace > :where(.topbar,.page,.finance-page,.attendances-page,.settings-page,.reports-page,.dashboard-page,section){
  max-width:100%!important;
  min-width:0!important;
  box-sizing:border-box!important;
}
html body[data-talerum-layout="private"] :where(.page,.finance-page,.attendances-page,.settings-page,.reports-page,.dashboard-page){
  width:100%!important;
}

/* --------------------------------------------------------------------------
   Atendimentos — paginated queue fills its card and closes on the same base.
   -------------------------------------------------------------------------- */
body[data-talerum-page="atendimentos"] .queue-card{
  height:calc(100dvh - 122px)!important;
  min-height:650px!important;
  max-height:calc(100dvh - 122px)!important;
}
body[data-talerum-page="atendimentos"] .queue-list{
  flex:1 1 auto!important;
  min-height:0!important;
  padding-bottom:8px!important;
}
body[data-talerum-page="atendimentos"] .attendance-queue-pagination{
  flex:0 0 auto!important;
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:10px!important;
  min-height:64px!important;
  margin-top:auto!important;
  padding:12px 12px!important;
  border-top:1px solid #EEE7E1!important;
  background:#fff!important;
}
body[data-talerum-page="atendimentos"] .attendance-queue-range{
  color:#786E68!important;
  font-size:11.5px!important;
  font-weight:650!important;
  white-space:nowrap!important;
}
body[data-talerum-page="atendimentos"] .attendance-queue-controls{
  display:flex!important;
  align-items:center!important;
  gap:6px!important;
}
body[data-talerum-page="atendimentos"] .attendance-queue-pages{display:flex!important;align-items:center!important;gap:5px!important}
body[data-talerum-page="atendimentos"] .attendance-queue-button,
body[data-talerum-page="atendimentos"] .attendance-queue-page{
  display:grid!important;
  place-items:center!important;
  min-width:32px!important;
  height:32px!important;
  padding:0 8px!important;
  border:1px solid #E5DDD7!important;
  border-radius:9px!important;
  background:#fff!important;
  color:#6D635D!important;
  font-size:11px!important;
  font-weight:750!important;
  box-shadow:none!important;
  cursor:pointer!important;
}
body[data-talerum-page="atendimentos"] .attendance-queue-page.active{
  border-color:#C96B29!important;
  background:#C96B29!important;
  color:#fff!important;
}
body[data-talerum-page="atendimentos"] .attendance-queue-button:disabled{opacity:.34!important;cursor:not-allowed!important;background:#F7F5F3!important}
body[data-talerum-page="atendimentos"] .attendance-queue-size{
  width:54px!important;
  height:32px!important;
  min-height:32px!important;
  padding:0 7px!important;
  border:1px solid #E5DDD7!important;
  border-radius:9px!important;
  background:#fff!important;
  color:#4F4742!important;
  font-size:11px!important;
}

/* --------------------------------------------------------------------------
   Fila do dentista — avatar/icon/action column optical alignment.
   -------------------------------------------------------------------------- */
body[data-talerum-page="fila-dentista"] #doctorQueue .person{
  display:grid!important;
  grid-template-columns:38px minmax(0,1fr)!important;
  align-items:center!important;
  column-gap:12px!important;
}
body[data-talerum-page="fila-dentista"] #doctorQueue .person-avatar{
  display:grid!important;
  place-items:center!important;
  width:38px!important;
  height:38px!important;
  min-width:38px!important;
  min-height:38px!important;
  margin:0!important;
  padding:0!important;
  border-radius:11px!important;
  line-height:1!important;
  text-align:center!important;
  font-size:11.5px!important;
  font-weight:800!important;
}
body[data-talerum-page="fila-dentista"] #doctorQueue .person>div{min-width:0!important;align-self:center!important}
body[data-talerum-page="fila-dentista"] #doctorQueue .item-side{
  align-self:center!important;
  align-content:center!important;
}
body[data-talerum-page="fila-dentista"] #doctorQueue .item-side>.badge{align-self:center!important;margin:0!important}
body[data-talerum-page="fila-dentista"] #doctorQueue .doctor-queue-action,
body[data-talerum-page="fila-dentista"] #doctorQueue .eye{align-self:center!important;margin:0!important}
body[data-talerum-page="fila-dentista"] #doctorQueue .eye svg{width:16px!important;height:16px!important;margin:auto!important}

/* --------------------------------------------------------------------------
   Financeiro — year comparison belongs to the chart card, not the page toolbar.
   -------------------------------------------------------------------------- */
body[data-talerum-page="financeiro"] .finance-toolbar-compare{padding:0!important;border:0!important;background:transparent!important}
body[data-talerum-page="financeiro"] .cashflow-card .card-head{
  align-items:flex-start!important;
  gap:18px!important;
}
body[data-talerum-page="financeiro"] .cashflow-card-tools{
  display:flex!important;
  flex-direction:column!important;
  align-items:flex-end!important;
  gap:10px!important;
  margin-left:auto!important;
}
body[data-talerum-page="financeiro"] .cashflow-card-tools .finance-toolbar-compare{
  display:flex!important;
  align-items:center!important;
  gap:9px!important;
  min-height:32px!important;
  color:#655B55!important;
  font-size:11.75px!important;
  font-weight:720!important;
  white-space:nowrap!important;
}
body[data-talerum-page="financeiro"] .cashflow-card-tools .legend{justify-content:flex-end!important;flex-wrap:wrap!important;gap:11px!important}
body[data-talerum-page="financeiro"] .cashflow-card .finance-compare-note{margin-top:12px!important}

/* --------------------------------------------------------------------------
   Convênios — close card columns on the same base and remove floating geometry.
   -------------------------------------------------------------------------- */
body[data-talerum-page="convenios"] [data-panel="operations"]>.split{
  display:grid!important;
  grid-template-columns:minmax(0,1.72fr) minmax(320px,.78fr)!important;
  gap:0!important;
  align-items:stretch!important;
  margin:0!important;
}
body[data-talerum-page="convenios"] [data-panel="operations"]>.split>div:first-child{
  display:flex!important;
  flex-direction:column!important;
  min-width:0!important;
  padding:0 16px 16px!important;
}
body[data-talerum-page="convenios"] [data-panel="operations"]>.split>div:first-child>.panel-head{
  padding-left:0!important;
  padding-right:0!important;
}
body[data-talerum-page="convenios"] [data-panel="operations"]>.split>div:first-child>.table-wrap{
  flex:1 1 auto!important;
  margin-top:12px!important;
  border:1px solid #ECE4DD!important;
  border-radius:14px!important;
  overflow:hidden!important;
}
body[data-talerum-page="convenios"] [data-panel="operations"]>.split>aside{
  display:flex!important;
  flex-direction:column!important;
  height:100%!important;
  min-height:100%!important;
  padding:16px!important;
  border-left:1px solid #ECE4DD!important;
  background:#fff!important;
}
body[data-talerum-page="convenios"] [data-panel="operations"]>.split>aside .detail-list{margin-top:14px!important}
body[data-talerum-page="convenios"] [data-panel="operations"]>.split>aside>.banner{margin-top:auto!important;margin-bottom:0!important}
body[data-talerum-page="convenios"] [data-panel="operations"]>section.card{
  margin:16px!important;
  margin-top:0!important;
}
body[data-talerum-page="convenios"] [data-panel="operations"]>section.card .panel-body{padding-top:14px!important}
body[data-talerum-page="convenios"] [data-panel="operations"]>section.card .split-even{
  align-items:stretch!important;
  gap:12px!important;
}
body[data-talerum-page="convenios"] [data-panel="operations"]>section.card .list-item{
  height:100%!important;
  min-height:66px!important;
  padding:12px 14px!important;
  border:1px solid #EEE6DF!important;
  border-radius:13px!important;
  background:#FFFEFD!important;
}

@media(max-width:1180px){
  body[data-talerum-page="convenios"] [data-panel="operations"]>.split{grid-template-columns:minmax(0,1fr) 300px!important}
  body[data-talerum-page="atendimentos"] .attendance-queue-range{display:none!important}
}

/* High-specificity lock: legacy sidebar CSS uses !important grid declarations. */
html body[data-talerum-layout="private"][data-talerum-page] div.shell,
html body[data-talerum-layout="private"][data-talerum-page] div.talerum-shell,
html body[data-talerum-layout="private"][data-talerum-page] div.shell.talerum-shell{
  display:block!important;
  grid-template-columns:none!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
}
html body[data-talerum-layout="private"][data-talerum-page] div.shell > main.workspace,
html body[data-talerum-layout="private"][data-talerum-page] div.talerum-shell > main.workspace{
  grid-column:auto!important;
  margin-left:var(--talerum-sidebar-width)!important;
  width:calc(100% - var(--talerum-sidebar-width))!important;
  max-width:calc(100% - var(--talerum-sidebar-width))!important;
}
html.talerum-sidebar-collapsed body[data-talerum-layout="private"][data-talerum-page] div.shell > main.workspace,
html.talerum-sidebar-collapsed body[data-talerum-layout="private"][data-talerum-page] div.talerum-shell > main.workspace{
  margin-left:var(--talerum-sidebar-collapsed)!important;
  width:calc(100% - var(--talerum-sidebar-collapsed))!important;
  max-width:calc(100% - var(--talerum-sidebar-collapsed))!important;
}
body[data-talerum-page="atendimentos"] .queue-card{
  height:clamp(620px,calc(100dvh - 330px),760px)!important;
  min-height:620px!important;
  max-height:760px!important;
}

/* V26.80.12 — global fill for primary list/table cards + standardized private surfaces */
body[data-talerum-layout="private"]{
  --talerum-card-surface:#fff;
}

/* Standardize main card/box backgrounds across private screens */
body[data-talerum-layout="private"] :where(
  .card,.panel,.tabs-card,.table-card,.report-library-card,.patient-index-table-card,
  .returns-list-card,.return-detail-card,.waitlist-card,.attention-card,.day-summary,
  .occupancy-card,.summary-card,.detail-card,.queue-card,.section-card,.module-card
){
  background:var(--talerum-card-surface)!important;
}

/* Make dominant cards absorb leftover vertical space instead of leaving dead page gaps */
body[data-talerum-layout="private"] :where(
  .table-card,.report-library-card,.patient-index-table-card,.returns-list-card,
  .queue-card,.list-card,.data-card,.table-panel,.records-card
):has(table),
body[data-talerum-layout="private"] :where(
  .table-card,.report-library-card,.patient-index-table-card,.returns-list-card,
  .queue-card,.list-card,.data-card,.table-panel,.records-card
):has(.talerum-pagination-footer),
body[data-talerum-layout="private"] :where(
  .table-card,.report-library-card,.patient-index-table-card,.returns-list-card,
  .queue-card,.list-card,.data-card,.table-panel,.records-card
):has(.table-footer)
{
  display:flex!important;
  flex-direction:column!important;
  align-self:stretch!important;
  min-height:clamp(460px,56vh,760px)!important;
}

body[data-talerum-layout="private"] :where(
  .table-card,.report-library-card,.patient-index-table-card,.returns-list-card,
  .queue-card,.list-card,.data-card,.table-panel,.records-card
):has(table) :where(.table-wrap,.talerum-auto-table-wrap,.patient-index-table-wrap,.list){
  flex:1 1 auto!important;
}

body[data-talerum-layout="private"] :where(
  .table-card,.report-library-card,.patient-index-table-card,.returns-list-card,
  .queue-card,.list-card,.data-card,.table-panel,.records-card
):has(table) :where(.talerum-pagination-footer,.table-footer,.reception-pagination,.returns-pagination,.attendance-queue-pagination,.doctor-queue-pagination){
  margin-top:auto!important;
}

/* Relatórios: keep the main library card visually unified and filled */
body[data-talerum-page="relatorios"] .panel.active[data-panel="library"]{
  display:flex!important;
}
body[data-talerum-page="relatorios"] .report-library-card{
  width:100%!important;
  min-height:clamp(500px,60vh,780px)!important;
}
body[data-talerum-page="relatorios"] .report-library-card table{
  background:#fff!important;
}

/* Revenue / funnel-style operational pages benefit from full-height primary table cards */
body[data-talerum-page="receita-saude"] .card:has(table),
body[data-talerum-page="last-mile-comercial"] .card:has(table),
body[data-talerum-page="revenue-os"] .card:has(table),
body[data-talerum-page="pacientes"] .table-card,
body[data-talerum-page="recepcao"] .card.panel:has(.talerum-pagination-footer){
  min-height:clamp(500px,58vh,780px)!important;
}

/* V26.80.13 — normalize page surface so only two neutral layers remain:
   1) page/background surface
   2) card/box surface
   Removes the third "deep background" strip at the bottom of shorter pages. */
:root{
  --talerum-page-surface:#F7F5F3;
  --talerum-card-surface:#FFFFFF;
}
html,
body[data-talerum-layout="private"],
body[data-talerum-layout="private"] :where(.shell,.talerum-shell),
body[data-talerum-layout="private"] :where(.workspace,main.workspace),
body[data-talerum-layout="private"] :where(.page,.finance-page,.attendances-page,.settings-page,.reports-page,.dashboard-page,.revenue-page,.automation-page,.patients-page,.calendar-page,section){
  background:var(--talerum-page-surface)!important;
}
body[data-talerum-layout="private"] :where(.shell,.talerum-shell),
body[data-talerum-layout="private"] :where(.workspace,main.workspace),
body[data-talerum-layout="private"] :where(.page,.finance-page,.attendances-page,.settings-page,.reports-page,.dashboard-page,.revenue-page,.automation-page,.patients-page,.calendar-page){
  min-height:100dvh!important;
}
/* Preserve cards/boxes as the only lighter neutral surface */
body[data-talerum-layout="private"] :where(
  .card,.panel,.tabs-card,.table-card,.report-library-card,.patient-index-table-card,
  .returns-list-card,.return-detail-card,.waitlist-card,.attention-card,.day-summary,
  .occupancy-card,.summary-card,.detail-card,.queue-card,.section-card,.module-card,
  .talerum-modal-card,.cashflow-card,.chart-card,.hero-card,.page-card
){
  background:var(--talerum-card-surface)!important;
}

/* V26.81.5 — white page canvas, stronger full-height table fill, config + readiness alignment */
:root{
  --talerum-page-surface:#FFFFFF;
  --talerum-card-surface:#FFFFFF;
}

html,
body,
body[data-talerum-layout="private"],
body[data-talerum-layout="private"] :where(.shell,.talerum-shell,.workspace,main.workspace,.page,.dashboard,.dashboard-page,.finance-page,.attendances-page,.settings-page,.reports-page,.dashboard-page,.revenue-page,.automation-page,.patients-page,.calendar-page,.nora-central-page,.panel.active){
  background:#FFFFFF!important;
}

body[data-talerum-layout="private"] :where(.grid-2,.grid-even,.split,.workspace-grid,.main-grid,.content-grid,.overview-grid,.fiscal-grid,.nora-central-grid){
  align-items:stretch!important;
}

/* Make table/list cards consume the available box height consistently */
body[data-talerum-layout="private"] :where(
  .card,.section,.section-card,.table-card,.report-library-card,.patient-index-table-card,
  .returns-list-card,.queue-card,.list-card,.data-card,.table-panel,.records-card
):has(table),
body[data-talerum-layout="private"] :where(
  .card,.section,.section-card,.table-card,.report-library-card,.patient-index-table-card,
  .returns-list-card,.queue-card,.list-card,.data-card,.table-panel,.records-card
):has(.table-wrap),
body[data-talerum-layout="private"] :where(
  .card,.section,.section-card,.table-card,.report-library-card,.patient-index-table-card,
  .returns-list-card,.queue-card,.list-card,.data-card,.table-panel,.records-card
):has(.talerum-pagination-footer),
body[data-talerum-layout="private"] :where(
  .card,.section,.section-card,.table-card,.report-library-card,.patient-index-table-card,
  .returns-list-card,.queue-card,.list-card,.data-card,.table-panel,.records-card
):has(.table-footer){
  display:flex!important;
  flex-direction:column!important;
  align-self:stretch!important;
  min-height:clamp(500px,58vh,780px)!important;
}

body[data-talerum-layout="private"] :where(
  .card,.section,.section-card,.table-card,.report-library-card,.patient-index-table-card,
  .returns-list-card,.queue-card,.list-card,.data-card,.table-panel,.records-card
):has(.table-wrap) > .table-wrap,
body[data-talerum-layout="private"] :where(
  .card,.section,.section-card,.table-card,.report-library-card,.patient-index-table-card,
  .returns-list-card,.queue-card,.list-card,.data-card,.table-panel,.records-card
):has(.talerum-auto-table-wrap) > .talerum-auto-table-wrap,
body[data-talerum-layout="private"] :where(
  .card,.section,.section-card,.table-card,.report-library-card,.patient-index-table-card,
  .returns-list-card,.queue-card,.list-card,.data-card,.table-panel,.records-card
):has(.list) > .list,
body[data-talerum-layout="private"] :where(
  .card,.section,.section-card,.table-card,.report-library-card,.patient-index-table-card,
  .returns-list-card,.queue-card,.list-card,.data-card,.table-panel,.records-card
):has(table) > table{
  flex:1 1 auto!important;
}

body[data-talerum-layout="private"] :where(
  .card,.section,.section-card,.table-card,.report-library-card,.patient-index-table-card,
  .returns-list-card,.queue-card,.list-card,.data-card,.table-panel,.records-card
):has(.talerum-pagination-footer) :where(.talerum-pagination-footer,.table-footer,.reception-pagination,.returns-pagination,.attendance-queue-pagination,.doctor-queue-pagination){
  margin-top:auto!important;
}

/* Settings: left navigation column should stretch to the same visual base as the content column */
body[data-talerum-page="configuracoes"] .overview-grid > .settings-nav-card,
body[data-talerum-page="configuracoes"] .overview-grid > aside.settings-nav-card{
  display:flex!important;
  flex-direction:column!important;
  align-self:stretch!important;
  height:100%!important;
}
body[data-talerum-page="configuracoes"] .settings-menu{
  display:flex!important;
  flex:1 1 auto!important;
  flex-direction:column!important;
  gap:10px!important;
}
/* Nora central: keep it visually in the same family as the other private pages */
body[data-talerum-page="nora-central"] .talerum-managed-topbar,
body[data-talerum-page="nora-central"] .topbar,
body[data-talerum-page="nora-central"] .workspace,
body[data-talerum-page="nora-central"] .nora-central-page{
  background:#FFFFFF!important;
}
body[data-talerum-page="nora-central"] .nora-central-page{
  padding:24px 32px 38px!important;
}
body[data-talerum-page="nora-central"] .nora-central-hero,
body[data-talerum-page="nora-central"] .nora-central-card,
body[data-talerum-page="nora-central"] .nora-central-tabs{
  box-shadow:none!important;
}

/* Support / system health: fix broken source-status pills and keep the grid stable */
body[data-talerum-page="suporte-readiness"] .status-matrix{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:12px!important;
  align-items:stretch!important;
}
body[data-talerum-page="suporte-readiness"] .status-cell{
  display:flex!important;
  flex-direction:column!important;
  gap:10px!important;
  min-height:130px!important;
  padding:16px!important;
  border:1px solid #EFE7E0!important;
  border-radius:16px!important;
  background:#FFFFFF!important;
}
body[data-talerum-page="suporte-readiness"] .status-cell label{
  margin:0!important;
  font-size:13px!important;
  line-height:1.25!important;
}
body[data-talerum-page="suporte-readiness"] .status-cell strong{
  display:flex!important;
  align-items:center!important;
  min-height:24px!important;
}
body[data-talerum-page="suporte-readiness"] .status-cell .pill{
  max-width:max-content!important;
  white-space:nowrap!important;
}
body[data-talerum-page="suporte-readiness"] .status-cell > span{
  color:#7A6F68!important;
  font-size:12px!important;
  line-height:1.45!important;
}
body[data-talerum-page="suporte-readiness"] .status-cell .eye{
  margin-top:auto!important;
}

@media (max-width:1200px){
  body[data-talerum-page="suporte-readiness"] .status-matrix{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}
