@charset "UTF-8";
/* Calculadora da CBS e do IBS · Alexander Andrade Leite
   Mesmo sistema visual do minicurso e do painel (cursoreforma2027/css/estilo.css):
   papel claro, editorial, acento laranja usado uma vez por tela. */
:root {
  --bg: #f5f4ef;
  --bg-2: #eceae3;
  --surface: #ffffff;
  --ink: #111318;
  --ink-2: #474c55;
  --ink-3: #6f747d;
  --line: #e2dfd6;
  --line-2: #d3cfc4;
  --accent: #ff5a1f;
  --accent-soft: #ffe7dc;
  --credit: #0f7d5e;
  --credit-soft: #d9f3ea;
  --loss: #c2183f;
  --cbs: #2563eb;
  --ibs: #7c3aed;
  --f-display: "Inter Tight", "Segoe UI", system-ui, sans-serif;
  --f-text: "Inter", "Segoe UI", system-ui, sans-serif;
  --f-serif: "Instrument Serif", Georgia, serif;
  --f-mono: "JetBrains Mono", Consolas, monospace;
  --radius: 18px;
  --out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--f-text);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "ss01" 1;
}
a { color: inherit; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
.mono { font-family: var(--f-mono); font-feature-settings: "tnum" 1; font-size: .92em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ===================== topo ===================== */
.topo { border-bottom: 1px solid var(--line); background: var(--bg); }
.topo-in {
  max-width: 1120px; margin: 0 auto; padding: 18px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.assinatura { display: flex; flex-direction: column; text-decoration: none; line-height: 1.15; }
.assinatura .nome { font: 400 24px/1.1 var(--f-serif); }
.assinatura .papel { font: 500 13px/1.4 var(--f-text); color: var(--ink-3); letter-spacing: .02em; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  font: 500 14px/1 var(--f-text); color: var(--ink-2); text-decoration: none;
  padding: 12px 12px; border-radius: 999px; min-height: 40px; display: inline-flex; align-items: center;
}
.nav a:hover { background: var(--bg-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }

/* ===================== página ===================== */
.pagina { max-width: 1120px; margin: 0 auto; padding: 40px 24px 64px; }
.abertura { max-width: 720px; margin-bottom: 32px; }
.sobre { font: 600 12.5px/1.4 var(--f-text); letter-spacing: .14em; text-transform: uppercase; color: #d9440f; margin: 0 0 12px; }
h1 { font: 800 clamp(36px, 5.4vw, 58px)/1.02 var(--f-display); letter-spacing: -.035em; margin: 0 0 16px; }
h1 em { display: block; font: italic 400 1.02em/1.08 var(--f-serif); letter-spacing: -.01em; color: var(--accent); }
.lead { font-size: 18px; color: var(--ink-2); margin: 0; max-width: 62ch; }

.grade { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.grade > * { min-width: 0; }
@media (min-width: 960px) {
  .grade { grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 28px; }
  .saida { position: sticky; top: 20px; }
}

.cartao {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; box-shadow: 0 1px 0 rgba(17, 19, 24, .03);
}
@media (max-width: 520px) { .cartao { padding: 22px 18px; } .pagina { padding: 28px 16px 120px; } }
.titulo-cartao { font: 400 30px/1.1 var(--f-serif); margin: 0 0 20px; }

/* ===================== campos ===================== */
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.campo { margin: 0 0 22px; }
label, legend { display: block; font: 600 14px/1.3 var(--f-text); margin: 0 0 8px; padding: 0; }
.ajuda { font-size: 13.5px; color: var(--ink-3); margin: 8px 0 0; line-height: 1.5; }
input, select {
  font: 500 17px/1.2 var(--f-text); color: var(--ink);
  width: 100%; min-height: 52px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover { border-color: var(--ink-3); }
input:focus, select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17, 19, 24, .10); }
input[aria-invalid="true"] { border-color: var(--loss); box-shadow: 0 0 0 3px rgba(194, 24, 63, .10); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 42px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23474c55' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
.moeda, .pct { position: relative; display: flex; align-items: center; }
.moeda span { position: absolute; left: 16px; font: 600 17px/1 var(--f-mono); color: var(--ink-3); pointer-events: none; }
.moeda input { padding-left: 52px; font: 600 22px/1 var(--f-mono); min-height: 60px; letter-spacing: -.01em; }
.pct span { position: absolute; right: 14px; font: 500 15px/1 var(--f-mono); color: var(--ink-3); pointer-events: none; }
.pct input { padding-right: 34px; font-family: var(--f-mono); }

.anos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.anos label, .segmento label { margin: 0; position: relative; font-weight: 500; }
.anos input, .segmento input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; pointer-events: none; }
.anos span, .segmento span {
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  min-height: 52px; padding: 8px 6px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface);
  font: 600 16px/1.1 var(--f-mono); color: var(--ink);
  transition: background .15s, color .15s, border-color .15s, transform .15s var(--out);
}
.anos small { display: block; font: 500 11px/1.2 var(--f-text); color: var(--ink-3); margin-top: 3px; letter-spacing: .02em; }
.anos span:hover, .segmento span:hover { border-color: var(--ink-3); }
.anos span:active, .segmento span:active { transform: scale(.97); }
.anos input:checked + span, .segmento input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.anos input:checked + span small { color: rgba(255, 255, 255, .72); }
.anos input:focus-visible + span, .segmento input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.segmento { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmento span { font: 600 15px/1.2 var(--f-text); }

/* blocos que abrem */
.mais { border-top: 1px solid var(--line); }
.mais:last-of-type { border-bottom: 1px solid var(--line); }
.mais summary {
  list-style: none; cursor: pointer; min-height: 56px; padding: 14px 32px 14px 0; position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font: 600 15px/1.3 var(--f-text);
}
.mais summary::-webkit-details-marker { display: none; }
.mais summary::after {
  content: ""; position: absolute; right: 6px; top: 50%; width: 9px; height: 9px; margin-top: -7px;
  border-right: 1.6px solid var(--ink-2); border-bottom: 1.6px solid var(--ink-2); transform: rotate(45deg);
  transition: transform .2s var(--out);
}
.mais[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.resumo-det { font: 500 13.5px/1.3 var(--f-text); color: var(--ink-3); text-align: right; }
.mais-corpo { padding: 4px 0 18px; }
.duplo { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
.triplo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 10px; }
@media (min-width: 560px) { .duplo { grid-template-columns: 120px 1fr; } }
.duplo .campo, .triplo .campo { margin-bottom: 0; }
.link {
  font: 600 14px/1.2 var(--f-text); color: var(--ink); background: none; border: 0; padding: 12px 0; margin-top: 4px;
  text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; cursor: pointer; min-height: 44px;
}

/* ===================== resultado ===================== */
.saida { transition: opacity .15s; }
.saida[aria-busy="true"] #saida-ok { opacity: .55; }
.saida-topo { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.saida-topo .titulo-cartao { margin-bottom: 18px; }
.selo {
  font: 600 12px/1.2 var(--f-text); letter-spacing: .02em; padding: 7px 11px; border-radius: 999px; margin-top: 6px;
  background: var(--accent-soft); color: #7a2a0c;
}
.selo.oficial { background: var(--credit-soft); color: var(--credit); }
.rotulo { font: 600 12px/1.4 var(--f-text); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 6px; }
.total { margin: 0; font: 700 clamp(44px, 7vw, 68px)/1 var(--f-display); letter-spacing: -.03em; font-feature-settings: "tnum" 1; }
.total span {
  text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 5px;
  text-underline-offset: 9px; text-decoration-skip-ink: none;
}
.total-sub { margin: 16px 0 22px; color: var(--ink-2); font-size: 16px; }
.total-sub b { color: var(--ink); font-weight: 600; white-space: nowrap; }

.tabela-rolagem { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.tabela { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 420px; }
.tabela th, .tabela td { padding: 11px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tabela th:first-child, .tabela td:first-child { text-align: left; padding-left: 0; }
.tabela th:last-child, .tabela td:last-child { padding-right: 0; }
.tabela thead th { font: 600 11.5px/1.3 var(--f-text); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.tabela td { font-family: var(--f-mono); font-size: 14px; }
.tabela td.trib { font-family: var(--f-text); font-size: 15px; font-weight: 500; }
.tabela td.trib i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.tabela td.trib i.cbs { background: var(--cbs); }
.tabela td.trib i.ibs { background: var(--ibs); }
.tabela tfoot th, .tabela tfoot td { border-bottom: 0; border-top: 1.5px solid var(--ink); font-weight: 700; color: var(--ink); }
.tabela tfoot th { font: 700 15px/1.3 var(--f-text); text-transform: none; letter-spacing: 0; }

.nota-ano { font-size: 14px; color: var(--ink-2); margin: 16px 0 0; padding: 12px 14px; background: var(--bg); border-radius: 12px; }
.nfse { margin-top: 22px; }
.nfse h3, .fontes h2 { font: 400 22px/1.2 var(--f-serif); margin: 0 0 10px; }
.nfse dl { margin: 0; display: grid; gap: 0; }
.nfse dl div { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.nfse dt { color: var(--ink-3); font-weight: 600; font-size: 13px; padding-top: 1px; }
.nfse dd { margin: 0; color: var(--ink-2); }
.nfse dd .mono { color: var(--ink); font-weight: 600; margin-right: 4px; }

.memoria { margin-top: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.memoria summary { cursor: pointer; min-height: 48px; padding: 13px 16px; font: 600 14px/1.4 var(--f-text); list-style: none; position: relative; }
.memoria summary::-webkit-details-marker { display: none; }
.memoria summary::after { content: "+"; position: absolute; right: 16px; top: 11px; font: 500 18px/1 var(--f-mono); color: var(--ink-3); }
.memoria[open] summary::after { content: "−"; }
#memoria { padding: 0 16px 14px; }
#memoria p { margin: 0 0 10px; font-size: 13.5px; color: var(--ink-2); }
#memoria b { color: var(--ink); font-weight: 600; }

.acoes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.botao {
  font: 600 15px/1.2 var(--f-text); color: var(--ink); background: var(--surface);
  border: 1px solid var(--ink); border-radius: 12px; min-height: 50px; padding: 12px 14px; cursor: pointer;
  transition: background .15s, transform .15s var(--out);
}
.botao:hover { background: var(--bg-2); }
.botao:active { transform: scale(.97); }
@media (max-width: 420px) { .acoes { grid-template-columns: 1fr; } }
.aviso-copia { min-height: 20px; margin: 8px 0 0; font-size: 13.5px; color: var(--credit); }
.saida-msg { padding: 12px 0 4px; color: var(--ink-2); }
.saida-msg.erro p { color: var(--loss); margin: 0 0 14px; }

/* ===================== fontes e rodapé ===================== */
.fontes { margin-top: 36px; max-width: 860px; }
.fontes ol { margin: 0; padding-left: 20px; }
.fontes li { font-size: 14px; color: var(--ink-2); margin-bottom: 8px; padding-left: 4px; }
.fontes li::marker { font: 600 13px var(--f-mono); color: var(--ink-3); }
.rodape { border-top: 1px solid var(--line); }
.rodape p { max-width: 1120px; margin: 0 auto; padding: 22px 24px 28px; font-size: 14px; color: var(--ink-3); }
.rodape .nome { font: 400 18px/1 var(--f-serif); color: var(--ink); }

/* ===================== barra do celular ===================== */
.barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--ink); color: #fff;
  box-shadow: 0 -8px 24px rgba(17, 19, 24, .12);
}
.barra-txt { font-size: 14px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.barra-rot { color: rgba(255, 255, 255, .7); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.barra b { font: 700 19px/1 var(--f-mono); }
.barra-txt > span:last-child { font-family: var(--f-mono); color: rgba(255, 255, 255, .8); }
.barra-bt {
  color: var(--ink); background: #fff; text-decoration: none; font: 600 14px/1 var(--f-text);
  padding: 14px 16px; border-radius: 10px; min-height: 44px; display: inline-flex; align-items: center; white-space: nowrap;
}
@media (min-width: 960px) { .barra { display: none !important; } }

/* ===================== celular ===================== */
.legenda-red { display: none; font-size: 13px; color: var(--ink-3); margin: 10px 0 0; }
@media (max-width: 560px) {
  .topo-in { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 16px 12px; }
  .nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .nav a { justify-content: center; text-align: center; padding: 10px 6px; font-size: 13.5px; min-height: 44px; }
  .nav .longo { display: none; }
  .tabela { min-width: 0; }
  .tabela th, .tabela td { padding: 10px 4px; }
  .tabela thead th { font-size: 10.5px; letter-spacing: .03em; }
  .tabela td { font-size: 12.5px; }
  .tabela td.trib { font-size: 14px; white-space: normal; }
  .tabela td.trib i { margin-right: 6px; }
  .saida-topo .selo { margin: -6px 0 16px; }
  .tabela .col-red { display: none; }
  .legenda-red { display: block; }
  .total-sub { font-size: 15px; }
}

/* ===================== impressão ===================== */
.impressao { display: none; }
@media print {
  @page { margin: 16mm 14mm; }
  body { background: #fff; font-size: 12px; }
  .nav, .lead, .entrada, .acoes, .aviso-copia, .barra, .memoria summary::after { display: none !important; }
  .topo, .rodape { border: 0; }
  .pagina { padding: 0; }
  .abertura { margin-bottom: 12px; }
  h1 { font-size: 26px; }
  .grade { display: block; }
  .cartao { border: 0; padding: 0; box-shadow: none; }
  .saida { position: static; }
  .impressao { display: block; margin: 0 0 14px; font-size: 13px; color: var(--ink-2); }
  .impressao p { margin: 0 0 4px; }
  .memoria { border: 0; background: none; }
  .memoria:not([open]) > *:not(summary) { display: block; }
  #memoria { padding: 0; }
  .tabela { min-width: 0; }
  a { text-decoration: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
