/* SAP Fiori–inspired ERP Financeiro */
:root {
  --font-ui: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Consolas", "Courier New", monospace;

  --sap-blue: #0070f2;
  --sap-blue-hover: #0064d9;
  --sap-blue-light: #e8f4fd;
  --sap-shell: #ffffff;
  --sap-bg: #f5f6f7;
  --sap-bg-filter: #eff1f2;
  --sap-border: #d9d9d9;
  --sap-border-light: #e5e5e5;
  --sap-text: #32363a;
  --sap-text-secondary: #6a6d70;
  --sap-text-muted: #89919a;
  --sap-title: #1d2d3e;
  --sap-link: #0a6ed1;
  --sap-success: #107e3e;
  --sap-warning: #e9730c;
  --sap-error: #bb0000;

  --header-h: 2.75rem;
  --sidebar-w: 13.75rem;
  --radius: 4px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--sap-text);
  background: var(--sap-bg);
  line-height: 1.42857;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--sap-link); text-decoration: none; }
a:hover { color: var(--sap-blue-hover); }

/* Reset links em menus — evita visual HTML cru */
.shell-nav a,
.shell-logo,
.panel-toolbar a,
.btn,
.shell-actions a {
  text-decoration: none !important;
}
.shell-nav a:hover,
.btn:hover { text-decoration: none !important; }

/* ═══ Shell superior (global) ═══ */
.shell-header {
  grid-area: header;
  height: var(--header-h);
  background: var(--sap-shell);
  border-bottom: 1px solid var(--sap-border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.shell-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--sap-title);
  font-weight: 700;
  font-size: 0.9375rem;
  white-space: nowrap;
}
.shell-logo:hover { text-decoration: none; color: var(--sap-title); }
.shell-logo-img {
  height: 2.25rem;
  width: auto;
  object-fit: contain;
  border-radius: var(--radius);
  display: block;
}
.shell-logo-mark {
  width: 2rem;
  height: 2rem;
  background: var(--sap-blue);
  color: #fff;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
}

.shell-search {
  flex: 1;
  max-width: 28rem;
  position: relative;
}
.shell-search input {
  width: 100%;
  height: 2rem;
  padding: 0 0.75rem 0 2.25rem;
  border: 1px solid var(--sap-border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  background: var(--sap-bg);
  color: var(--sap-text);
}
.shell-search input:focus {
  outline: none;
  border-color: var(--sap-blue);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(0, 112, 242, 0.15);
}
.shell-search .bi {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sap-text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.shell-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}
.shell-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--sap-text);
}
.shell-user strong { font-weight: 600; }

.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.lang-switch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border: 1px solid transparent;
  border-radius: 3px;
  line-height: 0;
  opacity: 0.72;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}
.lang-switch-btn:hover {
  opacity: 1;
}
.lang-switch-btn.is-active {
  opacity: 1;
  border-color: var(--sap-blue);
  box-shadow: 0 0 0 1px rgba(0, 112, 242, 0.12);
}
.lang-switch-btn img {
  display: block;
  border-radius: 2px;
  object-fit: cover;
}
.login-lang {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}
.shell-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--sap-blue);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ═══ Shell da aplicação ═══ */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: var(--header-h) 1fr;
  grid-template-areas:
    "header header"
    "sidebar main";
  min-height: 100vh;
}

/* ═══ Menu de navegação (vertical, esquerda) ═══ */
.shell-nav {
  grid-area: sidebar;
  width: var(--sidebar-w);
  background: var(--sap-shell);
  border-right: 1px solid var(--sap-border);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0.5rem 0;
  overflow-x: hidden;
  overflow-y: auto;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  z-index: 999;
}
.shell-nav a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  color: var(--sap-text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  border-left: 3px solid transparent;
  line-height: 1.25;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.shell-nav a:hover {
  color: var(--sap-blue);
  text-decoration: none;
  background: var(--sap-blue-light);
}
.shell-nav a.active {
  color: var(--sap-blue);
  border-left-color: var(--sap-blue);
  background: var(--sap-blue-light);
}
.shell-nav a .bi {
  font-size: 1rem;
  opacity: 0.9;
  flex-shrink: 0;
}
.shell-nav-divider {
  height: 1px;
  background: var(--sap-border-light);
  margin: 0.35rem 0.75rem;
  align-self: stretch;
}
.shell-nav-group {
  display: flex;
  flex-direction: column;
}
.shell-nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 1rem;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--sap-text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  line-height: 1.25;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.shell-nav-group-toggle:hover {
  color: var(--sap-blue);
  background: var(--sap-blue-light);
}
.shell-nav-group.open .shell-nav-group-toggle,
.shell-nav-group.active .shell-nav-group-toggle {
  color: var(--sap-blue);
  border-left-color: var(--sap-blue);
  background: var(--sap-blue-light);
}
.shell-nav-group-label {
  flex: 1;
  min-width: 0;
}
.shell-nav-chevron {
  font-size: 0.75rem;
  opacity: 0.7;
  transition: transform 0.15s;
  flex-shrink: 0;
}
.shell-nav-group.open .shell-nav-chevron {
  transform: rotate(180deg);
}
.shell-nav-submenu {
  display: none;
  flex-direction: column;
}
.shell-nav-group.open .shell-nav-submenu {
  display: flex;
}
.shell-nav-submenu a {
  padding-left: 2.25rem;
  font-size: 0.75rem;
  font-weight: 500;
}
.company-module-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.5rem 0;
  font-size: 0.8125rem;
  color: var(--sap-text-secondary);
  cursor: pointer;
}
.company-module-option input {
  margin-top: 0.15rem;
  flex-shrink: 0;
}
.shell-branch-form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.shell-branch-label {
  font-size: 0.7rem;
  color: var(--sap-text-muted);
  white-space: nowrap;
}
.shell-branch-badge {
  font-size: 0.75rem;
  color: var(--sap-text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.profile-branch-tab.active {
  background: var(--sap-blue-light);
  color: var(--sap-blue);
  border-color: var(--sap-blue);
}

/* ═══ Área de conteúdo ═══ */
.shell-body {
  grid-area: main;
  padding: 0;
  min-height: calc(100vh - var(--header-h));
  min-width: 0;
}

/* Cabeçalho do objeto (título da página) */
.object-header {
  background: var(--sap-shell);
  border-bottom: 1px solid var(--sap-border-light);
  padding: 1rem 1.5rem;
}
.object-header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--sap-title);
  line-height: 1.3;
}
.object-header .object-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--sap-text-secondary);
  font-weight: 400;
}
.object-header-with-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}
.object-header-main {
  flex: 1 1 auto;
  min-width: 0;
}
.object-header-tools {
  flex: 0 1 auto;
  margin-left: auto;
}

.page-content {
  padding: 1rem 1.5rem 2rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* ═══ Barra de filtros (estilo SAP) ═══ */
.filter-bar {
  background: var(--sap-bg-filter);
  border: 1px solid var(--sap-border-light);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem 1rem;
}
.filter-bar .filter-field {
  flex: 1 1 140px;
  min-width: 120px;
}
.filter-bar .filter-field .form-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filter-bar .filter-field.has-field-hint {
  position: relative;
  padding-bottom: 1.15rem;
}
.filter-bar .filter-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-left: auto;
  padding-top: calc(0.75rem + 0.25rem);
}

/* ═══ Formulários ═══ */
.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--sap-text-secondary);
  margin-bottom: 0.25rem;
}
.form-control,
.form-select {
  display: block;
  width: 100%;
  height: 2.25rem;
  padding: 0 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--sap-text);
  background: #fff;
  border: 1px solid var(--sap-border);
  border-radius: var(--radius);
}
.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--sap-blue);
  box-shadow: 0 0 0 2px rgba(0, 112, 242, 0.12);
}
textarea.form-control { height: auto; min-height: 4rem; padding: 0.5rem; }
.input-money {
  font-family: var(--font-mono);
  text-align: right;
}
.form-hint {
  font-size: 0.75rem;
  color: var(--sap-text-muted);
  margin-top: 0.25rem;
}
.form-hint a { font-weight: 600; }
.form-hint-error { color: var(--sap-error); }
.form-hint-success { color: #166534; }

.input-with-action {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.input-with-action .form-control { flex: 1; min-width: 0; }
.input-with-action .btn { white-space: nowrap; flex-shrink: 0; }

.detail-list {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
  font-size: 0.875rem;
}
.detail-list dt {
  margin: 0;
  font-weight: 600;
  color: var(--sap-text-secondary);
}
.detail-list dd {
  margin: 0;
  color: var(--sap-text);
}

.form-control.input-year {
  font-family: var(--font-mono);
  max-width: 7rem;
}
.panel-toolbar .btn.active-filter {
  background: var(--sap-blue-light);
  border-color: var(--sap-blue);
  color: var(--sap-blue);
}

/* ═══ Botões (com borda — SAP) ═══ */
.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: 2.25rem;
  padding: 0 0.75rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  background: transparent;
  color: var(--sap-text);
}
.btn:hover { text-decoration: none; }
.btn .bi { font-size: 1rem; line-height: 1; }

/* Primário — sólido azul (formulários / salvar) */
.btn-primary,
.btn-app-primary,
button.btn.btn-primary {
  background: var(--sap-blue) !important;
  border: 1px solid var(--sap-blue) !important;
  color: #fff !important;
}
.btn-primary:hover,
.btn-app-primary:hover,
button.btn.btn-primary:hover {
  background: var(--sap-blue-hover) !important;
  border-color: var(--sap-blue-hover) !important;
  color: #fff !important;
}
.btn-primary:focus,
.btn-primary:active,
button.btn.btn-primary:focus,
button.btn.btn-primary:active {
  background: var(--sap-blue) !important;
  border-color: var(--sap-blue) !important;
  color: #fff !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 112, 242, 0.25);
}

/* Executar / ações em barra de filtros — borda azul, texto azul (sempre legível) */
.filter-actions .btn-primary,
.filter-actions button.btn.btn-primary,
.btn-execute {
  background: #fff !important;
  border: 2px solid var(--sap-blue) !important;
  color: var(--sap-blue) !important;
  box-shadow: none !important;
}
.filter-actions .btn-primary:hover,
.filter-actions button.btn.btn-primary:hover,
.btn-execute:hover {
  background: var(--sap-blue-light) !important;
  color: var(--sap-blue-hover) !important;
  border-color: var(--sap-blue-hover) !important;
}
.filter-actions .btn-primary:focus,
.filter-actions .btn-primary:active,
.filter-actions button.btn.btn-primary:focus,
.filter-actions button.btn.btn-primary:active,
.btn-execute:focus,
.btn-execute:active {
  background: #fff !important;
  color: var(--sap-blue) !important;
  border: 2px solid var(--sap-blue) !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 112, 242, 0.2) !important;
}

.btn-danger-outline {
  background: #fff !important;
  border: 1px solid var(--sap-error) !important;
  color: var(--sap-error) !important;
}
.btn-danger-outline:hover {
  background: #fff5f5 !important;
  color: var(--sap-error) !important;
}

/* Modal de confirmação */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.confirm-modal[hidden] {
  display: none !important;
}
.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(29, 45, 62, 0.45);
}
.confirm-modal-dialog {
  position: relative;
  width: min(100%, 26rem);
  background: var(--sap-shell);
  border: 1px solid var(--sap-border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  padding: 1.25rem 1.25rem 1rem;
}
.confirm-modal-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}
.confirm-modal-icon {
  color: var(--sap-warning);
  font-size: 1.25rem;
  flex-shrink: 0;
}
.confirm-modal.is-delete .confirm-modal-icon {
  color: var(--sap-error);
}
.confirm-modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--sap-title);
  line-height: 1.3;
}
.confirm-modal-message {
  margin: 0 0 1.25rem;
  color: var(--sap-text);
  font-size: 0.875rem;
  line-height: 1.45;
}
.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Ícones editar / excluir na tabela */
.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  white-space: nowrap;
}
.btn-icon {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--sap-border) !important;
  background: #fff !important;
  color: var(--sap-text) !important;
  border-radius: var(--radius);
}
.btn-icon .bi { font-size: 0.95rem; line-height: 1; }
.btn-icon.btn-edit:hover {
  background: var(--sap-blue-light) !important;
  color: var(--sap-blue) !important;
  border-color: var(--sap-blue) !important;
}
.btn-icon.btn-cancel {
  color: #e65100 !important;
  border-color: #ffe0b2 !important;
}
.btn-icon.btn-cancel:hover {
  background: #fff8e1 !important;
  border-color: #e65100 !important;
}
.btn-icon.btn-delete {
  color: var(--sap-error) !important;
  border-color: #ffcdd2 !important;
}
.btn-icon.btn-delete:hover {
  background: #fff5f5 !important;
  border-color: var(--sap-error) !important;
}
.d-inline { display: inline; }

/* Secundário — borda azul */
.btn-secondary,
.btn-app-secondary,
.btn-outline-primary {
  background: #fff;
  border-color: var(--sap-blue);
  color: var(--sap-blue) !important;
}
.btn-secondary:hover,
.btn-app-secondary:hover,
.btn-outline-primary:hover {
  background: var(--sap-blue-light);
  color: var(--sap-blue-hover) !important;
}

/* Terciário / transparente com borda cinza */
.btn-tertiary,
.btn-outline-dark {
  background: #fff;
  border-color: var(--sap-border);
  color: var(--sap-text) !important;
}
.btn-tertiary:hover,
.btn-outline-dark:hover {
  background: var(--sap-bg);
  border-color: var(--sap-text-muted);
}

/* Botões de toolbar (texto, sem fundo) */
.btn-toolbar {
  height: 2rem;
  padding: 0 0.5rem;
  font-weight: 600;
  color: var(--sap-link) !important;
  border: 1px solid transparent;
  background: transparent;
}
.btn-toolbar:hover {
  background: var(--sap-blue-light);
  border-color: transparent;
  text-decoration: none;
}

.btn-sm {
  height: 1.75rem;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
}
.btn-lg {
  height: 2.5rem;
  padding: 0 1rem;
}

.form-actions {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--sap-border-light);
}

.btn-confirm-create,
button.btn-confirm-create {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  min-height: 2.5rem !important;
  margin-top: 0 !important;
  background: var(--sap-blue) !important;
  border: 2px solid var(--sap-blue) !important;
  color: #fff !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.btn-confirm-create:hover,
button.btn-confirm-create:hover {
  background: var(--sap-blue-hover) !important;
  border-color: var(--sap-blue-hover) !important;
  color: #fff !important;
}

.panel-form .panel-body {
  padding-bottom: 1.25rem;
  overflow: visible;
}

.panel-form {
  overflow: visible;
}
.panel {
  background: var(--sap-shell);
  border: 1px solid var(--sap-border-light);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: visible;
}
.panel:has(.table-wrap) {
  overflow: visible;
}
.panel-header {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--sap-border-light);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--sap-title);
  background: #fafbfc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.panel-header .panel-count {
  font-weight: 400;
  color: var(--sap-text-muted);
  font-size: 0.8125rem;
}
.panel-body { padding: 1rem; }
.panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--sap-border-light);
  background: #fff;
}

/* Layout duas colunas */
.layout-split {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 991px) {
  .layout-split { grid-template-columns: 1fr; }
}

/* ═══ KPI ═══ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.kpi-tile {
  background: var(--sap-shell);
  border: 1px solid var(--sap-border-light);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
}
.kpi-tile .kpi-label {
  font-size: 0.75rem;
  color: var(--sap-text-secondary);
  margin-bottom: 0.35rem;
}
.kpi-tile .kpi-value {
  font-family: var(--font-mono);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--sap-title);
}
.kpi-tile.kpi-success .kpi-value { color: var(--sap-success); }
.kpi-tile.kpi-danger .kpi-value { color: var(--sap-error); }

/* Painel executivo — gráficos */
.dashboard-header-filter.filter-bar {
  margin-bottom: 0;
  padding: 0.5rem 0.75rem;
  align-items: flex-end;
  flex-wrap: nowrap;
  gap: 0.5rem 0.625rem;
}
.dashboard-header-filter .filter-field {
  flex: 0 0 auto;
  min-width: 0;
}
.dashboard-header-filter .filter-field--modo {
  width: 9.25rem;
}
.dashboard-header-filter .filter-field--year {
  width: 5.25rem;
}
.dashboard-header-filter .filter-field--year .input-year {
  text-align: center;
}
.dashboard-header-filter .filter-field--date {
  width: 8.25rem;
}
.dashboard-header-filter .filter-actions {
  margin-left: 0;
  padding-top: calc(0.75rem + 0.25rem);
}
.dashboard-header-filter .form-label {
  margin-bottom: 0.2rem;
  font-size: 0.6875rem;
  letter-spacing: 0.01em;
}
.dashboard-header-filter .form-control,
.dashboard-header-filter .form-select {
  height: 2rem;
  font-size: 0.8125rem;
}
.dashboard-header-filter .btn-sm {
  height: 2rem;
  padding: 0 0.75rem;
  white-space: nowrap;
}
@media (max-width: 991px) {
  .object-header-with-tools {
    flex-direction: column;
    align-items: stretch;
  }
  .object-header-tools {
    margin-left: 0;
    width: 100%;
  }
  .dashboard-header-filter.filter-bar {
    flex-wrap: wrap;
  }
  .dashboard-header-filter .filter-field--modo,
  .dashboard-header-filter .filter-field--year,
  .dashboard-header-filter .filter-field--date {
    width: auto;
    flex: 1 1 7rem;
  }
  .dashboard-header-filter .filter-actions {
    width: 100%;
    justify-content: flex-end;
    padding-top: 0;
  }
}
.dashboard-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  margin-bottom: 1rem;
}
.dashboard-year-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--sap-shell);
  border: 1px solid var(--sap-border-light);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
}
.dashboard-year-form .form-label {
  margin: 0;
  white-space: nowrap;
  font-size: 0.8125rem;
}
.dashboard-year-form .form-select {
  min-width: 6rem;
  height: 2rem;
}
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.chart-panel-wide {
  grid-column: 1 / -1;
}
.chart-body {
  position: relative;
  height: 280px;
  padding: 0.75rem 1rem 1rem;
}
.chart-empty {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--sap-text-muted);
  font-size: 0.875rem;
}
#dashboard-data {
  display: none;
}
@media (max-width: 991px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .chart-panel-wide {
    grid-column: auto;
  }
}

/* ═══ Tabela ERP (Fiori) ═══ */
.table-wrap {
  overflow-x: auto;
  background: #fff;
  width: 100%;
  max-width: 100%;
}
.table-fiori {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table-fiori thead th {
  text-align: left;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--sap-title);
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--sap-border);
  background: #fafbfc;
  white-space: nowrap;
}
.table-with-filters {
  table-layout: fixed;
}
.table-with-filters thead .table-filter-row th {
  vertical-align: top;
  white-space: normal;
  padding: 0.55rem 0.5rem;
}
.table-with-filters .th-filter-cell {
  box-sizing: border-box;
}
.table-with-filters .th-label {
  display: block;
  height: 0.875rem;
  line-height: 0.875rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--sap-title);
  margin: 0 0 0.3rem;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-with-filters .th-label-spacer {
  visibility: hidden;
  user-select: none;
}
.table-with-filters .th-filter,
.table-with-filters .form-select.th-filter {
  display: block;
  width: 100%;
  min-width: 0;
  height: 2rem;
  min-height: 2rem;
  padding: 0 0.45rem;
  font-size: 0.8125rem;
  box-sizing: border-box;
}
.table-with-filters .th-filter-range {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.35rem;
  height: 2rem;
}
.table-with-filters .th-filter-range .th-filter {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
}
.table-with-filters .th-filter-cell--desc {
  width: 24%;
  min-width: 8.5rem;
}
.table-with-filters .th-filter-cell--grow {
  width: auto;
  min-width: 6.5rem;
}
.table-with-filters .th-filter-cell--party {
  width: 16%;
  min-width: 6.5rem;
}
.table-with-filters .th-filter-cell--money {
  width: 10%;
  min-width: 5.5rem;
}
.table-with-filters .th-filter-cell--money .th-label {
  text-align: left;
}
.table-with-filters .th-filter-cell--money .th-filter {
  text-align: right;
}
.table-with-filters .th-filter-cell--date {
  width: 18%;
  min-width: 9.5rem;
}
.table-with-filters .th-filter-cell--status {
  width: 11%;
  min-width: 6rem;
}
.table-with-filters .th-filter-cell--ref {
  width: 14%;
  min-width: 6rem;
}
.table-with-filters .th-filter-cell--tipo {
  width: 10%;
  min-width: 5.5rem;
}
.table-with-filters .th-filter-actions {
  width: 7.5rem;
  min-width: 7.5rem;
  max-width: 7.5rem;
  padding-right: 0.65rem;
}
.table-with-filters tbody td.col-actions,
.table-with-filters tbody td:last-child {
  white-space: nowrap;
}
.table-with-filters .th-filter-actions .th-filter-buttons {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  justify-content: flex-end;
  height: 2rem;
  min-height: 2rem;
}
.table-with-filters .th-filter-range .flatpickr-wrapper {
  display: block;
  flex: 1 1 0;
  min-width: 0;
}
.th-filter-range.date-range-invalid .th-filter-date,
.th-filter-range.date-range-invalid .flatpickr-input,
.filter-bar.date-range-invalid input[name="inicio"],
.filter-bar.date-range-invalid input[name="fim"],
.dashboard-header-filter.date-range-invalid input.dashboard-date-picker {
  border-color: var(--sap-error) !important;
  box-shadow: 0 0 0 1px rgba(187, 0, 0, 0.15);
}
.table-with-filters .th-filter-range .flatpickr-wrapper .form-control {
  width: 100% !important;
  height: 2rem !important;
  min-height: 2rem !important;
  padding: 0 0.45rem !important;
  font-size: 0.8125rem !important;
  box-sizing: border-box;
}
.table-with-filters .th-filter-range input.th-filter-date.flatpickr-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.btn-xs {
  min-width: 2rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.table-cols-payments {
  table-layout: fixed;
  width: 100%;
}
.table-cols-payments col.col-w-date { width: 12%; }
.table-cols-payments col.col-w-tipo { width: 11%; }
.table-cols-payments col.col-w-money { width: 12%; }
.table-cols-payments col.col-w-grow { width: auto; }
.table-cols-payments col.col-w-status { width: 10%; }
.table-cols-payments col.col-w-actions { width: 7.5rem; }
.table-cols-payments .th-filter-cell,
.table-cols-payments .th-filter-actions {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
}
.table-cols-payments tbody td.col-actions {
  text-align: right;
  white-space: nowrap;
  padding-left: 0.35rem;
  padding-right: 0.5rem;
}

.table-list-filter-form {
  display: none;
}

@media (max-width: 1100px) {
  .table-with-filters {
    table-layout: auto;
  }
  .table-cols-payments {
    table-layout: fixed;
    width: 100%;
  }
  .table-with-filters .th-filter-cell--desc,
  .table-with-filters .th-filter-cell--party,
  .table-with-filters .th-filter-cell--money,
  .table-with-filters .th-filter-cell--date,
  .table-with-filters .th-filter-cell--status,
  .table-with-filters .th-filter-cell--ref,
  .table-with-filters .th-filter-cell--tipo {
    width: auto;
    min-width: 5.5rem;
  }
}
.table-fiori tbody td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--sap-border-light);
  vertical-align: middle;
  color: var(--sap-text);
}
.table-fiori tbody tr:hover td {
  background: #f5faff;
}
.table-fiori tbody tr:last-child td {
  border-bottom: none;
}
.table-fiori .col-money {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
}
.table-fiori .col-link a {
  color: var(--sap-link);
  font-weight: 600;
}
.table-fiori .cell-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--sap-text-muted);
  font-weight: 400;
  margin-top: 0.1rem;
}

/* Status */
.status-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
}
.status-pendente { color: var(--sap-warning); border-color: #f9e4c8; background: #fef7f0; }
.status-pago { color: var(--sap-success); border-color: #c8e6c9; background: #f1f8f4; }
.status-cancelado { color: var(--sap-text-muted); border-color: var(--sap-border); background: #f5f6f7; }
.status-entrada { color: var(--sap-success); border-color: #c8e6c9; background: #f1f8f4; }
.status-saida { color: var(--sap-error); border-color: #ffcdd2; background: #fff5f5; }
.status-online { color: var(--sap-success); border-color: #c8e6c9; background: #f1f8f4; }
.status-offline { color: var(--sap-text-muted); border-color: var(--sap-border); background: #f5f6f7; }
.session-dot { font-size: 0.45rem; vertical-align: middle; margin-right: 0.2rem; }
.status-online .session-dot { color: var(--sap-success); }
.status-offline .session-dot { color: var(--sap-text-muted); }

/* Compatibilidade classes antigas */
.card-corporate,
.table-responsive.card-corporate {
  background: var(--sap-shell);
  border: 1px solid var(--sap-border-light);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: visible;
}
.card-corporate .card-header,
.panel-header {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--sap-border-light);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--sap-title);
  background: #fafbfc;
}
.card-corporate .card-body,
.panel-body { padding: 1rem; }

.table-admin {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 0;
}
.table-admin thead th {
  text-align: left;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--sap-title);
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--sap-border);
  background: #fafbfc;
}
.table-admin tbody td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--sap-border-light);
}
.table-admin tbody tr:hover td { background: #f5faff; }
.table-admin .text-money {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
}

.badge-status {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
}
.badge-pendente { color: var(--sap-warning); border-color: #f9e4c8; background: #fef7f0; }
.badge-pago { color: var(--sap-success); border-color: #c8e6c9; background: #f1f8f4; }
.badge-cancelado { color: var(--sap-text-muted); border-color: var(--sap-border); background: #f5f6f7; }
.badge-entrada { color: var(--sap-success); border-color: #c8e6c9; background: #f1f8f4; }
.badge-saida { color: var(--sap-error); border-color: #ffcdd2; background: #fff5f5; }

.page-header { display: none; }
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.kpi-card {
  background: var(--sap-shell);
  border: 1px solid var(--sap-border-light);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
}
.kpi-card .kpi-label { font-size: 0.75rem; color: var(--sap-text-secondary); }
.kpi-card .kpi-value { font-family: var(--font-mono); font-size: 1.375rem; font-weight: 700; }
.kpi-card.positive .kpi-value { color: var(--sap-success); }
.kpi-card.negative .kpi-value { color: var(--sap-error); }

/* ═══ Relatório ═══ */
.report-document {
  background: #fff;
  border: 1px solid var(--sap-border-light);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  padding-bottom: 2.5rem;
}
.report-letterhead {
  border-bottom: 2px solid var(--sap-border);
  background: #fff;
}
.report-letterhead-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 1rem;
  text-align: center;
}
.report-company-logo img {
  max-height: 4.5rem;
  max-width: 8rem;
  object-fit: contain;
  display: block;
}
.report-company-info {
  flex: 1;
  min-width: 0;
  width: 100%;
}
.report-company-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--sap-title);
  margin-bottom: 0.25rem;
}
.report-company-line {
  font-size: 0.8125rem;
  color: var(--sap-text-secondary);
  line-height: 1.45;
}
.report-title-block {
  padding: 0.75rem 1.25rem 1rem;
  background: var(--sap-title);
  color: #fff;
  text-align: center;
}
.report-title-block h2 {
  margin: 0 0 0.25rem;
  font-size: 1.125rem;
  font-weight: 700;
}
.report-title-block .report-meta {
  font-size: 0.8125rem;
  opacity: 0.9;
}
.report-watermark {
  position: absolute;
  left: 0.75rem;
  bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  opacity: 0.18;
  pointer-events: none;
  user-select: none;
  z-index: 1;
}
.report-watermark img {
  height: 1.1rem;
  width: auto;
  object-fit: contain;
  filter: grayscale(100%);
}
.report-watermark span {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sap-title);
}

.company-logo-upload {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.company-logo-preview {
  display: inline-flex;
  padding: 0.5rem;
  border: 1px solid var(--sap-border-light);
  border-radius: var(--radius);
  background: #fafbfc;
  max-width: 12rem;
}
.company-logo-preview-readonly {
  margin-bottom: 1rem;
}
.company-logo-preview img {
  max-height: 4rem;
  max-width: 100%;
  object-fit: contain;
  display: block;
}
.company-logo-remove {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--sap-text-secondary);
  cursor: pointer;
}

/* ═══ Página Empresa ═══ */
.company-page {
  width: 100%;
  max-width: 100%;
}
.company-layout {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 340px);
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}
.company-layout--readonly {
  grid-template-columns: 1fr;
  max-width: 720px;
}
.company-layout--readonly .company-aside {
  max-width: 100%;
}
.company-main {
  min-width: 0;
}
.company-aside {
  min-width: 0;
}
.company-aside .panel {
  margin-bottom: 0;
  position: sticky;
  top: 0.5rem;
}
.company-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--sap-border-light);
}
.company-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.company-section-title {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sap-text-muted);
}
.company-section-hint {
  margin: -0.35rem 0 0.75rem;
}
.company-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 1rem;
}
.company-form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.company-field {
  min-width: 0;
}
.company-field-span2 {
  grid-column: span 2;
}
.company-field-full {
  grid-column: 1 / -1;
}
.company-field-narrow {
  max-width: 7rem;
}
.company-field .form-hint {
  margin-top: 0.25rem;
  margin-bottom: 0;
}
.company-field-logo {
  margin-bottom: 0.25rem;
}
.company-logo-block {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.company-logo-fields {
  flex: 1;
  min-width: 200px;
}
.company-logo-preview--empty {
  width: 5rem;
  height: 5rem;
  align-items: center;
  justify-content: center;
  color: var(--sap-text-muted);
  font-size: 1.75rem;
}
.company-logo-preview--aside {
  margin: 0 auto 1rem;
  max-width: 10rem;
}
.company-cert-status {
  margin: 0 0 0.35rem;
  color: var(--sap-positive, #2e7d32);
}
.company-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--sap-border-light);
}
.company-detail-list {
  grid-template-columns: minmax(5.5rem, 38%) 1fr;
  gap: 0.45rem 0.75rem;
}
.company-detail-list dd {
  word-break: break-word;
}
.company-empty-msg {
  margin: 0;
  padding: 1.5rem 0;
  text-align: center;
  color: var(--sap-text-muted);
  font-size: 0.875rem;
}
.company-branches-panel {
  margin-bottom: 1rem;
}
.company-branches-panel .panel-header .panel-count {
  font-weight: 600;
}
.company-branches-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  align-items: stretch;
}
.company-branch-form {
  padding: 1rem;
  border-right: 1px solid var(--sap-border-light);
  background: #fafbfc;
}
.company-branch-form-hint {
  margin: 0 0 0.65rem;
  font-weight: 600;
  color: var(--sap-title);
}
.company-branch-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.company-modules-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.25rem;
}
.company-branch-table {
  min-width: 0;
  overflow: auto;
}
.company-branch-table .table-wrap {
  border: none;
  border-radius: 0;
}
.company-branch-modules-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.company-module-tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--sap-blue-light, #e8f4fd);
  color: var(--sap-blue);
  white-space: nowrap;
}
.company-table-empty {
  text-align: center;
  padding: 1.5rem !important;
  color: var(--sap-text-muted);
}
.company-clear-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1rem;
  background: var(--sap-shell);
  border: 1px solid var(--sap-border-light);
  border-radius: var(--radius);
}
@media (max-width: 1199px) {
  .company-form-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .company-form-grid-3 .company-field-span2 {
    grid-column: span 2;
  }
}
@media (max-width: 991px) {
  .company-layout {
    grid-template-columns: 1fr;
  }
  .company-aside .panel {
    position: static;
  }
  .company-branches-layout {
    grid-template-columns: 1fr;
  }
  .company-branch-form {
    border-right: none;
    border-bottom: 1px solid var(--sap-border-light);
  }
}
@media (max-width: 767px) {
  .company-form-grid,
  .company-form-grid-3 {
    grid-template-columns: 1fr;
  }
  .company-field-span2,
  .company-form-grid-3 .company-field-span2 {
    grid-column: span 1;
  }
  .company-field-narrow {
    max-width: none;
  }
}

/* ═══ Contas bancárias ═══ */
.bank-accounts-page,
.bank-form-page {
  width: 100%;
}
.bank-group-title {
  margin: 1rem 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sap-text-muted);
}
.bank-group-title:first-child {
  margin-top: 0;
}
.bank-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.65rem;
}
.bank-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem;
  border-radius: var(--radius);
  background: var(--bank-color);
  color: var(--bank-text);
  text-decoration: none;
  border: 2px solid transparent;
  min-height: 7rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.bank-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  color: var(--bank-text);
}
.bank-card-code {
  font-size: 0.6875rem;
  font-weight: 700;
  opacity: 0.85;
}
.bank-card-name {
  font-size: 1.125rem;
  font-weight: 800;
  line-height: 1.1;
}
.bank-card-full {
  font-size: 0.6875rem;
  opacity: 0.9;
  line-height: 1.2;
}
.bank-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-top: auto;
}
.bank-comm-tag {
  font-size: 0.5625rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
}
.bank-list-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.bank-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  background: var(--bank-color);
  color: var(--bank-text);
}
.bank-form-header-main {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.bank-form-code {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.2);
}
.bank-form-header .form-hint {
  color: inherit;
  opacity: 0.9;
  margin: 0.15rem 0 0;
}
.bank-form-header .btn-tertiary {
  background: rgba(255, 255, 255, 0.15);
  color: inherit;
  border-color: rgba(255, 255, 255, 0.35);
}

.report-document .report-head {
  background: var(--sap-title);
  color: #fff;
  padding: 1rem 1.25rem;
}
.report-document .report-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.125rem;
  font-weight: 700;
}
.report-document .report-meta {
  font-size: 0.8125rem;
  opacity: 0.9;
}
.report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  border-bottom: 1px solid var(--sap-border-light);
  background: #fafbfc;
}
.report-summary .summary-item {
  padding: 0.85rem 1rem;
  border-right: 1px solid var(--sap-border-light);
}
.report-summary .summary-label {
  font-size: 0.7rem;
  color: var(--sap-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.report-summary .summary-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 0.2rem;
}

/* ═══ Login ═══ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sap-bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--sap-border-light);
  border-radius: var(--radius);
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.08);
}
.login-card .login-top {
  padding: 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--sap-border-light);
}
.login-logo {
  margin: 0 auto 0.75rem;
  max-width: 9rem;
}
.login-logo-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
}
.login-card .login-top h1 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--sap-title);
}
.login-card .login-top p {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--sap-text-secondary);
}
.login-card .login-body { padding: 1.25rem 1.5rem 1.5rem; }

.alert-danger {
  background: #fff5f5;
  border: 1px solid #ffcdd2;
  color: var(--sap-error);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  margin-bottom: 1rem;
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  margin-bottom: 1rem;
}

/* Mobile menu */
.shell-menu-btn {
  display: none;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--sap-border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main";
  }
  .shell-menu-btn { display: inline-flex; }
  .shell-nav {
    display: none;
    position: fixed;
    left: 0;
    top: var(--header-h);
    bottom: 0;
    width: min(var(--sidebar-w), 85vw);
    height: auto;
    max-height: none;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.12);
  }
  .shell-nav.open { display: flex; }
  .shell-nav a {
    padding: 0.65rem 0.85rem;
  }
  .shell-search { display: none; }
}

.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.w-100 { width: 100%; }
.d-none { display: none !important; }
.text-muted { color: var(--sap-text-muted); }
.text-success { color: var(--sap-success); }
.text-danger { color: var(--sap-error); }

/* Calendário — Flatpickr pt-BR */
.flatpickr-calendar {
  font-family: var(--font-ui);
  border: 1px solid var(--sap-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-weekdays,
.flatpickr-day {
  font-family: var(--font-ui);
}
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: var(--sap-blue);
  border-color: var(--sap-blue);
}
.flatpickr-day.today {
  border-color: var(--sap-blue);
}
.flatpickr-day:hover {
  background: var(--sap-blue-light);
}
input.input-date.form-control + .form-control.input,
input.input-date + input.form-control {
  font-family: var(--font-ui);
}

.receipt-print-page {
  margin: 0;
  min-height: 100vh;
  background: var(--sap-bg, #f5f6f7);
  padding: 1rem;
  font-family: var(--font-ui, system-ui, sans-serif);
}
.receipt-toolbar {
  max-width: 80mm;
  margin: 0 auto 0.75rem;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}
.receipt-document {
  max-width: 80mm;
  margin: 0 auto;
  background: #fff;
  padding: 6mm 5mm;
  border: 1px dashed var(--sap-border-light, #ccc);
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.45;
  color: #111;
}
.receipt-logo {
  text-align: center;
  margin-bottom: 0.35rem;
}
.receipt-logo img {
  max-width: 48mm;
  max-height: 18mm;
  object-fit: contain;
}
.receipt-company-name {
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 0.2rem;
}
.receipt-line {
  text-align: center;
  font-size: 10px;
  color: #333;
}
.receipt-divider {
  border-top: 1px dashed #999;
  margin: 0.45rem 0;
}
.receipt-title {
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.receipt-subtitle {
  text-align: center;
  font-size: 10px;
  margin-top: 0.15rem;
}
.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}
.receipt-label {
  flex: 0 0 auto;
  color: #555;
  max-width: 42%;
}
.receipt-value {
  flex: 1 1 auto;
  text-align: right;
  font-weight: 600;
  word-break: break-word;
}
.receipt-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  margin: 0.15rem 0;
}
.receipt-total strong {
  font-size: 14px;
}
.receipt-footer {
  text-align: center;
  font-size: 9px;
  color: #555;
}
.receipt-disclaimer {
  margin-top: 0.35rem;
  font-style: italic;
}

.form-control.field-invalid,
.form-select.field-invalid {
  border-color: var(--sap-error, #bb0000);
  box-shadow: 0 0 0 1px var(--sap-error, #bb0000);
}

@media print {
  .receipt-print-page {
    background: #fff;
    padding: 0;
  }
  .receipt-document {
    border: none;
    border-radius: 0;
    max-width: 80mm;
    width: 80mm;
    margin: 0 auto;
    padding: 2mm;
  }
  @page {
    size: 80mm auto;
    margin: 2mm;
  }
  .shell-header, .shell-nav, .no-print, .filter-bar, .panel form, .object-header { display: none !important; }
  .report-document {
    border: none;
    border-radius: 0;
    padding-bottom: 0;
  }
  .report-watermark {
    position: fixed;
    left: 0.5cm;
    bottom: 0.4cm;
    opacity: 0.15;
  }
  .report-letterhead-main,
  .report-title-block {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

.tab-pane { display: block; }

.perm-groups-scroll {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--sap-border-light);
  padding: 0.75rem;
  border-radius: var(--radius);
}
.perm-group-block,
.perm-module-block {
  margin-bottom: 0.15rem;
}
.perm-module-block--flat {
  padding-left: 1.75rem;
}
.fitness-fieldset {
  border: 1px solid var(--sap-border-light);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin: 0.75rem 0;
}
.fitness-fieldset legend {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0 0.35rem;
}
.student-photo-preview {
  width: 140px;
  height: 140px;
  border: 1px solid var(--sap-border-light);
  border-radius: var(--radius);
  background: var(--sap-bg-filter);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  margin-bottom: 0.5rem;
  overflow: hidden;
}
.student-photo-preview img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.student-list-identity {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.student-list-identity-text {
  min-width: 0;
}
.student-list-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  object-fit: cover;
  object-position: center top;
  flex-shrink: 0;
  border: 1px solid var(--sap-border-light);
  background: var(--sap-bg-filter);
}
.student-list-thumb--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sap-text-muted);
  font-size: 1.15rem;
}
.workout-ex-line {
  font-size: 0.8125rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--sap-border-light);
}
.workout-day-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: var(--sap-blue-light);
  color: var(--sap-blue);
  margin-right: 0.35rem;
}

/* Treinos — lista acima, formulário abaixo (largura total) */
.layout-treinos {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}
.panel-treinos-list {
  margin-bottom: 0;
}
.panel-treinos-list .table-wrap--flat {
  overflow: visible;
}
.panel-treinos-form {
  margin-bottom: 0;
  overflow: visible;
}
.panel-treinos-form .panel-body {
  overflow: visible;
  padding: 1rem 1.25rem 1.25rem;
}
.workout-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.workout-form-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  align-items: start;
}
.workout-form-field--title {
  grid-column: 1 / 3;
}
.workout-form-field--notes {
  grid-column: 3 / 5;
}
.workout-form-field--active {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  padding-top: 0.15rem;
}
.workout-active-option {
  margin: 0;
}
.workout-exercises-section {
  border: 1px solid var(--sap-border-light);
  border-radius: var(--radius);
  background: #fff;
  overflow: visible;
}
.workout-exercises-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--sap-border-light);
  background: #fafbfc;
}
.workout-exercises-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--sap-title);
}
.workout-exercises-table-wrap {
  overflow: visible;
  width: 100%;
}
.workout-exercises-table {
  table-layout: fixed;
  width: 100%;
}
.workout-exercises-table th,
.workout-exercises-table td {
  vertical-align: middle;
  padding: 0.45rem 0.5rem;
}
.workout-exercises-table th:nth-child(1),
.workout-exercises-table td:nth-child(1) { width: 8%; }
.workout-exercises-table th:nth-child(2),
.workout-exercises-table td:nth-child(2) { width: 26%; }
.workout-exercises-table th:nth-child(3),
.workout-exercises-table td:nth-child(3) { width: 10%; }
.workout-exercises-table th:nth-child(4),
.workout-exercises-table td:nth-child(4) { width: 14%; }
.workout-exercises-table th:nth-child(5),
.workout-exercises-table td:nth-child(5) { width: 24%; }
.workout-exercises-table th:nth-child(6),
.workout-exercises-table td:nth-child(6) { width: 12%; }
.workout-exercises-table th:nth-child(7),
.workout-exercises-table td:nth-child(7) { width: 6%; }
.workout-ex-include-col,
.workout-ex-include {
  text-align: center;
  white-space: nowrap;
}
.workout-ex-include .btn {
  padding: 0.2rem 0.45rem;
  font-size: 0.7rem;
}
.workout-ex-actions-col,
.workout-ex-actions {
  text-align: center;
  white-space: nowrap;
}
.workout-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding-top: 0.25rem;
}
@media (max-width: 1199px) {
  .workout-form-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .workout-form-field--title,
  .workout-form-field--notes {
    grid-column: auto;
  }
}
@media (max-width: 767px) {
  .workout-form-meta {
    grid-template-columns: 1fr;
  }
}

/* Equipamentos — cards */
.equipment-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.equipment-card {
  border: 1px solid var(--sap-border-light);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.equipment-card--inactive {
  opacity: 0.75;
}
.equipment-card-photo {
  aspect-ratio: 4 / 3;
  background: var(--sap-bg-filter);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0.5rem;
  border-bottom: 1px solid var(--sap-border-light);
}
.equipment-card-photo img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center center;
}
.equipment-card-photo-placeholder {
  font-size: 2.5rem;
  color: var(--sap-text-muted);
}
.equipment-card-body {
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}
.equipment-card-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--sap-title);
}
.equipment-card-meta {
  margin: 0;
  font-size: 0.8125rem;
}
.equipment-card-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--sap-border-light);
}
.equipment-card-meta dt {
  margin: 0;
  color: var(--sap-text-secondary);
  font-weight: 500;
}
.equipment-card-meta dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}
.equipment-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.35rem;
}
.equipment-card-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.equipment-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--sap-text-muted);
  padding: 2rem;
}
.equipment-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}
.equipment-form-photo {
  grid-column: span 2;
}
.equipment-form-active {
  display: flex;
  align-items: flex-end;
}
.equipment-form-preview {
  width: 160px;
  height: 120px;
  border: 1px solid var(--sap-border-light);
  border-radius: var(--radius);
  background: var(--sap-bg-filter);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
  margin-bottom: 0.5rem;
  overflow: hidden;
}
.equipment-form-preview img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center center;
}
.equipment-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
@media (max-width: 991px) {
  .equipment-form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .equipment-form-photo {
    grid-column: span 2;
  }
}
@media (max-width: 575px) {
  .equipment-form-grid {
    grid-template-columns: 1fr;
  }
  .equipment-form-photo {
    grid-column: auto;
  }
}

/* Manutenção */
.maintenance-form-meta .workout-form-field--title {
  grid-column: 1 / 3;
}
.maintenance-approval-panel {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--sap-border-light);
  border-radius: var(--radius);
  background: var(--sap-bg-filter);
}
.maintenance-approval-panel h4 {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
}
.maintenance-approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.maintenance-complete-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--sap-border-light);
}
.maintenance-status-readonly {
  font-size: 0.8125rem;
  color: var(--sap-text-secondary);
  padding: 0.5rem 0;
}
.perm-group-header,
.perm-module-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.perm-collapse-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--sap-text-muted);
  border-radius: var(--radius);
  cursor: pointer;
}
.perm-collapse-btn:hover {
  background: var(--sap-blue-light);
  color: var(--sap-blue);
}
.perm-collapse-btn--sub {
  margin-left: 0.35rem;
}
.perm-collapse-body.is-collapsed {
  display: none;
}
.perm-collapse-body--inner {
  padding-left: 1.75rem;
}
.profile-module-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.profile-module-tag,
.profile-branch-tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}
.profile-module-tag {
  background: var(--sap-blue-light);
  color: var(--sap-blue);
}
.profile-branch-tag {
  background: #e8f5e9;
  color: #2e7d32;
}
.portal-dl {
  display: grid;
  grid-template-columns: minmax(8rem, 35%) 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
}
.portal-dl dt {
  margin: 0;
  color: var(--sap-text-muted);
  font-size: 0.8125rem;
}
.portal-dl dd {
  margin: 0;
  font-weight: 600;
}
.shell-nav-portal-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  color: var(--sap-text);
  text-decoration: none;
  font-weight: 600;
}
.shell-nav-portal-link.active,
.shell-nav-portal-link:hover {
  background: var(--sap-blue-light);
  color: var(--sap-blue);
}
.perm-master-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  flex: 1;
  min-width: 0;
}
.perm-master-label input[type="checkbox"] {
  flex-shrink: 0;
  margin: 0;
  cursor: pointer;
}
.perm-group-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--sap-text-muted);
  margin: 0.75rem 0 0.35rem;
  letter-spacing: 0.03em;
}
.perm-group-title:first-child { margin-top: 0; }
.perm-module-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--sap-text);
  margin: 0.5rem 0 0.25rem;
  padding-left: 0.25rem;
  border-left: 3px solid var(--sap-blue);
}
.perm-module-title.perm-master-label {
  padding-left: 0.5rem;
}
.perm-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  margin-bottom: 0.35rem;
  cursor: pointer;
  padding-left: 0.5rem;
}

/* Ícones Bootstrap */
[class^="bi-"]::before,
[class*=" bi-"]::before {
  display: inline-block;
  font-family: "bootstrap-icons" !important;
}
