/* ===== Tema ===== */
:root {
  --bg: #f1f3fa;
  --card: #ffffff;
  --texto: #0f172a;
  --suave: #64748b;
  --borda: #e5e8f2;
  --indigo: #6366f1;
  --violeta: #8b5cf6;
  --ciano: #06b6d4;
  --azul: #3b82f6;
  --verde: #10b981;
  --ambar: #f59e0b;
  --vermelho: #ef4444;
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #06b6d4 140%);
  --sombra: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 32px rgba(15, 23, 42, .06);
  --raio: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--texto);
  -webkit-font-smoothing: antialiased;
}

/* ===== Estrutura: menu lateral + conteúdo ===== */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

.lateral {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 28px;
  padding: 26px 16px 20px;
  background: radial-gradient(120% 60% at 0% 0%, #312e81 0%, transparent 60%), linear-gradient(180deg, #0f172a, #1e1b4b);
  color: #cbd5e1;
}
.marca { display: flex; align-items: center; gap: 12px; padding: 0 10px; }
.marca-icone {
  width: 42px; height: 42px; border-radius: 13px; background: var(--grad);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 8px 20px rgba(99, 102, 241, .45);
}
.marca-icone svg { width: 22px; height: 22px; }
.marca strong { display: block; color: #fff; font-size: 17px; letter-spacing: -.2px; }
.marca small { color: #94a3b8; font-size: 12px; }

.menu { display: flex; flex-direction: column; gap: 4px; }
.menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px;
  color: #cbd5e1; text-decoration: none; font-weight: 500; font-size: 14.5px;
  transition: background .15s, color .15s, transform .15s;
}
.menu-item svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.menu-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.menu-item.ativo {
  background: var(--grad); color: #fff; font-weight: 600;
  box-shadow: 0 8px 22px rgba(99, 102, 241, .4);
}
.menu-item.ativo svg { opacity: 1; }

.lateral-rodape {
  margin-top: auto; padding: 12px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, .06); font-size: 12.5px; color: #94a3b8;
  display: flex; align-items: center; gap: 8px;
}
.ponto { width: 8px; height: 8px; border-radius: 50%; background: var(--verde); box-shadow: 0 0 0 4px rgba(16, 185, 129, .2); }

.conteudo {
  padding: 36px clamp(18px, 4vw, 48px) 60px;
  background: radial-gradient(60% 280px at 85% 0%, rgba(99, 102, 241, .10), transparent 70%);
  min-width: 0;
}
.topo { margin-bottom: 26px; }
.topo h1 { margin: 0; font-size: 30px; letter-spacing: -.6px; font-weight: 800; }
.topo p { margin: 6px 0 0; color: var(--suave); font-size: 15px; }

/* ===== Cartões e grades ===== */
.grade { display: grid; gap: 22px; margin-bottom: 22px; }
.grade.dois { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cartao {
  background: var(--card); border: 1px solid var(--borda); border-radius: var(--raio);
  padding: 26px; box-shadow: var(--sombra); margin-bottom: 22px; min-width: 0;
}
.grade .cartao { margin-bottom: 0; }
.cartao h2 { margin: 0 0 18px; font-size: 16px; font-weight: 700; letter-spacing: -.2px; display: flex; align-items: center; gap: 10px; }
.cartao-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.cartao-topo h2 { margin-bottom: 4px; }
.nota { color: var(--suave); font-size: 12.5px; line-height: 1.5; margin: 14px 0 0; }
.cartao-topo .nota { margin: 0; }

/* ===== Formulários e botões ===== */
.campo { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: #334155; }
input, select {
  width: 100%; padding: 13px 15px; font: inherit; font-size: 15px; color: var(--texto);
  background: #f8f9fd; border: 1.5px solid var(--borda); border-radius: 13px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus { outline: none; background: #fff; border-color: var(--indigo); box-shadow: 0 0 0 4px rgba(99, 102, 241, .15); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px; border: 0; border-radius: 13px; cursor: pointer;
  font: inherit; font-size: 14.5px; font-weight: 600; color: #fff; background: var(--grad);
  box-shadow: 0 8px 20px rgba(99, 102, 241, .32);
  transition: transform .12s, box-shadow .12s, opacity .12s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(99, 102, 241, .4); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
form .btn { width: 100%; }
.btn-sec { background: #eef0f8; color: #334155; box-shadow: none; }
.btn-sec:hover { background: #e3e6f2; box-shadow: none; }
.btn-perigo { background: linear-gradient(135deg, #ef4444, #f97316); box-shadow: 0 8px 20px rgba(239, 68, 68, .3); }
.btn-perigo:hover { box-shadow: 0 12px 26px rgba(239, 68, 68, .4); }
.btn-perigo-sec { background: #fff1f0; color: #dc2626; box-shadow: none; border: 1px solid #fecaca; }
.btn-perigo-sec:hover { background: #fee2e2; box-shadow: none; }
.btn-pequeno { padding: 9px 14px; font-size: 13px; border-radius: 11px; }

/* ===== Resultado das calculadoras ===== */
.resultado {
  min-height: 190px; border-radius: 16px; padding: 24px; text-align: center;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px;
  background: #f6f7fd; border: 1.5px dashed var(--borda);
}
.vazio-res { color: var(--suave); font-size: 14px; gap: 14px; }
.triangulo { width: 96px; color: #c7cbe6; }
.resultado.ok { border: 0; color: #fff; background: var(--grad); box-shadow: 0 14px 34px rgba(99, 102, 241, .35); }
.resultado.ok.g-abaixo { background: linear-gradient(135deg, #3b82f6, #06b6d4); box-shadow: 0 14px 34px rgba(59, 130, 246, .35); }
.resultado.ok.g-normal { background: linear-gradient(135deg, #10b981, #06b6d4); box-shadow: 0 14px 34px rgba(16, 185, 129, .35); }
.resultado.ok.g-sobrepeso { background: linear-gradient(135deg, #f59e0b, #f97316); box-shadow: 0 14px 34px rgba(245, 158, 11, .35); }
.resultado.ok.g-obesidade { background: linear-gradient(135deg, #f97316, #ef4444); box-shadow: 0 14px 34px rgba(239, 68, 68, .35); }
.resultado.erro { background: #fff7ed; border: 1.5px solid #fed7aa; color: #c2410c; font-weight: 500; }
.res-rotulo { font-size: 12.5px; text-transform: uppercase; letter-spacing: 1.2px; opacity: .85; font-weight: 600; }
.res-valor { font-size: 58px; font-weight: 800; letter-spacing: -2px; line-height: 1.05; }
.res-legenda { font-size: 16px; font-weight: 600; opacity: .95; }

.escala { position: relative; width: 100%; max-width: 320px; margin-top: 18px; }
.escala-faixas { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: rgba(255, 255, 255, .3); }
.escala-faixas span { display: block; }
.escala-marca {
  position: absolute; top: -5px; width: 20px; height: 20px; margin-left: -10px;
  border-radius: 50%; background: #fff; border: 4px solid #0f172a; box-shadow: 0 3px 10px rgba(0, 0, 0, .3);
}
.f1 { background: #3b82f6; } .f2 { background: #10b981; } .f3 { background: #f59e0b; }
.f4 { background: #f97316; } .f5 { background: #ef4444; } .f6 { background: #b91c1c; }

.faixas { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.faixas li { display: grid; grid-template-columns: 12px 1fr; column-gap: 10px; align-items: center; padding: 12px 14px; background: #f8f9fd; border-radius: 13px; font-size: 13px; }
.faixas i { width: 12px; height: 12px; border-radius: 50%; grid-row: span 2; }
.faixas span { color: var(--suave); font-size: 12px; }

/* ===== Conciliação: envio de arquivos ===== */
.pilula { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 9px; font-size: 13px; font-weight: 800; color: #fff; }
.p-azul { background: linear-gradient(135deg, #3b82f6, #06b6d4); }
.p-violeta { background: linear-gradient(135deg, #8b5cf6, #ec4899); }

.zona {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 30px 16px; margin: 0; cursor: pointer; text-align: center;
  border: 2px dashed #c9cde8; border-radius: 16px; background: #f8f9fd; color: var(--suave);
  transition: border-color .15s, background .15s, transform .15s;
}
.zona svg { width: 34px; height: 34px; color: var(--indigo); }
.zona strong { color: var(--texto); font-size: 14.5px; }
.zona span { font-size: 12.5px; }
.zona:hover, .zona.sobre { border-color: var(--indigo); background: #eef0ff; }
.zona.sobre { transform: scale(1.01); }

.info { margin-top: 18px; }
.arquivo-nome { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; word-break: break-all; }
.arquivo-nome small { font-weight: 500; color: var(--suave); white-space: nowrap; }
.selecoes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.selecoes label { font-size: 12px; margin-bottom: 5px; }
.selecoes select { padding: 10px 12px; font-size: 13.5px; }
.previa { overflow-x: auto; border: 1px solid var(--borda); border-radius: 12px; }
.previa table { font-size: 12px; }
.previa th, .previa td { padding: 7px 10px; white-space: nowrap; }
.msg-erro { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: #fff7ed; border: 1px solid #fed7aa; color: #c2410c; font-size: 13.5px; }

.barra-acao { display: flex; align-items: center; gap: 16px; margin: 4px 0 26px; flex-wrap: wrap; }
.barra-acao .nota { margin: 0; }

/* ===== Conciliação: resultado ===== */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi {
  text-align: left; cursor: pointer; font: inherit; color: inherit;
  background: var(--card); border: 1.5px solid var(--borda); border-radius: 18px; padding: 18px 20px;
  box-shadow: var(--sombra); transition: transform .12s, border-color .12s;
}
.kpi:hover { transform: translateY(-2px); }
.kpi.ativo { border-color: var(--indigo); box-shadow: 0 0 0 4px rgba(99, 102, 241, .12), var(--sombra); }
.kpi small { display: flex; align-items: center; gap: 8px; color: var(--suave); font-size: 12.5px; font-weight: 600; }
.kpi small i { width: 10px; height: 10px; border-radius: 50%; }
.kpi b { display: block; margin-top: 8px; font-size: 32px; font-weight: 800; letter-spacing: -1px; }
.c-verde { background: var(--verde); } .c-ambar { background: var(--ambar); }
.c-azul { background: var(--azul); } .c-violeta { background: var(--violeta); }

.totais { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.total { background: var(--card); border: 1px solid var(--borda); border-radius: 18px; padding: 16px 20px; box-shadow: var(--sombra); }
.total small { color: var(--suave); font-size: 12.5px; font-weight: 600; }
.total b { display: block; margin-top: 4px; font-size: 21px; font-weight: 800; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.total.destaque { background: var(--grad); border: 0; color: #fff; }
.total.destaque small { color: rgba(255, 255, 255, .85); }
.total.destaque.zerado { background: linear-gradient(135deg, #10b981, #06b6d4); }

.avisos { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.aviso { padding: 11px 14px; border-radius: 12px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 13px; }
.sucesso { padding: 16px 18px; border-radius: 14px; background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; font-weight: 600; margin-bottom: 18px; }

.ferramentas { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border-radius: 99px; border: 1.5px solid var(--borda); background: #fff; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: #475569; transition: all .12s;
}
.chip:hover { border-color: var(--indigo); color: var(--indigo); }
.chip.ativo { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.chip em { font-style: normal; opacity: .7; margin-left: 4px; }
.busca { width: 220px; padding: 10px 14px; font-size: 13.5px; border-radius: 99px; }

/* ===== Tabelas ===== */
.tabela-wrap { overflow-x: auto; border: 1px solid var(--borda); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; padding: 12px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--suave); background: #f8f9fd; border-bottom: 1px solid var(--borda); position: sticky; top: 0; white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid #eef0f7; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbff; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num { text-align: right; }
.pos { color: #047857; font-weight: 600; } .neg { color: #dc2626; font-weight: 600; }
.vazio-tab { padding: 28px; text-align: center; color: var(--suave); }
.rodape-tab { margin-top: 12px; font-size: 12.5px; color: var(--suave); }
td.acao { width: 52px; text-align: right; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-confere { background: #d1fae5; color: #047857; }
.b-diferente { background: #fef3c7; color: #b45309; }
.b-so_contabil { background: #dbeafe; color: #1d4ed8; }
.b-so_financeiro { background: #ede9fe; color: #6d28d9; }
.b-imc { background: #e0e7ff; color: #4338ca; }
.b-hipotenusa { background: #cffafe; color: #0e7490; }
.b-conciliacao { background: #fce7f3; color: #be185d; }

.icone-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 10px; border: 0; background: transparent; color: #94a3b8; cursor: pointer; transition: all .12s; }
.icone-btn svg { width: 17px; height: 17px; }
.icone-btn:hover { background: #fee2e2; color: #dc2626; }

/* ===== Janela de confirmação ===== */
dialog { border: 0; border-radius: 22px; padding: 28px; width: min(420px, 92vw); box-shadow: 0 30px 80px rgba(15, 23, 42, .35); color: var(--texto); font-family: inherit; }
dialog::backdrop { background: rgba(15, 23, 42, .55); backdrop-filter: blur(4px); }
dialog h3 { margin: 0 0 8px; font-size: 19px; letter-spacing: -.3px; }
dialog p { margin: 0 0 22px; color: var(--suave); font-size: 14px; line-height: 1.55; }
.dlg-acoes { display: flex; justify-content: flex-end; gap: 10px; }

/* ===== Telas menores ===== */
@media (max-width: 980px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .faixas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .lateral { position: static; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 14px; overflow-x: auto; }
  .marca div, .lateral-rodape { display: none; }
  .menu { flex-direction: row; }
  .menu-item span { display: none; }
  .menu-item.ativo span { display: inline; }
  .grade.dois { grid-template-columns: 1fr; }
  .totais { grid-template-columns: 1fr; }
  .selecoes { grid-template-columns: 1fr; }
  .busca { width: 100%; }
}

/* ===== Login e botão Sair ===== */
.menu-sair {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; border: 0; border-radius: 14px; cursor: pointer;
  background: transparent; color: #cbd5e1; font: inherit; font-size: 14.5px; font-weight: 500;
  transition: background .15s, color .15s;
}
.menu-sair svg { width: 19px; height: 19px; opacity: .85; }
.menu-sair:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.menu-sair + .lateral-rodape { margin-top: 0; }
.lateral .menu { flex: 0 0 auto; }
.lateral .menu-sair { margin-top: auto; }
.lateral .menu-sair + .lateral-rodape { margin-top: 0; }

.login-pagina {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(70% 50% at 20% 0%, rgba(99, 102, 241, .35), transparent 70%),
              radial-gradient(60% 50% at 100% 100%, rgba(6, 182, 212, .25), transparent 70%), #0f172a;
}
.login-card {
  width: min(400px, 100%); background: #fff; border-radius: 24px; padding: 34px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .4);
}
.marca-login { padding: 0; margin-bottom: 22px; }
.marca-login strong { color: var(--texto); }
.marca-login small { color: var(--suave); }
.login-card h1 { margin: 0; font-size: 26px; letter-spacing: -.5px; font-weight: 800; }
.login-card .sub { margin: 6px 0 22px; color: var(--suave); font-size: 14px; }
