/* ==========================================================================
   AllRegTech Financeiro - folha de estilo unica
   ========================================================================== */

:root {
  --fundo: #f1f5f9;
  --superficie: #ffffff;
  --superficie-2: #f8fafc;
  --borda: #e2e8f0;
  --borda-forte: #cbd5e1;
  --texto: #0f172a;
  --texto-2: #475569;
  --texto-3: #94a3b8;

  --marca: #0f172a;
  --marca-2: #1e293b;
  --primaria: #0284c7;
  --primaria-clara: #e0f2fe;
  --sucesso: #059669;
  --sucesso-clara: #d1fae5;
  --perigo: #dc2626;
  --perigo-clara: #fee2e2;
  --alerta: #d97706;
  --alerta-clara: #fef3c7;
  --cofre: #7c3aed;
  --cofre-clara: #ede9fe;

  --raio: 12px;
  --raio-sm: 8px;
  --sombra: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 12px rgba(15, 23, 42, .05);
  --sombra-alta: 0 10px 40px rgba(15, 23, 42, .18);
  --lateral: 244px;
  --transicao: .18s cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
a { color: var(--primaria); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

.oculto { display: none !important; }
.crescer { flex: 1; }
.direita { text-align: right; }
.centro { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; }

/* ============================= login ============================= */

.login-tela {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--marca);
}

.login-arte {
  position: relative;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background:
    radial-gradient(900px 500px at 10% 10%, rgba(2, 132, 199, .35), transparent 60%),
    radial-gradient(700px 600px at 90% 90%, rgba(124, 58, 237, .32), transparent 60%),
    linear-gradient(160deg, #0f172a, #1e293b);
  overflow: hidden;
}

.login-arte::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(600px at 30% 40%, #000, transparent 75%);
}

.login-arte > * { position: relative; z-index: 1; }

.login-marca { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.login-marca span.tag { font-weight: 500; color: #7dd3fc; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }

.login-arte h1 { font-size: 40px; line-height: 1.1; max-width: 15ch; }
.login-arte p { color: #cbd5e1; max-width: 46ch; font-size: 15px; }

.login-recursos { display: flex; flex-direction: column; gap: 10px; margin-top: 26px; }
.login-recursos div { display: flex; align-items: center; gap: 10px; color: #e2e8f0; font-size: 14px; }
.login-recursos svg { color: #38bdf8; flex: none; }

.login-form-area {
  background: var(--superficie);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-caixa { width: 100%; max-width: 380px; }
.login-caixa h2 { font-size: 26px; margin-bottom: 6px; }
.login-caixa .sub { color: var(--texto-2); margin-bottom: 28px; }

@media (max-width: 900px) {
  .login-tela { grid-template-columns: 1fr; }
  .login-arte { display: none; }
}

/* ============================= layout app ============================= */

.app { display: flex; min-height: 100vh; }

.lateral {
  width: var(--lateral);
  flex: none;
  background: var(--marca);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  transition: transform var(--transicao);
}

.lateral-topo {
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.lateral-marca { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 16px; letter-spacing: -.02em; }
.lateral-marca .logo {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #0ea5e9, #7c3aed);
  display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 800;
}
.lateral-sub { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: #64748b; margin-top: 6px; margin-left: 42px; }

.menu { padding: 14px 12px; overflow-y: auto; flex: 1; }
.menu-grupo { font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: #64748b; padding: 14px 10px 6px; font-weight: 700; }

.menu a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--raio-sm);
  color: #cbd5e1; font-weight: 500; font-size: 14px;
  transition: background var(--transicao), color var(--transicao);
  cursor: pointer;
}
.menu a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.menu a.ativo { background: var(--primaria); color: #fff; box-shadow: 0 4px 12px rgba(2, 132, 199, .35); }
.menu a svg { width: 18px; height: 18px; flex: none; }
.menu a .contador {
  margin-left: auto; background: var(--perigo); color: #fff;
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 20px;
}

.lateral-rodape { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
.usuario-caixa { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #38bdf8, #7c3aed);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.usuario-caixa .nome { color: #fff; font-weight: 600; font-size: 13px; line-height: 1.2; }
.usuario-caixa .papel { color: #64748b; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.btn-sair { background: none; border: none; color: #94a3b8; cursor: pointer; padding: 6px; border-radius: 6px; }
.btn-sair:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.conteudo { flex: 1; margin-left: var(--lateral); display: flex; flex-direction: column; min-width: 0; }

.topo {
  background: var(--superficie);
  border-bottom: 1px solid var(--borda);
  padding: 0 26px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topo h1 { font-size: 19px; }
.topo .sub { color: var(--texto-3); font-size: 12.5px; }

.pagina { padding: 22px 26px 60px; }

.btn-menu { display: none; background: none; border: none; cursor: pointer; padding: 6px; }

@media (max-width: 1024px) {
  .lateral { transform: translateX(-100%); }
  .lateral.aberta { transform: none; box-shadow: var(--sombra-alta); }
  .conteudo { margin-left: 0; }
  .btn-menu { display: block; }
  .pagina { padding: 16px 14px 60px; }
  .topo { padding: 0 14px; }
}

/* ============================= componentes ============================= */

.cartao {
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  box-shadow: var(--sombra);
}
.cartao-cabecalho {
  padding: 14px 18px;
  border-bottom: 1px solid var(--borda);
  display: flex; align-items: center; gap: 12px;
}
.cartao-cabecalho h3 { font-size: 15px; }
.cartao-cabecalho .sub { color: var(--texto-3); font-size: 12px; }
.cartao-corpo { padding: 18px; }

.grade { display: grid; gap: 16px; }
.grade-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grade-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grade-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1200px) { .grade-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .grade-4, .grade-3, .grade-2 { grid-template-columns: 1fr; }
}

/* indicadores */
.indicador {
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 16px 18px;
  box-shadow: var(--sombra);
  position: relative;
  overflow: hidden;
}
.indicador::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primaria);
}
.indicador.verde::before { background: var(--sucesso); }
.indicador.vermelho::before { background: var(--perigo); }
.indicador.laranja::before { background: var(--alerta); }
.indicador.roxo::before { background: var(--cofre); }
.indicador .rotulo {
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--texto-3); font-weight: 700;
}
.indicador .valor { font-size: 25px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; }
.indicador .nota { font-size: 12px; color: var(--texto-2); margin-top: 4px; }
.indicador .icone {
  position: absolute; right: 14px; top: 14px; opacity: .16;
}

/* tabelas */
.tabela-area { overflow-x: auto; }
table.tabela { width: 100%; border-collapse: collapse; }
table.tabela th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--texto-3); font-weight: 700; padding: 10px 12px;
  border-bottom: 1px solid var(--borda); background: var(--superficie-2);
  position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
table.tabela td { padding: 11px 12px; border-bottom: 1px solid var(--borda); vertical-align: middle; }
table.tabela tbody tr { transition: background var(--transicao); }
table.tabela tbody tr:hover { background: var(--superficie-2); }
table.tabela tbody tr:last-child td { border-bottom: none; }
table.tabela .principal { font-weight: 600; }
table.tabela .secundario { font-size: 12px; color: var(--texto-3); }
.valor-entrada { color: var(--sucesso); font-weight: 700; }
.valor-saida { color: var(--perigo); font-weight: 700; }

.vazio { padding: 44px 20px; text-align: center; color: var(--texto-3); }
.vazio svg { opacity: .3; margin-bottom: 10px; }
.vazio p { margin: 4px 0; }

/* selos */
.selo {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700;
  background: var(--superficie-2); color: var(--texto-2); white-space: nowrap;
}
.selo.pago { background: var(--sucesso-clara); color: #065f46; }
.selo.pendente { background: var(--alerta-clara); color: #92400e; }
.selo.atrasado { background: var(--perigo-clara); color: #991b1b; }
.selo.cancelado { background: #f1f5f9; color: #64748b; text-decoration: line-through; }
.selo.info { background: var(--primaria-clara); color: #075985; }
.selo.roxo { background: var(--cofre-clara); color: #5b21b6; }
.selo.ponto::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* botoes */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--raio-sm); border: 1px solid transparent;
  background: var(--primaria); color: #fff; font-weight: 600; font-size: 13.5px;
  cursor: pointer; transition: all var(--transicao); white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; }
.btn.secundario { background: var(--superficie); color: var(--texto); border-color: var(--borda-forte); }
.btn.secundario:hover { background: var(--superficie-2); }
.btn.perigo { background: var(--perigo); }
.btn.verde { background: var(--sucesso); }
.btn.roxo { background: var(--cofre); }
.btn.fantasma { background: transparent; color: var(--texto-2); }
.btn.fantasma:hover { background: var(--superficie-2); color: var(--texto); }
.btn.pequeno { padding: 6px 11px; font-size: 12.5px; }
.btn.icone { padding: 7px; }
.btn.bloco { width: 100%; }

/* formularios */
.campo { margin-bottom: 14px; }
.campo label {
  display: block; font-size: 12.5px; font-weight: 600; color: var(--texto-2); margin-bottom: 5px;
}
.campo .ajuda { font-size: 11.5px; color: var(--texto-3); margin-top: 4px; }
.controle {
  width: 100%; padding: 9px 12px; border: 1px solid var(--borda-forte);
  border-radius: var(--raio-sm); background: var(--superficie);
  transition: border-color var(--transicao), box-shadow var(--transicao);
}
.controle:focus {
  outline: none; border-color: var(--primaria);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, .15);
}
.controle:disabled { background: var(--superficie-2); color: var(--texto-3); }
textarea.controle { resize: vertical; min-height: 76px; }
select.controle { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }

.linha-campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.linha-campos.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) { .linha-campos, .linha-campos.tres { grid-template-columns: 1fr; } }

.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--primaria); cursor: pointer; }

.filtros {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  padding: 14px 16px; background: var(--superficie);
  border: 1px solid var(--borda); border-radius: var(--raio); margin-bottom: 16px;
  box-shadow: var(--sombra);
}
.filtros .campo { margin: 0; min-width: 140px; }
.filtros .campo.busca { flex: 1; min-width: 220px; }

.abas { display: flex; gap: 3px; border-bottom: 1px solid var(--borda); margin-bottom: 18px; overflow-x: auto; }
.abas button {
  background: none; border: none; padding: 10px 15px; cursor: pointer;
  color: var(--texto-2); font-weight: 600; font-size: 13.5px;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.abas button:hover { color: var(--texto); }
.abas button.ativa { color: var(--primaria); border-bottom-color: var(--primaria); }

/* modal */
.modal-fundo {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(3px); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: surgir .16s ease;
}
.modal {
  background: var(--superficie); border-radius: 16px; width: 100%; max-width: 560px;
  max-height: 92vh; display: flex; flex-direction: column;
  box-shadow: var(--sombra-alta); animation: subir .2s cubic-bezier(.16, 1, .3, 1);
}
.modal.grande { max-width: 860px; }
.modal.pequeno { max-width: 420px; }
.modal-cabecalho {
  padding: 18px 22px; border-bottom: 1px solid var(--borda);
  display: flex; align-items: center; gap: 12px;
}
.modal-cabecalho h3 { font-size: 17px; }
.modal-cabecalho .sub { font-size: 12.5px; color: var(--texto-3); margin-top: 2px; }
.modal-corpo { padding: 20px 22px; overflow-y: auto; }
.modal-rodape {
  padding: 14px 22px; border-top: 1px solid var(--borda);
  display: flex; justify-content: flex-end; gap: 9px; background: var(--superficie-2);
  border-radius: 0 0 16px 16px;
}
.fechar-modal {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--texto-3); padding: 5px; border-radius: 6px; line-height: 0;
}
.fechar-modal:hover { background: var(--superficie-2); color: var(--texto); }

@keyframes surgir { from { opacity: 0; } to { opacity: 1; } }
@keyframes subir { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* avisos */
.aviso {
  padding: 11px 14px; border-radius: var(--raio-sm); font-size: 13.5px;
  display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px;
}
.aviso svg { flex: none; margin-top: 1px; }
.aviso.erro { background: var(--perigo-clara); color: #991b1b; }
.aviso.sucesso { background: var(--sucesso-clara); color: #065f46; }
.aviso.alerta { background: var(--alerta-clara); color: #92400e; }
.aviso.info { background: var(--primaria-clara); color: #075985; }

/* toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--marca); color: #fff; padding: 12px 16px; border-radius: 10px;
  box-shadow: var(--sombra-alta); font-size: 13.5px; font-weight: 500;
  display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 380px;
  animation: entrar .22s cubic-bezier(.16, 1, .3, 1);
}
.toast.sucesso { background: #047857; }
.toast.erro { background: #b91c1c; }
.toast.alerta { background: #b45309; }
@keyframes entrar { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* graficos */
.grafico { width: 100%; overflow: visible; }
.grafico .grade-linha { stroke: var(--borda); stroke-width: 1; }
.grafico text { font-size: 10.5px; fill: var(--texto-3); }
.legenda { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--texto-2); }
.legenda span { display: flex; align-items: center; gap: 6px; }
.legenda i { width: 10px; height: 10px; border-radius: 3px; display: block; }

.barra-progresso { height: 6px; background: var(--borda); border-radius: 20px; overflow: hidden; }
.barra-progresso div { height: 100%; border-radius: 20px; transition: width .3s ease; }

/* cofre */
.cofre-travado {
  max-width: 440px; margin: 60px auto; text-align: center;
  background: var(--superficie); border: 1px solid var(--borda);
  border-radius: 18px; padding: 40px 32px; box-shadow: var(--sombra);
}
.cofre-cadeado {
  width: 68px; height: 68px; border-radius: 20px; margin: 0 auto 18px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 10px 30px rgba(124, 58, 237, .35);
}
.cofre-item {
  display: flex; align-items: center; gap: 14px; padding: 13px 16px;
  border-bottom: 1px solid var(--borda); transition: background var(--transicao);
}
.cofre-item:hover { background: var(--superficie-2); }
.cofre-item:last-child { border-bottom: none; }
.cofre-icone {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
  background: var(--cofre-clara); color: var(--cofre);
}
.senha-caixa {
  display: flex; align-items: center; gap: 8px;
  background: var(--superficie-2); border: 1px solid var(--borda);
  border-radius: var(--raio-sm); padding: 8px 12px;
  font-family: ui-monospace, Consolas, monospace; font-size: 13.5px;
  word-break: break-all;
}
.forca-senha { height: 5px; border-radius: 20px; background: var(--borda); overflow: hidden; margin-top: 6px; }
.forca-senha div { height: 100%; transition: width .25s ease; }

/* -------- cartoes do cofre -------- */
.cc-bloco {
  background: var(--superficie); border: 1px solid var(--borda);
  border-radius: var(--raio); overflow: hidden;
  transition: transform var(--transicao), box-shadow var(--transicao);
}
.cc-bloco:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15, 23, 42, .12); }
.cc {
  color: #fff; padding: 16px 18px 14px;
  display: flex; flex-direction: column; gap: 14px; min-height: 152px;
}
.cc-topo { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cc-apelido { font-weight: 650; font-size: 14.5px; line-height: 1.3; }
.cc-selo {
  flex: none; font-size: 11px; font-weight: 600; letter-spacing: .03em;
  background: rgba(255, 255, 255, .2); border-radius: 20px; padding: 3px 9px;
}
.cc-numero {
  font-family: ui-monospace, Consolas, monospace; font-size: 17px;
  letter-spacing: .09em; margin-top: auto;
}
.cc-rodape { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.cc-rodape small { display: block; opacity: .72; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; }
.cc-rodape b { font-weight: 600; }
.cc-acoes { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.cc-info { flex: 1; min-width: 0; font-size: 12px; color: var(--texto-3); line-height: 1.45; }

.trilha { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--texto-3); }

.carregando {
  display: inline-block; width: 15px; height: 15px;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  border-radius: 50%; animation: girar .7s linear infinite;
}
.carregando.escuro { border-color: rgba(15, 23, 42, .18); border-top-color: var(--texto); }
@keyframes girar { to { transform: rotate(360deg); } }

.esqueleto {
  background: linear-gradient(90deg, #eef2f6 25%, #e2e8f0 50%, #eef2f6 75%);
  background-size: 200% 100%; animation: brilho 1.4s infinite; border-radius: 6px; height: 14px;
}
@keyframes brilho { to { background-position: -200% 0; } }

@media print {
  .lateral, .topo, .filtros, .btn { display: none !important; }
  .conteudo { margin: 0; }
  .cartao { box-shadow: none; border-color: #cbd5e1; }
}
