
/* V465 - TRUE supplier debt UI rebuild: one renderer, no stacked legacy UI */
body.v465-debt-page{
  background:#071827!important;
}
body.v465-debt-page main,
body.v465-debt-page [role="main"]{
  background:#0a2031!important;
}

/* Hide only the old supplier-debt blocks. Customer debt remains available. */
body.v465-debt-page .v438m-supplier-debt,
body.v465-debt-page #v462-supplier-debt-workspace,
body.v465-debt-page #v461-ncc-payment-history,
body.v465-debt-page #v460-payment-date-gaps,
body.v465-debt-page #v464-history-inline,
body.v465-debt-page #v464-debt-info{
  display:none!important;
}

#v465-debt-app{
  --bg:#0b2133;
  --panel:#0e283d;
  --panel2:#102f49;
  --line:#29465b;
  --muted:#9eb1c0;
  --text:#f5f9fc;
  --green:#13a34a;
  --red:#ef4444;
  --orange:#f59e0b;
  --blue:#2f80ed;
  color:var(--text);
  background:var(--bg);
  border:1px solid rgba(148,163,184,.22);
  border-radius:8px;
  padding:12px;
  margin:0 0 20px;
  box-shadow:0 8px 30px rgba(0,0,0,.16);
  font-family:Arial,"Segoe UI",Tahoma,sans-serif;
}

#v465-debt-app *{box-sizing:border-box}

.v465-breadcrumb{
  color:#bdcbd6;
  font-size:11px;
  margin:0 0 9px;
}
.v465-breadcrumb b{color:#fff}

.v465-head{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:0 0 10px;
}
.v465-head h2{
  margin:0;
  font-size:18px;
  font-weight:800;
  letter-spacing:.2px;
}
.v465-head p{
  margin:4px 0 0;
  color:var(--muted);
  font-size:10.8px;
}
.v465-head-actions{display:flex;gap:7px}
.v465-btn{
  height:34px;
  border:1px solid #36546a;
  border-radius:5px;
  background:#102a40;
  color:#f4f8fb;
  padding:0 11px;
  font-size:10.8px;
  font-weight:700;
  cursor:pointer;
}
.v465-btn.green{background:#0b762e;border-color:#0e9139}
.v465-btn.red{background:#cc2f35;border-color:#e14248}
.v465-btn:disabled{opacity:.48;cursor:not-allowed}

.v465-tabs{
  display:flex;
  overflow:auto;
  border:1px solid #284359;
  border-radius:5px;
  margin-bottom:11px;
  background:#10283c;
}
.v465-tabs button{
  flex:0 0 auto;
  min-width:150px;
  height:38px;
  border:0;
  border-right:1px solid #284359;
  background:transparent;
  color:#e5eef5;
  font-size:11.2px;
  font-weight:750;
  cursor:pointer;
}
.v465-tabs button.active{
  background:#139547;
  color:#fff;
}

.v465-kpis{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:9px;
  margin-bottom:10px;
}
.v465-kpi{
  min-height:68px;
  display:flex;
  align-items:center;
  gap:10px;
  background:#0e283d;
  border:1px solid #365368;
  border-radius:7px;
  padding:10px 12px;
}
.v465-kpi-icon{
  width:38px;height:38px;border-radius:50%;
  display:grid;place-items:center;
  font-size:17px;
  background:#193f5a;
}
.v465-kpi:nth-child(1) .v465-kpi-icon{background:#124b86}
.v465-kpi:nth-child(2) .v465-kpi-icon{background:#105c32}
.v465-kpi:nth-child(3) .v465-kpi-icon{background:#6b2828}
.v465-kpi:nth-child(4) .v465-kpi-icon{background:#694b13}
.v465-kpi small{display:block;color:#b8c7d2;font-size:10.4px;margin-bottom:3px}
.v465-kpi strong{display:block;color:#fff;font-size:17px;line-height:1.15;white-space:nowrap}

.v465-toolbar{
  display:grid;
  grid-template-columns:210px minmax(260px,1fr) 170px auto auto;
  gap:7px;
  align-items:center;
  padding:10px;
  background:#0e283d;
  border:1px solid #29475d;
  border-radius:7px 7px 0 0;
}
.v465-control{
  height:34px;
  border:1px solid #3b586c;
  border-radius:5px;
  background:#0b2032;
  color:#edf4f9;
  padding:0 9px;
  font-size:10.8px;
  min-width:0;
}
.v465-control::placeholder{color:#7f94a4}

.v465-card{
  border:1px solid #29475d;
  background:#0e283d;
  border-radius:7px;
  overflow:hidden;
}
.v465-card + .v465-card{margin-top:10px}
.v465-card-head{
  min-height:40px;
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:9px 11px;
  border-bottom:1px solid #29475d;
}
.v465-card-head h3{margin:0;font-size:12.8px;font-weight:800}
.v465-card-head p{margin:3px 0 0;color:var(--muted);font-size:9.8px}
.v465-card-head span{font-size:9.8px;color:#c9d7e0}

.v465-table-wrap{overflow:auto}
.v465-table{
  width:100%;
  min-width:1120px;
  border-collapse:collapse;
}
.v465-table th{
  position:sticky;top:0;z-index:1;
  background:#112e45;
  color:#d9e5ed;
  text-transform:none;
  font-size:10px;
  font-weight:750;
  padding:8px 8px;
  text-align:left;
  border-right:1px solid #29465b;
  border-bottom:1px solid #29465b;
  white-space:nowrap;
}
.v465-table td{
  color:#eaf1f6;
  font-size:10.8px;
  padding:8px;
  border-right:1px solid rgba(41,70,91,.75);
  border-bottom:1px solid rgba(41,70,91,.75);
  vertical-align:middle;
}
.v465-table tr:hover td{background:#102c42}
.v465-table .num{text-align:right;font-weight:700}
.v465-table .center{text-align:center}
.v465-table a{color:#8bc4ff;text-decoration:none;font-weight:700}

.v465-status{
  display:inline-flex;align-items:center;justify-content:center;
  padding:3px 7px;
  border-radius:4px;
  font-size:9.5px;
  font-weight:800;
  white-space:nowrap;
}
.v465-status.paid{background:#174f2d;color:#b8f5c9}
.v465-status.partial{background:#164768;color:#baddff}
.v465-status.unpaid{background:#6a4d0b;color:#ffe8a0}
.v465-status.overdue{background:#672626;color:#ffb5b5}
.v465-status.reversed{background:#6a2727;color:#ffb1b1}

.v465-check{
  display:inline-flex;align-items:center;gap:5px;white-space:nowrap;
  color:#cbead3;font-size:10px;font-weight:700;cursor:pointer;
}
.v465-check input{width:15px;height:15px;accent-color:#16a34a;cursor:pointer}
.v465-icon-btn{
  width:28px;height:28px;border-radius:4px;border:1px solid #35638a;
  background:#12508a;color:#fff;cursor:pointer;font-size:12px;
}
.v465-icon-btn.warn{background:#a46d05;border-color:#d49210}
.v465-icon-btn.reverse{background:#142c41;border-color:#e38515;color:#ffae37}

.v465-pagination{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  color:#aebecb;font-size:10px;padding:8px 10px;
}
.v465-pagination-actions{display:flex;gap:5px}
.v465-pagination button{
  width:28px;height:28px;border-radius:4px;border:1px solid #345269;background:#102a40;color:#fff
}

.v465-history-title{
  font-size:13px;font-weight:850;color:#fff;
}
.v465-history-meta{color:#9eb1c0;font-size:9.8px}

.v465-info{
  display:flex;gap:9px;align-items:flex-start;
  margin-top:10px;padding:10px 11px;
  border:1px solid #2d71aa;
  background:#0b3656;
  color:#d8edff;
  border-radius:6px;
  font-size:10.5px;
  line-height:1.45;
}
.v465-info b{color:#fff}

.v465-toast{
  position:fixed;right:20px;top:70px;z-index:100000;
  min-width:330px;max-width:430px;
  padding:13px 14px;border-radius:7px;
  border:1px solid #1c9f4a;background:#0c7f34;color:#fff;
  box-shadow:0 12px 35px rgba(0,0,0,.32);
  display:flex;gap:10px;
}
.v465-toast strong{display:block;font-size:12px}.v465-toast span{display:block;font-size:10.5px;margin-top:3px}

.v465-modal-backdrop{
  position:fixed;inset:0;z-index:99990;background:rgba(0,0,0,.46);
  display:flex;align-items:center;justify-content:flex-end;padding:24px;
}
.v465-modal{
  width:min(370px,calc(100vw - 30px));
  background:#10293d;border:1px solid #425b6d;border-radius:7px;color:#fff;
  box-shadow:0 24px 80px rgba(0,0,0,.5);
}
.v465-modal-head{
  display:flex;align-items:center;justify-content:space-between;
  padding:13px 14px;border-bottom:1px solid #345166;
}
.v465-modal-head h3{margin:0;font-size:13px}.v465-modal-close{border:0;background:none;color:#cbd8e0;font-size:19px;cursor:pointer}
.v465-modal-body{padding:13px 14px}
.v465-modal-row{display:grid;grid-template-columns:125px 1fr;gap:8px;margin:0 0 10px;font-size:10.8px}
.v465-modal-row span{color:#afbfca}.v465-modal-row b{font-weight:750}
.v465-modal-amount{color:#ff5e61!important;font-size:15px}
.v465-modal label{display:block;font-size:10.5px;margin:12px 0 5px}
.v465-modal textarea{
  width:100%;min-height:90px;resize:vertical;
  background:#0b2031;color:#fff;border:1px solid #4a6375;border-radius:5px;
  padding:9px;font-size:10.8px;
}
.v465-modal-actions{display:flex;justify-content:flex-end;gap:7px;padding:0 14px 14px}

.v465-reconcile-grid{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin-bottom:10px
}
.v465-reconcile-box{
  background:#102d44;border:1px solid #345167;border-radius:6px;padding:10px
}
.v465-reconcile-box span{display:block;color:#9eb1c0;font-size:9.8px}
.v465-reconcile-box b{display:block;color:#fff;margin-top:4px;font-size:14px}

.v465-bulk-actions{
  display:flex;gap:7px;align-items:center;padding:10px;background:#0e283d;border:1px solid #29475d;border-radius:7px 7px 0 0
}
.v465-bulk-actions input{flex:1}
.v465-empty{padding:22px!important;text-align:center!important;color:#91a5b5!important}

@media(max-width:1100px){
  #v465-debt-app{padding:9px}
  .v465-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
  .v465-toolbar{grid-template-columns:1fr 1fr}
  .v465-toolbar .v465-search{grid-column:1/-1}
  .v465-head{align-items:flex-start}
}
@media(max-width:620px){
  .v465-head{flex-direction:column}
  .v465-head-actions{width:100%}.v465-head-actions .v465-btn{flex:1}
  .v465-kpis{grid-template-columns:1fr 1fr}
  .v465-kpi{padding:9px}.v465-kpi-icon{width:32px;height:32px}.v465-kpi strong{font-size:13px}
  .v465-toolbar{grid-template-columns:1fr}
  .v465-toolbar .v465-search{grid-column:auto}
  .v465-tabs button{min-width:135px}
  .v465-modal-backdrop{padding:10px;align-items:flex-end}
  .v465-modal{width:100%}
}


/* V466 SQL-FIRST + professional desktop/mobile */
.v466-sql-live{
  display:inline-flex;align-items:center;gap:4px;
  color:#76e39a;font-weight:800;
}
.v466-cell-sub{
  display:block!important;
  margin-top:3px!important;
  color:#8299a9!important;
  font-size:9px!important;
  font-weight:500!important;
  white-space:nowrap;
}
.v466-mobile-debts,.v466-mobile-history{display:none}

/* Desktop: optimize 12–15 inch screens without wrapping money. */
@media(min-width:1101px){
  #v465-debt-app{max-width:100%;overflow:hidden}
  .v465-table{table-layout:auto}
  .v465-table th,.v465-table td{white-space:nowrap}
  .v465-table td:nth-child(4){white-space:normal;min-width:165px}
  .v465-table td:nth-child(5),
  .v465-table td:nth-child(6),
  .v465-table td:nth-child(7){min-width:118px}
  .v465-table-wrap{scrollbar-width:thin;scrollbar-color:#38546a #0b2031}
}

/* Tablet and mobile: real cards, never squeeze the desktop table. */
@media(max-width:1100px){
  body.v465-debt-page main,body.v465-debt-page [role="main"]{overflow-x:hidden!important}
  #v465-debt-app{
    margin:0 -2px 18px;
    padding:10px;
    border-radius:8px;
  }
  .v465-breadcrumb{display:none}
  .v465-head h2{font-size:16px}
  .v465-head p{font-size:10px;line-height:1.45}
  .v465-head-actions{flex-wrap:wrap}
  .v465-tabs{
    overflow-x:auto;
    scroll-snap-type:x proximity;
    -webkit-overflow-scrolling:touch;
  }
  .v465-tabs button{min-width:auto;padding:0 13px;scroll-snap-align:start}
  .v465-kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
  .v465-kpi{min-height:62px;padding:9px}
  .v465-kpi-icon{display:none}
  .v465-kpi small{font-size:9.5px}
  .v465-kpi strong{font-size:14px}
  .v465-toolbar{
    grid-template-columns:1fr 1fr;
    padding:8px;
    border-radius:7px;
  }
  .v465-toolbar .v465-search{grid-column:1/-1;grid-row:1}
  .v465-toolbar .v465-btn{width:100%}
  .v465-card>.v465-table-wrap{display:none}
  .v466-mobile-debts,.v466-mobile-history{display:grid;gap:8px;padding:8px}
  .v466-debt-card,.v466-history-card{
    background:#0b2235;
    border:1px solid #2d4a60;
    border-radius:8px;
    padding:11px;
    min-width:0;
  }
  .v466-card-top{
    display:flex;align-items:flex-start;justify-content:space-between;gap:10px;
  }
  .v466-card-top a,.v466-card-top b{color:#fff;font-size:12px;font-weight:800;text-decoration:none}
  .v466-card-top small{display:block;color:#8fa5b5;font-size:9.5px;margin-top:3px}
  .v466-supplier-name{
    margin:9px 0 8px;color:#e9f1f6;font-size:11.5px;font-weight:750;
  }
  .v466-supplier-name small{display:block;color:#8fa5b5;font-size:9.5px;font-weight:500;margin-top:3px}
  .v466-money-grid{
    display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;
  }
  .v466-money-grid>div{
    background:#102d43;border-radius:6px;padding:8px;min-width:0;
  }
  .v466-money-grid span{display:block;color:#91a6b5;font-size:9px;margin-bottom:4px}
  .v466-money-grid b{display:block;color:#fff;font-size:11px;overflow:hidden;text-overflow:ellipsis}
  .v466-money-grid b.paid{color:#69dc89}
  .v466-money-grid b.debt{color:#ff7272}
  .v466-card-meta{
    display:flex;flex-wrap:wrap;justify-content:space-between;gap:5px 10px;
    padding:8px 0;color:#9cb0be;font-size:9.5px;
  }
  .v466-card-meta b{color:#e8f0f5}
  .v466-card-actions{
    display:flex;align-items:center;justify-content:flex-end;gap:7px;
    border-top:1px solid #29465b;padding-top:8px;
  }
  .v466-card-actions .v465-btn{height:32px}
  .v466-history-amount{
    color:#fff;font-size:17px;font-weight:850;margin:9px 0;
  }
  .v466-history-meta{
    display:flex;flex-wrap:wrap;justify-content:space-between;gap:5px 10px;
    color:#9eb1c0;font-size:9.5px;margin-top:5px;
  }
  .v466-reverse-mobile{width:100%;margin-top:9px}
  .v465-pagination{padding:8px}
  .v465-info{margin:8px;font-size:10px}
  .v465-modal-backdrop{padding:10px;align-items:flex-end}
  .v465-modal{width:100%;border-radius:12px 12px 7px 7px}
}
@media(max-width:560px){
  #v465-debt-app{padding:8px}
  .v465-head{gap:8px}
  .v465-head-actions{display:grid;grid-template-columns:1fr 1fr;width:100%}
  .v465-head-actions .v465-btn{width:100%}
  .v465-tabs{margin-left:-8px;margin-right:-8px;border-left:0;border-right:0;border-radius:0}
  .v465-tabs button{height:36px;font-size:10px;padding:0 11px}
  .v465-toolbar{grid-template-columns:1fr}
  .v465-toolbar .v465-search{grid-column:auto;grid-row:auto}
  .v465-kpi strong{font-size:12.5px}
  .v466-money-grid{grid-template-columns:1fr 1fr}
  .v466-money-grid>div:first-child{grid-column:1/-1}
  .v466-card-actions{justify-content:stretch}
  .v466-card-actions .v465-btn{flex:1}
  .v465-pagination{font-size:9px}
}
