/* ============================================================================
   MARCA — CalculAI
   Carregar SEMPRE depois de theme.css.

   Aqui só entram TOKENS. Componente não se reescreve por aplicação — se um
   componente precisa mudar, ele muda no theme.css, para todas as aplicações.

   Paleta: creme / areia / caramelo, escolhida com o proprietário a partir da
   referência visual do projeto. É uma paleta CLARA, como manda o padrão:
   cansa menos em uso o dia inteiro, imprime melhor e combina com a área
   branca do logo.
   ============================================================================ */

/* ─── Cor principal da aplicação ───────────────────────────────────────────── */
:root {
  --primary:    #8A6642;   /* marrom médio — ação principal, links, seleção */
  --primary-lt: #B08F6C;   /* caramelo — topo do gradiente do botão */
  --primary-dk: #6B4A2C;   /* marrom escuro — hover */
  --accent:     #E9992F;   /* âmbar — destaque sobre fundo escuro */
  --accent-dk:  #B4761A;   /* mesma família, para TEXTO sobre fundo claro */
}

/* ─── Menu lateral — CREME CLARO ───────────────────────────────────────────── */
:root {
  --side-bg1: #FDFAF7;  --side-bg2: #F1E7DC;
  --side-text: #6B5B4A; --side-text-strong: #3C2A1A;
  --side-border: #EADFD3; --side-hover: rgba(107,74,44,.07);
  --side-active-bg: #B08F6C; --side-active-text: #FFFFFF;
  --side-section: #A08F7D;
  --side-logo-bg: #FFFFFF; --side-footer-bg: rgba(107,74,44,.05);

  --login-bg1: #F8F1EA; --login-bg2: #E3D4C4;
}

/* ─── Superfícies quentes ──────────────────────────────────────────────────── */
/* O padrão usa cinza-azulado; aqui o fundo é creme, para a plataforma inteira
   ter a mesma temperatura de cor da identidade. */
:root {
  --bg:         #F8F1EA;
  --card:       #FFFFFF;
  --panel:      #FBF6F1;
  --border:     #EADFD3;
  --text:       #3C2A1A;
  --text-muted: #7A6754;
}

/* O item ativo do menu tem fundo caramelo cheio: o contorno herdado do tema
   ficaria visível como uma borda dupla. */
.nav-item.active { box-shadow: none; }

/* Linha de tabela em destaque acompanha a temperatura do resto. */
.data-table tbody tr:hover { background: #FDFAF7; }

/* ─── Logo ─────────────────────────────────────────────────────────────────── */
.sidebar-logo img { max-height: 46px; }
.login-logo-img   { max-height: 96px; }

/* ─── Complementos de tela ─────────────────────────────────────────────────── */

/* Memória de cálculo — lista numerada com fórmula e valor. */
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; }
.steps li {
  counter-increment: s; position: relative; padding: 11px 0 11px 42px;
  border-bottom: 1px dashed var(--border); font-size: .86rem;
}
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 11px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--panel); color: var(--primary);
  display: grid; place-items: center; font-size: .74rem; font-weight: 700;
}
.step-label   { font-weight: 600; color: var(--text); display: block; }
.step-formula { font-size: .78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.step-value   { float: right; font-weight: 700; color: var(--primary-dk); font-variant-numeric: tabular-nums; }
.step-nota    { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }

/* Resultado em destaque. */
.result-hero {
  background: linear-gradient(135deg, var(--primary-dk) 0%, var(--primary-lt) 100%);
  color: #fff; border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-md);
  margin-bottom: 18px;
}
.result-hero .rh-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .8px;
  opacity: .85; font-weight: 700;
}
.result-hero .rh-value {
  font-size: 2.1rem; font-weight: 800; letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.result-hero .rh-split { display: flex; gap: 24px; margin-top: 12px; flex-wrap: wrap; }
.result-hero .rh-split div { font-size: .78rem; opacity: .9; }
.result-hero .rh-split b {
  display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; opacity: 1;
}

/* Área de envio de arquivos. */
.drop {
  border: 2px dashed #D3BBA2; border-radius: var(--radius); background: var(--panel);
  padding: 34px 22px; text-align: center; cursor: pointer; transition: .16s;
}
.drop:hover, .drop.over { border-color: var(--primary); background: #F1E7DC; }
.drop h4 { margin: 8px 0 4px; }
.drop p  { font-size: .82rem; color: var(--text-muted); margin: 0; }

/* Abas internas de uma tela. */
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.subtabs button {
  border: 0; background: transparent; font-family: inherit; font-size: .85rem; font-weight: 600;
  color: var(--text-muted); padding: 9px 15px; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.subtabs button.on { color: var(--primary-dk); border-bottom-color: var(--primary); }

/* Tabela larga com rolagem e primeira coluna fixa. */
.table-scroll { overflow: auto; max-height: 62vh; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.table-scroll .data-table th {
  position: sticky; top: 0; z-index: 2; background: var(--panel);
  border-bottom: 1px solid var(--border);
}

/* Paywall dentro do app, para quem entrou sem assinatura vigente. */
.paywall {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 34px; text-align: center; box-shadow: var(--shadow); max-width: 620px; margin: 0 auto;
}

/* Barra de progresso do processamento de arquivos. */
.bar { height: 7px; background: var(--border); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary-lt); border-radius: 99px; transition: width .25s; }

/* Caixa de código monoespaçada (link de primeiro acesso, campos da NF-e). */
.mono {
  font-family: 'JetBrains Mono', Consolas, ui-monospace, monospace;
  font-size: .8rem; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; word-break: break-all;
}

/* Página pública de apresentação. */
.publica { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.hero-publica {
  background:
    radial-gradient(900px 420px at 78% -8%, rgba(211,187,162,.5), transparent 62%),
    var(--bg);
  padding: 64px 0 56px; border-bottom: 1px solid var(--border);
}
.hero-publica h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); letter-spacing: -1.5px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; background: var(--card);
  border: 1px solid var(--border); color: var(--primary-dk); font-size: .76rem;
  font-weight: 700; padding: 6px 14px; border-radius: 999px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.check-list { list-style: none; padding: 0; margin: 16px 0; }
.check-list li { padding: 6px 0 6px 26px; position: relative; font-size: .88rem; }
.check-list li::before { content: '\2713'; position: absolute; left: 0; color: var(--success); font-weight: 800; }
.preco { font-size: 2.8rem; font-weight: 800; letter-spacing: -2px; }
.preco small { font-size: .95rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0; }

/* ─── Registro em duas linhas ──────────────────────────────────────────────────
   Primeira linha: identificação (nota, item, descrição ou regra).
   Segunda linha: o detalhe, ocupando a largura toda. Evita que um texto longo
   espalhe a tabela para os lados e funciona do celular ao monitor largo.     */
.tabela-dupla tbody tr.reg-topo td { border-bottom: 0; padding-bottom: 4px; }
.tabela-dupla tbody tr.reg-detalhe td { padding-top: 2px; padding-bottom: 12px; }
.tabela-dupla tbody tr.reg-par td { background: var(--panel); }
.tabela-dupla tbody tr:hover { background: transparent; }
.tabela-dupla tbody tr.reg-topo:hover td,
.tabela-dupla tbody tr.reg-topo:hover + tr.reg-detalhe td { background: #FDFAF7; }

/* Pares rótulo/valor na segunda linha; quebram sozinhos conforme a largura. */
.pares { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px 14px; }
.par { display: flex; flex-direction: column; min-width: 0; }
.par .p-rot {
  font-size: .64rem; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); font-weight: 700;
}
.par .p-val { font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.par.valor .p-val { font-weight: 600; }

/* Mensagem de validação: texto corrido na largura toda. */
.reg-mensagem { font-size: .83rem; line-height: 1.45; color: var(--text); }
/* Rótulo com a mesma cor e o mesmo tamanho do texto da mensagem; só o peso
   da fonte o distingue. */
.reg-mensagem .reg-mensagem-rot { font-weight: 700; }

/* ─── Dica suspensa (tooltip/popover) ───────────────────────────────────────────
   Uma única caixa, criada pelo front e posicionada junto do elemento. Abre no
   hover e no foco (mouse e teclado) e no toque (celular, onde não há hover). */
.com-dica {
  font: inherit; font-variant-numeric: tabular-nums; cursor: help;
  background: none; border: 0; padding: 0; color: inherit;
  border-bottom: 1px dotted currentColor;
}
.com-dica.sem-sublinhado { border-bottom: 0; }
.com-dica:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 3px; }
#dica-flutuante {
  position: fixed; z-index: 300; max-width: min(360px, calc(100vw - 24px));
  background: var(--text); color: #fff; font-size: .8rem; line-height: 1.45;
  padding: 9px 12px; border-radius: 10px; box-shadow: var(--shadow-lg);
  pointer-events: none; opacity: 0; transition: opacity .12s;
}
#dica-flutuante.aberta { opacity: 1; }
#dica-flutuante b { display: block; font-size: .72rem; opacity: .75; margin-bottom: 2px; letter-spacing: .3px; }

/* ─── Informativos ─────────────────────────────────────────────────────────── */
.informativo {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.informativo h3 { font-size: 1.05rem; letter-spacing: -.3px; margin-bottom: 6px; }
.informativo .inf-meta {
  font-size: .74rem; color: var(--text-muted); display: flex; gap: 12px;
  flex-wrap: wrap; align-items: center; margin-bottom: 12px;
}
.informativo .inf-texto { font-size: .9rem; line-height: 1.6; }
.informativo .inf-texto p { margin: 0 0 10px; }
.informativo .inf-fonte { font-size: .78rem; color: var(--text-muted); margin-top: 10px; word-break: break-word; }
.informativo .inf-fonte a { color: var(--primary); }
.informativo .inf-acoes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.informativo.rascunho { border-style: dashed; background: var(--panel); }
.informativo .inf-resumo { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }

@media (max-width: 640px) {
  .pares { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .informativo { padding: 16px; }
}

/* Itens e impostos: Nota e Item ocupam só a largura do conteúdo; a Descrição
   fica com o restante. Sem isto, com apenas três colunas na tabela, o navegador
   repartia a sobra entre elas e abria um vão grande entre os três campos. */
.tabela-itens th:nth-child(-n+2),
.tabela-itens tr.reg-topo td:nth-child(-n+2) { width: 1%; white-space: nowrap; padding-right: 28px; }
