/* Layout global — sem scrollbar vertical do navegador */

html.app-root,
body.app-body {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

/* Shell principal */
.layout.app-shell {
  display: flex;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.main.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.topbar {
  flex-shrink: 0;
  position: relative;
}

/* Área de abas */
.workspace.app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.tab-workspace {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.tab-pane {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.tab-pane.active {
  display: flex;
}

.tab-pane > .tab-messages,
.tab-pane > .messages.tab-messages {
  flex-shrink: 0;
  margin: 0;
  padding: 12px 24px 0;
}

/* Conteúdo da aba */
.tab-panel-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.page-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Containers roláveis — aliases semânticos */
.page-scroll,
.form-scroll,
.dashboard-scroll,
.report-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
  -webkit-overflow-scrolling: touch;
}

/* Detalhes (NF-e, conferência, etc.) */
.details-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.details-header {
  flex-shrink: 0;
  padding: 16px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.details-header .toolbar {
  margin-bottom: 0;
}

.details-body,
.details-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 24px;
  -webkit-overflow-scrolling: touch;
}

.details-footer {
  flex-shrink: 0;
  padding: 12px 24px 16px;
  max-height: 28vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.details-body > .card,
.details-scroll > .card {
  margin: 0;
}

.details-body table.data thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
}

@media (max-width: 860px) {
  .page-scroll,
  .form-scroll,
  .dashboard-scroll,
  .report-scroll {
    padding: 16px;
  }

  .details-header {
    padding: 16px 16px 0;
  }

  .details-body,
  .details-scroll {
    padding: 0 16px;
  }

  .details-footer {
    padding: 10px 16px 14px;
  }

  .tab-pane > .tab-messages,
  .tab-pane > .messages.tab-messages {
    padding: 12px 16px 0;
  }
}
