:root {
  --azul: #1f2b4d;
  --azul-2: #2c3b66;
  --azul-claro: #e8ecf6;
  --fundo: #f2f3f8;
  --cartao: #ffffff;
  --texto: #1d2333;
  --texto-suave: #6a7185;
  --borda: #e3e6ef;
  --verde: #1f8a4c;
  --vermelho: #c0392b;
  --dourado: #b8893b;
  --sombra: 0 2px 6px rgba(31,43,77,.06), 0 8px 24px rgba(31,43,77,.06);
  --sombra-forte: 0 6px 14px rgba(31,43,77,.12), 0 22px 44px rgba(31,43,77,.16);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fundo); color: var(--texto); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

/* ---------- estrutura ---------- */
.app { display: flex; min-height: 100vh; }
aside.menu { width: 230px; flex: none; background: linear-gradient(180deg, var(--azul) 0%, #18223d 100%); color: #fff; padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
aside.menu .marca { text-align: center; margin-bottom: 26px; }
aside.menu .marca img { width: 120px; }
aside.menu .marca span { display: block; margin-top: 8px; font-family: Georgia, "Times New Roman", serif; letter-spacing: .28em; font-size: 10px; opacity: .8; }
aside.menu nav button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; font: inherit; font-size: 15px; color: rgba(255,255,255,.78); background: transparent; border: 0; border-radius: 12px; padding: 11px 12px; margin-bottom: 4px; cursor: pointer; transition: background .2s, color .2s, transform .2s; }
aside.menu nav button:hover { background: rgba(255,255,255,.08); color: #fff; transform: translateX(3px); }
aside.menu nav button.ativo { background: #fff; color: var(--azul); font-weight: 600; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
aside.menu nav .ic { width: 22px; text-align: center; font-size: 17px; }
aside.menu .rodape { margin-top: auto; font-size: 12px; opacity: .65; }
aside.menu .rodape button { margin-top: 8px; font: inherit; color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
main { flex: 1; min-width: 0; padding: 22px 26px 40px; }
.titulo-modulo { font-size: 24px; font-weight: 700; color: var(--azul); margin: 0 0 4px; }
.sub-modulo { color: var(--texto-suave); margin: 0 0 16px; font-size: 14px; }

/* ---------- seletor de período ---------- */
.periodo { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.periodo button, .periodo select { font: inherit; font-size: 14px; border: 1px solid var(--borda); background: #fff; color: var(--texto); border-radius: 999px; padding: 7px 15px; cursor: pointer; transition: all .2s; box-shadow: var(--sombra); }
.periodo button:hover { transform: translateY(-2px); }
.periodo button.ativo { background: var(--azul); color: #fff; border-color: var(--azul); }
.periodo .escolher { display: none; gap: 6px; align-items: center; font-size: 14px; color: var(--texto-suave); }
.periodo .escolher.aberto { display: inline-flex; flex-wrap: wrap; }
.periodo .rotulo { width: 100%; font-size: 13px; color: var(--texto-suave); }
.periodo .rotulo b { color: var(--azul); }

/* ---------- cartões 3D ---------- */
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; perspective: 1000px; }
.cartao { background: var(--cartao); border: 1px solid var(--borda); border-radius: 18px; padding: 18px; box-shadow: var(--sombra); }
.c3d { transform-style: preserve-3d; transition: transform .25s ease, box-shadow .25s ease; will-change: transform; position: relative; }
.c3d:hover { box-shadow: var(--sombra-forte); z-index: 2; }
.c3d::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(135deg, rgba(255,255,255,.55), rgba(255,255,255,0) 45%); opacity: 0; transition: opacity .25s; pointer-events: none; }
.c3d:hover::after { opacity: 1; }
.cartao h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-suave); margin: 0 0 8px; font-weight: 600; }
.numero { font-size: 28px; font-weight: 700; color: var(--azul); letter-spacing: -.01em; }
.compara { font-size: 13px; margin-top: 6px; color: var(--texto-suave); }
.compara span { font-weight: 600; }
.sobe { color: var(--verde); }
.desce { color: var(--vermelho); }
.destaque { background: linear-gradient(135deg, var(--azul) 0%, var(--azul-2) 100%); color: #fff; border: 0; }
.destaque h2, .destaque .compara { color: rgba(255,255,255,.75); }
.destaque .numero { color: #fff; }
.destaque .sobe { color: #7ee2a8; } .destaque .desce { color: #ffb3a8; }
section.bloco { margin-top: 26px; }
section.bloco > h3 { font-size: 17px; margin: 0 0 4px; color: var(--azul); }
.dica { font-size: 13px; color: var(--texto-suave); margin: 0 0 12px; }

/* quadradinhos de mês */
.meses { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; perspective: 900px; }
.mes-card { border-radius: 16px; padding: 14px; background: #fff; border: 1px solid var(--borda); box-shadow: var(--sombra); }
.mes-card .m { font-size: 13px; color: var(--texto-suave); text-transform: capitalize; }
.mes-card .v { font-size: 20px; font-weight: 700; color: var(--azul); margin: 2px 0; }
.mes-card .d { font-size: 12px; font-weight: 600; }
.mes-card.sel { border: 2px solid var(--dourado); }

/* listas em cartões (profissionais, serviços, pacotes, produtos) */
.lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; perspective: 1000px; }
.item { cursor: pointer; }
.item .pos { position: absolute; top: 14px; right: 16px; font-size: 13px; font-weight: 700; color: var(--dourado); }
.item .nome { font-weight: 600; font-size: 15px; margin-bottom: 8px; padding-right: 26px; }
.item .linha { display: flex; justify-content: space-between; font-size: 13px; color: var(--texto-suave); margin-top: 3px; }
.item .linha b { color: var(--texto); }
.item .valor { font-size: 22px; font-weight: 700; color: var(--azul); }
.barra { height: 6px; border-radius: 99px; background: var(--azul-claro); margin-top: 10px; overflow: hidden; }
.barra i { display: block; height: 100%; background: linear-gradient(90deg, var(--azul), var(--dourado)); border-radius: 99px; }

/* resultado (DRE) */
.dre { max-width: 560px; }
.linha-res { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--borda); }
.linha-res.total { border-bottom: 0; font-weight: 700; font-size: 18px; color: var(--azul); }

/* janela de detalhe */
.janela { position: fixed; inset: 0; background: rgba(15,20,35,.55); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 20; backdrop-filter: blur(2px); }
.janela.aberta { display: flex; }
.janela .cartao { width: 100%; max-width: 760px; max-height: 88vh; overflow: auto; animation: abre .25s ease; }
@keyframes abre { from { transform: scale(.94) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.janela .fechar { float: right; border: 0; background: none; font-size: 26px; cursor: pointer; color: var(--texto-suave); line-height: 1; }
.janela h3 { margin: 0 0 4px; color: var(--azul); font-size: 19px; }

.vazio { color: var(--texto-suave); padding: 20px; text-align: center; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login .cartao { width: 100%; max-width: 340px; text-align: center; }
.login input { font-size: 26px; letter-spacing: .4em; text-align: center; width: 100%; padding: 10px; border: 1px solid var(--borda); border-radius: 10px; margin: 12px 0; }
.login button { width: 100%; font: inherit; font-weight: 600; background: var(--azul); color: #fff; border: 0; border-radius: 999px; padding: 11px; cursor: pointer; }
.login .erro { color: var(--vermelho); font-size: 14px; min-height: 20px; }
.logo-login { width: 190px; max-width: 70%; display: block; margin: 4px auto 6px; }
.subtitulo-marca { font-family: Georgia, "Times New Roman", serif; letter-spacing: .28em; font-size: 11px; color: var(--texto-suave); padding-left: .28em; white-space: nowrap; margin-top: 8px; }

/* ---------- celular ---------- */
@media (max-width: 820px) {
  .app { flex-direction: column; }
  aside.menu { width: 100%; height: auto; position: sticky; top: 0; z-index: 10; padding: 10px 10px 8px; }
  aside.menu .marca { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 8px; text-align: left; }
  aside.menu .marca img { width: 64px; }
  aside.menu .marca span { margin: 0; font-size: 9px; }
  aside.menu nav { display: flex; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  aside.menu nav button { width: auto; white-space: nowrap; padding: 7px 12px; font-size: 13px; margin: 0; }
  aside.menu nav button:hover { transform: none; }
  aside.menu .rodape { display: none; }
  main { padding: 14px 12px 40px; }
  .grade { grid-template-columns: 1fr 1fr; gap: 10px; }
  .cartao { padding: 13px; border-radius: 14px; }
  .numero { font-size: 21px; }
  .compara { font-size: 12px; }
  .meses { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
  .titulo-modulo { font-size: 20px; }
}
/* ajustes de largura */
html, body { overflow-x: hidden; }
.grade > *, .lista > *, .meses > * { min-width: 0; }
.numero, .item .valor, .mes-card .v { white-space: nowrap; }
@media (max-width: 400px) { .numero { font-size: 18px; } .mes-card .v { font-size: 17px; } }
@media (max-width: 820px) {
  .periodo { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .periodo button { white-space: nowrap; font-size: 13px; padding: 6px 12px; box-shadow: none; }
  .periodo .rotulo { display: none; }
  .periodo .escolher.aberto { white-space: nowrap; }
  .sub-modulo { font-size: 13px; margin-bottom: 10px; }
  .lista { grid-template-columns: 1fr; }
}

/* ---------- v3: visual mais limpo ---------- */
.grade.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.painel { background: #fff; border: 1px solid var(--borda); border-radius: 18px; box-shadow: var(--sombra); padding: 6px 18px 12px; margin-top: 22px; }
.painel > .topo-painel { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 0 6px; }
.painel h3 { margin: 0; font-size: 17px; color: var(--azul); }
.pilulas { display: flex; flex-wrap: wrap; gap: 6px; }
.pilulas button { font: inherit; font-size: 13px; border: 1px solid var(--borda); background: #fff; border-radius: 999px; padding: 5px 12px; cursor: pointer; color: var(--texto); transition: all .2s; }
.pilulas button:hover { transform: translateY(-1px); border-color: var(--azul); }
.pilulas button.ativo { background: var(--azul); color: #fff; border-color: var(--azul); }
.linhas { width: 100%; border-collapse: collapse; }
.linhas th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--texto-suave); font-weight: 600; text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--borda); white-space: nowrap; }
.linhas td { padding: 11px 8px; border-bottom: 1px solid var(--borda); font-size: 14px; }
.linhas tr:last-child td { border-bottom: 0; }
.linhas .v { text-align: right; white-space: nowrap; }
.linhas .pos { color: var(--dourado); font-weight: 700; width: 28px; }
.linhas .nome { font-weight: 600; }
.linhas tbody tr { transition: background .15s, transform .15s; }
.linhas tbody tr:hover { background: var(--azul-claro); }
.linhas tr.clica { cursor: pointer; }
.linhas tfoot td { font-weight: 700; color: var(--azul); border-top: 2px solid var(--borda); }
.rolagem { overflow-x: auto; }
.dre-tab th, .dre-tab td { text-align: right; white-space: nowrap; }
.dre-tab th:first-child, .dre-tab td:first-child { text-align: left; position: sticky; left: 0; background: #fff; }
.dre-tab tr.total td { font-weight: 700; color: var(--azul); background: #f7f8fc; }
.dre-tab tr.total td:first-child { background: #f7f8fc; }
.botao-link { font: inherit; font-size: 14px; color: var(--azul); background: var(--azul-claro); border: 0; border-radius: 999px; padding: 8px 16px; cursor: pointer; font-weight: 600; }
.botao-link:hover { filter: brightness(.96); }
.cartao.clicavel { cursor: pointer; }
.cartao.clicavel .compara:last-child { color: var(--azul); font-weight: 600; }
.whats { color: var(--verde); text-decoration: none; white-space: nowrap; }
.semi-resumo .linha-res span:last-child { font-weight: 600; }
@media (max-width: 820px) {
  .grade.tres { grid-template-columns: 1fr 1fr; }
  .grade.tres > :first-child { grid-column: 1 / -1; }
  .painel { padding: 4px 10px 8px; border-radius: 14px; }
  .linhas td, .linhas th { padding: 9px 5px; font-size: 13px; }
  .esconde-cel { display: none; }
  .pilulas { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .pilulas button { white-space: nowrap; }
}
.cartao.texto .numero { white-space: normal; font-size: 18px; line-height: 1.25; overflow-wrap: anywhere; }
.dre-tab td.sel { background: #fbf6ec; }
@media (max-width: 820px) { .cartao.texto .numero { font-size: 15px; } }
@media (max-width: 820px) { .linhas th { white-space: normal; } .linhas td, .linhas th { padding: 9px 4px; } }
@media (max-width: 820px) { .linhas td.nome { overflow-wrap: anywhere; font-size: 12.5px; } .linhas td.v { font-size: 12.5px; } }

.total-geral { padding: 22px 24px; }
.total-geral .numero { font-size: 36px; }
@media (max-width: 820px) { .total-geral .numero { font-size: 28px; } .total-geral .compara { line-height: 1.6; } }
