/* =====================================================================
   VISUAL DA CALCULADORA DE JUROS COMPOSTOS
   Usa as cores do site (variáveis de _nucleo/estilo.css), então
   funciona nos modos claro e escuro. Classes começam com .jc-
   As 2 cores do gráfico (investido e juros) ficam logo abaixo.
   ===================================================================== */

/* ---------- Cores do gráfico (claro e escuro) ---------- */
.jc { --jc-inv: #2350E0; --jc-jur: #12A585; }
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) .jc { --jc-inv: #8FB0FF; --jc-jur: #5EE6C8; }
}
:root[data-tema="escuro"] .jc { --jc-inv: #8FB0FF; --jc-jur: #5EE6C8; }
.jc-cor-investido { --c: var(--jc-inv); }
.jc-cor-juros { --c: var(--jc-jur); }

/* ---------- Base ---------- */
.jc { display: grid; gap: 1rem; margin-top: .4rem; }
.jc [hidden] { display: none !important; }
.jc-painel { display: grid; gap: 1rem; min-width: 0; }
.jc-painel:focus { outline: none; }
.jc-duas { display: grid; gap: 1rem; min-width: 0; }
.jc-pilha { display: grid; gap: 1rem; min-width: 0; align-content: start; }
.jc-cartao, .jc-resultado { padding: 1.1rem 1rem 1.2rem; min-width: 0; }
.jc-tit { display: flex; align-items: center; gap: .55rem; font-size: 1.15rem; margin: 0 0 .9rem; }
.jc-num { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--primaria); color: var(--sobre-primaria); font-size: .85rem; }
.jc-subtit { font-size: 1rem; margin: 0; }
.jc-explica { font-size: .88rem; color: var(--texto-2); line-height: 1.5; margin: .8rem 0 0; }
.jc-rot-pequeno { margin: 1rem 0 .45rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--texto-2); }
.jc-vazio { padding: 1.2rem 1rem; border-radius: 12px; background: var(--superficie-2); color: var(--texto-2); font-size: .92rem; text-align: center; }
.jc-link { border: 0; background: none; padding: 0; font: inherit; color: var(--primaria); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.jc-largo { width: 100%; margin-top: 1rem; }

/* ---------- Abas (fixas no topo enquanto rola) ---------- */
.jc-abas { position: sticky; top: calc(var(--topo-h) + 6px); z-index: 30; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; padding: 4px; border-radius: 18px; background: var(--superficie-2); box-shadow: 0 0 0 6px var(--fundo); }
.jc-abas button { display: flex; justify-content: center; align-items: center; gap: .4rem; border: 0; border-radius: 14px; min-height: 46px; background: transparent; font-weight: 650; font-size: .9rem; color: var(--texto-2); cursor: pointer; min-width: 0; }
.jc-abas .ico { width: 20px; height: 20px; flex: none; }
.jc-abas [aria-selected="true"] { background: var(--superficie); color: var(--titulo); box-shadow: inset 0 0 0 1px var(--borda), var(--sombra); }
.jc-abas [aria-selected="true"] .ico { color: var(--destaque-texto); }

/* ---------- Campos ---------- */
.jc-campos { display: grid; gap: .8rem; }
.jc-campo { display: grid; gap: .35rem; font-size: .9rem; font-weight: 650; color: var(--titulo); min-width: 0; }
.jc-campo small { font-size: .78rem; font-weight: 600; color: var(--texto-2); min-height: 1em; }

/* Caixa com "R$" na frente e caixa com sufixo ("%") atrás */
.jc-reais, .jc-sufixo { display: flex; align-items: center; min-height: 48px; border: 1.5px solid var(--borda); border-radius: var(--raio-p); background: var(--superficie); overflow: hidden; min-width: 0; }
.jc-reais:focus-within, .jc-sufixo:focus-within, .jc-qtd:focus { border-color: var(--primaria); box-shadow: 0 0 0 3px var(--primaria-suave); }
.jc-reais > span { padding: 0 .1rem 0 .85rem; font-weight: 700; color: var(--texto-2); }
.jc-reais input, .jc-sufixo input { flex: 1 1 auto; min-width: 0; width: 100%; border: 0; background: transparent; padding: .55rem .7rem; font: inherit; font-size: 1.15rem; font-weight: 700; color: var(--titulo); outline: none; }
.jc-sufixo > span { flex: none; padding: 0 .75rem 0 0; font-size: .85rem; font-weight: 700; color: var(--texto-2); white-space: nowrap; }
.jc-sufixo-mini { display: inline-flex; min-height: 40px; width: 9.5rem; vertical-align: middle; margin-top: .3rem; }
.jc-sufixo-mini input { font-size: 1rem; padding: .35rem .55rem; }

/* Número + botões de escolha lado a lado (taxa ao mês/ao ano, prazo em meses/anos) */
.jc-par { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: .5rem; }
.jc-qtd { min-height: 48px; height: 48px; padding: 0 .5rem; box-sizing: border-box; width: 100%; min-width: 0; border: 1.5px solid var(--borda); border-radius: var(--raio-p); background: var(--superficie); text-align: center; font: inherit; font-size: 1.15rem; font-weight: 700; color: var(--titulo); outline: none; }

/* Botões de escolha */
.jc-escolha { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; border-radius: 14px; background: var(--superficie-2); min-width: 0; }
.jc-escolha button { border: 0; border-radius: 11px; min-height: 42px; padding: .3rem .4rem; background: transparent; font: inherit; font-size: .86rem; font-weight: 700; color: var(--texto-2); cursor: pointer; line-height: 1.2; min-width: 0; }
.jc-escolha [aria-checked="true"] { background: var(--superficie); color: var(--titulo); box-shadow: inset 0 0 0 1px var(--borda); }
.jc-escolha-p button { min-height: 36px; font-size: .8rem; padding: .2rem .6rem; }
.jc-modo { margin-bottom: 1rem; }

/* Atalhos das taxas de hoje */
.jc-atalhos { display: flex; flex-wrap: wrap; gap: .4rem; }
.jc-atalhos small { font-weight: 600; opacity: .8; }
.jc-atalhos [aria-pressed="true"] { border-color: var(--destaque); background: var(--destaque-suave); color: var(--titulo); }

/* ---------- Mais opções ---------- */
.jc-mais summary { position: relative; cursor: pointer; font-size: .92rem; font-weight: 700; color: var(--titulo); list-style: none; display: block; padding-right: 1.6rem; line-height: 1.5; }
.jc-mais summary::-webkit-details-marker { display: none; }
.jc-mais summary::after { position: absolute; right: 0; top: 0; content: "+"; font-size: 1.25rem; line-height: 1; color: var(--destaque-texto); }
.jc-mais[open] summary::after { content: "–"; }
.jc-mais[open] summary { margin-bottom: .8rem; }
.jc-marcar { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem 0; border-top: 1px solid var(--borda); font-size: .88rem; line-height: 1.45; color: var(--texto); cursor: pointer; }
.jc-marcar input[type="checkbox"] { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--primaria); }
.jc-marcar b { color: var(--titulo); }
.jc-marcar-campo { flex-wrap: wrap; align-items: center; }

/* ---------- Resultado ---------- */
.jc-resultado { border: 1.5px solid color-mix(in srgb, var(--destaque) 45%, var(--borda)); }
.jc-frase { margin: 0; font-weight: 650; color: var(--texto-2); line-height: 1.4; }
.jc-grande { margin: .35rem 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .5rem; }
.jc-grande strong { font-family: var(--fonte-titulo); font-size: clamp(2rem, 9vw, 2.7rem); font-weight: 800; line-height: 1.08; color: var(--titulo); letter-spacing: -.02em; overflow-wrap: anywhere; }
.jc-grande > span { color: var(--texto-2); font-size: .95rem; font-weight: 600; }
.jc-sub { margin: .35rem 0 1rem; font-size: .92rem; color: var(--texto-2); line-height: 1.5; }

/* Barra investido × juros */
.jc-pilha-barra { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--superficie-2); }
.jc-pilha-barra i { display: block; height: 100%; background: var(--c); }
.jc-numeros { margin: .9rem 0 0; display: grid; gap: 0; }
.jc-numeros div { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; padding: .5rem 0; border-bottom: 1px solid var(--borda); }
.jc-numeros div:last-child { border-bottom: 0; }
.jc-numeros dt { display: flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--texto-2); min-width: 0; }
.jc-numeros dd { margin: 0; font-weight: 750; color: var(--titulo); white-space: nowrap; }
.jc-chave { display: inline-block; width: 12px; height: 12px; flex: none; border-radius: 4px; background: var(--c); vertical-align: -1px; }

/* Dicas automáticas */
.jc-insights { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .5rem; }
.jc-insights:empty { display: none; }
.jc-insights li { padding: .65rem .8rem; border-radius: 12px; background: var(--destaque-suave); font-size: .9rem; line-height: 1.5; color: var(--texto); }
.jc-insights b { color: var(--titulo); }

/* Ligação com o comparador de renda fixa */
.jc-ponte { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: 1rem; padding: .8rem .95rem; border: 1px solid var(--borda); border-radius: 12px; background: var(--superficie); text-decoration: none; color: var(--texto); font-size: .9rem; line-height: 1.4; }
.jc-ponte:hover { border-color: var(--destaque); }
.jc-ponte b { color: var(--titulo); }
.jc-ponte .ico { width: 18px; height: 18px; flex: none; color: var(--destaque-texto); }

.jc-acoes { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: 1.2rem; }
.jc-acoes .btn:first-child { grid-column: 1 / -1; }
.jc-acoes .btn { white-space: normal; text-align: center; line-height: 1.2; padding: .6rem .8rem; font-size: .9rem; }

/* ---------- Gráfico ---------- */
.jc-legenda { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; margin: -.3rem 0 .6rem; font-size: .85rem; color: var(--texto-2); }
.jc-legenda .jc-chave:last-of-type { margin-left: .6rem; }
.jc-grafico { position: relative; min-width: 0; margin-top: 1.3rem; }
.jc-grafico svg { display: block; width: 100%; height: 220px; touch-action: pan-y; cursor: crosshair; }
.jc-svg-guia { stroke: var(--borda); stroke-width: 1; vector-effect: non-scaling-stroke; }
.jc-svg-juros { fill: color-mix(in srgb, var(--jc-jur) 55%, transparent); }
.jc-svg-investido { fill: color-mix(in srgb, var(--jc-inv) 70%, transparent); }
.jc-svg-linha { fill: none; stroke: var(--jc-jur); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.jc-svg-marca { stroke: var(--titulo); stroke-width: 1.5; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.jc-eixo { position: absolute; left: 4px; transform: translateY(-110%); font-size: .72rem; font-weight: 700; color: var(--texto-2); background: color-mix(in srgb, var(--superficie) 80%, transparent); padding: 0 .25rem; border-radius: 4px; pointer-events: none; }
.jc-eixo-x { display: flex; justify-content: space-between; margin: .3rem 0 0; font-size: .75rem; font-weight: 650; color: var(--texto-2); }
.jc-ponto { margin: .6rem 0 0; padding: .55rem .75rem; border-radius: 10px; background: var(--superficie-2); font-size: .86rem; line-height: 1.45; color: var(--texto); min-height: 2.4em; }
.jc-ponto b { color: var(--titulo); }

/* ---------- Tabelas (resultado e artigo) ---------- */
.jc-tabela-topo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin: 1.4rem 0 .5rem; }
.jc-tabela-caixa { max-height: 460px; overflow: auto; border: 1px solid var(--borda); border-radius: 12px; margin-bottom: .8rem; }
.jc-tabela { width: 100%; border-collapse: collapse; font-size: .86rem; }
.jc-tabela th, .jc-tabela td { padding: .55rem .5rem; border-bottom: 1px solid var(--borda); text-align: right; white-space: nowrap; }
.jc-tabela th:first-child { text-align: left; }
.jc-tabela thead th { font-size: .7rem; color: var(--texto-2); text-transform: uppercase; letter-spacing: .05em; background: var(--superficie); }
.jc-mes-a-mes thead th { position: sticky; top: 0; z-index: 1; }
.jc-tabela tbody th { font-weight: 600; }
.jc-tabela tr:last-child th, .jc-tabela tr:last-child td { border-bottom: 0; }
.jc-tabela .jc-destaque th, .jc-tabela .jc-destaque td { background: color-mix(in srgb, var(--destaque) 10%, var(--superficie)); }
.jc-tabela .jc-destaque th { box-shadow: inset 3px 0 0 var(--destaque); }
@media (max-width: 559px) {
  .jc-col-extra { display: none; }
  .jc-tabela { font-size: .8rem; }
  .jc-tabela th, .jc-tabela td { padding: .5rem .3rem; }
}   /* no celular, os juros do período saem para caber */

/* ---------- Dica do dia e aviso ---------- */
.jc-dica { padding: 1rem 1.1rem; border-radius: var(--raio); background: var(--destaque-suave); border: 1px solid color-mix(in srgb, var(--destaque) 35%, transparent); }
.jc-dica p { margin: 0; font-size: .92rem; }
.jc-dica-rot { font-size: .72rem !important; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; color: var(--destaque-texto); }
.jc-dica-tit { font-family: var(--fonte-titulo); font-weight: 800; font-size: 1.05rem !important; color: var(--titulo); margin: .25rem 0 .2rem !important; }
.jc-aviso-legal { margin: 0; font-size: .8rem; }

/* ---------- Artigo: exemplo resolvido e casos ---------- */
.jc-exemplo { margin: 1.2rem 0 1.4rem; padding: 1rem 1.1rem; border-radius: var(--raio); background: var(--superficie); border: 1px solid var(--borda); }
.jc-exemplo-rot { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; color: var(--destaque-texto); margin: 0 0 .4rem; }
.jc-conta { margin: .4rem 0 .9rem; padding-left: 1.2rem; display: grid; gap: .35rem; font-size: .93rem; overflow-wrap: anywhere; }
.jc-formula { margin: .8rem 0 1rem; padding: .8rem 1rem; border-radius: 12px; background: var(--superficie-2); font-family: var(--fonte-titulo); font-weight: 800; font-size: 1.15rem; color: var(--titulo); text-align: center; overflow-wrap: anywhere; }
.jc-casos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .5rem; margin: .8rem 0 1.4rem; }
.jc-caso { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .8rem .95rem; border: 1px solid var(--borda); border-radius: 12px; background: var(--superficie); text-decoration: none; color: var(--texto); font-size: .93rem; }
.jc-caso:hover { border-color: var(--destaque); }
.jc-caso .ico { width: 18px; height: 18px; flex: none; color: var(--destaque-texto); }

/* ---------- Telas maiores ---------- */
@media (min-width: 560px) {
  .jc-campos { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .jc-grafico svg { height: 260px; }
}
@media (min-width: 700px) {
  .jc-cartao, .jc-resultado { padding: 1.3rem 1.3rem 1.4rem; }
}
@media (min-width: 900px) {
  .jc-duas { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
  .jc-duas > .jc-resultado { position: sticky; top: calc(var(--topo-h) + 80px); }
  .jc-grafico svg { height: 300px; }
}

/* ---------- Impressão: só o que importa ---------- */
@media print {
  .jc-abas, .jc-dica, .jc-atalhos, .jc-rot-pequeno, .jc-aviso-legal .jc-link, .jc-ponte { display: none !important; }
  .jc-cartao, .jc-resultado { box-shadow: none; break-inside: avoid; }
  .jc-duas > .jc-resultado { position: static; }
  .jc-tabela-caixa { max-height: none; overflow: visible; }
  .jc-mais summary::after { content: ""; }
}
