/*
 * Tema Nova Era — mesmo estilo clean do ExxorBuild (sidebar grafite, topo branco,
 * cards com borda fina). O CSS do Filament fica em @layer, então estas regras
 * (fora de camada) prevalecem sem precisar de !important.
 */
:root {
  --ne-bg: #f4f5f7;
  --ne-surface: #ffffff;
  --ne-surface-2: #f8f9fb;
  --ne-line: #e3e6eb;
  --ne-line-2: #d3d8df;
  --ne-text: #16202c;
  --ne-text-2: #4a5563;
  --ne-muted: #7a8494;
  --ne-ink: #16202c;
  --ne-ink-2: #223041;
  --ne-ink-on: #2c3c51;
  --ne-brand: #1479c9;
  --ne-brand-light: #5fb0ee;
  --ne-radius: 10px;
  --ne-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --sidebar-width: 16.5rem;
}

/* ---------- Base ---------- */
.fi-body { background: var(--ne-bg); color: var(--ne-text); font-size: 14px; }
.fi-main { padding-inline: 24px; }
.fi-page { padding-block: 20px 32px; }

/* ---------- Sidebar ---------- */
.fi-sidebar { background: var(--ne-ink); }
.fi-sidebar.fi-sidebar-open { box-shadow: none; }
.fi-body-has-topbar .fi-sidebar-header,
.fi-sidebar-header {
  background: var(--ne-ink);
  box-shadow: none;
  border-bottom: 1px solid #2b3a4d;
  padding-inline: 18px;
}
.fi-sidebar-nav { padding: 14px 12px 24px; row-gap: 6px; }
.fi-sidebar-nav-groups { row-gap: 4px; margin-inline: 0; }
.fi-sidebar-group-btn { padding: 14px 10px 4px; }
.fi-sidebar-group-label {
  color: #6f7d90;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  line-height: 1.4;
}
.fi-sidebar-group-btn .fi-icon,
.fi-sidebar-group-collapse-btn { color: #6f7d90; }
.fi-sidebar-group-items { row-gap: 1px; }
.fi-sidebar-item-btn {
  justify-content: flex-start;
  padding: 7px 10px;
  border-radius: 8px;
}
.fi-sidebar-item-btn > .fi-icon { color: #8b97a7; width: 18px; height: 18px; }
.fi-sidebar-item-label { color: #c9d1db; font-size: 13.5px; font-weight: 500; }
@media (hover: hover) {
  .fi-sidebar-item.fi-sidebar-item-has-url > .fi-sidebar-item-btn:hover { background: var(--ne-ink-2); }
  .fi-sidebar-item.fi-sidebar-item-has-url > .fi-sidebar-item-btn:hover .fi-sidebar-item-label { color: #fff; }
}
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn { background: var(--ne-ink-on); }
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn > .fi-icon { color: var(--ne-brand-light); }
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn > .fi-sidebar-item-label { color: #fff; }
.fi-sidebar-item-badge-ctn .fi-badge {
  background: var(--ne-brand);
  color: #fff;
  box-shadow: none;
  font-weight: 700;
  min-width: 20px;
  justify-content: center;
}
.fi-sidebar-item-badge-ctn .fi-badge.fi-color-danger { background: #dc4c4c; }
.fi-sidebar-footer { border-color: #2b3a4d; }
.fi-sidebar .fi-icon-btn { color: #8b97a7; }
.fi-sidebar .fi-icon-btn:hover { background: var(--ne-ink-2); color: #fff; }

/* Logo: versão clara sobre o grafite (desktop), normal no login e no celular */
.ne-logo { display: block; height: 2.1rem; width: auto; }
.ne-logo-escuro { display: none; }
.fi-sidebar .ne-logo-claro { display: none; }
.fi-sidebar .ne-logo-escuro { display: block; }
.fi-simple-layout .ne-logo { height: 2.6rem; margin: 0 auto 10px; }

/* ---------- Topbar ---------- */
.fi-topbar {
  background: var(--ne-surface);
  box-shadow: none;
  border-bottom: 1px solid var(--ne-line);
}
.fi-topbar .fi-input-wrp { background: var(--ne-surface-2); }

/* No desktop o trecho do topo acima da sidebar fica grafite, como uma coluna só */
@media (min-width: 64rem) {
  .fi-body {
    --ne-coluna: var(--sidebar-width);
  }
  .fi-body:has(.fi-sidebar:not(.fi-sidebar-open)) {
    --ne-coluna: var(--collapsed-sidebar-width, 4.5rem);
  }
  .fi-topbar {
    border-bottom: 0;
    background:
      linear-gradient(to right, #2b3a4d var(--ne-coluna), var(--ne-line) var(--ne-coluna)) bottom / 100% 1px no-repeat,
      linear-gradient(to right, var(--ne-ink) var(--ne-coluna), var(--ne-surface) var(--ne-coluna));
  }
  .fi-topbar-start { width: calc(var(--ne-coluna) - 16px); }
  .fi-topbar-start .ne-logo-claro { display: none; }
  .fi-topbar-start .ne-logo-escuro { display: block; }
  .fi-topbar-start .fi-icon-btn { color: #8b97a7; }
  .fi-topbar-start .fi-icon-btn:hover { background: var(--ne-ink-2); color: #fff; }
}

/* ---------- Cabeçalho da página ---------- */
.fi-header { margin-bottom: 4px; }
.fi-header-heading { font-size: 22px; font-weight: 700; letter-spacing: -.01em; color: var(--ne-text); }
.fi-header-subheading { color: var(--ne-muted); font-size: 13.5px; }
.fi-breadcrumbs-item-label { color: var(--ne-muted); font-size: 13px; }

/* ---------- Cards (seções, tabelas, widgets) ---------- */
.fi-section:not(.fi-section-not-contained),
.fi-ta-ctn,
.fi-wi-stats-overview-stat,
.fi-fo-repeater-item,
.fi-modal-window {
  background: var(--ne-surface);
  border: 1px solid var(--ne-line);
  border-radius: var(--ne-radius);
  box-shadow: var(--ne-shadow);
}
.fi-section-header { padding: 14px 20px; }
.fi-section-header-heading { font-size: 15px; font-weight: 650; }
.fi-section-content-ctn { border-color: var(--ne-line); }
.fi-section-content { padding: 18px 20px; }

/* KPIs */
.fi-wi-stats-overview-stat { padding: 16px 18px; }
.fi-wi-stats-overview-stat-label { color: var(--ne-muted); font-size: 12.5px; font-weight: 500; }
.fi-wi-stats-overview-stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.fi-wi-stats-overview-stat-description { font-size: 12.5px; }

/* ---------- Tabelas ---------- */
.fi-ta-header-cell {
  background: var(--ne-surface-2);
  color: var(--ne-text-2);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding-block: 9px;
  white-space: nowrap;
}
.fi-ta-header-cell-sort-btn { color: var(--ne-text-2); }
.fi-ta-table > thead { border-bottom: 1px solid var(--ne-line); }
.fi-ta-row { border-color: var(--ne-line); }
.fi-ta-row:hover > td { background: #fafbfc; }
.fi-ta-cell { font-size: 13.5px; }
.fi-ta-cell .fi-ta-text-item { padding-block: 10px; }
.fi-ta-summary-row > td,
.fi-ta-summary-header-row > td { background: var(--ne-surface-2); font-weight: 700; }
.fi-ta-header-toolbar { border-color: var(--ne-line); }
.fi-ta-content-ctn, .fi-ta-main { border-color: var(--ne-line); }

/* ---------- Badges em pílula ---------- */
.fi-badge {
  border-radius: 20px;
  box-shadow: none;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
}

/* ---------- Abas ---------- */
.fi-tabs {
  background: var(--ne-surface);
  border: 1px solid var(--ne-line);
  border-radius: var(--ne-radius);
  box-shadow: var(--ne-shadow);
}
.fi-tabs-item-label { font-size: 13.5px; }

/* ---------- Botões e campos ---------- */
.fi-btn { border-radius: 8px; font-weight: 600; font-size: 13.5px; }
.fi-input-wrp { border-radius: 8px; }

/* ---------- Login ---------- */
.fi-simple-layout { background: var(--ne-bg); }
.fi-simple-main {
  border: 1px solid var(--ne-line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, .08);
}
.fi-simple-header-heading { font-size: 20px; font-weight: 700; }

/* ---------- Sidebar: rolagem discreta (só aparece se o menu não couber) ---------- */
.fi-sidebar-nav {
  scrollbar-gutter: auto;
  scrollbar-width: thin;
  scrollbar-color: #2f3f54 transparent;
}
.fi-sidebar-nav::-webkit-scrollbar { width: 6px; }
.fi-sidebar-nav::-webkit-scrollbar-thumb { background: #2f3f54; border-radius: 6px; }
.fi-sidebar-nav::-webkit-scrollbar-track { background: transparent; }

/* ---------- Tabelas: quebrar texto em vez de rolar para o lado ---------- */
.fi-ta-cell .fi-ta-text-item,
.fi-ta-cell .fi-ta-text { white-space: normal; }
.fi-wi-widget .fi-ta-content { overflow-x: visible; }
.fi-wi-widget .fi-ta-cell, .fi-wi-widget .fi-ta-header-cell { padding-inline: 12px; }

/* ---------- Filtros do painel ---------- */
.fi-page-header-main-ctn > .fi-sc-form,
.fi-page .fi-sc-form[wire\:partial="table-filters-form"] {
  background: var(--ne-surface);
  border: 1px solid var(--ne-line);
  border-radius: var(--ne-radius);
  box-shadow: var(--ne-shadow);
  padding: 14px 18px;
}

/* ---------- Listas com barra (rankings do painel) ---------- */
.ne-lista .fi-section-content { padding: 6px 20px 16px; }
.ne-lista-itens { list-style: none; margin: 0; padding: 0; }
.ne-lista-itens > li + li { border-top: 1px solid #eef0f3; }
.ne-lista-linha { display: block; padding: 10px 0; color: inherit; text-decoration: none; }
a.ne-lista-linha:hover .ne-lista-rotulo { color: var(--ne-brand); }
.ne-lista-topo { display: flex; align-items: baseline; gap: 12px; }
.ne-lista-rotulo {
  flex: 1; min-width: 0;
  font-size: 13.5px; font-weight: 500; color: var(--ne-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ne-lista-valor { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ne-text); }
.ne-lista-barra { height: 7px; background: #eceef1; border-radius: 6px; overflow: hidden; margin-top: 6px; }
.ne-lista-barra > span { display: block; height: 100%; background: var(--ne-brand); border-radius: 6px; }
.ne-lista-detalhe { font-size: 12px; color: var(--ne-muted); margin-top: 4px; }
.ne-lista-rodape { font-size: 12px; color: var(--ne-muted); margin: 10px 0 0; padding-top: 10px; border-top: 1px solid #eef0f3; }
.ne-lista-vazio { color: var(--ne-muted); font-size: 13.5px; margin: 8px 0; }

/* KPIs clicáveis */
a.fi-wi-stats-overview-stat:hover { border-color: var(--ne-line-2); }

/* ---------- Ficha do cliente: cartões de resumo ---------- */
.ne-cartao .fi-section-content { padding: 14px 16px; }
.ne-cartao .fi-in-entry-label, .ne-cartao .fi-in-entry-wrp-label { color: var(--ne-muted); font-size: 12.5px; font-weight: 500; }
.ne-cartao .fi-in-text-item { font-size: 18px; white-space: nowrap; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

/* Itens de endereço/contato no formulário */
.fi-fo-repeater-item-header { padding-block: 10px; }
.fi-fo-repeater-item-header-label { font-weight: 600; font-size: 13.5px; }

/* ---------- Produtos: foto na lista ---------- */
.ne-foto-lista { border-radius: 8px; object-fit: cover; border: 1px solid var(--ne-line); background: #fff; }

/* ---------- Catálogo ---------- */
.ne-card-produto { display: flex; flex-direction: column; height: 100%; }
.ne-card-foto { position: relative; aspect-ratio: 1 / 1; background: #fff; border-bottom: 1px solid var(--ne-line); border-radius: 8px 8px 0 0; overflow: hidden; display: grid; place-items: center; }
.ne-card-foto img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.ne-card-foto img.ne-card-sem-foto { width: 45%; height: 45%; opacity: .8; }
.ne-card-qtd { position: absolute; right: 8px; bottom: 8px; background: rgba(22, 32, 44, .75); color: #fff; font-size: 11px; font-weight: 600; border-radius: 10px; padding: 1px 8px; }
.ne-card-tag { position: absolute; left: 8px; top: 8px; background: var(--ne-brand); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 8px; }
.ne-card-tag-laranja { background: #d97706; }
.ne-card-tag-cinza { background: #7a8494; }
.ne-card-corpo { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.ne-card-ref { font-size: 11.5px; color: var(--ne-muted); }
.ne-card-nome { font-size: 13.5px; font-weight: 600; color: var(--ne-text); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.ne-card-preco { margin-top: 4px; display: flex; align-items: baseline; gap: 6px; }
.ne-card-preco strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.ne-card-preco span, .ne-card-emb { font-size: 11.5px; color: var(--ne-muted); }
.fi-ta-content-grid .fi-ta-record { padding: 0; overflow: hidden; }
.fi-ta-content-grid .fi-ta-record-content { padding: 0; }

/* ---------- Fotos sem produto ---------- */
.ne-galeria-soltas { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.ne-solta { background: var(--ne-surface); border: 1px solid var(--ne-line); border-radius: var(--ne-radius); box-shadow: var(--ne-shadow); overflow: hidden; display: flex; flex-direction: column; }
.ne-solta-foto { display: grid; place-items: center; aspect-ratio: 1 / 1; background: #fff; border-bottom: 1px solid var(--ne-line); }
.ne-solta-foto img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.ne-solta-nome { font-size: 11.5px; color: var(--ne-muted); padding: 8px 10px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ne-solta-acoes { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px 10px; }

/* ---------- Pedido: totais abaixo dos itens ---------- */
.ne-totais-pedido { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) 1.4fr; gap: 10px; margin-top: 4px; }
.ne-totais-pedido > div { border: 1px solid var(--ne-line); border-radius: 8px; padding: 8px 12px; background: var(--ne-surface-2); }
.ne-totais-pedido span { display: block; font-size: 11.5px; color: var(--ne-muted); }
.ne-totais-pedido strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.ne-totais-pedido .ne-totais-destaque { background: var(--ne-ink); border-color: var(--ne-ink); }
.ne-totais-pedido .ne-totais-destaque span { color: #c9d1db; }
.ne-totais-pedido .ne-totais-destaque strong { color: #fff; font-size: 18px; }
@media (max-width: 64rem) { .ne-totais-pedido { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Portal: rascunho em aberto no catálogo ---------- */
.ne-carrinho { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border: 1px solid #bfdbfe; background: #eff6ff; border-radius: var(--ne-radius); }
.ne-carrinho strong { display: block; font-size: 14px; color: var(--ne-text); }
.ne-carrinho span { font-size: 12.5px; color: var(--ne-muted); }
.fi-ta-content-grid .fi-ta-record .fi-ta-actions { padding: 0 12px 12px; }

/* ---------- Comissões ---------- */
.ne-comissao-topo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ne-comissao-mes { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.ne-comissao-mes select { border: 1px solid var(--ne-line); border-radius: 8px; padding: 6px 30px 6px 10px; font-size: 13.5px; background-color: var(--ne-surface); }
.ne-aviso-saneamento { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 6px 10px; }
.ne-aviso-saneamento b { font-weight: 600; margin-left: 4px; }
.ne-cartoes-comissao { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.ne-cartoes-comissao > div, .ne-vendedor-card { background: var(--ne-surface); border: 1px solid var(--ne-line); border-radius: var(--ne-radius); box-shadow: var(--ne-shadow); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.ne-cartoes-comissao span { font-size: 12px; color: var(--ne-muted); }
.ne-cartoes-comissao strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.ne-cartoes-comissao small, .ne-vendedor-linha { font-size: 11.5px; color: var(--ne-muted); }
.ne-vendedores-comissao { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ne-vendedor-nome { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ne-vendedor-valor { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ne-var-alta { color: #15803d !important; }
.ne-var-baixa { color: #b91c1c !important; }
.ne-var-neutra { color: var(--ne-muted); }
@media (max-width: 64rem) { .ne-cartoes-comissao { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- NF-e: conferência antes de emitir ---------- */
.ne-nfe-topo { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.ne-nfe-info { font-size: 12.5px; color: var(--ne-muted); }
.ne-nfe-pendencias { border: 1px solid #fecaca; background: #fef2f2; color: #991b1b; border-radius: var(--ne-radius); padding: 12px 16px; font-size: 13px; }
.ne-nfe-pendencias ul { margin: 6px 0 0 18px; list-style: disc; }
.ne-nfe-rejeicao { border: 1px solid #fde68a; background: #fffbeb; color: #92400e; border-radius: var(--ne-radius); padding: 10px 14px; font-size: 13px; }
.ne-nfe-grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ne-nfe-dl { display: grid; grid-template-columns: 120px 1fr; gap: 4px 12px; font-size: 13px; }
.ne-nfe-dl dt { color: var(--ne-muted); }
.ne-nfe-dl small { color: var(--ne-muted); }
.ne-nfe-dup { display: inline-block; margin: 0 8px 4px 0; padding: 1px 8px; border: 1px solid var(--ne-line); border-radius: 10px; font-size: 12px; }
.ne-nfe-tabela { overflow-x: auto; }
.ne-nfe-tabela table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ne-nfe-tabela th, .ne-nfe-tabela td { border-bottom: 1px solid var(--ne-line); padding: 6px 8px; text-align: left; vertical-align: top; }
.ne-nfe-tabela th { font-size: 11px; text-transform: uppercase; color: var(--ne-muted); }
.ne-nfe-tabela .n { text-align: right; white-space: nowrap; }
.ne-nfe-tabela small { color: var(--ne-muted); }
.ne-nfe-tabela tfoot td { font-weight: 700; }
.ne-nfe-tabela .ne-erro { color: #b91c1c; font-weight: 600; }
.ne-nfe-infcpl { font-size: 12.5px; white-space: pre-line; }
.ne-link { color: var(--ne-brand); }
@media (max-width: 64rem) { .ne-nfe-grade { grid-template-columns: 1fr; } }

/* ---------- Inventário ---------- */
.ne-inv-busca { border: 1px solid var(--ne-line); border-radius: 8px; padding: 6px 10px; font-size: 13.5px; background: var(--ne-surface); min-width: 220px; }
.ne-inv-qtd { width: 90px; text-align: right; border: 1px solid var(--ne-line); border-radius: 6px; padding: 4px 8px; font-size: 13px; }


/* ---------- Contábil: DRE ---------- */
.ne-dre table { font-size: 12px; }
.ne-dre td:first-child { white-space: nowrap; }
.ne-dre tr.ne-dre-subtotal td { font-weight: 700; background: var(--ne-surface-2); }
.ne-dre tr.ne-dre-total td { font-weight: 800; background: var(--ne-ink); color: #fff; }
.ne-dre tr.ne-dre-total td.ne-var-baixa { color: #fca5a5 !important; }


/* ---------- Pedido: linha de andamento (status só leitura) ---------- */
.ne-andamento { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.ne-andamento small { width: 100%; font-size: 12px; font-weight: 500; color: var(--ne-text-2); margin-bottom: 2px; }
.ne-andamento span { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--ne-line); }
.ne-andamento .ne-and-ok { background: #ecfdf3; border-color: #bbf7d0; color: #15803d; }
.ne-andamento .ne-and-atual { background: var(--ne-brand); border-color: var(--ne-brand); color: #fff; font-weight: 600; }
.ne-andamento .ne-and-prox { color: var(--ne-muted); }
.ne-andamento .ne-and-seta { border: 0; padding: 0; color: var(--ne-muted); }
.ne-andamento .ne-and-fim { background: #fef2f2; border-color: #fecaca; color: #b91c1c; font-weight: 600; }
