html:has(.product-lab[open]) { overflow: hidden; }
.product-lab {
  width: min(35rem, calc(100% - 1.5rem));
  max-height: min(90dvh, 56rem);
  padding: 0;
  color: var(--ink);
  background: #fafbf6;
  border: 1px solid #839889;
  border-radius: 1.2rem;
  box-shadow: 0 1.5rem 6rem #06140b50;
  overscroll-behavior: contain;
  overflow: auto;
}
.product-lab[open] { animation: lab-appear .18s ease-out; }
.product-lab::backdrop { background: #0c1c14bc; }
.lab-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem clamp(1rem,4vw,1.6rem);
  background: #1e392a;
  color: #f7f8f0;
}
.lab-kicker { color: #c5e0b6; text-transform: uppercase; font-size: .68rem; font-weight: 700; letter-spacing: .1em; margin-bottom: .35rem; }
.lab-head h2 { font-size: clamp(1.5rem,4vw,2.05rem); line-height: 1.1; letter-spacing: -.045em; }
.lab-head h2:focus { outline: none; }
.lab-close { flex: 0 0 44px; width: 44px; height: 44px; border: 1px solid #8a9d8f; border-radius: 50%; background: transparent; color: #fff; font-size: 1.65rem; line-height: 1; }
.lab-close:hover { background: #385240; }
.lab-close:focus-visible { outline-color: var(--mint); }
.lab-body { padding: clamp(1rem,4vw,1.6rem); }
.lab-fixture { margin: 0 0 1.35rem; border-left: 3px solid #76936e; background: #eef3e9; padding: .75rem 1rem; border-radius: 0 .6rem .6rem 0; }
.lab-fixture strong, .lab-result h3 { font-size: .98rem; }
.lab-fixture p { font-size: .93rem; line-height: 1.47; color: #405344; margin-top: .2rem; }
.lab-official { display: inline-block; padding-top: .45rem; color: #315745; text-underline-offset: .18em; text-decoration: underline; font-size: .84rem; }
.product-lab label { font-size: 1rem; font-weight: 730; }
.product-lab .lab-unit-price { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .85rem; font-size: .9rem; }
.lab-unit-price input { width: 6.6rem; min-height: 44px; border: 1px solid #90a38f; border-radius: .55rem; padding: .45rem .6rem; background: #fffef9; font: inherit; color: var(--ink); }
.product-lab textarea { display: block; width: 100%; resize: vertical; min-height: 4rem; margin: .5rem 0 .3rem; padding: .75rem; border: 1px solid #90a38f; border-radius: .65rem; background: #fffef9; color: var(--ink); line-height: 1.45; font-size: 1rem; }
#lab-hint { font-size: .8rem; color: var(--muted); line-height: 1.4; }
.lab-examples { display: flex; flex-wrap: wrap; gap: .25rem .45rem; margin: .65rem 0 .9rem; }
.lab-examples button { font-size: .84rem; border: 1px solid #cbd6c5; color: #354e38; background: #f6f8f0; border-radius: .65rem; min-height: 44px; text-align: left; padding: .5rem .7rem; }
.lab-examples button:hover, .lab-examples [aria-pressed="true"] { border-color: #789276; background: #e7f0dd; }
.lab-run:disabled { opacity: .65; cursor: wait; }
.lab-status { font-size: .9rem; }
.lab-status[data-state="working"], .lab-status[data-state="error"] { margin-top: .8rem; }
.lab-status[data-state="error"] { color: #92391a; }
.lab-status[data-state="done"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.lab-result { margin-top: 1rem; padding: 1rem; border: 1px solid #c5d4bf; border-radius: .8rem; background: #f0f5e8; }
.lab-result-head { display: flex; align-items: baseline; justify-content: space-between; gap: .55rem; flex-wrap: wrap; }
.lab-source { color: #425e45; font-size: .8rem; }
.lab-answer,.lab-response { margin: .65rem 0 .75rem; color: #243c2a; line-height: 1.52; white-space: pre-line; overflow-wrap: anywhere; }
.lab-metric { --accent: #3d664d; --paper: #fbfcf5; padding: .95rem 1rem; margin: .7rem 0 .3rem; border-radius: .6rem; background: var(--paper); border: 1px solid #c5d0be; border-left: 4px solid var(--accent); color: #223629; animation: lab-enter .23s ease-out; }
.product-lab[data-product="facturas"] .lab-metric { --accent: #745887; --paper: #fcf8ff; }
.product-lab[data-product="costos"] .lab-metric { --accent: #96663d; --paper: #fffaf1; }
.product-lab[data-product="compras"] .lab-metric { --accent: #386d78; --paper: #f5fbfc; }
.product-lab[data-product="dte"] .lab-metric { --accent: #357283; --paper: #f1f9fa; }
.lab-reference { margin: .8rem 0; padding: .1rem .8rem; background: #e1ebdf; border-radius: .55rem; font-size: .88rem; }
.lab-reference summary { padding-block: .8rem; font-weight: 680; color: #284d37; }
.lab-reference blockquote { margin: 0 0 .85rem; line-height: 1.55; border-left: 2px solid #688f71; padding-left: .65rem; }
.lab-sequence { display: flex; flex-wrap: wrap; gap: .25rem .65rem; list-style: none; padding: 0; margin: .85rem 0 0; color: #425745; font-size: .75rem; font-weight: 650; }
.lab-sequence li { display: flex; align-items: center; gap: .3rem; }
.lab-sequence li::before { content:''; width: .45rem; height: .45rem; border-radius: 50%; background: #849287; }
.lab-sequence[data-state="done"] li::before, .lab-sequence[data-state="working"] li:first-child::before { background: #335f40; }
.lab-sequence[data-state="working"] li:nth-child(2)::before { background: #4d7840; animation: lab-working 1.2s ease-in-out infinite; }
@keyframes lab-working { 50% { box-shadow: 0 0 0 3px #668b5029; } }
.lab-metric-label { display: block; font-size: .85rem; font-weight: 680; }
.lab-metric strong { display: block; margin: .12rem 0 .3rem; font-size: clamp(2rem,7vw,3rem); letter-spacing: -.055em; overflow-wrap: anywhere; line-height: 1.08; font-variant-numeric: tabular-nums; }
.lab-metric-note { margin: 0; color: #3f5148; line-height: 1.45; font-size: .92rem; }
.lab-ledger { display: grid; gap: .6rem; margin: 1rem 0 .15rem; font-size: .83rem; }
.lab-ledger > div { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .25rem .65rem; align-items: baseline; }
.lab-ledger dt { overflow-wrap: anywhere; }
.lab-ledger dd { margin: 0; font-weight: 680; font-variant-numeric: tabular-nums; }
.lab-ledger > div::after { content: ''; grid-column: 1/-1; height: .24rem; border-radius: .2rem; background: linear-gradient(to right,var(--accent) 0 var(--share),#dfe4d9 var(--share) 100%); animation: lab-mark .25s ease-out; }
.lab-details summary { color: #315437; cursor: pointer; padding: .75rem 0; min-height: 44px; font-weight: 650; font-size: .9rem; }
.lab-details .lab-answer { margin-top: 0; }
.lab-quote { border: 0; border-top: 1px solid #c7d9bb; padding: .65rem 0 0; min-height: 44px; display: flex; justify-content: space-between; align-items: center; gap: .65rem; width: 100%; color: #315437; background: transparent; text-align: left; font-weight: 700; }
.lab-quote:hover { text-decoration: underline; }
@keyframes lab-appear { from { opacity: .45; transform: translateY(.3rem); } }
@keyframes lab-enter { from { transform: translateY(.22rem); } }
@keyframes lab-mark { from { opacity: .45; } }
@media (prefers-reduced-motion: reduce) {
  .product-lab[open], .lab-metric, .lab-ledger > div::after, .lab-sequence[data-state="working"] li:nth-child(2)::before { animation: none; }
}
@media (max-width: 480px) {
  .product-lab { width: calc(100% - 1rem); max-height: 94dvh; }
  .lab-run { width: 100%; }
}
