/* ============================================================
   A&7 · Emissor Fiscal Visual — HERO + FERRAMENTA (o protagonista)
   Abas NF-e / CT-e · formulário · processamento animado · resultado
   ============================================================ */

.hero {
  min-height: calc(100vh - var(--header-h));
  display: grid;
  align-items: center;
  overflow: hidden;
  padding: calc(var(--header-h) + 16px) 0 24px;
  background:
    radial-gradient(circle at 88% 12%, rgba(37,99,235,.16), transparent 34%),
    radial-gradient(circle at 12% 26%, rgba(6,182,212,.12), transparent 31%),
    linear-gradient(180deg, var(--hero-bg-1) 0%, var(--hero-bg-2) 100%);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .35;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}

/* ---- Documentos flutuantes de fundo (animações) ---- */
.hero-float { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.hero-float .f-doc {
  position: absolute;
  width: 56px; height: 72px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 8px;
  opacity: .5;
  animation: floatDoc 9s ease-in-out infinite;
}
.hero-float .f-doc i {
  display: block;
  height: 5px;
  border-radius: 99px;
  background: var(--line-strong);
}
.hero-float .f-doc i:nth-child(1) { width: 70%; background: linear-gradient(90deg, var(--indigo), var(--cyan)); }
.hero-float .f-doc i:nth-child(2) { width: 90%; }
.hero-float .f-doc i:nth-child(3) { width: 82%; }
.hero-float .f-doc i:nth-child(4) { width: 60%; }
.hero-float .f-doc.f1 { top: 16%; left: 6%; transform: rotate(-8deg); animation-delay: 0s; }
.hero-float .f-doc.f2 { top: 58%; left: 12%; width: 46px; height: 60px; transform: rotate(6deg); animation-delay: 1.4s; }
.hero-float .f-doc.f3 { top: 22%; right: 8%; transform: rotate(9deg); animation-delay: 2.6s; }
.hero-float .f-doc.f4 { top: 66%; right: 14%; width: 44px; height: 58px; transform: rotate(-6deg); animation-delay: 3.4s; }
@media (max-width: 980px) { .hero-float { display: none; } }
@keyframes floatDoc {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -16px; }
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 44px;
  align-items: center;
}
.hero-copy { max-width: 620px; }
.hero-copy .display { max-width: 640px; }
.hero-copy .section-lead { max-width: 560px; margin-top: 14px; }

/* KPIs da hero */
.hero-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 16px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.hero-kpi-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hero-kpi-item .kpi-num {
  font-size: 1.15rem;
  font-weight: 850;
  letter-spacing: -.02em;
  background: linear-gradient(135deg, var(--indigo), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-kpi-item .kpi-label {
  font-size: .74rem;
  font-weight: 650;
  color: var(--muted);
  line-height: 1.3;
}

.hero-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 18px;
}
.hero-trust span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  font-weight: 650;
  color: var(--muted);
}
.hero-trust span::before {
  content: "✓";
  display: grid; place-items: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  font-size: .55rem;
  color: #fff;
  background: linear-gradient(135deg, var(--green), #0d9a6e);
}

/* ---------- Card da ferramenta ---------- */
.tool-wrap { max-width: 540px; width: 100%; justify-self: center; }
.tool-card {
  position: relative;
  background: var(--tool-bg);
  border: 1px solid var(--tool-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}
.tool-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--indigo), var(--violet), var(--cyan));
}

.tool-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.tool-title { display: flex; align-items: center; gap: 9px; }
.tool-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 850;
  font-size: .96rem;
}
.tool-live .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(16,185,129,.5);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16,185,129,.5); }
  70% { box-shadow: 0 0 0 9px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
.tool-sub {
  font-size: .72rem;
  color: var(--muted);
  font-weight: 650;
}
.tool-badge {
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--violet-2);
  border: 1px solid var(--line-strong);
  padding: 4px 9px;
  border-radius: 999px;
}

/* ---- Abas NF-e / CT-e ---- */
.tool-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 999px;
  margin-bottom: 12px;
}
.tool-tab {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: .82rem;
  padding: 7px 10px;
  border-radius: 999px;
  transition: color .3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tool-tab .tab-ico { font-size: .92rem; }
.tool-tab.active { color: var(--ink); }
.tool-tab-ind {
  position: absolute;
  top: 3px; bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
}
.tool-tab-ind.cte { transform: translateX(100%); }

/* ---- Formulário ---- */
.tool-form { display: grid; gap: 8px; width: 100%; box-sizing: border-box; }
.tool-pane { display: grid; gap: 8px; }
.tool-pane[hidden] { display: none; }
.tool-field { display: grid; gap: 4px; min-width: 0; width: 100%; }
.tool-field-half { grid-column: 1 / -1; min-width: 0; }
.tool-label {
  font-size: .68rem;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.tool-label .req { color: var(--red); }
.tool-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: .88rem;
  letter-spacing: .02em;
  transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}
.tool-input::placeholder { color: var(--muted); }
.tool-input:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 4px var(--glow);
  transform: translateY(-1px);
}
.tool-input.error { border-color: var(--red); animation: shake .3s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.tool-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
  padding-right: 42px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.tool-go { min-width: 100%; }

.tool-extra {
  display: grid;
  gap: 8px;
}
@media (min-width: 460px) {
  .tool-extra { grid-template-columns: 1fr 1fr; }
  .tool-field-half { grid-column: auto; }
  .tool-go { min-width: 100%; }
}

.tool-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.chip-label { font-size: .68rem; color: var(--muted); font-weight: 650; }
.chip {
  font-size: .68rem;
  font-weight: 700;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 4px 9px;
  border-radius: 999px;
  transition: .22s ease;
}
.chip:hover { border-color: var(--indigo); color: var(--indigo); transform: translateY(-1px); }

/* ---- Linha de item (NF-e) ---- */
.item-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  position: relative;
}
.item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.item-num {
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.item-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.item-grid .item-desc { grid-column: 1 / -1; }
.item-grid .item-total-cell { grid-column: 1 / -1; }
.item-row .tool-input { min-height: 42px; font-size: .86rem; padding: 0 12px; }
.row-total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font-size: .8rem;
  color: var(--muted);
}
.row-total strong { color: var(--ink); }
.item-remove {
  width: 28px; height: 28px;
  border: 0;
  border-radius: 9px;
  background: var(--badge-danger-bg);
  color: var(--badge-danger-ink);
  font-size: 1rem;
  line-height: 1;
}
.item-remove:hover { transform: scale(1.08); }
.add-item-btn {
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--indigo);
  font-weight: 800;
  font-size: .8rem;
  padding: 6px 2px;
}
.add-item-btn:hover { text-decoration: underline; }
@media (min-width: 460px) {
  .item-grid { grid-template-columns: 1fr 1fr 1fr; }
  .item-grid .item-desc { grid-column: 1 / -1; }
  .item-grid .item-total-cell { grid-column: 1 / -1; }
}

/* ---- Status / steps animados ---- */
.tool-status {
  margin-top: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: grid;
  gap: 10px;
  overflow: hidden;
  position: relative;
}
.step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .88rem;
  font-weight: 650;
  color: var(--muted);
  opacity: .45;
  transition: .3s ease;
}
.step::before {
  content: "";
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  flex: none;
  transition: .3s ease;
}
.step.active { color: var(--ink); opacity: 1; }
.step.active::before {
  border-color: var(--indigo);
  background: radial-gradient(circle, var(--indigo) 0 45%, transparent 50%);
  animation: stepPop .4s ease;
}
.step.done { color: var(--green); opacity: 1; }
.step.done::before {
  border-color: var(--green);
  background: var(--green);
  box-shadow: inset 0 0 0 3px var(--tool-bg);
}
@keyframes stepPop { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

.tool-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(79,70,229,.09) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
  pointer-events: none;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- Veredito ---- */
.tool-verdict {
  margin-top: 18px;
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: .92rem;
  line-height: 1.55;
  background: var(--badge-ok-bg);
  color: var(--badge-ok-ink);
  border: 1px solid rgba(16,185,129,.35);
  animation: rise .45s ease;
}
.tool-verdict .verdict-ico { font-size: 1.3rem; line-height: 1; }
.tool-verdict strong { display: block; }
html[data-theme="dark"] .tool-verdict { color: #34d399; }

/* ---- Resultado ---- */
.tool-result {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 18px;
  animation: rise .45s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.result-status {
  display: inline-block;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.result-status.ok { background: var(--badge-ok-bg); color: var(--badge-ok-ink); }
.result-status.warn { background: var(--badge-warn-bg); color: var(--badge-warn-ink); }
.result-status.danger { background: var(--badge-danger-bg); color: var(--badge-danger-ink); }
.result-name { font-size: 1.18rem; letter-spacing: -.02em; line-height: 1.2; }
.result-meta { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.code-link {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--indigo);
  font-size: .78rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- Resumo de tributos (resultado) ---- */
.tax-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.tax-chip {
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  background: var(--surface-2);
}
.tax-chip .t-label {
  display: block;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.tax-chip .t-value { display: block; font-size: 1.05rem; font-weight: 900; letter-spacing: -.02em; margin-top: 2px; }
.tax-chip.hl { border-color: rgba(79,70,229,.45); background: linear-gradient(135deg, rgba(79,70,229,.08), var(--surface-2)); }
.tax-chip.hl .t-value { color: var(--indigo); }
html[data-theme="dark"] .tax-chip.hl .t-value { color: #a5b4fc; }

/* ---- Ações do documento ---- */
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.doc-actions .btn { min-height: 44px; padding: 10px 16px; font-size: .84rem; }

.result-source {
  margin-top: 12px;
  font-size: .74rem;
  color: var(--green);
  font-weight: 700;
}
html[data-theme="dark"] .result-source { color: #34d399; }

/* ---- Erro ---- */
.tool-error {
  margin-top: 14px;
  border: 1px solid var(--badge-danger-bg);
  background: var(--badge-danger-bg);
  color: var(--badge-danger-ink);
  border-radius: var(--radius-xs);
  padding: 13px 15px;
  font-size: .86rem;
  font-weight: 650;
  animation: rise .4s ease;
}

/* ---- Nota de honestidade ---- */
.tool-limit {
  margin-top: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .74rem;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.5;
}
.tool-limit .limited { color: var(--amber); font-weight: 800; }

/* ---------- Responsivo hero ---------- */
@media (max-width: 400px) {
  .tool-card { padding: 16px; }
  .item-grid { grid-template-columns: 1fr; }
}

@media (min-width: 980px) {
  .hero {
    min-height: 100vh;
    height: 100vh;
    padding: calc(var(--header-h) + 12px) 0 20px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }
  .hero-grid {
    display: grid;
    grid-template-columns: 1fr 1.05fr;
    gap: 36px;
    align-items: center;
    justify-items: center;
    max-width: 1080px;
    width: 100%;
    margin-inline: auto;
  }
  .hero-copy {
    max-width: 480px;
    text-align: left;
    position: relative;
    top: 0;
  }
  .hero-copy .display {
    font-size: clamp(1.7rem, 2.3vw, 2.25rem);
    line-height: 1.12;
    max-width: 480px;
  }
  .hero-copy .section-lead {
    font-size: clamp(.85rem, 1vw, .95rem);
    margin-top: 10px;
    max-width: 460px;
  }
  .hero-kpis {
    margin-top: 18px;
    padding-top: 16px;
    gap: 10px 14px;
  }
  .hero-kpi-item .kpi-num {
    font-size: 1.08rem;
  }
  .hero-kpi-item .kpi-label {
    font-size: .7rem;
  }
  .tool-wrap {
    justify-self: center;
    max-width: 520px;
    width: 100%;
  }
  .tool-card {
    padding: 16px 18px;
    max-height: calc(100vh - var(--header-h) - 36px);
    overflow-y: auto;
  }
  .tool-card::-webkit-scrollbar {
    width: 6px;
  }
  .tool-card::-webkit-scrollbar-track {
    background: transparent;
  }
  .tool-card::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 999px;
  }
  .tool-extra-nfe, .tool-extra-cte {
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
  }
  .tool-field { gap: 4px; }
  .tool-label {
    font-size: .66rem;
    white-space: normal;
  }
  .tool-input {
    min-height: 36px;
    padding: 0 12px;
    font-size: .86rem;
  }
  .tool-go {
    min-height: 42px;
    font-size: .92rem;
  }
}
