/* ============================================================
   KONTU — design system (docs/DESIGN-SYSTEM.md)
   CSS partilhado: Filament (painel) + views públicas.
   ============================================================ */

:root {
  /* base navy/slate — o azul-céu é a cor de destaque (família Nexa) */
  --nb-teal-900: #0C1730; /* rail de navegação desktop (navy profundo) */
  --nb-teal-800: #1A2E5A; /* cor primária: header mobile, botões primários (navy) */
  --nb-teal-600: #1054A0; /* hover/estado activo (azul médio) */
  --nb-teal-100: #AEBBD4; /* ícones sobre fundo escuro */
  --nb-teal-50:  #EAF1FB; /* texto sobre escuro, fundos subtis */
  --nb-coral-600:#0EA5E9; /* acção destacada: FAB +, logomarca (azul-céu) */
  --nb-coral-50: #E3F3FC; /* fundo de ícone de despesa */
  --nb-ink:      #0E1B33; /* texto principal (navy-ink) */
  --nb-muted:    #64748B; /* texto secundário (slate) */
  --nb-border:   rgba(16,31,61,.12);
  --nb-bg:       #F6F8FB; /* fundo de página (cool) */
  --nb-card:     #FFFFFF;
  --nb-radius:   12px;

  /* estados: pill fundo/texto (semânticos — mantêm-se) */
  --nb-paid-bg: #EAF3DE;    --nb-paid-fg: #27500A;
  --nb-overdue-bg: #FCEBEB; --nb-overdue-fg: #791F1F;
  --nb-partial-bg: #FAEEDA; --nb-partial-fg: #633806;
  --nb-draft-bg: #EEF2F7;   --nb-draft-fg: #475569;
}

/* ---------- Base ---------- */
.fi-body, body {
  background-color: var(--nb-bg);
  color: var(--nb-ink);
}

/* Pesos: apenas 400 e 500 — nunca 600/700 */
.fi-header-heading,
.fi-section-header-heading,
.fi-modal-heading,
.fi-ta-header-cell-label,
.fi-btn-label,
.fi-badge,
.fi-tabs-item-label,
.fi-sidebar-item-label,
.fi-sidebar-group-label,
.fi-wi-stats-overview-stat-value,
.fi-fo-field-wrp-label,
strong, b, th {
  font-weight: 500 !important;
}

.fi-header-heading { font-size: 22px !important; }

/* Cabeçalho de página: o número do documento (COT-000012) nunca parte a meio;
   quando falta espaço, as acções descem para uma linha própria em vez de transbordar */
.fi-header { flex-wrap: wrap; row-gap: 12px; }
.fi-header-heading { white-space: nowrap; }
.fi-header > div:has(.fi-ac),
.fi-header .fi-ac { flex-wrap: wrap; min-width: 0; }

/* Números monetários alinham na vertical */
.fi-ta-cell, .fi-in-entry, .fi-wi-stats-overview-stat-value {
  font-variant-numeric: tabular-nums;
}

/* ---------- Rail lateral (desktop): teal-900 ---------- */
.fi-sidebar, .fi-sidebar-header {
  background-color: var(--nb-teal-900) !important;
  border-color: transparent !important;
}

.fi-sidebar-item-label,
.fi-sidebar-group-label {
  color: var(--nb-teal-50) !important;
}

.fi-sidebar-item-icon,
.fi-sidebar-group-collapse-button svg,
.fi-sidebar-group-button svg {
  color: var(--nb-teal-100) !important;
}

.fi-sidebar-item-button:hover,
.fi-sidebar-group-button:hover {
  background-color: var(--nb-teal-800) !important;
  border-radius: var(--nb-radius);
}

.fi-sidebar-item-active .fi-sidebar-item-button {
  background-color: var(--nb-teal-600) !important;
  border-radius: var(--nb-radius);
}

.fi-sidebar-item-active .fi-sidebar-item-label,
.fi-sidebar-item-active .fi-sidebar-item-icon {
  color: #fff !important;
}

/* ---------- Cartões e tabelas ---------- */
.fi-section,
.fi-ta-ctn,
.fi-wi-widget > .fi-section {
  background-color: var(--nb-card);
  border: 0.5px solid var(--nb-border) !important;
  border-radius: var(--nb-radius) !important;
  box-shadow: none !important;
}

/* linhas vencidas com fundo subtil */
.nb-row-overdue { background-color: rgba(252, 235, 235, .45) !important; }

/* ---------- Pills de estado ---------- */
.fi-badge {
  border-radius: 999px !important;
  font-size: 11px !important;
  border: none !important;
}

.fi-badge.fi-color-success { background-color: var(--nb-paid-bg) !important; color: var(--nb-paid-fg) !important; }
.fi-badge.fi-color-danger  { background-color: var(--nb-overdue-bg) !important; color: var(--nb-overdue-fg) !important; }
.fi-badge.fi-color-warning { background-color: var(--nb-partial-bg) !important; color: var(--nb-partial-fg) !important; }
.fi-badge.fi-color-gray    { background-color: var(--nb-draft-bg) !important; color: var(--nb-draft-fg) !important; }
.fi-badge.fi-color-info    { background-color: var(--nb-teal-50) !important; color: var(--nb-teal-800) !important; }

/* ---------- Botões ---------- */
.fi-btn {
  border-radius: var(--nb-radius) !important;
}

@media (max-width: 1023px) {
  /* alvo de toque — só em mobile real, nunca dentro da vista dividida */
  html:not(.nb-embed) .fi-btn { min-height: 44px; }
}

/* ---------- Bottom navigation (mobile) ---------- */
.nb-bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  background: var(--nb-card);
  border-top: 0.5px solid var(--nb-border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}

.nb-bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  min-height: 44px;
  font-size: 11px;
  color: var(--nb-muted);
  text-decoration: none;
}

.nb-bottom-nav a.nb-active { color: var(--nb-teal-800); }

.nb-bottom-nav svg { width: 22px; height: 22px; }

.nb-bottom-nav .nb-fab {
  transform: translateY(-14px);
  background: var(--nb-coral-600);
  color: #fff;
  border-radius: 999px;
  width: 52px;
  height: 52px;
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(14, 165, 233, .35);
}

.nb-bottom-nav .nb-fab svg { width: 26px; height: 26px; }

@media (min-width: 1024px) {
  .nb-bottom-nav { display: none; }
}

@media (max-width: 1023px) {
  html:not(.nb-embed) .fi-main { padding-bottom: 84px; } /* espaço para a bottom nav */

  /* Sem overflow horizontal: nada excede o ecrã; tabelas fazem
     scroll dentro do próprio cartão */
  html:not(.nb-embed) body { overflow-x: hidden; }
  html:not(.nb-embed) .fi-main,
  html:not(.nb-embed) .fi-wi,
  html:not(.nb-embed) .fi-wi > *,
  html:not(.nb-embed) .fi-section {
    max-width: 100% !important;
    min-width: 0 !important;
  }
  html:not(.nb-embed) .fi-wi { grid-template-columns: minmax(0, 1fr) !important; }
  html:not(.nb-embed) .fi-ta-ctn,
  html:not(.nb-embed) .fi-ta-content {
    max-width: calc(100vw - 32px);
    overflow-x: auto;
  }
  .nb-mobile-quick-item { min-width: 0; }

  /* Em mobile não há sidebar (navegação = bottom nav + ecrã Mais, como no Zoho app) */
  html:not(.nb-embed) .fi-sidebar,
  html:not(.nb-embed) .fi-sidebar-close-overlay,
  html:not(.nb-embed) .fi-topbar-open-sidebar-btn,
  html:not(.nb-embed) .fi-topbar-close-sidebar-btn,
  html:not(.nb-embed) .fi-topbar-open-database-notifications-btn {
    display: none !important;
  }
}

/* ---------- Sidebar: esconder o scrollbar claro que "flutua" no bordo ----------
   Quando a navegação é mais alta que a janela, a sidebar ganha um scrollbar
   claro do sistema encostado ao seu bordo direito (fundo escuro) — fica
   estranho. Escondemo-lo mantendo o scroll por roda/trackpad, para ficar só
   um scrollbar visível (o do conteúdo). */
.fi-sidebar,
.fi-sidebar-nav,
.fi-sidebar-nav-groups {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.fi-sidebar::-webkit-scrollbar,
.fi-sidebar-nav::-webkit-scrollbar,
.fi-sidebar-nav-groups::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* ---------- Estados estilo Zoho (texto colorido, caixa alta) ---------- */
.nb-status {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px !important;
}

/* ---------- Banner "O que vem a seguir?" ---------- */
.nb-next-step {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--nb-teal-50);
  border: 0.5px solid var(--nb-border);
  border-radius: var(--nb-radius);
  padding: 14px 18px;
}

.nb-next-step-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--nb-teal-600);
}

.nb-next-step-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--nb-ink);
}

.nb-next-step-title {
  font-weight: 500;
  color: var(--nb-teal-800);
}

.nb-next-step-cta {
  margin-left: auto;
  flex-shrink: 0;
  background: var(--nb-teal-800);
  color: var(--nb-teal-50);
  border-radius: var(--nb-radius);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  min-height: 34px;
}

.nb-next-step-cta:hover { background: var(--nb-teal-600); }

/* Controlos de dispensar (o CTA principal vive no cabeçalho do documento) */
.nb-next-step-hide {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--nb-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.nb-next-step-hide:hover { color: var(--nb-ink); }

.nb-next-step-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  line-height: 1;
  font-size: 20px;
  color: var(--nb-muted);
  border-radius: 6px;
}
.nb-next-step-close:hover { color: var(--nb-ink); background: rgba(0, 0, 0, 0.05); }

[x-cloak] { display: none !important; }

@media (max-width: 1023px) {
  html:not(.nb-embed) .nb-next-step { flex-wrap: wrap; }
  html:not(.nb-embed) .nb-next-step-cta { margin-left: 0; width: 100%; min-height: 44px; }
}

/* No embed, o banner é sempre uma linha compacta (estilo Zoho) */
.nb-embed .nb-next-step { flex-wrap: nowrap; padding: 10px 14px; }
.nb-embed .nb-next-step-cta { white-space: nowrap; }

/* ---------- PDF embebido ---------- */
.nb-pdf-embed iframe {
  width: 100%;
  height: 78vh;
  border: 0.5px solid var(--nb-border);
  border-radius: var(--nb-radius);
  background: #EDEFF3; /* fundo neutro da pré-visualização */
}

/* ---------- Timeline de actividade ---------- */
.nb-timeline {
  list-style: none;
  margin: 0;
  padding: 4px 0 4px 4px;
}

.nb-timeline li {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 0 0 22px 0;
}

.nb-timeline li:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 14px;
  bottom: 0;
  width: 1px;
  background: var(--nb-border);
}

.nb-timeline-dot {
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--nb-teal-600);
  border: 2px solid var(--nb-teal-50);
}

.nb-timeline-title { font-weight: 500; font-size: 14px; }
.nb-timeline-detail { font-size: 12px; color: var(--nb-muted); margin-top: 1px; }
.nb-timeline-date { font-size: 11px; color: var(--nb-muted); margin-top: 2px; }

/* ---------- Botão "+" global no topbar ---------- */
.nb-quick { position: relative; margin-inline-start: 8px; }

.nb-quick-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--nb-coral-600);
  color: #fff;
}

.nb-quick-btn:hover { filter: brightness(1.08); }
.nb-quick-btn svg { width: 20px; height: 20px; }

.nb-quick-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  min-width: 200px;
  background: var(--nb-card);
  border: 0.5px solid var(--nb-border);
  border-radius: var(--nb-radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
  padding: 6px;
}

.nb-quick-menu a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--nb-ink);
  text-decoration: none;
}

.nb-quick-menu a:hover { background: var(--nb-teal-50); color: var(--nb-teal-800); }

[x-cloak] { display: none !important; }

/* ---------- Footer fixo dos formulários (estilo Zoho) ---------- */
.fi-main form > .fi-form-actions {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--nb-bg) 90%, transparent);
  backdrop-filter: blur(8px);
  border-top: 0.5px solid var(--nb-border);
  padding: 12px 4px;
  margin-top: 4px;
}

@media (max-width: 1023px) {
  html:not(.nb-embed) .fi-main form > .fi-form-actions { bottom: 76px; } /* acima da bottom nav */
}

/* Mobile: barra "Guardar" em grelha compacta (2 colunas) em vez de embrulho
   irregular — ocupa menos ecrã por cima da bottom nav */
@media (max-width: 640px) {
  html:not(.nb-embed) .fi-main form > .fi-form-actions .fi-ac {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  html:not(.nb-embed) .fi-main form > .fi-form-actions .fi-btn { width: 100%; }
}

/* Mobile: banner "O que vem a seguir?" mais compacto — menos padding,
   sem lâmpada, para o conteúdo do documento aparecer mais cedo */
@media (max-width: 640px) {
  .nb-next-step { padding: 10px 14px; gap: 10px; }
  .nb-next-step-icon { display: none; }
  .nb-next-step-body { font-size: 12.5px; }
}

/* Tabs em ecrãs pequenos: sem ícones e mais compactas para caberem todas;
   se mesmo assim não couberem, a barra faz scroll horizontal próprio */
@media (max-width: 640px) {
  .fi-tabs { overflow-x: auto; max-width: 100%; }
  .fi-tabs-item { padding-inline: 10px; white-space: nowrap; }
  .fi-tabs-item-icon { display: none; }
}

/* ---------- Galeria de modelos de PDF (Perfil da organização) ---------- */
.nb-tpl-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 460px;
}
.nb-tpl-card {
  display: block;
  border: 1.5px solid var(--nb-border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.nb-tpl-card:hover { border-color: var(--nb-teal-600); }
.nb-tpl-card:has(input:checked) {
  border-color: var(--nb-coral-600);
  box-shadow: 0 0 0 1px var(--nb-coral-600);
}
.nb-tpl-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.nb-tpl-thumb { display: block; background: #EDEFF3; padding: 10px 10px 0; }
.nb-tpl-thumb img {
  display: block;
  width: 100%;
  border: 0.5px solid var(--nb-border);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}
.nb-tpl-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-top: 0.5px solid var(--nb-border);
}
.nb-tpl-name { font-size: 13px; }
.nb-tpl-card:has(input:checked) .nb-tpl-name { font-weight: 500; }
.nb-tpl-preview { font-size: 12px; color: var(--nb-coral-600); white-space: nowrap; }
.nb-tpl-preview:hover { text-decoration: underline; }

@media (max-width: 640px) {
  /* card estreito: nome e link empilhados para nada ficar cortado */
  .nb-tpl-foot { flex-direction: column; align-items: flex-start; gap: 2px; }
}

/* ---------- Tabela de itens densa no formulário ---------- */
.fi-fo-repeater .fi-fo-repeater-item {
  border-radius: 8px !important;
  box-shadow: none !important;
  border: 0.5px solid var(--nb-border);
}

.fi-fo-repeater .fi-fo-repeater-item-content { padding: 10px 12px !important; }

.fi-fo-repeater .fi-input { font-size: 13px; }

/* ---------- Dashboard mobile (design system: hero teal + criação rápida) ---------- */
.nb-mobile-home { display: none; }

@media (max-width: 1023px) {
  html:not(.nb-embed) .nb-mobile-home { display: block; }

  /* em mobile, o hero substitui a linha de KPIs */
  html:not(.nb-embed) .fi-main:has(.nb-mobile-home) .fi-wi-stats-overview { display: none; }
}

.nb-mobile-hero {
  background: var(--nb-teal-800);
  border-radius: var(--nb-radius);
  padding: 20px 18px;
  color: var(--nb-teal-50);
}

.nb-mobile-greeting { font-size: 14px; color: var(--nb-teal-100); }

.nb-mobile-label {
  margin-top: 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--nb-teal-100);
}

.nb-mobile-amount {
  font-size: 30px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: #fff;
  margin-top: 2px;
}

.nb-mobile-overdue {
  display: inline-block;
  margin-top: 10px;
  background: var(--nb-coral-600);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
}

.nb-mobile-quick-label {
  margin: 16px 2px 8px;
  font-size: 13px;
  font-weight: 500;
}

.nb-mobile-quick {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.nb-mobile-quick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--nb-card);
  border: 0.5px solid var(--nb-border);
  border-radius: var(--nb-radius);
  padding: 14px 6px;
  min-height: 44px;
  font-size: 12px;
  color: var(--nb-ink);
  text-decoration: none;
}

.nb-mobile-quick-item:active { background: var(--nb-teal-50); }

.nb-mobile-quick-item svg {
  width: 24px;
  height: 24px;
  color: var(--nb-teal-800);
}

/* ---------- Ecrã "Mais" (mobile, estilo Zoho) ---------- */
.nb-more { max-width: 640px; }

.nb-more-group-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--nb-muted);
  margin: 18px 4px 6px;
}

.nb-more-group-label:first-child { margin-top: 0; }

.nb-more-group {
  background: var(--nb-card);
  border: 0.5px solid var(--nb-border);
  border-radius: var(--nb-radius);
  overflow: hidden;
}

.nb-more-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  min-height: 48px;
  font-size: 14px;
  color: var(--nb-ink);
  text-decoration: none;
}

.nb-more-row + .nb-more-row { border-top: 0.5px solid rgba(0, 0, 0, .06); }

.nb-more-row:active, .nb-more-row:hover { background: var(--nb-teal-50); }

.nb-more-icon {
  width: 20px;
  height: 20px;
  color: var(--nb-teal-800);
  flex-shrink: 0;
}

.nb-more-chevron {
  width: 16px;
  height: 16px;
  color: var(--nb-muted);
  margin-left: auto;
}

/* ---------- Vista dividida (estilo Zoho: lista + detalhe) ---------- */
.nb-split {
  display: flex;
  gap: 16px;
  /* Altura ajustada ao espaço real abaixo do cabeçalho da página (~164px do
     topo) + folga, para o split não transbordar o viewport e a PÁGINA não
     ganhar um segundo scrollbar. Só os painéis internos (lista/iframe) fazem
     scroll. dvh acompanha a barra dinâmica do browser em mobile. */
  height: calc(100dvh - 196px);
  min-height: 420px;
}

.nb-split-list {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nb-split-search {
  width: 100%;
  border: 0.5px solid var(--nb-border);
  border-radius: var(--nb-radius);
  background: var(--nb-card);
  padding: 10px 12px;
  font-size: 13px;
}

.nb-split-search:focus {
  outline: 2px solid var(--nb-teal-600);
  outline-offset: 1px;
}

.nb-split-cards {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.nb-card {
  text-align: left;
  background: var(--nb-card);
  border: 0.5px solid var(--nb-border);
  border-radius: var(--nb-radius);
  padding: 10px 12px;
  cursor: pointer;
}

.nb-card:hover { border-color: var(--nb-teal-600); }

.nb-card-active {
  border-color: var(--nb-teal-600);
  background: var(--nb-teal-50);
}

.nb-card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.nb-card-title {
  font-weight: 500;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nb-card-amount {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.nb-card-sub {
  font-size: 11.5px;
  color: var(--nb-muted);
  margin: 2px 0 6px;
}

.nb-pill {
  display: inline-block;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 9px;
}

.nb-pill-success { background: var(--nb-paid-bg); color: var(--nb-paid-fg); }
.nb-pill-danger  { background: var(--nb-overdue-bg); color: var(--nb-overdue-fg); }
.nb-pill-warning { background: var(--nb-partial-bg); color: var(--nb-partial-fg); }
.nb-pill-gray    { background: var(--nb-draft-bg); color: var(--nb-draft-fg); }
.nb-pill-info    { background: var(--nb-teal-50); color: var(--nb-teal-800); }

.nb-split-detail {
  flex: 1;
  min-width: 0;
  background: var(--nb-card);
  border: 0.5px solid var(--nb-border);
  border-radius: var(--nb-radius);
  overflow: hidden;
}

.nb-split-detail iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--nb-bg);
}

.nb-split-empty,
.nb-split-empty-list {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--nb-muted);
  font-size: 13px;
  padding: 24px;
}

@media (max-width: 1023px) {
  .nb-split { height: auto; }
  .nb-split-list { width: 100%; }
  .nb-split-detail { display: none; } /* no telemóvel, o cartão navega para o detalhe */
}

/* ---------- Documento no detalhe: tabela de linhas + resumo (estilo Zoho) ---------- */
.nb-doc-table-wrap { overflow-x: auto; }

.nb-doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.nb-doc-table th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--nb-muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--nb-border);
  background: var(--nb-bg);
}

.nb-doc-table td {
  padding: 9px 10px;
  border-bottom: 0.5px solid rgba(0, 0, 0, .06);
  vertical-align: top;
}

.nb-doc-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.nb-doc-table .muted { color: var(--nb-muted); }

.nb-doc-summary {
  display: flex;
  gap: 32px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.nb-doc-notes {
  flex: 1;
  min-width: 220px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--nb-ink);
}

.nb-doc-notes-label {
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--nb-muted);
  margin-bottom: 4px;
}

.nb-doc-totals {
  width: 320px;
  flex-shrink: 0;
  margin-left: auto;
  font-size: 13.5px;
}

.nb-total-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 10px;
}

.nb-total-row .num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.nb-total-row .muted { color: var(--nb-muted); }

.nb-total-grand {
  background: var(--nb-teal-50);
  color: var(--nb-teal-800);
  font-weight: 500;
  font-size: 15px;
  border-radius: 8px;
  padding: 10px;
  margin: 4px 0;
}

.nb-total-row .nb-danger { color: var(--nb-overdue-fg); font-weight: 500; }
.nb-total-row .nb-success { color: var(--nb-paid-fg); font-weight: 500; }

.nb-total-extenso {
  text-align: right;
  font-size: 11px;
  color: var(--nb-muted);
  padding: 4px 10px 0;
  font-style: italic;
}

/* ---------- Modo embutido (dentro da vista dividida) ---------- */
.nb-embed .fi-sidebar,
.nb-embed .fi-topbar,
.nb-embed .nb-bottom-nav,
.nb-embed .fi-sidebar-open-overlay,
.nb-embed .fi-sidebar-close-overlay {
  display: none !important;
}

.nb-embed .fi-main-ctn,
.nb-embed .fi-layout,
.nb-embed body {
  background: var(--nb-bg) !important;
}

.nb-embed .fi-main-ctn { padding: 0 !important; }

/* Conteúdo embutido centrado como uma folha — proporções à Zoho */
.nb-embed .fi-main {
  padding: 20px 28px 32px !important;
  max-width: 1080px !important;
  margin-inline: auto !important;
}

.nb-embed .fi-header { margin-bottom: 14px; }
.nb-embed .fi-header-heading { font-size: 18px !important; }
.nb-embed .fi-breadcrumbs { display: none; }

/* ---------- Logomarca ---------- */
.nb-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 500;
  color: var(--nb-teal-50);
  letter-spacing: -0.01em;
}

.fi-topbar .nb-brand, .fi-simple-layout .nb-brand { color: var(--nb-ink); }

.nb-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--nb-teal-800) 0%, var(--nb-teal-600) 55%, var(--nb-coral-600) 100%);
  color: #fff;
  font-weight: 500;
  font-size: 16px;
}
