/* ═══════════════════════════════════════════════════════════════════════════
   Emissor NFS-e — estilos do módulo (prefixo .emi-). Usa os tokens do styles.css.
   ═══════════════════════════════════════════════════════════════════════════ */

/* faixa de homologação (ambiente 2): listras âmbar da marca, sempre visível no topo da tela */
.emi-homolog {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--accent-500); color: var(--accent-ink); font-size: 13.5px;
  background: repeating-linear-gradient(-45deg, var(--accent-100) 0 14px, #FAE5BC 14px 28px);
}
.emi-homolog strong { letter-spacing: .14em; }

/* filtros */
.emi-filtros { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; padding: 16px 20px; }
.emi-filtros .field { margin: 0; flex: 1 1 150px; min-width: 0; }
.emi-filtros .emi-grow { flex: 2 1 220px; }
.emi-filtros .btn { flex: none; }
.emi-todas { gap: 8px; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.emi-todas input, .emi-tbl input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--brand-800); }
.emi-bar { flex-wrap: wrap; }

/* tabelas densas */
.emi-tbl td, .emi-tbl th { white-space: nowrap; padding-left: 8px; padding-right: 8px; }
.emi-tbl { font-size: 13px; }
.emi-tbl td:nth-child(5), .emi-tbl td:nth-child(4) { white-space: normal; }
.emi-tbl .sr-only, .emi-bar .sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.emi-tbl a { color: var(--brand-800); font-weight: 600; text-underline-offset: 2px; }
.emi-tbl a:hover { color: var(--accent-ink); }
.emi-detalhe, .emi-detalhe:hover { background: var(--surface-2) !important; }
.emi-detalhe td { padding: 14px 16px; white-space: normal; }
.emi-detalhe h4 { font-size: 13px; }

/* situação da emissão (etiqueta com ponto) */
.emi-tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .2px; white-space: nowrap;
  background: #ECEDEF; color: var(--text-soft);
}
.emi-tag i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.emi-tag-validada { background: var(--info-bg); color: var(--info); }
.emi-tag-enviando { background: var(--accent-100); color: var(--accent-ink); }
.emi-tag-enviando i { animation: emi-pulso 1.2s ease-in-out infinite; }
.emi-tag-autorizada { background: var(--success-bg); color: var(--success); }
.emi-tag-recuperada { background: var(--success-bg); color: var(--success); box-shadow: inset 0 0 0 1px currentColor; }
.emi-tag-erro { background: var(--danger-bg); color: var(--danger); }
.emi-tag-emitida_fora { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border-strong); }
@keyframes emi-pulso { 50% { opacity: .25; } }

/* lote em andamento */
.emi-lote { display: grid; gap: 12px; margin-bottom: 16px; border-left: 3px solid var(--accent-500); }
.emi-prog { height: 10px; border-radius: 999px; background: var(--border); overflow: hidden; }
.emi-prog span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-400), var(--accent-500)); transition: width var(--t-med); }
.emi-prog.done span { background: var(--success); }
.emi-res { list-style: none; margin: 0; padding: 0; display: grid; max-height: 260px; overflow: auto; }
.emi-res li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.emi-res li:last-child { border-bottom: none; }
.emi-res a { color: var(--brand-800); font-weight: 600; }

/* detalhe da fatura */
.emi-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 20px; align-items: start; margin-bottom: 16px; }
.emi-head h2 { font-size: 22px; }
.emi-head-r { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.emi-valor { font-size: 24px; font-weight: 700; }
.emi-acoes, .emi-bloqueio { grid-column: 1 / -1; }
.emi-acoes { display: flex; gap: 10px; flex-wrap: wrap; }
.emi-acoes a.btn { text-decoration: none; }
.emi-sec { margin-bottom: 16px; }
.emi-alert { padding: 10px 14px; margin-bottom: 8px; border-radius: var(--radius-sm); border-left: 3px solid; font-size: 13.5px; overflow-wrap: anywhere; }
.emi-alert--erro { background: var(--danger-bg); color: var(--danger); }
.emi-alert--aviso { background: var(--warning-bg); color: var(--warning); }
.emi-alert--ok { background: var(--success-bg); color: var(--success); }
.emi-cmp { table-layout: fixed; }
.emi-cmp th:first-child, .emi-cmp td:first-child { width: 26%; color: var(--text-soft); font-weight: 600; }
.emi-cmp td { vertical-align: top; overflow-wrap: anywhere; }
.emi-cmp td:nth-child(3) { font-family: var(--font-mono); font-size: 12.5px; }
.emi-cmp + .table-wrap, .table-wrap + .table-wrap { border-top: 1px solid var(--border); }

/* XML, request/response e dados da emissão */
.emi-pre {
  margin: 0; padding: 12px 14px; max-height: 380px; overflow: auto; white-space: pre;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12px; line-height: 1.5;
}
.emi-pre.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.emi-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; font-size: 13.5px; }
.emi-dl dt { color: var(--muted); font-weight: 600; }
.emi-dl dd { margin: 0; overflow-wrap: anywhere; }
.emi-chave { font-size: 12px; }
.modal .emi-dl { margin-top: 14px; }
.emi-links { display: inline-flex; gap: 12px; flex-wrap: wrap; }
.emi-links a { color: var(--info); font-weight: 600; text-decoration: none; }
.emi-links a:hover { text-decoration: underline; }
.emi-linkbtn { padding: 0; border: none; background: none; color: var(--info); font-weight: 600; font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; }
.emi-linkbtn.mono { color: var(--brand-800); font-size: 12.5px; }
.emi-linkbtn:hover { color: var(--accent-ink); }

@media (max-width: 640px) {
  .emi-head { grid-template-columns: 1fr; }
  .emi-head-r { align-items: flex-start; }
  .emi-dl { grid-template-columns: 1fr; gap: 2px; }
  .emi-dl dd { margin-bottom: 8px; }
  .emi-cmp th:first-child, .emi-cmp td:first-child { width: 34%; }
}
