:root {
  --bg: #0f1420;
  --surface: #171e2e;
  --surface-2: #1e273a;
  --border: #2a3448;
  --text: #e6ebf5;
  --muted: #8b97ad;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.brand-center { justify-content: center; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 8px; font-weight: 700; font-size: .9rem; color: #fff;
}
.brand-name { font-weight: 600; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  color: var(--muted); padding: 9px 12px; border-radius: 8px; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary); color: #fff; }

.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.user-name { font-weight: 600; font-size: .9rem; }
.user-mail { color: var(--muted); font-size: .78rem; margin-bottom: 8px; }
.btn-link { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0; font-size: .85rem; }
.btn-link:hover { color: var(--text); }

.content { padding: 24px 32px; }
.topbar { margin-bottom: 20px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-form { max-width: 720px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-label { color: var(--muted); font-size: .8rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } .app { grid-template-columns: 1fr; } }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Tags ---------- */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
  background: var(--surface-2); color: var(--muted);
}
.tag-nfe, .tag-nfce { background: rgba(59,130,246,.18); color: #93c5fd; }
.tag-nfse { background: rgba(139,92,246,.18); color: #c4b5fd; }
.tag-evento, .tag-cte { background: rgba(245,158,11,.16); color: #fcd34d; }
.tag-ok { background: rgba(34,197,94,.16); color: #86efac; }
.tag-warn { background: rgba(245,158,11,.16); color: #fcd34d; }
.tag-err { background: rgba(239,68,68,.16); color: #fca5a5; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); font-weight: 500; }
.form input, .form select {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 9px 11px; border-radius: 8px; font-size: .95rem;
}
.form input:focus, .form select:focus { outline: none; border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

.page-actions { margin-bottom: 16px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 8px 10px; border-radius: 8px;
}
.filters input[type=text] { flex: 1; min-width: 200px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; cursor: pointer; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  padding: 9px 14px; border-radius: 8px; font-size: .9rem; font-weight: 500;
}
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: rgba(239,68,68,.4); color: #fca5a5; }
.btn-danger:hover { background: rgba(239,68,68,.12); }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-block { width: 100%; }

/* ---------- Flash ---------- */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-size: .9rem; border: 1px solid; }
.flash-ok { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.4); color: #86efac; }
.flash-erro { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.4); color: #fca5a5; }
.flash-info { background: rgba(59,130,246,.1); border-color: rgba(59,130,246,.4); color: #93c5fd; }

/* ---------- Logs ---------- */
.log-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.log-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .85rem; }
.log-msg { color: var(--muted); }
.link { font-size: .85rem; }

/* ---------- Pager ---------- */
.pager { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.page { padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: .85rem; }
.page.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Auth ---------- */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 32px; width: 100%; max-width: 380px; }
.auth-sub { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: .9rem; }
.auth-foot { text-align: center; margin-top: 18px; font-size: .88rem; color: var(--muted); }

/* Pagina de captura */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; }
.step-mark {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); font-weight: 700; font-size: .85rem;
}
.steps li.done .step-mark { background: rgba(34,197,94,.16); border-color: rgba(34,197,94,.4); color: #86efac; }
.steps li.alert .step-mark { background: rgba(245,158,11,.16); border-color: rgba(245,158,11,.4); color: #fcd34d; }
.kv { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: .9rem; }
.kv li { display: flex; justify-content: space-between; gap: 12px; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .85em; }
.checks { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; display: flex; gap: 18px; flex-wrap: wrap; }
.checks legend { color: var(--muted); font-size: .8rem; padding: 0 4px; }
.form .check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.form .check input { width: auto; }

/* Filtros de notas */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; align-items: center; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font-size: .82rem; background: var(--surface); }
.chip:hover { color: var(--text); text-decoration: none; border-color: var(--muted); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chips-sep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; }
.filters .filtro { display: flex; flex-direction: column; gap: 4px; font-size: .72rem; color: var(--muted); }
.filters { align-items: flex-end; }
.totais { margin-top: 14px; }
.small-value { font-size: 1.1rem; }
.nowrap { white-space: nowrap; }
.page.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Usuarios / utilitarios */
form.inline { display: inline; }
.inline-det { display: inline-block; }
.inline-det summary { list-style: none; cursor: pointer; }
.inline-det summary::-webkit-details-marker { display: none; }
.form-mini { gap: 6px; margin-top: 6px; }
.form-mini input { padding: 6px 8px; font-size: .8rem; }
.kv-lista { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.table select { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 4px 6px; }
.tabela-rolagem { overflow-x: auto; }

/* Relatorios / graficos */
.dir { text-align: right; }
.legenda { font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.leg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.leg-entrada, .gb-barra.entrada { background: #3b82f6; }
.leg-saida, .gb-barra.saida { background: #22c55e; }
.grafico-barras { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding: 8px 4px 0; margin-bottom: 14px; overflow-x: auto; border-bottom: 1px solid var(--border); }
.gb-coluna { flex: 1 0 34px; display: flex; flex-direction: column; align-items: center; height: 100%; }
.gb-barras { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.gb-barra { width: 42%; max-width: 22px; border-radius: 3px 3px 0 0; min-height: 1px; }
.gb-rotulo { font-size: .7rem; color: var(--muted); padding: 4px 0; white-space: nowrap; }
.table .dir { text-align: right; }
pre.codigo { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-size: .8rem; overflow-x: auto; }

/* Detalhe da nota */
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-bottom: 18px; }
.kv-valor { text-align: right; word-break: break-word; }
.chave-detalhe { margin: -6px 0 14px; letter-spacing: .02em; }
.pre-wrap { white-space: pre-wrap; }
.linha-nota { cursor: pointer; }
.linha-nota:hover td { background: rgba(255,255,255,.03); }
.barra-lote { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.col-check { width: 28px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Painel */
.pendencias { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.pendencias .chip { border-color: rgba(245,158,11,.5); color: #fcd34d; }
.grid-painel { margin-bottom: 18px; }
.barra-empilhada { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--surface-2); margin: 6px 0 14px; }
.barra-empilhada span { display: block; height: 100%; }
.tp-produtos { background: #3b82f6; }
.tp-servicos { background: #8b5cf6; }
.tp-transporte { background: #f59e0b; }

/* ---------- Celular e telas pequenas ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .app > *, .content, .card { min-width: 0; }
  .sidebar { position: static; height: auto; padding: 12px 14px; flex-direction: column; }
  .brand { margin-bottom: 10px; }
  .nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 6px; }
  .nav a { white-space: nowrap; padding: 7px 10px; font-size: .85rem; }
  .sidebar-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; }
  .content { padding: 16px; }
  .grid-2, .grid-3, .form-row { grid-template-columns: 1fr; }
  .card { overflow-x: auto; }
  .topbar h1 { font-size: 1.25rem; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters .filtro, .filters input, .filters select, .filters .btn { width: 100%; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 1.15rem; }
  .table { font-size: .82rem; }
  .row-actions { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr; }
}

/* Emissao de NFS-e */
.form textarea { background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 9px 11px; border-radius: 8px; font: inherit; resize: vertical; }
.kv-bloco { display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.duas-colunas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
h3.sub { font-size: .9rem; margin: 10px 0 0; color: var(--muted); }
details summary.link { cursor: pointer; margin: 4px 0 8px; }

/* Emissao rapida por servico */
.grade-servicos { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.servico-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.servico-card input[type=text], .servico-card input[type=date] { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 7px 9px; width: 100%; }
.servico-card .check { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.sc-topo { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.sc-valor { font-weight: 700; white-space: nowrap; }
.form-avulsa > summary { list-style: none; cursor: pointer; margin-bottom: 0; }
.form-avulsa > summary::-webkit-details-marker { display: none; }
.form-avulsa > summary h2::before { content: '▸ '; color: var(--muted); }
.form-avulsa[open] > summary h2::before { content: '▾ '; }
.form-avulsa[open] > summary { margin-bottom: 12px; }

/* Pagina propria de cada empresa */
.nav-empresas { display: flex; flex-direction: column; gap: 2px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); min-width: 0; }
.nav-titulo { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 12px 6px; }
.nav-empresas a { color: var(--muted); padding: 7px 12px; border-radius: 8px; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-empresas a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-empresas a.active { background: var(--surface-2); color: var(--text); box-shadow: inset 3px 0 0 var(--primary); }
.nav-empresas select { margin: 0 4px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; font: inherit; font-size: .88rem; }

.empresa-topo { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; padding: 14px 18px; }
.et-ident { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.et-nome { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.et-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.abas-empresa { display: flex; gap: 2px; overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 0 10px; margin-bottom: 18px; }
.abas-empresa a { padding: 11px 12px; color: var(--muted); font-weight: 500; font-size: .9rem; white-space: nowrap; border-bottom: 2px solid transparent; }
.abas-empresa a:hover { color: var(--text); text-decoration: none; }
.abas-empresa a.active { color: var(--text); border-bottom-color: var(--primary); }

.status-captura { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.status-captura .sc-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.atalhos { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .nav-empresas { flex-direction: row; overflow-x: auto; margin-top: 6px; padding-top: 8px; gap: 6px; }
  .nav-titulo { display: none; }
  .nav-empresas a { padding: 6px 10px; font-size: .82rem; max-width: 200px; flex-shrink: 0; }
  .nav-empresas select { margin: 0; width: 100%; }
  .empresa-topo { padding: 12px 14px; }
}
a.gb-coluna, a.gb-coluna:hover { text-decoration: none; color: inherit; }
a.card.stat { color: inherit; }
a.card.stat:hover { text-decoration: none; border-color: var(--primary); }
.links-head { display: flex; gap: 14px; flex-wrap: wrap; }

/* Venda: NF-e / NFC-e */
.seletor-modelo { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; margin-bottom: 16px; }
.sm-op { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; text-align: left; min-width: 200px; }
.sm-op span { color: var(--muted); font-size: .82rem; }
.sm-op.active { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--surface-2); }
.sm-links { margin-left: auto; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.grid-venda { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.coluna-venda { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.coluna-venda .card { margin-bottom: 0; }
.busca-produto { position: relative; margin-bottom: 10px; }
.busca-produto input { width: 100%; }
.sugestoes { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 4px; display: flex; flex-direction: column; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.sugestoes[hidden] { display: none; }
.sugestoes button { background: none; border: 0; color: var(--text); text-align: left; padding: 8px 10px; border-radius: 6px; cursor: pointer; font: inherit; }
.sugestoes button:hover { background: var(--surface-2); }
.atalhos-produtos { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.ap-btn { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; font-size: .84rem; text-align: left; min-width: 0; }
.ap-btn span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ap-btn strong { color: var(--primary); font-size: .82rem; }
.ap-btn:hover { border-color: var(--primary); }
.itens-venda input.num { width: 84px; text-align: right; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 6px 8px; border-radius: 6px; font: inherit; }
.resumo-venda { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; padding: 12px; background: var(--surface-2); border-radius: 8px; }
.resumo-venda div { display: flex; justify-content: space-between; }
.resumo-venda div[hidden] { display: none; }
.resumo-venda .rv-total { font-size: 1.2rem; padding-top: 6px; border-top: 1px solid var(--border); }
.btn-block { width: 100%; }
.mono { font-family: ui-monospace, Consolas, monospace; }
[hidden] { display: none !important; }
@media (max-width: 1000px) { .grid-venda { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .sm-op { min-width: 0; flex: 1; } .sm-links { margin-left: 0; } }
.duas-colunas > * { min-width: 0; } .duas-colunas input, .duas-colunas select { width: 100%; box-sizing: border-box; }
@media (max-width: 600px) {
  .seletor-modelo .sm-op { flex: 1 1 40%; min-width: 0; }
  .seletor-modelo .sm-links { flex-basis: 100%; margin-left: 0; }
  .itens-venda input.num { width: 58px; padding: 6px; }
}

/* =====================================================================
   Tema profissional (claro) - sobrepoe as regras acima
   ===================================================================== */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --border: #e4e8ef;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff4ff;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --side-bg: #0e1726;
  --side-text: #a9b4c7;
}
body { font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }
h1 { font-size: 1.35rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: .98rem; font-weight: 600; }

/* Menu lateral escuro */
.app { grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { background: var(--side-bg); border-right: 0; color: var(--side-text); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand-name { color: #fff; letter-spacing: -.01em; }
.brand-mark { background: var(--primary); border-radius: 9px; }
.nav a, .nav-empresas a { color: var(--side-text); font-weight: 500; font-size: .9rem; padding: 8px 12px; }
.nav a:hover, .nav-empresas a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: rgba(37, 99, 235, .22); color: #fff; box-shadow: inset 3px 0 0 #3b82f6; }
.nav-empresas { border-top-color: rgba(255, 255, 255, .08); }
.nav-titulo { color: #6b7a93; }
.nav-empresas a.active { background: rgba(255, 255, 255, .08); color: #fff; box-shadow: inset 3px 0 0 #3b82f6; }
.nav-empresas select { background: #16213a; border-color: #24304a; color: #e2e8f0; }
.sidebar-foot { border-top-color: rgba(255, 255, 255, .08); }
.sidebar-foot .user-name { color: #fff; }
.sidebar-foot .user-mail, .sidebar-foot .btn-link { color: var(--side-text); }

/* Conteudo */
.content { padding: 24px 32px 40px; max-width: 1440px; }
.topbar { padding-bottom: 18px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.card { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: var(--radius); }
.card-head { margin-bottom: 14px; }
.stat-label { text-transform: uppercase; letter-spacing: .04em; font-size: .7rem; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 1.45rem; font-weight: 650; letter-spacing: -.02em; color: var(--text); }
a.card.stat:hover { border-color: #c7d4ea; box-shadow: 0 4px 12px rgba(16, 24, 40, .08); }

/* Tabelas */
.table th { background: var(--surface-2); color: var(--muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); }
.table td { border-bottom: 1px solid #eef1f5; }
.table tbody tr:hover td { background: #f9fbfe; }

/* Formularios */
.form input, .form select, .form textarea, .filters input, .filters select, input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="date"], select, textarea {
  background: #fff; color: var(--text); border: 1px solid #d5dbe5; border-radius: 8px;
}
.form input:focus, .form select:focus, .form textarea:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
.form label, label { color: #334155; }
input::placeholder, textarea::placeholder { color: #9aa6b8; }
.itens-venda input.num { background: #fff; border-color: #d5dbe5; }

/* Botoes */
.btn { background: #fff; border: 1px solid #d5dbe5; color: #1e293b; font-weight: 500; border-radius: 8px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.btn:hover { background: #f5f7fb; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-danger { background: #fff; border-color: #f3c4c4; color: var(--err); }
.btn-danger:hover { background: #fef2f2; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* Etiquetas */
.tag { font-weight: 600; letter-spacing: .02em; }
.tag-nfe, .tag-nfce { background: #e8f0fe; color: #1d4ed8; }
.tag-nfse { background: #f1ebfe; color: #6d28d9; }
.tag-evento, .tag-cte { background: #fff4e0; color: #b45309; }
.tag-ok { background: #e7f6ec; color: #15803d; }
.tag-warn { background: #fff4e0; color: #b45309; }
.tag-err { background: #fdecec; color: #b91c1c; }

/* Avisos */
.flash { border-radius: 8px; border-width: 1px; }
.flash-ok { background: #effaf3; border-color: #bfe7cd; color: #166534; }
.flash-erro { background: #fef3f2; border-color: #f6cfcc; color: #991b1b; }
.flash-info { background: #eff5ff; border-color: #c9dafc; color: #1e3a8a; }
.flash-info a, .flash-erro a, .flash-ok a { font-weight: 600; }

/* Chips, paginacao, passos */
.chip { background: #fff; border-color: #d9dfe8; color: #334155; }
.chip:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.chip.active, .page.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page { background: #fff; border-color: #d9dfe8; color: #334155; }
.pendencias .chip { background: #fffaf0; border-color: #f5d9a8; color: #92400e; }
.steps li.done .step-mark { background: #e7f6ec; border-color: #bfe7cd; color: #15803d; }
.steps li.alert .step-mark { background: #fff4e0; border-color: #f5d9a8; color: #b45309; }
.linha-nota:hover td { background: #f9fbfe; }

/* Pagina da empresa */
.empresa-topo { background: #fff; box-shadow: var(--shadow); }
.et-nome { font-size: 1.1rem; }
.abas-empresa { background: #fff; box-shadow: var(--shadow); }
.abas-empresa a { color: var(--muted); }
.abas-empresa a:hover { color: var(--text); }
.abas-empresa a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.status-captura .sc-item { background: var(--surface-2); }

/* Venda e emissao */
.sm-op { background: #fff; box-shadow: var(--shadow); }
.sm-op.active { background: var(--primary-soft); border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.sm-op.active strong { color: var(--primary-dark); }
.ap-btn, .servico-card { background: #fff; border-color: var(--border); box-shadow: var(--shadow); }
.ap-btn:hover, .servico-card:hover { border-color: #b9c8e6; }
.ap-btn strong { color: var(--primary-dark); }
.resumo-venda { background: var(--surface-2); border: 1px solid var(--border); }
.resumo-venda .rv-total strong { color: var(--primary-dark); }
.sugestoes { background: #fff; box-shadow: 0 10px 30px rgba(16, 24, 40, .12); }
.sugestoes button:hover { background: var(--primary-soft); }
.form-avulsa > summary { color: var(--text); }
code { background: #eef2f7; color: #334155; border-radius: 4px; padding: 1px 5px; }

@media (max-width: 900px) {
  .sidebar { position: static; height: auto; }
  .content { padding: 16px; }
  .nav a.active { box-shadow: none; }
}
.form label + label, .form label + .duas-colunas, .form .duas-colunas + label, .form label + .form-row, .form .form-row + label { margin-top: 12px; }

/* ---------- SaaS: conta, planos, plataforma ---------- */
.auth-card:has(form[action="/registrar"]) { max-width: 540px; }
.campo-oculto { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form .check-termos { flex-direction: row; align-items: flex-start; gap: 10px; color: var(--text); font-weight: 400; }
.form .check-termos input { width: auto; margin-top: 3px; }
.faixa-conta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.barra-uso { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.barra-uso span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.barra-uso span.cheia { background: var(--warn); }
.aviso-pagamento { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-color: rgba(245,158,11,.5); }
.aviso-pagamento h2 { margin-bottom: 4px; }
.aviso-pagamento p { margin: 0; }

.planos { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 8px; }
.plano-card { position: relative; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 8px; }
.plano-card h3 { margin: 0; font-size: 1.05rem; }
.plano-card form { margin-top: auto; }
.plano-card > .btn { margin-top: auto; }
.plano-destaque { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.plano-sugerido { outline: 2px dashed var(--primary); outline-offset: 3px; }
.plano-selo { position: absolute; top: -11px; right: 16px; background: var(--primary); color: #fff; font-size: .72rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; }
.plano-preco { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }
.plano-preco span { font-size: .85rem; color: var(--muted); font-weight: 500; }
.plano-itens { list-style: none; padding: 0; margin: 4px 0 12px; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.plano-itens li::before { content: "✓"; color: var(--ok); margin-right: 8px; font-weight: 700; }
.ajustes-conta { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; min-width: 280px; }
.ajustes-conta .form-mini { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
.ajustes-conta input, .ajustes-conta select { max-width: 150px; }

/* ---------- Site publico ---------- */
.site-body { display: flex; flex-direction: column; min-height: 100vh; }
.site-topo { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px clamp(16px, 5vw, 56px); border-bottom: 1px solid var(--border); }
.site-topo .brand { color: var(--text); text-decoration: none; padding: 0; border: 0; margin: 0; }
.site-nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.site-nav a:not(.btn) { color: var(--muted); }
.site-nav a:not(.btn):hover { color: var(--text); text-decoration: none; }
.site-main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 clamp(16px, 5vw, 32px) 64px; }
.hero { padding: clamp(48px, 9vw, 104px) 0 48px; max-width: 760px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.1; letter-spacing: -.03em; margin: 14px 0 18px; font-weight: 800; }
.hero-sub { font-size: 1.1rem; color: var(--muted); margin: 0 0 26px; max-width: 640px; }
.hero-selo { display: inline-block; font-size: .78rem; letter-spacing: .06em; color: var(--primary); border: 1px solid rgba(59,130,246,.4); padding: 4px 12px; border-radius: 99px; font-weight: 600; }
.hero-acoes { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.recursos { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin: 24px 0 72px; }
.recurso { background: var(--surface); padding: 24px; }
.recurso h3 { margin: 0 0 8px; font-size: 1rem; }
.recurso p { margin: 0; color: var(--muted); font-size: .92rem; }
.site-planos h2 { font-size: 1.6rem; letter-spacing: -.02em; margin-bottom: 6px; }
.site-planos .planos { margin-top: 24px; }
.site-rodape { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 22px clamp(16px, 5vw, 56px); border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }
.texto-legal { max-width: 760px; padding: 48px 0; }
.texto-legal h1 { font-size: 1.8rem; margin-bottom: 16px; }
.texto-legal h2 { font-size: 1.1rem; margin: 26px 0 8px; }
.texto-legal p { color: #c9d2e3; }
.aviso-modelo { border: 1px dashed var(--warn); color: var(--warn) !important; padding: 10px 14px; border-radius: 8px; font-size: .88rem; }
.form .form-row > label + label { margin-top: 0; }
.site-topo .brand-name { color: var(--text); }
.recursos { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .recursos { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .recursos { grid-template-columns: 1fr; } .site-nav a:not(.btn):not([href="/login"]) { display: none; } }
.form-linha { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-linha input { max-width: 220px; }

/* =====================================================================
   Layout Captura Total - Design System Moderno, Limpo e Tecnológico
   Inspirado nos melhores produtos SaaS / FinTech modernos (Linear / Stripe).
   Substitui o visual legado (degradês pesados, bolhas e caixas duplas).
   ===================================================================== */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-hover: #f8fafc;
  --border: #e2e8f0;
  --border-focus: #4f46e5;
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --primary-border: #c7d2fe;
  --acento: #06b6d4;
  --ok: #10b981;
  --ok-soft: #ecfdf5;
  --ok-border: #a7f3d0;
  --warn: #f59e0b;
  --warn-soft: #fffbeb;
  --warn-border: #fde68a;
  --err: #ef4444;
  --err-soft: #fef2f2;
  --err-border: #fecaca;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-forte: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --degrade: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  --cab-altura: 60px;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.ico { flex-shrink: 0; }

/* Faixa da conta (teste / regularizacao) */
.faixa-topo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #1e1b4b;
  color: #e0e7ff;
  font-size: .84rem;
  font-weight: 500;
  padding: 8px 16px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.faixa-topo.faixa-alerta {
  background: #7f1d1d;
  color: #fee2e2;
}
.faixa-btn {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  padding: 3px 12px;
  font-weight: 600;
  font-size: .78rem;
  transition: all .15s ease;
}
.faixa-btn:hover {
  background: #fff;
  color: #1e1b4b;
  text-decoration: none;
}
.faixa-topo.faixa-alerta .faixa-btn:hover {
  color: #7f1d1d;
}

/* Cabecalho Superior (Slim & Glassmorphic) */
.cabecalho {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--cab-altura);
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.marca {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -.02em;
}
.marca:hover { text-decoration: none; }
.marca-simbolo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: .92rem;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.25);
}
.marca-nome {
  font-family: "Inter", "Lato", system-ui, sans-serif;
  font-weight: 750;
  font-size: 1.18rem;
  letter-spacing: -.025em;
  color: #0f172a;
  white-space: nowrap;
}
.cabecalho-acoes {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cabecalho-acoes .tag { margin-right: 8px; }
.btn-icone {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  padding: 0;
  transition: all .15s ease;
}
.btn-icone:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
  text-decoration: none;
}
.ponto-aviso {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--err);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px #fff;
}

/* Estrutura do App: Sidebar Destaque e Area de Conteudo */
.app {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - var(--cab-altura));
  align-items: stretch;
}
.menu-recolhido .app { grid-template-columns: minmax(0, 1fr); }
.menu-recolhido .sidebar { display: none; }

/* Menu Lateral (Sleek Docked Navigation) */
.sidebar {
  position: sticky;
  top: var(--cab-altura);
  height: calc(100vh - var(--cab-altura));
  overflow-y: auto;
  margin: 0;
  padding: 16px 12px 24px;
  background: #ffffff;
  color: var(--text);
  border-right: 1px solid var(--border);
  border-left: 0;
  border-top: 0;
  border-bottom: 0;
  border-radius: 0;
  box-shadow: none;
  scrollbar-width: thin;
  display: flex;
  flex-direction: column;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-grupo {
  margin: 16px 10px 6px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #94a3b8;
}
.nav > .nav-grupo:first-child { margin-top: 4px; }
.nav a, .nav-empresas a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: #475569;
  font-weight: 500;
  font-size: .88rem;
  box-shadow: none;
  border: 1px solid transparent;
  transition: all .15s ease;
}
.nav a .ico, .nav-empresas a .ico {
  color: #94a3b8;
  transition: color .15s ease;
}
.nav a:hover, .nav-empresas a:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #f1f5f9;
  text-decoration: none;
}
.nav a:hover .ico, .nav-empresas a:hover .ico {
  color: var(--primary);
}
.nav a.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  border-color: var(--primary-border);
  box-shadow: none;
}
.nav a.active .ico {
  color: var(--primary);
}
.nav-selo {
  margin-left: auto;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 99px;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-size: .68rem;
  font-weight: 700;
  text-align: center;
}
.nav-empresas {
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-empresas .nav-grupo { margin-top: 4px; }
.nav-empresas a span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-inicial {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  font-size: .68rem;
  font-weight: 700;
  color: #64748b;
}
.nav-empresas a.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-border);
}
.nav-empresas a.active .nav-inicial {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.nav-empresas select {
  margin: 4px 6px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: .84rem;
}
.sidebar-foot {
  margin-top: auto;
  padding: 14px 10px 0;
  border-top: 1px solid var(--border);
}
.sidebar-foot .user-name {
  color: #0f172a;
  font-weight: 600;
  font-size: .88rem;
}
.sidebar-foot .user-mail {
  color: #64748b;
  font-size: .78rem;
  margin: 2px 0 0;
  word-break: break-word;
}
.menu-fundo { display: none; }

/* Area de Conteudo Principal (Sem caixa-dentro-de-caixa) */
.content {
  max-width: none;
  padding: 24px 32px 48px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.conteudo-caixa {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  background: transparent;
  border-radius: 0;
  padding: 0;
}
.rodape {
  text-align: center;
  color: #94a3b8;
  font-size: .82rem;
  padding: 28px 0 12px;
  margin-top: 36px;
  border-top: 1px solid var(--border);
}

/* Cabecalho da Pagina (Topbar Moderno e Polido) */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 24px;
  padding: 20px 24px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.topbar-icone {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
  border: 1px solid var(--primary-border);
  box-shadow: none;
}
.topbar-texto { min-width: 0; }
.topbar h1 {
  font-size: 1.32rem;
  font-weight: 750;
  letter-spacing: -.02em;
  color: #0f172a;
  margin: 0;
}
.topbar p {
  margin: 3px 0 0;
  color: #64748b;
  font-size: .88rem;
}

/* Cartoes Padrao */
.card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  margin-bottom: 20px;
}
.card > .card-head:first-child {
  margin: -22px -22px 18px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-head h2 {
  font-size: 1.02rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -.01em;
}

/* Indicadores / Cards de Metricas (FinTech Clean) */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.cards > .card.stat {
  position: relative;
  overflow: hidden;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-top: 3px solid #cbd5e1;
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.cards > .card.stat:nth-child(6n+1) { border-top-color: #6366f1; }
.cards > .card.stat:nth-child(6n+2) { border-top-color: #0284c7; }
.cards > .card.stat:nth-child(6n+3) { border-top-color: #3b82f6; }
.cards > .card.stat:nth-child(6n+4) { border-top-color: #8b5cf6; }
.cards > .card.stat:nth-child(6n+5) { border-top-color: #f97316; }
.cards > .card.stat:nth-child(6n+6) { border-top-color: #10b981; }

.cards > .card.stat::before,
.cards > .card.stat::after {
  display: none; /* Remove bolhas retro do vFisco */
}

.cards > .card.stat .stat-label {
  color: #64748b;
  font-size: .75rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 600;
}
.cards > .card.stat .stat-value {
  color: #0f172a;
  font-size: 1.65rem;
  font-weight: 750;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.cards > .card.stat .small-value {
  font-size: 1.2rem;
  font-weight: 700;
}
.cards > .card.stat .muted,
.cards > .card.stat .small,
.cards > .card.stat small {
  color: #64748b;
}
.cards > .card.stat a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.cards > .card.stat a:hover {
  text-decoration: underline;
}
.cards > .card.stat .tag {
  background: var(--surface-2);
  color: #475569;
  border: 1px solid var(--border);
}
.card-stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-bottom: 12px;
}
.stat-icon-wrapper {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  flex-shrink: 0;
}
a.card.stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
  text-decoration: none;
}

/* Tabelas Modernas */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.table th {
  background: #f8fafc;
  color: #475569;
  font-size: .76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: #1e293b;
}
.table tbody tr:hover td {
  background: #f8fafc;
}
.table input[type="checkbox"], .col-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Botoes Tecnologicos (Linear / Stripe style) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  background: #ffffff;
  font-weight: 500;
  font-size: .88rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all .15s ease;
}
.btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);
  border-color: #3730a3;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #4338ca 0%, #3730a3 100%);
  border-color: #312e81;
  color: #ffffff;
}
.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: #475569;
  box-shadow: none;
}
.btn-ghost:hover {
  background: var(--surface-2);
  border-color: transparent;
  color: #0f172a;
}
.btn-danger {
  border-color: #fca5a5;
  background: #fff;
  color: #dc2626;
  box-shadow: var(--shadow-sm);
}
.btn-danger:hover {
  background: #fef2f2;
  border-color: #ef4444;
  color: #b91c1c;
}
.btn-sm {
  padding: 5px 10px;
  font-size: .8rem;
}

/* Formularios e Filtros */
.form input, .form select, .form textarea,
.filters input, .filters select,
input[type="text"], input[type="search"], input[type="email"],
input[type="password"], input[type="date"], input[type="number"], select, textarea {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  min-height: 38px;
  padding: 8px 12px;
  background: #ffffff;
  color: var(--text);
  font-size: .9rem;
  transition: border-color .15s, box-shadow .15s;
}
.form input:focus, .form select:focus, .form textarea:focus,
.filters input:focus, .filters select:focus,
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
.form label, label {
  color: #334155;
  font-weight: 500;
  font-size: .86rem;
}
.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: #475569;
  background: #ffffff;
  font-size: .82rem;
  font-weight: 500;
  transition: all .15s;
}
.chip:hover {
  border-color: #94a3b8;
  color: #0f172a;
  text-decoration: none;
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.25);
}

/* Etiquetas / Tags em Pilulas Refinadas */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  text-transform: none;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: 0;
  padding: 2px 9px;
  border: 1px solid transparent;
}
.tag-nfe, .tag-nfce {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.tag-nfse {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}
.tag-evento, .tag-cte {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}
.tag-ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}
.tag-warn {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}
.tag-err {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

/* Alertas Flash */
.flash {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: .88rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Pagina da Empresa */
.empresa-topo {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border: 1px solid var(--border);
  border-bottom: 0;
  padding: 20px 24px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}
.et-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  color: #fff;
  font-weight: 800;
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}
.et-ident-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.abas-empresa {
  border: 1px solid var(--border);
  border-top: 1px solid #f1f5f9;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  padding: 0 16px;
  margin-bottom: 24px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}
.abas-empresa a {
  padding: 12px 16px;
  color: #64748b;
  font-weight: 500;
  font-size: .88rem;
  border-bottom: 2px solid transparent;
  transition: all .15s;
}
.abas-empresa a:hover {
  color: #0f172a;
  text-decoration: none;
}
.abas-empresa a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.et-ident {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.et-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.et-nome {
  font-size: 1.15rem;
  font-weight: 750;
  color: #0f172a;
  letter-spacing: -.015em;
}
.et-nome:hover {
  color: var(--primary);
  text-decoration: none;
}
.et-badge-doc {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.et-pf-tag {
  background: #eef2ff;
  color: #4f46e5;
  border-radius: 4px;
  padding: 1px 4px;
  font-size: .68rem;
  font-weight: 700;
  margin-left: 4px;
}
.et-meta {
  color: #64748b;
  font-size: .82rem;
  margin-top: 1px;
}
.et-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}
.tag-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: .78rem;
  font-weight: 600;
  border-radius: 999px;
}
.btn-capturar-topo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Responsividade Celular */
@media (max-width: 900px) {
  .cabecalho { padding: 0 14px; gap: 8px; }
  .marca-nome { font-size: 1.05rem; }
  .cabecalho-acoes .tag { display: none; }
  .app, .menu-recolhido .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .menu-recolhido .sidebar {
    display: block;
    position: fixed;
    z-index: 40;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 86vw);
    max-height: none;
    height: 100vh;
    margin: 0;
    border-radius: 0 16px 16px 0;
    transform: translateX(-105%);
    transition: transform .2s ease;
    padding: 20px 14px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  }
  .menu-aberto .sidebar { transform: none; }
  .nav { flex-direction: column; overflow: visible; padding: 0; }
  .nav a { white-space: normal; font-size: .9rem; padding: 9px 12px; }
  .nav-empresas { flex-direction: column; overflow: visible; }
  .nav-empresas .nav-grupo { display: block; }
  .nav-empresas a { max-width: none; }
  .menu-fundo {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(4px);
  }
  .menu-fundo[hidden] { display: none !important; }
  .content { padding: 14px 14px 28px; }
  .conteudo-caixa { padding: 0; }
  .topbar { padding: 16px; gap: 12px; border-radius: 12px; margin-bottom: 16px; }
  .topbar-icone { width: 40px; height: 40px; }
  .topbar h1 { font-size: 1.15rem; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .cards > .card.stat { min-height: 100px; padding: 14px; }
  .cards > .card.stat .stat-value { font-size: 1.25rem; }
  .card { padding: 16px; }
  .card > .card-head:first-child { margin: -16px -16px 14px; padding: 14px 16px; }
}
@media (max-width: 480px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 340px) {
  .cards { grid-template-columns: minmax(0, 1fr); }
}
.topbar { flex-wrap: nowrap; }
.cards > .card.stat .stat-value { font-family: inherit; overflow-wrap: anywhere; }
.cards > .card { margin-bottom: 0; }

/* ---------- Seletor de cliente com busca ---------- */
.seletor-cliente { position: relative; width: 100%; }
.sc-campo { position: relative; display: flex; align-items: center; }
.sc-campo input { width: 100%; padding: 9px 64px 9px 36px; font: inherit; font-size: .92rem; }
.sc-lupa { position: absolute; left: 11px; color: #94a3b8; pointer-events: none; }
.sc-escolhido .sc-campo input { font-weight: 600; color: var(--text); }
.sc-limpar, .sc-seta { position: absolute; display: grid; place-items: center; width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); border-radius: 6px; cursor: pointer; padding: 0; }
.sc-limpar { right: 34px; font-size: 1.2rem; line-height: 1; }
.sc-seta { right: 6px; border-left: 1px solid var(--border); border-radius: 0 6px 6px 0; }
.sc-limpar:hover, .sc-seta:hover { color: var(--primary); background: var(--surface-2); }
.sc-lista { position: absolute; z-index: 25; left: 0; right: 0; top: calc(100% + 4px); max-height: 320px; overflow-y: auto; margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-forte); }
.sc-item { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 10px; border-radius: 7px; cursor: pointer; font-size: .9rem; }
.sc-item .sc-nome { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.sc-item .sc-doc { flex-shrink: 0; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.sc-item.sc-todos .sc-nome { color: var(--muted); font-style: italic; }
.sc-item:hover, .sc-item.sc-ativo { background: var(--primary-soft); }
.sc-item.sc-marcado .sc-nome { color: var(--primary); font-weight: 600; }
.sc-aviso { padding: 10px; color: var(--muted); font-size: .84rem; }
.sc-carregando { opacity: .6; pointer-events: none; }

/* Escolha do cliente na Captura */
.escolha-cliente { padding: 18px 20px; position: relative; z-index: 5; overflow: visible; }
.ec-form { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ec-campo { flex: 1 1 380px; max-width: 620px; display: flex; flex-direction: column; gap: 6px; }
.ec-campo > label { font-size: .85rem; font-weight: 600; }
.ec-acoes { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; }
.cliente-captura .cc-topo { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.cc-ident { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 260px; }
.cc-nome { font-size: 1.1rem; }
.cc-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.cc-acoes { display: flex; gap: 8px; flex-wrap: wrap; }

/* Filtro de cliente na lista de notas */
.filters .filtro-cliente { flex: 1 1 320px; min-width: 260px; }
.filters .filtro-cliente > label { font-size: .72rem; color: var(--muted); }
.filters.card { overflow: visible; }
@media (max-width: 900px) {
  .ec-campo { max-width: none; }
  .cc-acoes { width: 100%; }
  .filters .filtro-cliente { min-width: 0; width: 100%; }
  .escolha-cliente, .filters.card { overflow: visible; }
}

/* Certificado no filtro de notas */
.filtros-busca-aviso, .filtro-dica { font-size: .74rem; color: var(--muted); }
.filters .filtro-certificado { flex: 1 1 100%; max-width: 640px; }
.btn-buscando { position: relative; padding-left: 34px; opacity: 1 !important; cursor: progress !important; }
.btn-buscando::before { content: ""; position: absolute; left: 12px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

/* Logo e Nome da Marca */
.marca-logo { width: 34px; height: 34px; object-fit: contain; flex-shrink: 0; }
.marca-nome { color: #0f172a; font-weight: 750; font-size: 1.18rem; letter-spacing: -.025em; }

/* =====================================================================
   Gerenciador de Pacotes e Funcionalidades (Plataforma > Planos)
   ===================================================================== */
.planos-topo-acoes {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.planos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.plano-card {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.plano-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}
.plano-card.plano-destaque {
  border-color: #c7d2fe;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.08);
}
.plano-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.plano-titulo-bloco {
  min-width: 0;
}
.plano-nome {
  font-size: 1.22rem;
  font-weight: 750;
  color: #0f172a;
  letter-spacing: -.02em;
  margin: 0;
}
.plano-codigo {
  font-size: .74rem;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}
.plano-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}
.plano-preco-bloco {
  margin: 8px 0 14px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.plano-preco-val {
  font-size: 1.85rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -.03em;
}
.plano-preco-per {
  font-size: .88rem;
  color: var(--muted);
  font-weight: 500;
}
.plano-limites {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  margin-bottom: 14px;
}
.plano-limite-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.plano-limite-item span:first-child {
  color: var(--muted);
}
.plano-limite-item strong {
  color: #0f172a;
}
.plano-func-resumo {
  margin: 12px 0 16px;
}
.plano-progresso-topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .78rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}
.plano-progresso-barra {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}
.plano-progresso-preenchimento {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #06b6d4);
  border-radius: 99px;
  transition: width .3s ease;
}
.plano-tags-grupos {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}
.plano-card-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* Modal / Drawer do Editor de Pacote */
.plano-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.plano-modal-backdrop.ativo {
  opacity: 1;
  visibility: visible;
}
.plano-modal-janela {
  width: 100%;
  max-width: 980px;
  height: 90vh;
  max-height: 860px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(.96);
  transition: transform .2s ease;
}
.plano-modal-backdrop.ativo .plano-modal-janela {
  transform: scale(1);
}
.plano-modal-head {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

/* Abas do Modal */
.modal-nav-abas {
  display: flex;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  gap: 8px;
  flex-shrink: 0;
}
.modal-aba-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  font-size: .88rem;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all .15s ease;
}
.modal-aba-btn:hover {
  color: #0f172a;
}
.modal-aba-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: #ffffff;
}
.modal-aba-btn .tab-badge {
  font-size: .74rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: #e2e8f0;
  color: #475569;
}
.modal-aba-btn.active .tab-badge {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

#form-editor-plano {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.plano-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  overscroll-behavior: contain;
}
.plano-modal-foot {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  z-index: 10;
}

/* Painel de Controle de Funcionalidades */
.func-painel-topo {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.func-contador-bloco {
  display: flex;
  align-items: center;
  gap: 12px;
}
.func-badge-qtd {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  padding: 4px 12px;
  border-radius: 99px;
  font-variant-numeric: tabular-nums;
}
.func-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.preset-btn {
  font-size: .8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all .15s ease;
}
.preset-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-border);
}

/* Categorias de Funcionalidades */
.func-grupo-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  margin-bottom: 16px;
  overflow: hidden;
}
.func-grupo-head {
  padding: 11px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.func-grupo-titulo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: .92rem;
  color: #0f172a;
}
.func-grupo-acoes {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .78rem;
}
.func-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  padding: 14px;
}
.func-item-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
}
.func-item-card:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.func-item-card.marcado {
  border-color: var(--primary-border);
  background: #f5f7ff;
}
.func-item-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}
.func-item-info {
  flex: 1;
  min-width: 0;
}
.func-item-nome {
  font-weight: 650;
  font-size: .88rem;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.func-item-card.marcado .func-item-nome {
  color: var(--primary-dark);
}
.func-item-desc {
  font-size: .78rem;
  color: #64748b;
  margin-top: 3px;
  line-height: 1.35;
}

/* Matriz Comparativa */
.matriz-comparativa {
  margin-top: 28px;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}
.tabela-matriz th, .tabela-matriz td {
  padding: 10px 14px;
  vertical-align: middle;
}
.tabela-matriz th {
  background: #f8fafc;
}
.tabela-matriz .func-check-ok {
  color: #16a34a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tabela-matriz .func-check-off {
  color: #cbd5e1;
}
