/* =========================================================
   CUEVA CREDIT ACCOUNTS v2
   ========================================================= */

.credit-page {
  display: grid;
  gap: 22px;
  padding-bottom: 32px;
}

.credit-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.credit-page-head h2,
.credit-modal-head h3 {
  margin: 3px 0 4px;
  color: #111827;
}

.credit-page-head p,
.credit-modal-head p,
.credit-table-head p,
.credit-section-title p {
  margin: 0;
  color: #667085;
}

.credit-eyebrow {
  color: #9a7100;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .11em;
}

.credit-primary-btn,
.credit-secondary-btn,
.credit-danger-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: .2s ease;
}

.credit-primary-btn {
  background: linear-gradient(135deg, #d9a91c, #f0cf68);
  color: #241900;
  box-shadow: 0 10px 22px rgba(190, 145, 17, .2);
}

.credit-secondary-btn {
  background: #eef1f5;
  color: #344054;
}

.credit-danger-btn {
  background: #fff0f1;
  color: #c43243;
}

.credit-primary-btn:hover,
.credit-secondary-btn:hover,
.credit-danger-btn:hover {
  transform: translateY(-1px);
}

.credit-primary-btn:disabled,
.credit-secondary-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.credit-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}

.credit-stat-card {
  position: relative;
  overflow: hidden;
  min-height: 135px;
  padding: 21px;
  border: 1px solid #eee6cf;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 14px 35px rgba(15, 23, 42, .06);
}

.credit-stat-card::after {
  content: "";
  position: absolute;
  top: -45px;
  right: -45px;
  width: 115px;
  height: 115px;
  border-radius: 50%;
  background: rgba(214, 169, 37, .09);
}

.credit-stat-card.danger::after {
  background: rgba(225, 68, 85, .08);
}

.credit-stat-card.success::after {
  background: rgba(22, 163, 74, .08);
}

.credit-stat-card span {
  display: block;
  color: #7c6a45;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.credit-stat-card strong {
  display: block;
  margin-top: 12px;
  color: #101828;
  font-size: 27px;
  line-height: 1;
}

.credit-stat-card small {
  display: block;
  margin-top: 9px;
  color: #667085;
  font-size: 12px;
}

.credit-toolbar-card {
  display: grid;
  grid-template-columns: minmax(260px, 1.8fr) minmax(170px, .8fr) minmax(200px, .9fr) auto;
  gap: 12px;
  align-items: center;
  padding: 15px;
  border: 1px solid #e8e2d4;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .05);
}

.credit-search-box {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid #d9dee7;
  border-radius: 12px;
  background: #fbfcfe;
}

.credit-search-box i {
  margin-right: 10px;
  color: #98a2b3;
}

.credit-search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
}

.credit-toolbar-card select,
.credit-form-grid input,
.credit-form-grid textarea,
.credit-form-grid select,
.credit-payment-form input,
.credit-payment-form select,
.credit-section-title select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #d9dee7;
  border-radius: 12px;
  background: #fff;
  color: #101828;
  font: inherit;
  outline: none;
}

.credit-search-box:focus-within,
.credit-toolbar-card select:focus,
.credit-form-grid input:focus,
.credit-form-grid textarea:focus,
.credit-form-grid select:focus,
.credit-payment-form input:focus,
.credit-payment-form select:focus {
  border-color: #cca020;
  box-shadow: 0 0 0 4px rgba(204, 160, 32, .11);
}

.credit-table-card {
  overflow: hidden;
  border: 1px solid #e8e2d4;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 15px 38px rgba(15, 23, 42, .06);
}

.credit-table-head {
  padding: 20px;
  border-bottom: 1px solid #eceff3;
}

.credit-table-head h3 {
  margin: 0 0 4px;
}

.credit-account-list {
  display: grid;
}

.credit-account {
  display: grid;
  grid-template-columns: minmax(210px, 1.45fr) repeat(4, minmax(120px, .8fr)) auto;
  gap: 15px;
  align-items: center;
  padding: 17px 20px;
  border-bottom: 1px solid #edf0f4;
  transition: .2s ease;
}

.credit-account:last-child {
  border-bottom: 0;
}

.credit-account:hover {
  background: #fffdf7;
}

.credit-account strong {
  color: #101828;
}

.credit-account small {
  display: block;
  margin-top: 4px;
  color: #667085;
  font-size: 11px;
}

.credit-customer-main {
  min-width: 0;
}

.credit-customer-main strong,
.credit-customer-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credit-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.credit-status.clear {
  background: #dcfce7;
  color: #067647;
}

.credit-status.pending {
  background: #fff4cc;
  color: #8a6500;
}

.credit-status.overdue {
  background: #fee2e2;
  color: #b42318;
}

.credit-status.blocked {
  background: #e5e7eb;
  color: #475467;
}

.credit-account-actions {
  display: flex;
  gap: 7px;
}

.credit-account-actions button {
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.credit-view-btn {
  background: #fff5d7;
  color: #7a5900;
}

.credit-edit-btn {
  background: #eef2ff;
  color: #3556b9;
}

.credit-empty-state {
  padding: 42px 20px;
  color: #667085;
  text-align: center;
}

.credit-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, .68);
  backdrop-filter: blur(5px);
}

.credit-modal.show {
  display: flex;
}

.credit-modal-card {
  width: min(780px, 100%);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  padding: 23px;
  border: 1px solid #ead9a8;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 32px 90px rgba(15, 23, 42, .28);
}

.credit-detail-card {
  width: min(980px, 100%);
}

.credit-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.credit-close-btn {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 11px;
  background: #fff5d7;
  color: #6d5000;
  cursor: pointer;
}

.credit-form-grid,
.credit-payment-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 21px 0;
}

.credit-form-grid label,
.credit-payment-form label {
  display: grid;
  gap: 7px;
  color: #475467;
  font-size: 12px;
  font-weight: 800;
}

.credit-form-grid .wide,
.credit-payment-form .wide {
  grid-column: 1 / -1;
}

.credit-input-suffix {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid #d9dee7;
  border-radius: 12px;
}

.credit-input-suffix input {
  border: 0;
  border-radius: 0;
}

.credit-input-suffix span {
  padding: 0 12px;
  color: #667085;
  font-size: 12px;
}

.credit-warning-box {
  padding: 13px 15px;
  border: 1px solid #f0d785;
  border-radius: 13px;
  background: #fff9e7;
  color: #725400;
  font-size: 12px;
  line-height: 1.5;
}

.credit-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 19px;
}

.credit-detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
  margin: 20px 0;
}

.credit-summary-box {
  padding: 15px;
  border: 1px solid #e7eaf0;
  border-radius: 14px;
  background: #f8fafc;
}

.credit-summary-box span {
  display: block;
  margin-bottom: 6px;
  color: #667085;
  font-size: 11px;
  font-weight: 700;
}

.credit-summary-box strong {
  color: #101828;
  font-size: 15px;
}

.credit-payment-panel,
.credit-ledger-panel {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #e7eaf0;
  border-radius: 17px;
  background: #fbfcfe;
}

.credit-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 13px;
}

.credit-section-title h4 {
  margin: 0 0 3px;
}

.credit-section-title select {
  width: auto;
  min-width: 165px;
}

.credit-payment-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.credit-payment-form button {
  align-self: end;
}

.credit-ledger {
  display: grid;
  gap: 9px;
}

.credit-ledger-row {
  display: grid;
  grid-template-columns: 145px minmax(180px, 1fr) minmax(120px, auto);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid #e7eaf0;
  border-radius: 13px;
  background: #fff;
}

.credit-ledger-row strong {
  text-align: right;
}

.credit-ledger-row.credit strong {
  color: #b42318;
}

.credit-ledger-row.payment strong {
  color: #067647;
}

.credit-ledger-row.adjustment strong {
  color: #8a6500;
}

.credit-ledger-meta {
  color: #667085;
  font-size: 11px;
  line-height: 1.5;
}

.credit-message-card {
  width: min(440px, 100%);
  text-align: center;
}

.credit-message-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 18px;
  background: #fff5d7;
  font-size: 25px;
}

body.modal-open {
  overflow: hidden !important;
}

@media (max-width: 1100px) {
  .credit-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .credit-toolbar-card {
    grid-template-columns: 1fr 1fr;
  }

  .credit-search-box {
    grid-column: 1 / -1;
  }

  .credit-account {
    grid-template-columns: 1.3fr repeat(2, 1fr);
  }

  .credit-account > div:nth-child(4),
  .credit-account > div:nth-child(5) {
    display: none;
  }

  .credit-account-actions {
    justify-self: end;
  }
}

@media (max-width: 700px) {
  .credit-page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .credit-page-head .credit-primary-btn {
    width: 100%;
  }

  .credit-stats,
  .credit-toolbar-card,
  .credit-form-grid,
  .credit-payment-form,
  .credit-detail-summary {
    grid-template-columns: 1fr;
  }

  .credit-search-box,
  .credit-form-grid .wide,
  .credit-payment-form .wide {
    grid-column: auto;
  }

  .credit-account {
    grid-template-columns: 1fr 1fr;
  }

  .credit-account > div:nth-child(3),
  .credit-account > div:nth-child(4),
  .credit-account > div:nth-child(5) {
    display: none;
  }

  .credit-account-actions {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .credit-account-actions button {
    flex: 1;
  }

  .credit-section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .credit-section-title select {
    width: 100%;
  }

  .credit-ledger-row {
    grid-template-columns: 1fr;
  }

  .credit-ledger-row strong {
    text-align: left;
  }

  .credit-modal {
    padding: 8px;
  }

  .credit-modal-card {
    max-height: calc(100dvh - 16px);
    padding: 17px;
    border-radius: 17px;
  }

  .credit-modal-actions {
    flex-direction: column-reverse;
  }

  .credit-modal-actions button {
    width: 100%;
  }
}



/* =========================================================
   CUEVA PRO — CREDIT ACCOUNTS PRODUCTION MOBILE V1
   Production logic unchanged; presentation only.
========================================================= */

.credit-page,
.credit-accounts-page,
.credit-wrapper{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  margin:0!important;
  padding:0!important;
}

/* ---------- Header ---------- */

.page-title,
.credit-header{
  display:flex!important;
  justify-content:space-between!important;
  gap:10px!important;
  align-items:center!important;
  margin:0 0 8px!important;
}

.page-title h1,
.page-title h2,
.credit-header h1,
.credit-header h2{
  margin:0!important;
  overflow:hidden!important;
  font-size:22px!important;
  line-height:1.05!important;
  letter-spacing:-.045em!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}

.page-title p,
.credit-header p{
  margin:4px 0 0!important;
  color:#8e8e93!important;
  font-size:8px!important;
}

.title-actions,
.credit-actions,
.credit-toolbar{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:6px!important;
  width:100%!important;
  min-width:0!important;
  margin:8px 0!important;
}

.title-actions button,
.credit-actions button,
.credit-toolbar button{
  min-width:0!important;
  min-height:43px!important;
  padding:0 9px!important;
  border-radius:13px!important;
  font-size:8px!important;
  font-weight:800!important;
}

/* ---------- Summary ---------- */

.credit-stats,
.stats-grid,
.main-stats{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:6px!important;
  margin:8px 0!important;
}

.credit-stats .stat-card,
.stats-grid .stat-card,
.main-stats .stat-card{
  min-width:0!important;
  min-height:94px!important;
  padding:10px!important;
  border:1px solid rgba(17,17,17,.055)!important;
  border-radius:16px!important;
  background:#fff!important;
  box-shadow:0 7px 20px rgba(0,0,0,.035)!important;
}

.credit-stats .stat-card h3,
.stats-grid .stat-card h3,
.main-stats .stat-card h3,
.credit-stats .stat-card strong,
.stats-grid .stat-card strong,
.main-stats .stat-card strong{
  display:block!important;
  margin-top:6px!important;
  overflow:hidden!important;
  font-size:20px!important;
  line-height:1!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}

.credit-stats .stat-card p,
.stats-grid .stat-card p,
.main-stats .stat-card p{
  margin-top:4px!important;
  color:#8e8e93!important;
  font-size:7px!important;
}

/* ---------- Search / filters ---------- */

.credit-filter-card,
.filter-card,
.credit-filters,
.filter-row{
  display:grid!important;
  grid-template-columns:1fr!important;
  gap:7px!important;
  width:100%!important;
  min-width:0!important;
  margin:8px 0!important;
  padding:10px!important;
  border:1px solid rgba(17,17,17,.055)!important;
  border-radius:17px!important;
  background:#fff!important;
}

.credit-filter-card input,
.credit-filter-card select,
.filter-card input,
.filter-card select,
.credit-filters input,
.credit-filters select,
.filter-row input,
.filter-row select{
  width:100%!important;
  min-width:0!important;
  min-height:42px!important;
  padding:0 9px!important;
  border:1px solid rgba(17,17,17,.07)!important;
  border-radius:12px!important;
  background:#f8f8f9!important;
  font-size:9px!important;
}

/* ---------- Account cards / table ---------- */

.table-wrapper,
.credit-table-wrap,
.accounts-table-wrap{
  width:100%!important;
  max-width:100%!important;
  overflow:visible!important;
}

.table-wrapper table,
.credit-table-wrap table,
.accounts-table-wrap table{
  display:block!important;
  width:100%!important;
  min-width:0!important;
}

.table-wrapper thead,
.credit-table-wrap thead,
.accounts-table-wrap thead{
  display:none!important;
}

.table-wrapper tbody,
.credit-table-wrap tbody,
.accounts-table-wrap tbody{
  display:grid!important;
  gap:7px!important;
  width:100%!important;
}

.table-wrapper tr,
.credit-table-wrap tr,
.accounts-table-wrap tr{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  gap:7px!important;
  width:100%!important;
  min-width:0!important;
  padding:10px!important;
  border:1px solid rgba(17,17,17,.055)!important;
  border-radius:16px!important;
  background:#fff!important;
  box-shadow:0 7px 20px rgba(0,0,0,.03)!important;
}

.table-wrapper td,
.credit-table-wrap td,
.accounts-table-wrap td{
  display:block!important;
  min-width:0!important;
  padding:0!important;
  border:0!important;
  overflow:hidden!important;
  font-size:8px!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}

.table-wrapper td:nth-child(1),
.credit-table-wrap td:nth-child(1),
.accounts-table-wrap td:nth-child(1){
  grid-column:1!important;
  font-size:11px!important;
  font-weight:850!important;
  color:#111!important;
}

.table-wrapper td:nth-child(2),
.table-wrapper td:nth-child(3),
.table-wrapper td:nth-child(4),
.credit-table-wrap td:nth-child(2),
.credit-table-wrap td:nth-child(3),
.credit-table-wrap td:nth-child(4),
.accounts-table-wrap td:nth-child(2),
.accounts-table-wrap td:nth-child(3),
.accounts-table-wrap td:nth-child(4){
  grid-column:1!important;
  color:#8e8e93!important;
  font-size:7px!important;
}

.table-wrapper td:last-child,
.credit-table-wrap td:last-child,
.accounts-table-wrap td:last-child{
  grid-column:2!important;
  grid-row:1/5!important;
  align-self:center!important;
}

.table-wrapper td:last-child button,
.credit-table-wrap td:last-child button,
.accounts-table-wrap td:last-child button{
  width:39px!important;
  height:39px!important;
  min-width:39px!important;
  padding:0!important;
  border-radius:12px!important;
  font-size:0!important;
}

.table-wrapper td:last-child button i,
.credit-table-wrap td:last-child button i,
.accounts-table-wrap td:last-child button i{
  font-size:12px!important;
}

/* Native card renderer compatibility */

.credit-account-list,
.accounts-list,
.credit-grid{
  display:grid!important;
  grid-template-columns:1fr!important;
  gap:7px!important;
}

.credit-account-card,
.account-card,
.credit-customer-card{
  min-width:0!important;
  padding:10px!important;
  border:1px solid rgba(17,17,17,.055)!important;
  border-radius:16px!important;
  background:#fff!important;
  box-shadow:0 7px 20px rgba(0,0,0,.03)!important;
}

.credit-account-card header,
.account-card header,
.credit-customer-card header{
  display:flex!important;
  justify-content:space-between!important;
  gap:10px!important;
  align-items:flex-start!important;
}

.credit-account-card h3,
.account-card h3,
.credit-customer-card h3{
  margin:0!important;
  overflow:hidden!important;
  font-size:11px!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}

.credit-account-card p,
.account-card p,
.credit-customer-card p{
  margin:3px 0 0!important;
  color:#8e8e93!important;
  font-size:7px!important;
}

.credit-balance,
.account-balance{
  flex:0 0 auto!important;
  color:#b42318!important;
  font-size:12px!important;
  font-weight:850!important;
}

/* ---------- Details panel as bottom sheet ---------- */

.credit-side-panel,
.account-side-panel,
#creditAccountPanel,
#accountDetailsPanel{
  position:fixed!important;
  inset:auto 0 0 0!important;
  z-index:7100!important;
  width:100%!important;
  max-width:none!important;
  max-height:91dvh!important;
  overflow-y:auto!important;
  padding:
    11px
    13px
    calc(18px + env(safe-area-inset-bottom))!important;
  border-radius:25px 25px 0 0!important;
  background:#f8f8fa!important;
  box-shadow:0 -20px 55px rgba(0,0,0,.2)!important;
}

.credit-side-panel:before,
.account-side-panel:before,
#creditAccountPanel:before,
#accountDetailsPanel:before{
  content:""!important;
  display:block!important;
  width:40px!important;
  height:4px!important;
  margin:0 auto 11px!important;
  border-radius:999px!important;
  background:rgba(17,17,17,.14)!important;
}

.credit-detail-grid,
.account-detail-grid,
.credit-summary-grid{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:7px!important;
}

.credit-detail-grid>div,
.account-detail-grid>div,
.credit-summary-grid>div{
  min-width:0!important;
  padding:10px!important;
  border-radius:14px!important;
  background:#fff!important;
}

.credit-detail-grid span,
.credit-detail-grid strong,
.account-detail-grid span,
.account-detail-grid strong,
.credit-summary-grid span,
.credit-summary-grid strong{
  display:block!important;
}

.credit-detail-grid span,
.account-detail-grid span,
.credit-summary-grid span{
  color:#8e8e93!important;
  font-size:7px!important;
}

.credit-detail-grid strong,
.account-detail-grid strong,
.credit-summary-grid strong{
  margin-top:5px!important;
  overflow:hidden!important;
  font-size:10px!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}

/* ---------- Payment / settlement history ---------- */

.credit-history,
.payment-history,
.settlement-history{
  display:grid!important;
  gap:7px!important;
  margin-top:9px!important;
}

.credit-history-item,
.payment-history-item,
.settlement-history-item{
  min-width:0!important;
  padding:9px!important;
  border-radius:14px!important;
  background:#fff!important;
}

.credit-history-item header,
.payment-history-item header,
.settlement-history-item header{
  display:flex!important;
  justify-content:space-between!important;
  gap:8px!important;
  align-items:flex-start!important;
}

.credit-history-item strong,
.payment-history-item strong,
.settlement-history-item strong{
  overflow:hidden!important;
  font-size:9px!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}

.credit-history-item small,
.payment-history-item small,
.settlement-history-item small{
  display:block!important;
  margin-top:3px!important;
  color:#8e8e93!important;
  font-size:7px!important;
}

/* ---------- Add customer / payment modals ---------- */

.modal,
.credit-modal,
.payment-modal,
#creditCustomerModal,
#creditPaymentModal,
#settlementModal{
  z-index:7300!important;
}

.modal-content,
.credit-modal-content,
.payment-modal-content,
#creditCustomerModal .modal-content,
#creditPaymentModal .modal-content,
#settlementModal .modal-content{
  width:100%!important;
  max-width:none!important;
  max-height:92dvh!important;
  overflow-y:auto!important;
  margin:0!important;
  padding:
    11px
    13px
    calc(18px + env(safe-area-inset-bottom))!important;
  border-radius:25px 25px 0 0!important;
  background:#f8f8fa!important;
}

.modal.open,
.credit-modal.open,
.payment-modal.open,
#creditCustomerModal:not(.hidden),
#creditPaymentModal:not(.hidden),
#settlementModal:not(.hidden){
  display:flex!important;
  align-items:flex-end!important;
}

.modal input,
.modal select,
.modal textarea,
.credit-modal input,
.credit-modal select,
.credit-modal textarea,
.payment-modal input,
.payment-modal select,
.payment-modal textarea{
  width:100%!important;
  min-width:0!important;
  min-height:42px!important;
  border-radius:12px!important;
  font-size:9px!important;
}

.form-grid,
.credit-form-grid,
.payment-form-grid{
  display:grid!important;
  grid-template-columns:1fr!important;
  gap:7px!important;
}

.modal-actions,
.credit-modal-actions,
.payment-modal-actions{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:7px!important;
  margin-top:10px!important;
}

.modal-actions button,
.credit-modal-actions button,
.payment-modal-actions button{
  min-height:46px!important;
  border-radius:13px!important;
  font-size:8px!important;
}

/* ---------- Payment methods ---------- */

.payment-methods,
.credit-payment-methods{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:7px!important;
  margin-top:8px!important;
}

.payment-methods button,
.credit-payment-methods button{
  min-width:0!important;
  min-height:47px!important;
  border-radius:13px!important;
  font-size:8px!important;
  font-weight:800!important;
}

/* ---------- Actions ---------- */

.credit-actions-grid,
.account-actions,
.credit-account-actions{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:7px!important;
  margin-top:10px!important;
}

.credit-actions-grid button,
.account-actions button,
.credit-account-actions button{
  min-width:0!important;
  min-height:46px!important;
  border-radius:13px!important;
  font-size:8px!important;
  font-weight:800!important;
}

/* ---------- Phone ---------- */

@media(max-width:430px){
  .credit-stats,
  .stats-grid,
  .main-stats{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }

  .credit-detail-grid,
  .account-detail-grid,
  .credit-summary-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}

@media(max-width:350px){
  .title-actions,
  .credit-actions,
  .credit-toolbar,
  .credit-detail-grid,
  .account-detail-grid,
  .credit-summary-grid,
  .payment-methods,
  .credit-payment-methods,
  .modal-actions,
  .credit-modal-actions,
  .payment-modal-actions,
  .credit-actions-grid,
  .account-actions,
  .credit-account-actions{
    grid-template-columns:1fr!important;
  }
}

/* =========================================================
   CUEVA PRO CREDIT ACCOUNTS — MOBILE PRODUCTION v3
   Matches Live mobile visual language.
   Presentation only: no credit/account/payment logic changed.
========================================================= */
@media (max-width: 760px) {
  #pageContent:has(.credit-page) {
    display: block !important;
    padding: 12px 12px 28px !important;
    overflow-x: hidden !important;
    background: #f5f5f7 !important;
  }

  #pageContent:has(.credit-page) > style { display: none !important; }

  .credit-page {
    display: grid !important;
    gap: 11px !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 0 0 calc(18px + env(safe-area-inset-bottom)) !important;
  }

  /* Header */
  .credit-page-head {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) auto !important;
    gap: 10px !important;
    align-items: center !important;
    padding: 3px 2px 1px !important;
  }

  .credit-page-head > div { min-width: 0 !important; }

  .credit-page-head .credit-eyebrow {
    display: none !important;
  }

  .credit-page-head h2 {
    margin: 0 !important;
    color: #111 !important;
    font-size: 22px !important;
    line-height: 1.05 !important;
    letter-spacing: -.045em !important;
  }

  .credit-page-head p {
    max-width: 230px !important;
    margin: 5px 0 0 !important;
    color: #8e8e93 !important;
    font-size: 8px !important;
    line-height: 1.35 !important;
  }

  #addCreditAccountBtn {
    width: 43px !important;
    min-width: 43px !important;
    height: 43px !important;
    min-height: 43px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 14px !important;
    background: #111 !important;
    color: #fff !important;
    box-shadow: 0 8px 20px rgba(0,0,0,.13) !important;
    font-size: 0 !important;
  }

  #addCreditAccountBtn i { font-size: 14px !important; }

  /* 4 compact mobile summary cards */
  .credit-stats {
    display: grid !important;
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    gap: 8px !important;
    margin: 0 !important;
  }

  .credit-stat-card {
    min-width: 0 !important;
    min-height: 92px !important;
    padding: 13px !important;
    border: 1px solid rgba(255,255,255,.94) !important;
    border-radius: 20px !important;
    background: rgba(255,255,255,.84) !important;
    box-shadow: 0 9px 27px rgba(0,0,0,.045) !important;
    backdrop-filter: blur(22px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(22px) saturate(150%) !important;
  }

  .credit-stat-card::after { display: none !important; }

  .credit-stat-card > span {
    display: block !important;
    color: #8e8e93 !important;
    font-size: 8px !important;
    font-weight: 750 !important;
    line-height: 1.2 !important;
  }

  .credit-stat-card > strong {
    display: block !important;
    max-width: 100% !important;
    margin: 9px 0 0 !important;
    overflow: hidden !important;
    color: #111 !important;
    font-size: 19px !important;
    line-height: 1 !important;
    letter-spacing: -.045em !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .credit-stat-card > small {
    display: block !important;
    margin-top: 7px !important;
    overflow: hidden !important;
    color: #aeaeb2 !important;
    font-size: 7px !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .credit-stat-card.danger > strong { color: #ff3b30 !important; }
  .credit-stat-card.success > strong { color: #248a3d !important; }

  /* Search + filters */
  .credit-toolbar-card {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) 46px !important;
    gap: 7px !important;
    padding: 10px !important;
    border: 1px solid rgba(255,255,255,.92) !important;
    border-radius: 20px !important;
    background: rgba(255,255,255,.8) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.035) !important;
    backdrop-filter: blur(20px) !important;
  }

  .credit-search-box {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    min-height: 45px !important;
    padding: 0 13px !important;
    border: 1px solid rgba(17,17,17,.06) !important;
    border-radius: 14px !important;
    background: rgba(17,17,17,.04) !important;
  }

  .credit-search-box i {
    margin-right: 8px !important;
    color: #8e8e93 !important;
    font-size: 11px !important;
  }

  .credit-search-box input {
    min-width: 0 !important;
    font-size: 10px !important;
  }

  #creditStatusFilter,
  #creditSort {
    min-width: 0 !important;
    min-height: 41px !important;
    padding: 0 10px !important;
    border: 1px solid rgba(17,17,17,.06) !important;
    border-radius: 13px !important;
    background: #f6f6f7 !important;
    color: #3a3a3c !important;
    font-size: 8px !important;
    font-weight: 700 !important;
  }

  #creditStatusFilter { grid-column: 1 !important; }
  #creditSort { grid-column: 1 !important; }

  #creditResetFilters {
    grid-column: 2 !important;
    grid-row: 2 / 4 !important;
    width: 46px !important;
    min-width: 46px !important;
    min-height: 100% !important;
    padding: 0 !important;
    border-radius: 13px !important;
    background: #111 !important;
    color: #fff !important;
    font-size: 0 !important;
  }

  #creditResetFilters i { font-size: 12px !important; }

  /* Accounts container */
  .credit-table-card {
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .credit-table-head {
    display: flex !important;
    align-items: end !important;
    justify-content: space-between !important;
    padding: 4px 2px 8px !important;
    border: 0 !important;
  }

  .credit-table-head h3 {
    margin: 0 !important;
    color: #111 !important;
    font-size: 15px !important;
    letter-spacing: -.03em !important;
  }

  .credit-table-head p {
    margin-top: 3px !important;
    color: #8e8e93 !important;
    font-size: 7px !important;
  }

  .credit-account-list {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 9px !important;
  }

  /* Actual renderer uses .credit-account */
  .credit-account {
    position: relative !important;
    display: grid !important;
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    grid-template-areas:
      "customer customer"
      "outstanding status"
      "limit available"
      "actions actions" !important;
    gap: 10px 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 15px !important;
    border: 1px solid rgba(255,255,255,.94) !important;
    border-radius: 22px !important;
    background:
      radial-gradient(circle at 100% 0%,rgba(212,166,42,.09),transparent 31%),
      rgba(255,255,255,.88) !important;
    box-shadow: 0 12px 32px rgba(0,0,0,.055) !important;
    transition: none !important;
  }

  .credit-account:hover { background: rgba(255,255,255,.88) !important; }

  .credit-account > div { min-width: 0 !important; }
  .credit-account > div:nth-child(1) { grid-area: customer !important; }
  .credit-account > div:nth-child(2) { grid-area: limit !important; }
  .credit-account > div:nth-child(3) { grid-area: outstanding !important; }
  .credit-account > div:nth-child(4) { grid-area: available !important; }
  .credit-account > div:nth-child(5) { grid-area: status !important; text-align: right !important; }
  .credit-account > div:nth-child(6) { grid-area: actions !important; }

  .credit-customer-main {
    padding-bottom: 10px !important;
    border-bottom: 1px solid rgba(17,17,17,.055) !important;
  }

  .credit-customer-main strong {
    display: block !important;
    overflow: hidden !important;
    color: #111 !important;
    font-size: 15px !important;
    line-height: 1.1 !important;
    letter-spacing: -.025em !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .credit-account small {
    display: block !important;
    margin-top: 4px !important;
    overflow: hidden !important;
    color: #8e8e93 !important;
    font-size: 7px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .credit-account > div:not(.credit-customer-main):not(.credit-account-actions) > strong {
    display: block !important;
    margin-top: 5px !important;
    overflow: hidden !important;
    color: #111 !important;
    font-size: 12px !important;
    line-height: 1.05 !important;
    letter-spacing: -.025em !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .credit-account > div:nth-child(3) > strong {
    color: #b42318 !important;
    font-size: 15px !important;
  }

  .credit-account > div:nth-child(4) > strong { color: #248a3d !important; }

  .credit-status {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 25px !important;
    padding: 0 9px !important;
    border: 0 !important;
    border-radius: 999px !important;
    font-size: 7px !important;
    font-weight: 850 !important;
    letter-spacing: .03em !important;
  }

  .credit-status.clear { background: rgba(48,209,88,.12) !important; color: #248a3d !important; }
  .credit-status.pending { background: rgba(240,200,90,.17) !important; color: #8a6500 !important; }
  .credit-status.overdue { background: rgba(255,59,48,.11) !important; color: #d70015 !important; }
  .credit-status.blocked { background: rgba(142,142,147,.13) !important; color: #636366 !important; }

  .credit-account-actions {
    display: grid !important;
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    gap: 7px !important;
    margin: 2px 0 0 !important;
    padding-top: 10px !important;
    border-top: 1px solid rgba(17,17,17,.055) !important;
  }

  .credit-account-actions:has(.credit-view-btn:only-child) {
    grid-template-columns: 1fr !important;
  }

  .credit-account-actions button {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 43px !important;
    padding: 0 10px !important;
    border: 0 !important;
    border-radius: 13px !important;
    font-size: 8px !important;
    font-weight: 800 !important;
  }

  .credit-view-btn { background: #111 !important; color: #fff !important; }
  .credit-edit-btn { background: rgba(17,17,17,.055) !important; color: #3a3a3c !important; }

  .credit-empty-state {
    padding: 35px 16px !important;
    border: 1px solid rgba(255,255,255,.92) !important;
    border-radius: 20px !important;
    background: rgba(255,255,255,.82) !important;
    color: #8e8e93 !important;
    font-size: 9px !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.035) !important;
  }

  /* All credit modals become matching mobile bottom sheets */
  .credit-modal,
  .credit-modal.show {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483200 !important;
    align-items: flex-end !important;
    justify-content: stretch !important;
    padding: 0 !important;
    background: rgba(0,0,0,.32) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
  }

  .credit-modal { display: none !important; }
  .credit-modal.show { display: flex !important; }

  .credit-modal-card,
  .credit-detail-card,
  .credit-message-card {
    position: relative !important;
    width: 100% !important;
    max-width: none !important;
    max-height: 91dvh !important;
    margin: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding: 19px 14px calc(18px + env(safe-area-inset-bottom)) !important;
    border: 0 !important;
    border-radius: 27px 27px 0 0 !important;
    background: #f5f5f7 !important;
    box-shadow: 0 -22px 55px rgba(0,0,0,.18) !important;
  }

  .credit-modal-card::before {
    content: "" !important;
    display: block !important;
    width: 38px !important;
    height: 4px !important;
    margin: -8px auto 13px !important;
    border-radius: 999px !important;
    background: rgba(17,17,17,.15) !important;
  }

  .credit-modal-head {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 10px !important;
    margin-bottom: 12px !important;
  }

  .credit-modal-head .credit-eyebrow { display: none !important; }

  .credit-modal-head h3 {
    margin: 0 !important;
    color: #111 !important;
    font-size: 20px !important;
    line-height: 1.05 !important;
    letter-spacing: -.04em !important;
  }

  .credit-modal-head p {
    margin-top: 5px !important;
    color: #8e8e93 !important;
    font-size: 8px !important;
  }

  .credit-close-btn {
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    border-radius: 12px !important;
    background: rgba(17,17,17,.06) !important;
    color: #3a3a3c !important;
  }

  /* Add/edit account form */
  .credit-form-grid,
  .credit-payment-form {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 9px !important;
    margin: 11px 0 !important;
  }

  .credit-form-grid .wide,
  .credit-payment-form .wide { grid-column: 1 !important; }

  .credit-form-grid label,
  .credit-payment-form label {
    display: grid !important;
    gap: 6px !important;
    min-width: 0 !important;
    color: #636366 !important;
    font-size: 8px !important;
    font-weight: 750 !important;
  }

  .credit-form-grid input,
  .credit-form-grid textarea,
  .credit-form-grid select,
  .credit-payment-form input,
  .credit-payment-form select,
  .credit-section-title select {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 45px !important;
    padding: 10px 12px !important;
    border: 1px solid rgba(17,17,17,.07) !important;
    border-radius: 13px !important;
    background: #fff !important;
    color: #111 !important;
    font-size: 10px !important;
    outline: 0 !important;
    box-shadow: none !important;
  }

  .credit-form-grid textarea { min-height: 76px !important; resize: vertical !important; }

  .credit-input-suffix {
    min-height: 45px !important;
    border: 1px solid rgba(17,17,17,.07) !important;
    border-radius: 13px !important;
    background: #fff !important;
  }

  .credit-input-suffix input { min-height: 43px !important; }
  .credit-input-suffix span { font-size: 8px !important; }

  .credit-warning-box {
    margin: 11px 0 !important;
    padding: 11px !important;
    border: 1px solid rgba(240,200,90,.24) !important;
    border-radius: 14px !important;
    background: rgba(240,200,90,.1) !important;
    color: #725b11 !important;
    font-size: 8px !important;
    line-height: 1.4 !important;
  }

  .credit-modal-actions {
    display: grid !important;
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    gap: 8px !important;
    margin-top: 12px !important;
  }

  .credit-modal-actions button,
  #receiveCreditPaymentBtn {
    min-width: 0 !important;
    min-height: 46px !important;
    border-radius: 14px !important;
    font-size: 8px !important;
    font-weight: 850 !important;
  }

  .credit-primary-btn {
    background: #111 !important;
    color: #fff !important;
    box-shadow: none !important;
  }

  .credit-secondary-btn { background: rgba(17,17,17,.055) !important; color: #3a3a3c !important; }

  /* Account details */
  .credit-detail-summary {
    display: grid !important;
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    gap: 8px !important;
    margin: 0 0 10px !important;
  }

  .credit-summary-box {
    min-width: 0 !important;
    min-height: 82px !important;
    padding: 12px !important;
    border: 1px solid rgba(255,255,255,.92) !important;
    border-radius: 17px !important;
    background: #fff !important;
    box-shadow: 0 7px 21px rgba(0,0,0,.035) !important;
  }

  .credit-summary-box > span {
    display: block !important;
    color: #8e8e93 !important;
    font-size: 7px !important;
    font-weight: 700 !important;
  }

  .credit-summary-box > strong {
    display: block !important;
    max-width: 100% !important;
    margin-top: 9px !important;
    overflow: hidden !important;
    color: #111 !important;
    font-size: 15px !important;
    line-height: 1 !important;
    letter-spacing: -.035em !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .credit-payment-panel,
  .credit-ledger-panel {
    margin-top: 10px !important;
    padding: 13px !important;
    border: 1px solid rgba(255,255,255,.94) !important;
    border-radius: 20px !important;
    background: rgba(255,255,255,.88) !important;
    box-shadow: 0 8px 25px rgba(0,0,0,.04) !important;
  }

  .credit-section-title {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) auto !important;
    gap: 8px !important;
    align-items: end !important;
  }

  .credit-section-title h4 {
    margin: 0 !important;
    color: #111 !important;
    font-size: 13px !important;
    letter-spacing: -.02em !important;
  }

  .credit-section-title p {
    margin-top: 3px !important;
    color: #8e8e93 !important;
    font-size: 7px !important;
  }

  #creditLedgerFilter {
    width: auto !important;
    min-width: 106px !important;
    min-height: 35px !important;
    padding: 0 8px !important;
    border-radius: 11px !important;
    font-size: 7px !important;
  }

  .credit-ledger {
    display: grid !important;
    gap: 7px !important;
    margin-top: 11px !important;
  }

  .credit-ledger-row {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) auto !important;
    gap: 5px 8px !important;
    align-items: center !important;
    min-width: 0 !important;
    padding: 11px !important;
    border: 1px solid rgba(17,17,17,.045) !important;
    border-radius: 15px !important;
    background: #f8f8f9 !important;
  }

  .credit-ledger-row > div:nth-child(1) { grid-column: 1 !important; }
  .credit-ledger-row > div:nth-child(2) { grid-column: 1 !important; }
  .credit-ledger-row > strong:last-child {
    grid-column: 2 !important;
    grid-row: 1 / 3 !important;
    align-self: center !important;
    color: #111 !important;
    font-size: 10px !important;
    white-space: nowrap !important;
  }

  .credit-ledger-row > div > strong {
    display: block !important;
    overflow: hidden !important;
    color: #3a3a3c !important;
    font-size: 8px !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .credit-ledger-meta {
    margin-top: 2px !important;
    overflow: hidden !important;
    color: #8e8e93 !important;
    font-size: 7px !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .credit-ledger-row.payment > strong:last-child { color: #248a3d !important; }
  .credit-ledger-row.credit > strong:last-child,
  .credit-ledger-row.charge > strong:last-child { color: #b42318 !important; }

  /* Message modal should stay compact */
  .credit-message-card {
    padding-top: 21px !important;
    text-align: center !important;
  }

  .credit-message-icon { font-size: 26px !important; }
  .credit-message-card h3 { margin: 9px 0 5px !important; font-size: 17px !important; }
  .credit-message-card p { margin: 0 !important; color: #8e8e93 !important; font-size: 9px !important; line-height: 1.4 !important; }
}

@media (max-width: 350px) {
  .credit-page-head { grid-template-columns: minmax(0,1fr) 40px !important; }
  #addCreditAccountBtn { width: 40px !important; min-width: 40px !important; height: 40px !important; min-height: 40px !important; }
  .credit-stat-card { padding: 11px !important; }
  .credit-stat-card > strong { font-size: 17px !important; }
  .credit-detail-summary { grid-template-columns: 1fr !important; }
}

/* =========================================================
   CUEVA CREDIT ACCOUNTS v3 — PREMIUM MOBILE UX
   Improves hierarchy/readability only. Existing HTML/JS IDs
   and credit business logic remain unchanged.
   ========================================================= */
@media (max-width: 760px) {
  .credit-page {
    gap: 14px !important;
    padding: 4px 12px 96px !important;
    background: #f5f5f7 !important;
  }

  /* Header — title first, quick add action */
  .credit-page-head {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) 48px !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 8px 2px 2px !important;
  }
  .credit-page-head .credit-eyebrow,
  .credit-page-head p { display: none !important; }
  .credit-page-head h2 {
    margin: 0 !important;
    font-size: 26px !important;
    line-height: 1.05 !important;
    font-weight: 800 !important;
    letter-spacing: -.045em !important;
    color: #111 !important;
  }
  #addCreditAccountBtn {
    width: 48px !important;
    min-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 !important;
    border-radius: 16px !important;
    background: #111 !important;
    color: #fff !important;
    box-shadow: 0 9px 24px rgba(0,0,0,.14) !important;
    font-size: 0 !important;
  }
  #addCreditAccountBtn i { font-size: 16px !important; }

  /* 2 x 2 scorecard — readable, no decorative clutter */
  .credit-stats {
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    gap: 9px !important;
  }
  .credit-stat-card {
    min-height: 108px !important;
    padding: 14px !important;
    border: 1px solid rgba(17,17,17,.055) !important;
    border-radius: 20px !important;
    background: #fff !important;
    box-shadow: 0 7px 22px rgba(0,0,0,.035) !important;
  }
  .credit-stat-card::after { display: none !important; }
  .credit-stat-card span {
    color: #7c7c80 !important;
    font-size: 10px !important;
    line-height: 1.15 !important;
    font-weight: 700 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
  }
  .credit-stat-card strong {
    margin-top: 9px !important;
    color: #111 !important;
    font-size: 21px !important;
    line-height: 1 !important;
    font-weight: 800 !important;
    letter-spacing: -.04em !important;
  }
  .credit-stat-card small {
    margin-top: 7px !important;
    color: #aaa !important;
    font-size: 9px !important;
    line-height: 1.25 !important;
  }
  .credit-stat-card.danger strong { color: #d70015 !important; }
  .credit-stat-card.success strong { color: #248a3d !important; }

  /* Search first. Filters below as touch-friendly chips/selects */
  .credit-toolbar-card {
    display: grid !important;
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    gap: 8px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  .credit-search-box {
    grid-column: 1 / -1 !important;
    min-height: 48px !important;
    padding: 0 14px !important;
    border: 1px solid rgba(17,17,17,.06) !important;
    border-radius: 16px !important;
    background: #fff !important;
    box-shadow: 0 4px 14px rgba(0,0,0,.025) !important;
  }
  .credit-search-box i { margin-right: 10px !important; font-size: 13px !important; color: #8e8e93 !important; }
  .credit-search-box input {
    font-size: 13px !important;
    color: #111 !important;
  }
  .credit-search-box input::placeholder { color: #a8a8ad !important; }
  .credit-toolbar-card select {
    min-height: 44px !important;
    padding: 0 11px !important;
    border: 1px solid rgba(17,17,17,.06) !important;
    border-radius: 14px !important;
    background: #fff !important;
    color: #3a3a3c !important;
    font-size: 10px !important;
    font-weight: 700 !important;
  }
  #creditResetFilters {
    grid-column: 1 / -1 !important;
    min-height: 38px !important;
    border-radius: 12px !important;
    background: rgba(17,17,17,.05) !important;
    color: #636366 !important;
    font-size: 10px !important;
  }

  /* Remove desktop table shell — mobile account cards stand alone */
  .credit-table-card {
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  .credit-table-head {
    display: flex !important;
    align-items: end !important;
    justify-content: space-between !important;
    padding: 4px 2px 8px !important;
    border: 0 !important;
  }
  .credit-table-head h3 {
    margin: 0 !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    letter-spacing: -.02em !important;
    color: #111 !important;
  }
  .credit-table-head p {
    margin-top: 3px !important;
    color: #8e8e93 !important;
    font-size: 9px !important;
  }
  .credit-account-list { gap: 10px !important; }

  /* Account card: customer/status top, outstanding is hero value */
  .credit-account {
    position: relative !important;
    display: grid !important;
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    grid-template-areas:
      "customer status"
      "outstanding outstanding"
      "available limit"
      "actions actions" !important;
    gap: 0 12px !important;
    padding: 15px !important;
    border: 1px solid rgba(17,17,17,.055) !important;
    border-radius: 22px !important;
    background: #fff !important;
    box-shadow: 0 8px 26px rgba(0,0,0,.04) !important;
  }
  .credit-account > div:nth-child(1) { grid-area: customer !important; }
  .credit-account > div:nth-child(2) { grid-area: limit !important; }
  .credit-account > div:nth-child(3) { grid-area: outstanding !important; }
  .credit-account > div:nth-child(4) { grid-area: available !important; }
  .credit-account > div:nth-child(5) { grid-area: status !important; text-align: right !important; }
  .credit-account > div:nth-child(6) { grid-area: actions !important; }

  .credit-customer-main {
    min-width: 0 !important;
    padding: 1px 0 13px !important;
    border: 0 !important;
  }
  .credit-customer-main strong {
    font-size: 16px !important;
    font-weight: 800 !important;
    line-height: 1.15 !important;
    letter-spacing: -.025em !important;
  }
  .credit-customer-main small {
    margin-top: 5px !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    color: #8e8e93 !important;
  }

  .credit-account > div:nth-child(5) {
    padding: 0 0 13px !important;
  }
  .credit-status {
    min-height: 28px !important;
    padding: 0 10px !important;
    font-size: 8px !important;
    font-weight: 800 !important;
    letter-spacing: .02em !important;
  }
  .credit-account > div:nth-child(5) small {
    margin-top: 5px !important;
    font-size: 8.5px !important;
  }

  /* Outstanding hero strip */
  .credit-account > div:nth-child(3) {
    margin: 0 -1px 12px !important;
    padding: 13px 14px !important;
    border-radius: 16px !important;
    background: #f6f6f8 !important;
  }
  .credit-account > div:nth-child(3) small {
    margin: 0 !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    color: #77777c !important;
  }
  .credit-account > div:nth-child(3) > strong {
    margin-top: 6px !important;
    font-size: 23px !important;
    line-height: 1 !important;
    font-weight: 850 !important;
    letter-spacing: -.045em !important;
    color: #111 !important;
  }
  .credit-account:has(.credit-status.overdue) > div:nth-child(3) {
    background: #fff1f2 !important;
  }
  .credit-account:has(.credit-status.overdue) > div:nth-child(3) > strong {
    color: #d70015 !important;
  }
  .credit-account:has(.credit-status.clear) > div:nth-child(3) {
    background: #f1faf3 !important;
  }
  .credit-account:has(.credit-status.clear) > div:nth-child(3) > strong {
    color: #248a3d !important;
  }

  /* Secondary money details */
  .credit-account > div:nth-child(2),
  .credit-account > div:nth-child(4) {
    min-width: 0 !important;
    padding: 2px 2px 14px !important;
  }
  .credit-account > div:nth-child(2) small,
  .credit-account > div:nth-child(4) small {
    margin: 0 !important;
    font-size: 8.5px !important;
    font-weight: 700 !important;
    color: #8e8e93 !important;
  }
  .credit-account > div:nth-child(2) > strong,
  .credit-account > div:nth-child(4) > strong {
    margin-top: 5px !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    color: #3a3a3c !important;
  }
  .credit-account > div:nth-child(4) > strong { color: #248a3d !important; }

  /* Actions */
  .credit-account-actions {
    gap: 8px !important;
    margin: 0 !important;
    padding-top: 12px !important;
    border-top: 1px solid rgba(17,17,17,.06) !important;
  }
  .credit-account-actions button {
    min-height: 46px !important;
    border-radius: 14px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
  }
  .credit-view-btn {
    background: #111 !important;
    color: #fff !important;
    box-shadow: 0 5px 14px rgba(0,0,0,.10) !important;
  }
  .credit-edit-btn {
    background: #f1f1f3 !important;
    color: #3a3a3c !important;
  }

  .credit-empty-state {
    padding: 32px 18px !important;
    border-radius: 20px !important;
    font-size: 11px !important;
    line-height: 1.45 !important;
  }

  /* Bottom sheets — cleaner and much more readable */
  .credit-modal,
  .credit-modal.show {
    background: rgba(0,0,0,.30) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
  }
  .credit-modal-card,
  .credit-detail-card,
  .credit-message-card {
    max-height: 92dvh !important;
    padding: 19px 15px calc(20px + env(safe-area-inset-bottom)) !important;
    border-radius: 28px 28px 0 0 !important;
    background: #f5f5f7 !important;
  }
  .credit-modal-card::before {
    width: 40px !important;
    height: 5px !important;
    margin-bottom: 15px !important;
  }
  .credit-modal-head h3 {
    font-size: 22px !important;
    font-weight: 800 !important;
  }
  .credit-modal-head p {
    font-size: 10px !important;
  }
  .credit-close-btn {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
  }

  /* Account detail summary: outstanding gets full-width emphasis */
  .credit-detail-summary {
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    gap: 9px !important;
  }
  .credit-summary-box {
    min-height: 92px !important;
    padding: 13px !important;
    border-radius: 18px !important;
  }
  .credit-summary-box:first-child {
    grid-column: 1 / -1 !important;
    min-height: 104px !important;
    background: #111 !important;
  }
  .credit-summary-box > span {
    font-size: 9px !important;
    font-weight: 700 !important;
  }
  .credit-summary-box > strong {
    margin-top: 9px !important;
    font-size: 17px !important;
    font-weight: 850 !important;
  }
  .credit-summary-box:first-child > span { color: rgba(255,255,255,.6) !important; }
  .credit-summary-box:first-child > strong {
    color: #fff !important;
    font-size: 29px !important;
  }

  /* Receive payment becomes the main action card */
  .credit-payment-panel,
  .credit-ledger-panel {
    padding: 15px !important;
    border-radius: 21px !important;
  }
  .credit-section-title h4 {
    font-size: 15px !important;
    font-weight: 800 !important;
  }
  .credit-section-title p {
    margin-top: 4px !important;
    font-size: 9px !important;
    line-height: 1.3 !important;
  }
  .credit-form-grid,
  .credit-payment-form {
    gap: 10px !important;
  }
  .credit-form-grid label,
  .credit-payment-form label {
    gap: 6px !important;
    font-size: 10px !important;
    font-weight: 700 !important;
  }
  .credit-form-grid input,
  .credit-form-grid textarea,
  .credit-form-grid select,
  .credit-payment-form input,
  .credit-payment-form select,
  .credit-section-title select {
    min-height: 48px !important;
    padding: 11px 12px !important;
    border-radius: 14px !important;
    font-size: 12px !important;
  }
  .credit-input-suffix { min-height: 48px !important; border-radius: 14px !important; }
  .credit-input-suffix input { min-height: 46px !important; }
  .credit-input-suffix span { font-size: 10px !important; }
  .credit-warning-box {
    padding: 12px !important;
    font-size: 10px !important;
  }
  .credit-modal-actions button,
  #receiveCreditPaymentBtn {
    min-height: 50px !important;
    border-radius: 15px !important;
    font-size: 11px !important;
  }
  #receiveCreditPaymentBtn {
    margin-top: 2px !important;
    background: #111 !important;
    color: #fff !important;
  }

  /* Ledger: readable transaction rows */
  #creditLedgerFilter {
    min-width: 118px !important;
    min-height: 38px !important;
    font-size: 9px !important;
  }
  .credit-ledger { gap: 8px !important; }
  .credit-ledger-row {
    padding: 12px !important;
    border-radius: 16px !important;
    background: #f7f7f8 !important;
  }
  .credit-ledger-row > div > strong {
    font-size: 10px !important;
    font-weight: 750 !important;
  }
  .credit-ledger-meta {
    margin-top: 4px !important;
    font-size: 8.5px !important;
  }
  .credit-ledger-row > strong:last-child {
    font-size: 12px !important;
    font-weight: 850 !important;
  }

  .credit-message-card h3 { font-size: 19px !important; }
  .credit-message-card p { font-size: 11px !important; }
}

@media (max-width: 350px) {
  .credit-page { padding-inline: 10px !important; }
  .credit-page-head h2 { font-size: 23px !important; }
  .credit-stat-card strong { font-size: 19px !important; }
  .credit-account > div:nth-child(3) > strong { font-size: 21px !important; }
}

/* =========================================================
   CREDIT FILTER BAR — RESET ALIGNMENT FIX
   Presentation only. Filter/search logic unchanged.
   ========================================================= */
@media (max-width: 760px) {
  .credit-toolbar-card {
    grid-template-columns: minmax(0,.9fr) minmax(0,1.2fr) 44px !important;
    gap: 8px !important;
    align-items: stretch !important;
  }

  .credit-search-box {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
  }

  #creditStatusFilter,
  #creditSort,
  #creditResetFilters {
    grid-row: auto !important;
    min-height: 44px !important;
    height: 44px !important;
    margin: 0 !important;
    border-radius: 14px !important;
  }

  #creditStatusFilter {
    grid-column: 1 !important;
  }

  #creditSort {
    grid-column: 2 !important;
  }

  #creditResetFilters {
    grid-column: 3 !important;
    width: 44px !important;
    min-width: 44px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    border: 1px solid rgba(17,17,17,.06) !important;
    background: #fff !important;
    color: #636366 !important;
    box-shadow: 0 4px 14px rgba(0,0,0,.025) !important;
    font-size: 0 !important;
  }

  #creditResetFilters i {
    margin: 0 !important;
    font-size: 13px !important;
  }
}

@media (max-width: 360px) {
  .credit-toolbar-card {
    grid-template-columns: minmax(0,1fr) 44px !important;
  }

  #creditStatusFilter,
  #creditSort {
    grid-column: 1 !important;
  }

  #creditResetFilters {
    grid-column: 2 !important;
    grid-row: 2 / 4 !important;
    height: auto !important;
    min-height: 96px !important;
  }
}

/* Prevent iOS from zooming Credit Account controls when the keyboard opens. */
@media (max-width: 760px) {
  .credit-page input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  .credit-page select,
  .credit-page textarea,
  .credit-modal input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  .credit-modal select,
  .credit-modal textarea {
    font-size: 16px !important;
  }
}
