/* APP TIENDA · UI V9 PRODUCCION R5
   Corrección quirúrgica de Historial + Compras recientes.
   Solo presentación. No altera formularios, endpoints, cálculos ni datos. */

/* ============================================================
   1) COMPRAS RECIENTES: evitar columnas estrechas / texto vertical
   ============================================================ */
body.lab-visual-v5 #purchases #v720History{
  min-width:0!important;
  width:100%!important;
}
body.lab-visual-v5 #purchases #v720History .v720-history-row.v721-history-row{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) minmax(128px,max-content)!important;
  align-items:start!important;
  justify-content:stretch!important;
  gap:12px!important;
  width:100%!important;
  min-width:0!important;
  padding:12px 0!important;
}
body.lab-visual-v5 #purchases #v720History .v721-history-main{
  display:flex!important;
  flex-direction:column!important;
  align-items:stretch!important;
  justify-content:flex-start!important;
  gap:5px!important;
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
  overflow:visible!important;
}
body.lab-visual-v5 #purchases #v720History .v721-history-main>strong,
body.lab-visual-v5 #purchases #v720History .r5-purchase-summary{
  display:grid!important;
  grid-template-columns:1fr!important;
  gap:3px!important;
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
  margin:0!important;
  font-size:.80rem!important;
  line-height:1.28!important;
  white-space:normal!important;
  word-break:normal!important;
  overflow-wrap:break-word!important;
}
body.lab-visual-v5 #purchases #v720History .r5-purchase-line{
  display:block!important;
  width:100%!important;
  min-width:0!important;
  white-space:normal!important;
  word-break:normal!important;
  overflow-wrap:break-word!important;
}
body.lab-visual-v5 #purchases #v720History .r5-purchase-more{
  display:block!important;
  margin-top:2px!important;
  color:var(--muted,#64748b)!important;
  font-size:.66rem!important;
  font-weight:700!important;
}
body.lab-visual-v5 #purchases #v720History .v721-history-main>small{
  display:block!important;
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
  margin:0!important;
  font-size:.66rem!important;
  line-height:1.35!important;
  white-space:normal!important;
  word-break:normal!important;
  overflow-wrap:break-word!important;
  color:var(--muted,#64748b)!important;
}
body.lab-visual-v5 #purchases #v720History .v721-history-actions{
  display:flex!important;
  flex-direction:row!important;
  flex-wrap:wrap!important;
  align-items:center!important;
  justify-content:flex-end!important;
  align-content:flex-start!important;
  gap:6px!important;
  width:auto!important;
  min-width:128px!important;
  max-width:210px!important;
  white-space:normal!important;
}
body.lab-visual-v5 #purchases #v720History .v721-history-actions>strong{
  display:block!important;
  flex:1 0 100%!important;
  width:100%!important;
  text-align:right!important;
  font-size:.92rem!important;
  line-height:1.15!important;
  white-space:nowrap!important;
}
body.lab-visual-v5 #purchases #v720History .v721-history-actions button{
  width:auto!important;
  min-width:64px!important;
  min-height:34px!important;
  padding:7px 10px!important;
  margin:0!important;
  white-space:nowrap!important;
}
body.lab-visual-v5 #purchases #v720History .v720-pill,
body.lab-visual-v5 #purchases #v720History .v7299-status{
  flex:1 0 100%!important;
  width:100%!important;
  max-width:100%!important;
  white-space:normal!important;
  text-align:right!important;
}

/* ============================================================
   2) HISTORIAL FINANCIERO: compra visible, legible y navegable
   ============================================================ */
body.lab-visual-v8 #history .v8-history-finance{
  padding-bottom:calc(116px + env(safe-area-inset-bottom,0px))!important;
}
body.lab-visual-v8 #history .v8-history-list-head{
  scroll-margin-top:86px!important;
}
body.lab-visual-v8 #history .v8-history-metric.is-purchase[data-v8-kind="purchases"]{
  position:relative;
}
body.lab-visual-v8 #history .v8-history-metric.is-purchase[data-v8-kind="purchases"]::after{
  content:"Toca para ver detalle";
  margin-top:2px;
  font-size:9px;
  font-weight:700;
  color:#7c3aed;
  opacity:.88;
}
body.lab-visual-v8 #history .v8-history-row.v8-type-purchase{
  cursor:pointer!important;
}
body.lab-visual-v8 #history .v8-history-row.v8-type-purchase:active{
  background:rgba(124,58,237,.055)!important;
}
body.lab-visual-v8 #history .v8-history-row.v8-type-purchase .v8-history-row-main small{
  white-space:normal!important;
  overflow:visible!important;
  text-overflow:clip!important;
  max-width:none!important;
  line-height:1.35!important;
}
body.lab-visual-v8 #history .v8-history-row.v8-type-purchase .v8-history-row-title strong{
  white-space:normal!important;
  overflow:visible!important;
  text-overflow:clip!important;
  line-height:1.25!important;
}
body.lab-visual-v8 #history .v8-history-row.v8-type-purchase .v8-history-row-title{
  flex-wrap:wrap!important;
}
body.lab-visual-v8 #history .r5-history-purchase-view{
  appearance:none;
  border:1px solid rgba(124,58,237,.24);
  background:rgba(124,58,237,.09);
  color:#6d28d9;
  border-radius:9px;
  min-height:30px;
  padding:5px 9px;
  font:inherit;
  font-size:10px;
  font-weight:800;
  line-height:1;
  cursor:pointer;
  white-space:nowrap;
}
body.lab-visual-v8.lab-theme-dark #history .r5-history-purchase-view{
  background:rgba(167,139,250,.13)!important;
  color:#c4b5fd!important;
  border-color:rgba(196,181,253,.24)!important;
}
body.lab-visual-v8 #history .v8-history-row-value.r5-has-purchase-button{
  display:grid!important;
  grid-template-columns:auto auto!important;
  gap:7px!important;
  align-items:center!important;
  justify-items:end!important;
}
body.lab-visual-v8 #history .v8-history-row-value.r5-has-purchase-button>span{
  display:none!important;
}

@media(max-width:700px){
  body.lab-visual-v5 #purchases #v720History .v720-history-row.v721-history-row{
    grid-template-columns:minmax(0,1fr)!important;
    gap:9px!important;
    padding:12px 2px!important;
  }
  body.lab-visual-v5 #purchases #v720History .v721-history-main>strong,
  body.lab-visual-v5 #purchases #v720History .r5-purchase-summary{
    font-size:.78rem!important;
    line-height:1.32!important;
  }
  body.lab-visual-v5 #purchases #v720History .v721-history-main>small{
    font-size:.64rem!important;
  }
  body.lab-visual-v5 #purchases #v720History .v721-history-actions{
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    justify-content:flex-start!important;
    border-top:1px solid rgba(148,163,184,.16)!important;
    padding-top:8px!important;
  }
  body.lab-visual-v5 #purchases #v720History .v721-history-actions>strong{
    flex:0 0 auto!important;
    width:auto!important;
    margin-right:auto!important;
    text-align:left!important;
    font-size:.94rem!important;
  }
  body.lab-visual-v5 #purchases #v720History .v720-pill,
  body.lab-visual-v5 #purchases #v720History .v7299-status{
    order:3!important;
    flex:1 0 100%!important;
    text-align:left!important;
  }
  body.lab-visual-v8 #history .v8-history-row.v8-type-purchase{
    grid-template-columns:30px minmax(0,1fr)!important;
    align-items:start!important;
  }
  body.lab-visual-v8 #history .v8-history-row.v8-type-purchase .v8-history-row-value{
    grid-column:2!important;
    width:100%!important;
    justify-content:space-between!important;
    justify-items:start!important;
    margin-top:3px!important;
  }
  body.lab-visual-v8 #history .v8-history-row.v8-type-purchase .v8-history-row-value strong{
    font-size:12px!important;
  }
  body.lab-visual-v8 #history .r5-history-purchase-view{
    justify-self:end!important;
  }
}
