.customers-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.customers-page-head h1,
.customers-page-head p {
  margin: 0;
}

.customers-page-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.customer-summary {
  display: flex;
  gap: 8px;
}

.customer-summary-card {
  min-width: 105px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: center;
}

.customer-summary-card small,
.customer-summary-card b {
  display: block;
}

.customer-summary-card small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.customer-summary-card b {
  margin-top: 4px;
  color: var(--brand-dark);
  font-size: 17px;
}

.customer-editor,
.customer-list-card {
  padding: 18px 20px;
}

.customer-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.customer-editor-head h2 {
  margin: 0;
}

.customer-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1.35fr .7fr auto;
  align-items: end;
  gap: 11px;
}

.customer-form p {
  margin: 0;
}

.customer-form textarea {
  min-height: 42px;
  height: 42px;
  resize: vertical;
}

.customer-form-actions {
  display: flex;
  gap: 7px;
  align-items: center;
}

.opening-balance-note {
  display: block;
  margin-top: 4px;
  color: #9b5f16;
  font-size: 9px;
}

.customer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.customer-toolbar input {
  max-width: 440px;
}

.customer-table-wrap {
  overflow-x: auto;
}

.customer-table {
  min-width: 830px;
}

.customer-table th,
.customer-table td {
  padding: 11px 10px;
}

.customer-identity b,
.customer-identity small {
  display: block;
}

.customer-identity small {
  max-width: 260px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.customer-whatsapp-status {
  display: inline-flex;
  margin-top: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
}

.customer-whatsapp-status.ready {
  background: #e5f6ed;
  color: #147346;
}

.customer-whatsapp-status.missing {
  background: #fff0e7;
  color: #a14d1f;
}

.customer-balance.due {
  color: #a53b32;
  font-weight: 850;
}

.customer-balance.clear {
  color: var(--brand);
  font-weight: 850;
}

.customer-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.customer-row-actions .btn {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 9px;
  box-shadow: none;
}

.customer-list-empty {
  padding: 28px !important;
  color: var(--muted);
  text-align: center;
}

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

@media (max-width: 700px) {
  .customers-page-head {
    display: block;
  }

  .customer-summary {
    margin-top: 12px;
  }

  .customer-summary-card {
    flex: 1;
    min-width: 0;
    padding: 9px 6px;
  }

  .customer-summary-card b {
    font-size: 15px;
  }

  .customer-form {
    grid-template-columns: 1fr;
  }

  .customer-form-actions .btn,
  .customer-form-actions button {
    flex: 1;
  }

  .customer-editor,
  .customer-list-card {
    padding: 15px;
  }
}


/* Mobile customers: readable rows with no horizontal table scrolling. */
@media (max-width: 700px) {
  .page-customers .wrap { padding-left: 10px !important; padding-right: 10px !important; }
  .customers-page-head { margin-bottom: 12px; }
  .customers-page-head h1 { font-size: 24px; line-height: 1.15; }
  .customers-page-head p { font-size: 10px; line-height: 1.4; }
  .customer-summary { gap: 6px; margin-top: 9px; }
  .customer-summary-card { padding: 8px 5px; border-radius: 9px; }
  .customer-summary-card small { font-size: 7.5px; }
  .customer-summary-card b { margin-top: 3px; font-size: 14px; }
  .customer-editor,
  .customer-list-card { padding: 12px 10px; margin-bottom: 11px; border-radius: 13px; }
  .customer-editor-head { margin-bottom: 10px; }
  .customer-editor-head h2,
  .customer-toolbar h2 { font-size: 16px; }
  .customer-form { gap: 8px; }
  .customer-form label { margin-bottom: 4px; font-size: 10px; }
  .customer-form input,
  .customer-form textarea { min-height: 40px; height: 40px; padding: 8px 10px; font-size: 13px; border-radius: 8px; }
  .customer-form textarea { min-height: 58px; height: 58px; }
  .customer-form-actions .btn,
  .customer-form-actions button { min-height: 39px; padding: 8px 9px; font-size: 10px; }
  .customer-toolbar { display: grid; grid-template-columns: 1fr; gap: 7px; margin-bottom: 8px; }
  .customer-toolbar input { max-width: none; min-height: 41px; padding: 8px 10px; font-size: 13px; }
  .customer-table-wrap { overflow: visible; }
  .customer-table,
  .customer-table tbody { display: block; width: 100%; min-width: 0; overflow: visible; white-space: normal; }
  .customer-table thead { display: none; }
  .customer-table tbody tr[data-customer-row] {
    display: grid;
    grid-template-columns: 30px minmax(0,1fr) auto;
    grid-template-areas:
      "sno customer balance"
      "sno phone actions";
    align-items: center;
    gap: 5px 9px;
    width: 100%;
    padding: 11px 2px;
    border-bottom: 1px solid #e5ede8;
    background: transparent;
  }
  .customer-table tbody tr[data-customer-row]:last-of-type { border-bottom: 0; }
  .customer-table tbody tr[data-customer-row] > td { display: block; min-width: 0; padding: 0; border: 0; white-space: normal; }
  .customer-sno {
    grid-area: sno;
    align-self: start;
    display: grid !important;
    place-items: center;
    width: 27px;
    height: 27px;
    border-radius: 7px;
    background: #edf5f0;
    color: #557065;
    font-size: 9px;
    font-weight: 750;
  }
  .customer-identity { grid-area: customer; }
  .customer-identity b { font-size: 13px; line-height: 1.3; overflow-wrap: anywhere; }
  .customer-identity small { margin-top: 2px; max-width: 220px; overflow: hidden; font-size: 9px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
  .customer-table tbody tr[data-customer-row] > td:nth-child(3) {
    grid-area: phone;
    color: #697970;
    font-size: 9px;
  }
  .customer-whatsapp-status { display: none; }
  .customer-balance { grid-area: balance; font-size: 12px; text-align: right !important; white-space: nowrap; }
  .customer-table tbody tr[data-customer-row] > td:nth-child(5) { grid-area: actions; justify-self: end; }
  .customer-row-actions { gap: 4px; white-space: normal; }
  .customer-row-actions .btn { min-height: 29px; padding: 6px 7px; font-size: 8.5px; border-radius: 7px; }
  .customer-list-empty { display: block; padding: 18px 6px !important; font-size: 10px; }
}
