/* ==========================================
   LEITOR NARRADO ("📥 Jogar Comprovantes" contado na tela)
   Não é janela: fica no fluxo da aba, entre o lote e a fila.
   ========================================== */
.leitor-palco {
  margin: 1.25rem 0 1rem;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.07), rgba(99, 102, 241, 0.04)), var(--bg-card);
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.leitor-palco[hidden] { display: none; }

.lp-topo { display: flex; align-items: center; gap: 0.6rem; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--border-color); flex-wrap: wrap; }
.lp-avatar {
  width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem;
  background: radial-gradient(circle at 30% 30%, rgba(52, 211, 153, 0.35), rgba(16, 185, 129, 0.12));
  border: 1px solid rgba(52, 211, 153, 0.5);
  animation: lpRespira 2.4s ease-in-out infinite;
}
.lp-titulo { display: flex; align-items: baseline; gap: 0.45rem; min-width: 0; font-family: var(--font-display); }
.lp-titulo strong { font-size: 0.98rem; }
.lp-estado { font-family: var(--font-main); font-size: 0.74rem; color: var(--text-muted); white-space: nowrap; }
.lp-trilha { display: flex; gap: 0.3rem; flex: 1 1 160px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.lp-trilha::-webkit-scrollbar { display: none; }
.lp-chip { flex: 0 0 auto; font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-full); border: 1px solid var(--border-color); color: var(--text-secondary); background: rgba(255, 255, 255, 0.03); white-space: nowrap; }
.lp-chip-lendo { border-color: rgba(96, 165, 250, 0.6); color: #93c5fd; animation: lpPisca 1.1s ease-in-out infinite; }
.lp-chip-pronto, .lp-chip-precisa_atencao, .lp-chip-possivel_duplicado { border-color: rgba(245, 158, 11, 0.55); color: #fcd34d; }
.lp-chip-conferido { border-color: rgba(16, 185, 129, 0.6); color: #6ee7b7; }
.lp-chip-duplicado, .lp-chip-problema_arquivo, .lp-chip-nao_comprovante { border-color: rgba(244, 63, 94, 0.55); color: #fda4af; }
.lp-chip-agora { box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.55); transform: translateY(-1px); }
.lp-btn { flex: 0 0 auto; font: inherit; font-size: 0.74rem; font-weight: 700; padding: 0.3rem 0.6rem; border-radius: var(--radius-full); border: 1px solid var(--border-color); background: rgba(255, 255, 255, 0.04); color: var(--text-secondary); cursor: pointer; }
.lp-btn:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.09); }
.lp-btn[hidden] { display: none; }
.lp-parar { border-color: rgba(244, 63, 94, 0.45); color: #fda4af; }
#lpRecolher { transition: transform 0.2s; }
.lp-recolhido #lpRecolher { transform: rotate(-90deg); }

.lp-agora-linha { position: relative; display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.9rem; font-size: 0.8rem; color: var(--text-secondary); min-height: 2rem; }
.lp-agora { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.lp-agora:empty::before { content: 'Esperando comprovantes…'; color: var(--text-muted); }
.lp-prazo { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: transparent; }
.lp-prazo i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #10b981, #6366f1); }
.lp-agora-linha:not(.lp-com-prazo) .lp-prazo i { width: 0 !important; }

.lp-cena { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 0.9rem; padding: 0.8rem 0.9rem 0.95rem; border-top: 1px solid var(--border-color); }
.lp-cena:empty { display: none; }
.lp-recolhido .lp-cena { display: none; }
.lp-mini { position: relative; width: 92px; height: 132px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border-color); background: #0b1220; display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.lp-mini img { width: 100%; height: 100%; object-fit: cover; object-position: top; opacity: 0.92; }
.lp-scan { position: absolute; left: 0; right: 0; top: 0; height: 22%; background: linear-gradient(180deg, rgba(52, 211, 153, 0), rgba(52, 211, 153, 0.35), rgba(52, 211, 153, 0)); animation: lpVarre 1.6s ease-in-out infinite; }
.lp-cena-fim .lp-scan { display: none; }

.lp-falas { list-style: none; margin: 0; padding: 0 0.2rem 0 0; display: flex; flex-direction: column; gap: 0.32rem; max-height: 440px; overflow-y: auto; }
.lp-fala { display: grid; grid-template-columns: 1.4em minmax(0, 1fr); column-gap: 0.45rem; align-items: start; font-size: 0.84rem; line-height: 1.45; color: var(--text-secondary); animation: lpEntra 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both; overflow-wrap: anywhere; }
.lp-fala > *:not(.lp-ic):not(.lp-tx) { grid-column: 2; }
.lp-ic { text-align: center; }
.lp-ok .lp-tx { color: var(--text-primary); }
.lp-aviso .lp-tx { color: #fcd34d; }
.lp-erro .lp-tx { color: #fda4af; font-weight: 600; }
.lp-info .lp-tx { color: var(--text-secondary); font-weight: 600; }
.lp-abrir { margin-top: 0.35rem; justify-self: start; font: inherit; font-size: 0.8rem; font-weight: 700; padding: 0.4rem 0.85rem; border-radius: var(--radius-full); border: 1px solid rgba(52, 211, 153, 0.55); background: rgba(16, 185, 129, 0.12); color: #6ee7b7; cursor: pointer; }
.lp-abrir:hover { background: rgba(16, 185, 129, 0.22); }

/* Dívidas abertas: o leitor "bate" em cada uma e para na escolhida */
.lp-dividas { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.3rem; }
.lp-divida { font-size: 0.76rem; padding: 0.25rem 0.6rem; border-radius: var(--radius-full); border: 1px solid var(--border-color); background: rgba(255, 255, 255, 0.03); color: var(--text-secondary); transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
.lp-divida strong { color: var(--text-primary); }
.lp-centavos { opacity: 0.55; border-style: dashed; }
.lp-tocando { transform: translateY(-2px) scale(1.04); border-color: rgba(96, 165, 250, 0.7); box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18); }
.lp-escolhida { border-color: var(--emerald-500); color: #6ee7b7; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); animation: lpBate 0.5s ease-out; }
.lp-escolhida::after { content: ' ✓'; font-weight: 800; }

/* Onde encaixa: um pedacinho do Bloco de Notas e os totais mudando */
.lp-encaixe { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0.7rem; margin-top: 0.4rem; }
.lp-np { font-family: var(--font-mono); font-size: 0.72rem; line-height: 1.55; background: #0b1220; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 10px; padding: 0.5rem 0.6rem; overflow: hidden; }
.lp-np-cab { font-family: var(--font-main); font-size: 0.7rem; font-weight: 700; color: var(--text-muted); margin-bottom: 0.3rem; }
.lp-ln { white-space: pre-wrap; word-break: break-word; color: #94a3b8; padding: 1px 4px; border-radius: 4px; }
.lp-nova { color: #d1fae5; background: rgba(16, 185, 129, 0.16); box-shadow: inset 3px 0 0 #10b981; max-height: 0; opacity: 0; transform: translateX(-12px); transition: max-height 0.35s ease, opacity 0.35s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
.lp-encaixou .lp-nova { max-height: 4em; opacity: 1; transform: none; animation: lpBrilho 1.4s ease-out 0.3s; }
.lp-desce { transition: transform 0.35s ease; transform: translateY(-1.2em); }
.lp-encaixou .lp-desce { transform: none; }
.lp-totais { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.76rem; }
.lp-totais div { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.2rem 0.45rem; border-radius: 6px; background: rgba(255, 255, 255, 0.03); }
.lp-totais span { color: var(--text-muted); min-width: 0; overflow-wrap: anywhere; }
.lp-totais b { font-variant-numeric: tabular-nums; color: var(--text-primary); white-space: nowrap; transition: color 0.3s; }
.lp-totais b.lp-mudou { color: #6ee7b7; }

@keyframes lpRespira { 0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.35); } 50% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); } }
@keyframes lpPisca { 50% { opacity: 0.55; } }
@keyframes lpVarre { 0% { top: -22%; } 100% { top: 100%; } }
@keyframes lpEntra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes lpBate { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes lpBrilho { 0% { box-shadow: inset 3px 0 0 #10b981, 0 0 0 0 rgba(16, 185, 129, 0.5); } 100% { box-shadow: inset 3px 0 0 #10b981, 0 0 0 10px rgba(16, 185, 129, 0); } }

/* Cartão de conferência e modal Em mãos: os meses da pessoa viram botões para escolher a dívida; "onde encaixa" embaixo */
.dvi-mes-btn { font: inherit; cursor: pointer; background: transparent; color: inherit; text-align: left; }
.dvi-mes-btn:hover { border-color: rgba(52, 211, 153, 0.6); color: var(--text-primary); }
.dvi-mes-btn:focus-visible { outline: 2px solid var(--emerald-400); outline-offset: 2px; }
.onde-encaixa { flex: 1 1 100%; margin-top: 0.3rem; }
.onde-encaixa:empty { display: none; }
.onde-encaixa .lp-encaixe { margin-top: 0; }
.onde-encaixa .lp-nova { max-height: 4em; opacity: 1; transform: none; transition: none; animation: none; }
.onde-encaixa .lp-desce { transform: none; transition: none; }
.onde-encaixa-aviso { flex: 1 1 100%; display: block; margin-top: 0.3rem; font-size: 0.78rem; color: #fcd34d; }
.lp-num { white-space: nowrap; }
.lp-antes { color: var(--text-muted); font-weight: 400; font-size: 0.7rem; }
.mlb-dividas { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: 0 0 0.9rem; }
.mlb-dividas:empty { display: none; }
.mlb-dividas-rot { flex: 1 1 100%; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.mlb-dividas .dvi-mes { font-size: 0.76rem; padding: 0.3rem 0.65rem; border-radius: var(--radius-full); border: 1px solid var(--border-color); color: var(--text-secondary); }
.mlb-dividas .dvi-mes.escolhido { border-color: var(--emerald-500); color: #6ee7b7; background: rgba(16, 185, 129, 0.1); }
#modalLancEncaixe { margin-top: 0.8rem; }

/* Celular: uma coluna, miniatura pequena */
@media (max-width: 700px) {
  .lp-cena { grid-template-columns: 1fr; }
  .lp-mini { width: 100%; height: 78px; }
  .lp-mini img { object-fit: cover; }
  .lp-encaixe { grid-template-columns: 1fr; }
  .lp-falas { max-height: 60vh; }
  .lp-btn { padding: 0.45rem 0.7rem; }
}

/* Tema claro */
body.theme-light .leitor-palco { background: linear-gradient(180deg, rgba(16, 185, 129, 0.06), rgba(99, 102, 241, 0.03)), #ffffff; }
body.theme-light .lp-np, body.theme-light .lp-mini { background: #f1f5f9; border-color: rgba(15, 23, 42, 0.1); }
body.theme-light .lp-ln { color: #475569; }
body.theme-light .lp-nova { color: #065f46; background: rgba(16, 185, 129, 0.14); }
body.theme-light .lp-aviso .lp-tx, body.theme-light .onde-encaixa-aviso { color: #b45309; }
body.theme-light .lp-erro .lp-tx { color: #be123c; }
body.theme-light .lp-totais b.lp-mudou, body.theme-light .lp-escolhida, body.theme-light .lp-abrir { color: #047857; }

/* Sem movimento: tudo aparece na hora */
@media (prefers-reduced-motion: reduce) {
  .lp-avatar, .lp-chip-lendo, .lp-scan, .lp-fala, .lp-escolhida, .lp-encaixou .lp-nova { animation: none !important; }
  .lp-nova, .lp-desce, .lp-divida { transition: none !important; }
}
@media print { .leitor-palco { display: none !important; } }

/* Etapa 5: prévia do Pix dividido (uma parte por pedacinho do Bloco de Notas) e o saldo que fica na casa */
.lp-parte { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0.5rem 0.7rem; padding: 0.35rem 0 0.45rem; border-top: 1px dashed rgba(148, 163, 184, 0.25); }
.lp-parte:first-child { border-top: 0; padding-top: 0; }
.lp-parte-cab { grid-column: 1 / -1; font-size: 0.74rem; font-weight: 700; color: #93c5fd; letter-spacing: 0.02em; }
.lp-totais-geral { grid-column: 1 / -1; border-top: 1px solid rgba(148, 163, 184, 0.3); padding-top: 0.4rem; }
.lp-saldo-casa { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 0.25rem; padding: 0.3rem 0.5rem; border-radius: 8px; background: rgba(59, 130, 246, 0.12); color: var(--text-primary, #f8fafc); }
.lp-saldo-casa b { color: #93c5fd; }
body.theme-light .lp-parte-cab, body.theme-light .lp-saldo-casa b { color: #1d4ed8; }
@media (max-width: 700px) { .lp-parte { grid-template-columns: 1fr; } }
/* Dentro das janelas estreitas (Em mãos / Lançamento rápido) a prévia fica numa coluna só: nada cortado à direita */
.modal-lancamento .lp-encaixe, .modal-lancamento .lp-parte { grid-template-columns: minmax(0, 1fr); }

/* Etapa 9: fundos que eram "branco transparente" (invisíveis no claro) */
body.theme-light .lp-chip, body.theme-light .lp-divida, body.theme-light .lp-totais div { background: rgba(15, 23, 42, 0.04); }
body.theme-light .lp-btn { background: rgba(15, 23, 42, 0.05); }
body.theme-light .lp-btn:hover { background: rgba(15, 23, 42, 0.1); }

/* ==========================================
   ⚡ SOZINHO (Etapa 11): chave, narração do "lancei sozinho" / "não lancei sozinho" e as pílulas ↩ no canto.
   Não é janela: as pílulas não têm role=dialog; o canto não pega clique (só a pílula).
   ========================================== */
.lp-sozinho-chave { flex: 0 0 auto; font: inherit; font-size: 0.74rem; font-weight: 700; padding: 0.3rem 0.65rem; border-radius: var(--radius-full); border: 1px solid var(--border-color); background: rgba(255, 255, 255, 0.04); color: var(--text-secondary); cursor: pointer; white-space: nowrap; }
.lp-sozinho-chave.ligado { border-color: rgba(250, 204, 21, 0.6); color: #fde68a; background: rgba(250, 204, 21, 0.1); }
.lp-sozinho-chave:hover { filter: brightness(1.15); }
.lp-sozinho-chave:focus-visible, .ld-desfazer:focus-visible { outline: 2px solid #fbbf24; outline-offset: 2px; }
.upload-panel-card .lp-sozinho-chave { margin-top: 0.55rem; }
.lp-sozinho { margin-top: 0.4rem; font-size: 0.8rem; color: var(--text-secondary); }
.lp-sozinho-ok { padding: 0.45rem 0.7rem; border-radius: var(--radius-md, 10px); border: 1px solid rgba(250, 204, 21, 0.5); background: rgba(250, 204, 21, 0.1); color: #fde68a; font-weight: 700; }
.lp-sozinho-nao p { margin: 0.3rem 0 0; color: var(--text-muted); }
.lp-porque { margin-top: 0.25rem; }
.lp-porque summary { cursor: pointer; font-weight: 700; color: var(--text-secondary); width: max-content; }
.lp-porque ul { margin: 0.3rem 0 0; padding-left: 1rem; display: grid; gap: 0.15rem; }
.lp-p-ok { color: #6ee7b7; }
.lp-p-nao { color: #fcd34d; }
.lp-p-pend { color: var(--text-muted); }

.leitor-desfazer { position: fixed; left: 1rem; bottom: 1rem; z-index: 980; display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 0.4rem; max-width: min(420px, calc(100vw - 2rem)); pointer-events: none; }
.leitor-desfazer:empty { display: none; }
.ld-pilula { pointer-events: auto; display: flex; align-items: center; gap: 0.5rem; max-width: 100%; padding: 0.4rem 0.45rem 0.4rem 0.75rem; border-radius: var(--radius-full); border: 1px solid rgba(250, 204, 21, 0.55); background: rgba(15, 23, 42, 0.94); color: #f8fafc; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); font-size: 0.8rem; animation: ldEntra 0.25s ease-out; }
.ld-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-desfazer { flex: 0 0 auto; font: inherit; font-size: 0.78rem; font-weight: 800; padding: 0.3rem 0.7rem; border-radius: var(--radius-full); border: 1px solid #fbbf24; background: #fbbf24; color: #1f2937; cursor: pointer; white-space: nowrap; }
.ld-desfazer:disabled { opacity: 0.6; cursor: progress; }
.ld-seg { display: inline-block; min-width: 1.4em; text-align: center; font-variant-numeric: tabular-nums; }
.ld-mais { pointer-events: auto; font-size: 0.74rem; font-weight: 800; padding: 0.2rem 0.6rem; border-radius: var(--radius-full); background: rgba(15, 23, 42, 0.9); color: #fde68a; border: 1px solid rgba(250, 204, 21, 0.45); }
@keyframes ldEntra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 768px) {
  .leitor-desfazer { bottom: calc(4.9rem + env(safe-area-inset-bottom, 0px)); left: 0.75rem; max-width: calc(100vw - 6rem); }
  .ld-pilula { font-size: 0.76rem; }
  .ld-mes, .ld-pal { display: none; }   /* no celular: valor e gerente inteiros; o mês fica no "Lancei sozinho" e no Cartório */
}
@media (max-width: 700px) { body.ia-chat-flut-aberto .leitor-desfazer { display: none; } }
body:has(.ia-chat-flutuante.grande.aberto) .leitor-desfazer { display: none; }
@media print { .leitor-desfazer, .lp-sozinho-chave { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .ld-pilula { animation: none; } }
body.theme-light .lp-sozinho-chave { background: rgba(15, 23, 42, 0.05); }
body.theme-light .lp-sozinho-chave.ligado, body.theme-light .lp-sozinho-ok { color: #92400e; background: rgba(250, 204, 21, 0.18); border-color: rgba(217, 119, 6, 0.55); }
body.theme-light .lp-p-ok { color: #047857; }
body.theme-light .lp-p-nao { color: #b45309; }
body.theme-light .ld-pilula { background: #ffffff; color: #0f172a; border-color: rgba(217, 119, 6, 0.6); box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18); }
body.theme-light .ld-mais { background: #ffffff; color: #92400e; }
