/* ==========================================================================
   Demo viva "invoice-cfdi" (hero de /facturacion-electronica): Finanzas →
   Facturación con Factura.com: Generar Factura de una venta, Emitir, la venta
   queda Facturada y se abre el PDF del CFDI 4.0 timbrado.
   Markup: resources/views/web/partials/anim/invoice-cfdi.blade.php
   Estados en la raíz:
     data-modal  modal abierto · data-filled  campos fiscales llenos
     data-busy   "Generando..." · data-done  venta Facturada · data-pdf  PDF visible
     data-cursor puntero visible
   El panel no tiene modo oscuro: solo halo y sombra.
   ========================================================================== */

/* ---------- Paleta ---------- */
.lla-cf {
  --lla-surface: #f8f9fa;
  --lla-text: #1e2022;
  --lla-muted: #677788;
  --lla-border: #e7eaf3;
  --lla-primary: #377dff;
  --lla-success: #00c9a7;
  --lla-shadow: 0 32px 64px -24px rgba(22, 34, 58, .38), 0 10px 24px -10px rgba(22, 34, 58, .18);
  --lla-glow-a: rgba(55, 125, 255, .16);
  --lla-glow-b: rgba(0, 201, 167, .12);
  --lla-cursor-fill: #1e2022;
  --lla-cursor-edge: #ffffff;
  --lla-cursor-ring: rgba(55, 125, 255, .55);
}
html[data-theme="dark"] .lla-cf {
  --lla-glow-a: rgba(77, 159, 255, .14);
  --lla-glow-b: rgba(74, 217, 145, .1);
  --lla-shadow: 0 32px 64px -24px rgba(0, 0, 0, .8), 0 10px 24px -10px rgba(0, 0, 0, .55);
}

/* ---------- Escena ---------- */
.lla-cf { max-width: 720px; margin-inline: auto; color: var(--lla-text); line-height: 1.3; text-align: left; }
.lla .lla-cf__stage { --lla-w: 720; --lla-h: 420; }
.lla-cf :where(b, small, strong, em, i, p, label) { margin: 0; font-size: inherit; font-style: normal; font-weight: inherit; color: inherit; }
.lla-cf .bi::before { vertical-align: 0; }
.lla-cf__glow { position: absolute; border-radius: 50%; pointer-events: none; }
.lla-cf__glow--a { left: -30px; top: 20px; width: 460px; height: 460px; background: radial-gradient(closest-side, var(--lla-glow-a), transparent); }
.lla-cf__glow--b { left: 380px; top: 40px; width: 380px; height: 420px; background: radial-gradient(closest-side, var(--lla-glow-b), transparent); }

/* ---------- Ventana ---------- */
.lla-cf__win { position: absolute; left: 0; top: 14px; width: 640px; height: 396px; overflow: hidden; border: 1px solid var(--lla-border); border-radius: 14px; background: #f5f7fb; box-shadow: var(--lla-shadow); }
.lla-cf__chrome { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 12px; border-bottom: 1px solid var(--lla-border); background: var(--lla-surface); }
.lla-cf__dots { display: flex; gap: 5px; }
.lla-cf__dots i { width: 9px; height: 9px; border-radius: 50%; background: #ff5f57; }
.lla-cf__dots i:nth-child(2) { background: #febc2e; }
.lla-cf__dots i:nth-child(3) { background: #28c840; }
.lla-cf__url { display: flex; align-items: center; gap: 6px; flex: 1; max-width: 340px; height: 20px; margin-inline: auto; padding: 0 10px; border-radius: 6px; background: #fff; color: var(--lla-muted); font-size: 11px; }
.lla-cf__url .bi { color: #198754; font-size: 9px; }
.lla-cf__panel { position: relative; height: calc(100% - 32px); padding: 12px; }
.lla-cf__card { height: 100%; overflow: hidden; border: 1px solid var(--lla-border); border-radius: 12px; background: #fff; }
.lla-cf__pills { display: flex; gap: 4px; padding: 7px; }
.lla-cf__pills span { display: flex; flex: 1; align-items: center; justify-content: center; gap: 4px; padding: 6px 2px; border-radius: 7px; color: var(--lla-muted); font-size: 10px; font-weight: 600; white-space: nowrap; }
.lla-cf__pills .bi { font-size: 9.5px; }
.lla-cf__pills .is-on { background: var(--lla-primary); color: #fff; }
.lla-cf__fc { display: flex; align-items: center; justify-content: space-between; margin: 4px 14px 0; padding: 8px 10px; border: 1px solid var(--lla-border); border-radius: 8px; font-size: 11.5px; }
.lla-cf__fc > span { display: flex; align-items: center; gap: 7px; }
.lla-cf__fc b { font-weight: 700; }
.lla-cf__fc > .bi { padding: 3px 7px; border: 1px solid #c4cad3; border-radius: 5px; color: var(--lla-muted); font-size: 11px; }
.lla-cf__ok { padding: 2px 7px; border-radius: 5px; background: var(--lla-success); color: #fff; font-size: 10px; font-weight: 700; }
.lla-cf__ok small { margin-left: 3px; padding: 0 5px; border-radius: 4px; background: #f8fafd; color: #1e2022; font-size: 9px; }
.lla-cf__h { margin: 12px 14px 6px !important; font-size: 13px !important; font-weight: 600; }
.lla-cf__table { width: calc(100% - 28px); margin: 0 14px; border-collapse: collapse; font-size: 11px; }
.lla-cf__table th { padding: 7px 8px; background: #f8fafd; color: var(--lla-muted); font-size: 10px; font-weight: 600; text-align: left; }
.lla-cf__table td { padding: 9px 8px; border-top: 1px solid #f1f3f7; white-space: nowrap; }
.lla-cf__table :is(th, td):nth-child(3) { text-align: right; }
.lla-cf__b { padding: 2px 7px; border-radius: 5px; font-size: 10px; font-weight: 700; }
.lla-cf__b--no { border: 1px solid #e7eaf3; background: #f8fafd; color: var(--lla-muted); }
.lla-cf__b--yes { display: none; background: var(--lla-success); color: #fff; }
.lla-cf__b--yes.is-on, .lla-cf[data-done] .lla-cf__target .lla-cf__b--yes { display: inline; }
.lla-cf[data-done] .lla-cf__target .lla-cf__b--no { display: none; }
.lla-cf__acts { display: none; gap: 4px; }
.lla-cf__acts.is-on, .lla-cf__acts--gen { display: inline-flex; }
.lla-cf[data-done] .lla-cf__acts--gen { display: none; }
.lla-cf[data-done] .lla-cf__acts--done { display: inline-flex; }
.lla-cf__acts i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; background: #f1f3f7; color: #3e4c5c; font-size: 11px; transition: transform .15s var(--lla-ease), background-color .15s; }
.lla-cf__acts--gen i { background: rgba(55, 125, 255, .12); color: var(--lla-primary); }
.lla-cf__acts .bi-file-earmark-pdf { color: #dc3545; }
.lla-cf__acts .bi-x-circle { color: #dc3545; }
.lla-cf__acts i.is-pressed { transform: scale(.88); background: #e2e6ee; }
.lla-cf[data-done] .lla-cf__target td { animation: lla-cf-hl 1.8s var(--lla-ease) both; }

/* ---------- Modal ---------- */
.lla-cf__backdrop { position: absolute; inset: 0; background: rgba(19, 33, 68, .35); opacity: 0; transition: opacity .3s var(--lla-ease); }
.lla-cf[data-modal] .lla-cf__backdrop { opacity: 1; }
.lla-cf__modal { position: absolute; left: 50%; top: 10px; width: 470px; overflow: hidden; border-radius: 12px; background: #fff; box-shadow: 0 24px 50px -12px rgba(19, 33, 68, .45); opacity: 0; transform: translate(-50%, -14px); transition: opacity .3s var(--lla-ease), transform .35s var(--lla-ease); }
.lla-cf[data-modal] .lla-cf__modal { opacity: 1; transform: translate(-50%, 0); }
.lla-cf__modal header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--lla-border); }
.lla-cf__modal header b { font-size: 14px; font-weight: 600; }
.lla-cf__modal header .bi { color: var(--lla-muted); font-size: 12px; }
.lla-cf__mbody { padding: 10px 16px; font-size: 11px; }
.lla-cf__info { margin-bottom: 8px !important; padding: 7px 10px; border-radius: 7px; background: rgba(55, 125, 255, .08); color: #2a4a8a; }
.lla-cf__info strong { font-weight: 700; }
.lla-cf__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.lla-cf__grid label { display: flex; flex-direction: column; gap: 3px; }
.lla-cf__grid small { font-size: 10px; font-weight: 600; }
.lla-cf__in { position: relative; display: flex; align-items: center; height: 27px; overflow: hidden; padding: 0 8px; border: 1px solid #dfe3ea; border-radius: 6px; font-size: 10.5px; white-space: nowrap; }
.lla-cf__sel { padding-right: 22px; }
.lla-cf__sel::before { content: ""; position: absolute; right: 9px; top: 10px; width: 5px; height: 5px; border-right: 1.5px solid #677788; border-bottom: 1.5px solid #677788; transform: rotate(45deg); }
.lla-cf__fill { color: transparent; transition: color .3s; }
.lla-cf[data-filled] .lla-cf__fill { color: var(--lla-text); }
.lla-cf__in.is-focus { border-color: rgba(55, 125, 255, .5); box-shadow: 0 0 0 3px rgba(55, 125, 255, .12); }
.lla-cf__in.is-focus::after { content: ""; width: 1px; height: 13px; margin-left: 1px; background: var(--lla-text); animation: lla-cf-caret 1s steps(1) infinite; }
.lla-cf__modal footer { display: flex; justify-content: flex-end; gap: 6px; padding: 9px 16px; border-top: 1px solid var(--lla-border); }
.lla-cf__ghost { padding: 6px 12px; border-radius: 6px; background: #71869d; color: #fff; font-size: 11px; font-weight: 600; }
.lla-cf__btn { display: inline-grid; padding: 6px 14px; border-radius: 6px; background: var(--lla-primary); color: #fff; font-size: 11px; font-weight: 600; transition: transform .15s var(--lla-ease), filter .15s; }
.lla-cf__btn em { display: inline-flex; grid-area: 1 / 1; align-items: center; gap: 5px; }
.lla-cf__btn em + em, .lla-cf[data-busy] .lla-cf__btn em:first-child { visibility: hidden; }
.lla-cf[data-busy] .lla-cf__btn em + em { visibility: visible; }
.lla-cf[data-busy] .lla-cf__btn { opacity: .75; }
.lla-cf__btn.is-pressed { transform: scale(.95); filter: brightness(.9); }
.lla-cf__spin { width: 11px; height: 11px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: lla-cf-spin .7s linear infinite; }

/* ---------- PDF del CFDI ---------- */
.lla-cf__pdf { position: absolute; left: 470px; top: 92px; z-index: 5; width: 240px; padding: 12px; border: 1px solid #e5e7eb; border-radius: 6px; background: #fff; box-shadow: var(--lla-shadow); font-size: 9.5px; opacity: 0; transform: translateY(18px) rotate(2deg) scale(.96); transition: opacity .45s var(--lla-ease), transform .55s var(--lla-ease); }
.lla-cf[data-pdf] .lla-cf__pdf { opacity: 1; transform: rotate(2deg); }
.lla-cf[data-fade] .lla-cf__pdf { opacity: 0; }
.lla-cf__pdfhead { display: flex; align-items: center; gap: 7px; padding-bottom: 8px; border-bottom: 2px solid #db2777; }
.lla-cf__logo { display: grid; flex: none; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #db2777; color: #fff; font-size: 9px; font-weight: 800; }
.lla-cf__pdfhead > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; }
.lla-cf__pdfhead b { overflow: hidden; font-size: 10px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.lla-cf__pdfhead small { color: var(--lla-muted); font-size: 8.5px; }
.lla-cf__pdfhead em { margin-left: auto; color: #db2777; font-size: 8.5px; font-weight: 700; text-align: right; text-transform: uppercase; }
.lla-cf__pdfhead em strong { color: var(--lla-text); font-size: 11px; }
.lla-cf__pdfrow { display: flex; flex-direction: column; padding: 7px 0; border-bottom: 1px solid #f1f3f7; }
.lla-cf__pdfrow small { color: var(--lla-muted); font-size: 8.5px; }
.lla-cf__pdfrow b { font-size: 10px; font-weight: 700; }
.lla-cf__pdfitems { display: flex; justify-content: space-between; padding: 4px 0; }
.lla-cf__pdfitems--m { color: var(--lla-muted); }
.lla-cf__pdfitems--t { border-top: 1px solid #e5e7eb; font-size: 11px; font-weight: 800; }
.lla-cf__pdffoot { display: flex; gap: 8px; margin-top: 7px; padding-top: 7px; border-top: 1px dashed #d1d5db; }
.lla-cf__qr { flex: none; width: 46px; height: 46px; background:
  conic-gradient(from 90deg at 30% 30%, #111 25%, transparent 0) 0 0 / 12px 12px,
  linear-gradient(90deg, #111 50%, transparent 0) 0 0 / 7px 7px; border: 3px solid #111; opacity: .85; }
.lla-cf__pdffoot > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lla-cf__pdffoot small { color: var(--lla-muted); font-size: 8px; text-transform: uppercase; }
.lla-cf__pdffoot b { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 7.5px; font-weight: 600; word-break: break-all; }
.lla-cf__pdffoot em { display: inline-flex; align-items: center; gap: 3px; color: #00a389; font-size: 8.5px; font-weight: 700; }

/* ---------- Puntero ---------- */
.lla-cf__cursor { position: absolute; top: 0; left: 0; z-index: 10; width: 22px; height: 22px; pointer-events: none; opacity: 0; transform: translate(560px, 450px); transition: transform .6s var(--lla-ease), opacity .3s var(--lla-ease); }
.lla-cf[data-cursor] .lla-cf__cursor { opacity: 1; }
.lla-cf__cursor svg { position: relative; display: block; width: 22px; height: 22px; fill: var(--lla-cursor-fill); stroke: var(--lla-cursor-edge); stroke-width: 1.4; stroke-linejoin: round; }
.lla-cf__cursor-ring { position: absolute; left: -10px; top: -12px; width: 28px; height: 28px; border: 2px solid var(--lla-cursor-ring); border-radius: 50%; opacity: 0; }
.lla-cf__cursor.is-tap svg { animation: lla-cf-press .3s var(--lla-ease); }
.lla-cf__cursor.is-tap .lla-cf__cursor-ring { animation: lla-cf-ripple .5s var(--lla-ease); }

@keyframes lla-cf-spin { to { transform: rotate(360deg); } }
@keyframes lla-cf-caret { 50% { opacity: 0; } }
@keyframes lla-cf-hl { 0%, 55% { background: rgba(0, 201, 167, .1); } 100% { background: transparent; } }
@keyframes lla-cf-press { 50% { transform: scale(.85); } }
@keyframes lla-cf-ripple {
  0% { opacity: .9; transform: scale(.4); }
  100% { opacity: 0; transform: scale(1.4); }
}
