
/* V438M - Debt dedupe + mobile polish */

/* Remove duplicated explanation panel; the compact note at top already explains the rule. */
.v438m-sale-grid > :last-child{
  display:none!important;
}

/* ---------- Mobile ---------- */
@media(max-width:760px){
  .v177-debts-mobile{
    overflow-x:hidden;
  }
  .v177-debts-mobile > *{
    max-width:100%;
  }

  /* Header + area filter */
  .v177-debts-mobile [data-loc="client/src/pages/Debts.tsx:DEBT_DELIVERED"]{
    max-width:100%;
  }
  .v177-debts-mobile [role="combobox"]{
    width:100%!important;
    min-width:0!important;
    height:36px!important;
    font-size:8.2px!important;
  }

  /* Compact rule note */
  .v438m-debt-note{
    margin-bottom:8px!important;
    padding:9px 10px!important;
    border-radius:9px!important;
    font-size:7.3px!important;
    line-height:1.45!important;
  }

  /* Top debt KPI */
  .v438m-debt-kpis{
    grid-template-columns:1fr 1fr!important;
    gap:6px!important;
    background:transparent!important;
    overflow:visible!important;
    margin-bottom:9px!important;
  }
  .v438m-debt-kpis > *{
    min-height:86px!important;
    border:1px solid var(--border)!important;
    border-radius:9px!important;
  }
  .v438m-debt-kpis > *:last-child:nth-child(odd){
    grid-column:1/-1!important;
  }

  /* Customer debt summary */
  .v438l-customer-debt-summary{
    margin-bottom:9px!important;
    padding:9px!important;
    border-radius:10px!important;
  }
  .v438l-summary-head{
    gap:5px!important;
  }
  .v438l-summary-head .eyebrow{
    font-size:6.8px!important;
  }
  .v438l-summary-head h3{
    font-size:11px!important;
    line-height:1.25!important;
  }
  .v438l-summary-head p{
    font-size:7px!important;
    line-height:1.4!important;
  }
  .v438l-summary-total{
    padding:8px 9px!important;
  }
  .v438l-summary-total span{
    font-size:6.8px!important;
  }
  .v438l-summary-total strong{
    font-size:14px!important;
    overflow-wrap:anywhere;
  }
  .v438l-tools{
    grid-template-columns:1fr 1fr!important;
    gap:6px!important;
  }
  .v438l-search{
    grid-column:1/-1!important;
  }
  .v438l-search,
  .v438l-select{
    height:36px!important;
    font-size:8px!important;
  }

  .v438l-mobile-list{
    gap:7px!important;
  }
  .v438l-card{
    padding:9px!important;
    border-radius:10px!important;
  }
  .v438l-card-head{
    padding-bottom:7px!important;
  }
  .v438l-card-head strong{
    font-size:10.5px!important;
  }
  .v438l-card-head small{
    font-size:6.9px!important;
  }
  .v438l-age{
    min-height:21px!important;
    font-size:6.8px!important;
  }
  .v438l-card-grid{
    margin-top:7px!important;
  }
  .v438l-card-grid>div{
    padding:8px!important;
  }
  .v438l-card-grid span{
    font-size:6.7px!important;
  }
  .v438l-card-grid b{
    font-size:9px!important;
  }
  .v438l-card-grid .debt b{
    font-size:10.5px!important;
  }
  .v438l-card-button{
    height:36px!important;
    font-size:8px!important;
  }

  /* Supplier debt section */
  .v438m-supplier-debt{
    margin-bottom:9px!important;
    padding:9px!important;
    border-radius:10px!important;
  }
  .v438m-supplier-debt > div:first-child{
    align-items:flex-start!important;
    gap:8px!important;
  }
  .v438m-supplier-debt h3{
    font-size:11px!important;
    line-height:1.25!important;
  }
  .v438m-supplier-debt p{
    font-size:7px!important;
    line-height:1.4!important;
  }
  .v438m-supplier-debt .stat-figure{
    font-size:14px!important;
    overflow-wrap:anywhere;
  }
  .v287-ncc-filterbar{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:6px!important;
  }
  .v287-ncc-filter-field:first-child,
  .v287-ncc-filter-summary,
  .v288-export-actions{
    grid-column:1/-1!important;
  }
  .v287-ncc-filter-control,
  .v289-ncc-page-size,
  .v287-ncc-filter-reset{
    width:100%!important;
    min-width:0!important;
    height:36px!important;
    font-size:8px!important;
  }
  .v288-export-actions{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:6px!important;
  }
  .v288-export-btn{
    width:100%!important;
    min-width:0!important;
    height:34px!important;
    font-size:8px!important;
  }

  .v275-supplier-debt-row{
    grid-template-columns:1fr!important;
    gap:8px!important;
    padding:9px!important;
    border-radius:9px!important;
  }
  .v275-supplier-debt-meta p{
    font-size:7px!important;
    line-height:1.4!important;
  }
  .v275-supplier-debt-actions{
    display:grid!important;
    grid-template-columns:1fr auto!important;
    width:100%!important;
    gap:7px!important;
  }
  .v275-supplier-debt-amount{
    align-self:center!important;
    font-size:11px!important;
    overflow-wrap:anywhere!important;
  }
  .v275-supplier-debt-actions button{
    height:34px!important;
    font-size:8px!important;
  }

  .v289-ncc-pagination{
    display:flex!important;
    flex-direction:column!important;
    gap:7px!important;
  }
  .v289-ncc-page-info{
    text-align:center!important;
    font-size:7px!important;
    line-height:1.4!important;
  }
  .v289-ncc-page-actions{
    display:grid!important;
    grid-template-columns:1fr auto 1fr!important;
    gap:6px!important;
  }
  .v289-ncc-page-actions button{
    width:100%!important;
    height:34px!important;
    font-size:8px!important;
  }

  /* Debt structure */
  .v438m-debt-structure{
    margin-bottom:9px!important;
    padding:9px!important;
    border-radius:10px!important;
  }
  .v438m-debt-structure h3{
    font-size:11px!important;
  }
  .v438m-debt-structure p{
    font-size:7px!important;
    line-height:1.4!important;
  }
  .v438m-debt-structure .flex.h-6{
    height:22px!important;
  }
  .v438m-debt-structure .mt-3{
    gap:6px 10px!important;
    font-size:7px!important;
  }

  /* Sale summary */
  .v438m-sale-grid{
    grid-template-columns:1fr!important;
    gap:7px!important;
    margin-bottom:10px!important;
  }
  .v438m-sale-grid > :first-child{
    padding:9px!important;
    border-radius:10px!important;
  }
  .v438m-sale-grid h3{
    font-size:11px!important;
  }
  .v438m-sale-grid p{
    font-size:7px!important;
    line-height:1.4!important;
  }
  .v438m-sale-grid .space-y-3{
    display:flex!important;
    flex-direction:column!important;
    gap:6px!important;
  }
  .v438m-sale-grid .space-y-3 > div{
    padding:9px!important;
    border-radius:9px!important;
  }
  .v438m-sale-grid .space-y-3 > div span{
    font-size:7px!important;
  }
  .v438m-sale-grid .space-y-3 > div span.font-bold,
  .v438m-sale-grid .space-y-3 > div .font-bold{
    font-size:11px!important;
  }

  /* Generic safety */
  .v177-debts-mobile .ledger-cell{
    max-width:100%;
  }
  .v177-debts-mobile .tabular,
  .v177-debts-mobile .stat-figure{
    overflow-wrap:anywhere;
  }
}

@media(max-width:390px){
  .v438m-debt-kpis,
  .v438l-tools,
  .v287-ncc-filterbar,
  .v288-export-actions{
    grid-template-columns:1fr!important;
  }
  .v438m-debt-kpis > *:last-child:nth-child(odd){
    grid-column:auto!important;
  }
  .v438l-search,
  .v287-ncc-filter-field:first-child,
  .v287-ncc-filter-summary,
  .v288-export-actions{
    grid-column:auto!important;
  }
  .v275-supplier-debt-actions{
    grid-template-columns:1fr!important;
  }
}
