/* nesayo-customers-and-udhaar-r1.css
   Loaded after all existing Nesayo/customer styles.
   Phone-first redesign for Customers & Udhaar.
*/

:root {
  --cu-green: #1A6B4C;
  --cu-green-hover: #14563D;
  --cu-green-soft: #EAF4EF;

  --cu-text: #18211D;
  --cu-text-secondary: #56615C;
  --cu-text-muted: #68736E;

  --cu-bg: #F5F7F6;
  --cu-surface: #FFFFFF;
  --cu-border: #D8DEDB;
  --cu-border-strong: #BEC8C3;

  --cu-amber: #8A5200;
  --cu-amber-bg: #FFF6E6;
  --cu-amber-border: #E7C98F;

  --cu-danger: #B42318;
  --cu-danger-bg: #FFF2F0;
  --cu-danger-border: #E9AAA3;

  --cu-focus: #0B6E4F;

  --cu-radius-sm: 8px;
  --cu-radius-md: 10px;
  --cu-radius-lg: 14px;

  --cu-control-h: 46px;
}

/* ---------- page ---------- */

html {
  background: var(--cu-bg);
}

body.customers-workspace {
  margin: 0;
  min-width: 320px;
  background: var(--cu-bg);
  color: var(--cu-text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    "Noto Sans Devanagari",
    Arial,
    sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

/* Defect fix: the body was in this list, so it inherited the
   browser default serif from <html>. Controls inherit the body's font. */
body.customers-workspace button,
body.customers-workspace input,
body.customers-workspace select {
  font-family: inherit;
}

body.customers-workspace .wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  box-sizing: border-box;
  padding:
    max(10px, env(safe-area-inset-top))
    12px
    calc(88px + env(safe-area-inset-bottom));
}

/* ---------- top / title ---------- */

body.customers-workspace .top {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  margin: 0 0 2px;
}

body.customers-workspace .top a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: var(--cu-green);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
  border-radius: var(--cu-radius-sm);
}

body.customers-workspace h1 {
  margin: 4px 0 2px;
  color: var(--cu-text);
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 760;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

body.customers-workspace .sub {
  max-width: 68ch;
  margin: 0 0 12px;
  color: var(--cu-text-secondary);
  font-size: 15px;
  line-height: 1.5;
}

/* ---------- add customer disclosure ---------- */

body.customers-workspace .customer-form {
  position: relative;
  z-index: 12;
  margin: 0 0 8px;
}

body.customers-workspace .customer-form > summary {
  display: inline-flex;
  min-height: 44px;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  gap: 7px;

  padding: 9px 14px;
  border: 1px solid var(--cu-green);
  border-radius: var(--cu-radius-md);

  background: var(--cu-surface);
  color: var(--cu-green);

  font-size: 15px;
  font-weight: 740;
  line-height: 1.25;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

body.customers-workspace .customer-form > summary::-webkit-details-marker {
  display: none;
}

body.customers-workspace .customer-form > summary::before {
  content: "+";
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
}

body.customers-workspace .customer-form[open] > summary {
  border-color: var(--cu-border);
  background: var(--cu-surface);
  color: var(--cu-text-secondary);
}

body.customers-workspace .customer-form[open] > summary::before {
  content: "−";
}

/* ---------- add/edit form ---------- */

body.customers-workspace #formCard {
  position: relative;
  display: flex;
  flex-direction: column;

  max-height: calc(100dvh - 68px);
  overflow-y: auto;
  overscroll-behavior: contain;

  box-sizing: border-box;
  margin: 8px 0 0;
  padding: 14px;

  border: 1px solid var(--cu-border);
  border-radius: var(--cu-radius-lg);

  background: var(--cu-surface);
  box-shadow: none;
}

body.customers-workspace #formCard h3,
body.customers-workspace #formTitle {
  margin: 0 0 2px;
  color: var(--cu-text);
  font-size: 18px;
  font-weight: 760;
  line-height: 1.3;
}

body.customers-workspace #formCard > .meta {
  margin: 0 0 4px;
  color: var(--cu-text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

/* ---------- labels ---------- */

body.customers-workspace label {
  display: block;
  margin: 11px 0 5px;
  color: #38423D;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

/* ---------- inputs ---------- */

body.customers-workspace input,
body.customers-workspace select {
  min-height: var(--cu-control-h);
  box-sizing: border-box;

  padding: 10px 12px;

  border: 1px solid var(--cu-border-strong);
  border-radius: var(--cu-radius-sm);

  background: var(--cu-surface);
  color: var(--cu-text);

  font-size: 16px;
  line-height: 1.35;
}

body.customers-workspace input::placeholder {
  color: #78827D;
  opacity: 1;
}

body.customers-workspace input:hover,
body.customers-workspace select:hover {
  border-color: #9EAAA4;
}

body.customers-workspace input:focus,
body.customers-workspace select:focus {
  outline: none;
  border-color: var(--cu-green);
}

body.customers-workspace input:focus-visible,
body.customers-workspace select:focus-visible,
body.customers-workspace button:focus-visible,
body.customers-workspace a:focus-visible,
body.customers-workspace summary:focus-visible {
  outline: 3px solid rgba(26, 107, 76, 0.28);
  outline-offset: 2px;
}

/* Expected field widths rather than full desktop-width fields */

body.customers-workspace #cName,
body.customers-workspace #cAddress {
  width: 100%;
}

body.customers-workspace #cPhone {
  width: min(100%, 18ch);
}

body.customers-workspace #cGst {
  width: min(100%, 22ch);
  text-transform: uppercase;
}

body.customers-workspace #cEmail {
  width: min(100%, 34ch);
}

/* ---------- helper / form errors ---------- */

body.customers-workspace .hint {
  margin: 5px 0 0;
  color: var(--cu-text-muted);
  font-size: 12px;
  line-height: 1.5;
}

body.customers-workspace .err,
body.customers-workspace .row-error {
  box-sizing: border-box;

  margin: 10px 0 0;
  padding: 9px 10px;

  border-left: 4px solid var(--cu-danger);
  border-radius: 0 var(--cu-radius-sm) var(--cu-radius-sm) 0;

  background: var(--cu-danger-bg);
  color: var(--cu-danger);

  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
}

body.customers-workspace .err:empty,
body.customers-workspace .row-error:empty {
  display: none !important;
}

/* ---------- optional business disclosure ---------- */

body.customers-workspace .business-details {
  margin: 12px 0 2px;
  border-top: 1px solid var(--cu-border);
  padding-top: 4px;
}

body.customers-workspace .business-details > summary {
  display: flex;
  min-height: 44px;
  align-items: center;

  color: var(--cu-green);

  font-size: 14px;
  font-weight: 720;
  line-height: 1.35;
  cursor: pointer;

  list-style: none;
}

body.customers-workspace .business-details > summary::-webkit-details-marker {
  display: none;
}

body.customers-workspace .business-details > summary::after {
  content: "›";
  margin-left: 7px;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  transform: rotate(90deg);
  transform-origin: center;
}

body.customers-workspace .business-details[open] > summary::after {
  transform: rotate(-90deg);
}

/* ---------- buttons ---------- */

body.customers-workspace .btn {
  display: inline-flex;
  min-height: 44px;
  box-sizing: border-box;

  align-items: center;
  justify-content: center;

  padding: 9px 14px;

  border: 1px solid var(--cu-border-strong);
  border-radius: var(--cu-radius-sm);

  background: var(--cu-surface);
  color: var(--cu-text);

  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;

  cursor: pointer;
  text-decoration: none;
}

body.customers-workspace .btn:hover {
  border-color: #97A49D;
  background: #F8FAF9;
}

body.customers-workspace .btn-primary {
  border-color: var(--cu-green);
  background: var(--cu-green);
  color: #FFFFFF;
}

body.customers-workspace .btn-primary:hover {
  border-color: var(--cu-green-hover);
  background: var(--cu-green-hover);
}

body.customers-workspace .btn:disabled,
body.customers-workspace .btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.52;
}

/* Save / cancel must remain available when Android keyboard is open */

body.customers-workspace #formCard > .row {
  position: sticky;
  bottom: -14px;
  z-index: 5;

  display: flex;
  gap: 8px;

  margin: 14px -14px -14px;
  padding: 10px 14px
    calc(10px + env(safe-area-inset-bottom));

  border-top: 1px solid var(--cu-border);
  background: rgba(255, 255, 255, 0.98);
}

body.customers-workspace #formCard > .row #saveBtn {
  flex: 1 1 auto;
}

body.customers-workspace #formCard > .row #cancelBtn {
  flex: 0 0 auto;
}

/* ---------- primary search ---------- */

body.customers-workspace .wrap > label[for="q"] {
  margin-top: 9px;
}

body.customers-workspace #q.search {
  width: 100%;
  min-height: 48px;
  margin: 0 0 7px;

  padding-left: 13px;

  border: 1.5px solid var(--cu-border-strong);
  border-radius: var(--cu-radius-md);

  background: var(--cu-surface);

  font-size: 16px;
  font-weight: 500;
}

body.customers-workspace #q.search:focus {
  border-color: var(--cu-green);
}

body.customers-workspace .count {
  margin: 0 0 8px;
  color: var(--cu-text-muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
}

/* ---------- customer / udhaar list ---------- */

body.customers-workspace #list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

body.customers-workspace #list > .card {
  position: relative;
  box-sizing: border-box;

  margin: 0;
  padding: 12px;

  border: 1px solid var(--cu-border);
  border-radius: var(--cu-radius-md);

  background: var(--cu-surface);
}

body.customers-workspace #list > .card:hover {
  border-color: var(--cu-border-strong);
}

body.customers-workspace #list > .card h3 {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;

  margin: 0 0 3px;

  color: var(--cu-text);
  font-size: 16px;
  font-weight: 760;
  line-height: 1.4;
}

body.customers-workspace #list > .card h3 > :first-child {
  min-width: 0;
}

body.customers-workspace #list .meta {
  min-width: 0;
  margin: 0;

  color: var(--cu-text-secondary);
  font-size: 14px;
  line-height: 1.5;

  overflow-wrap: anywhere;
}

body.customers-workspace .dues {
  flex: 0 0 auto;

  color: var(--cu-amber);

  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;

  white-space: nowrap;
  text-align: right;

  font-variant-numeric: tabular-nums lining-nums;
}

body.customers-workspace #list > .card .row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;

  margin: 9px 0 0;
}

body.customers-workspace #list > .card .row .btn {
  min-height: 44px;
  padding-inline: 12px;
  font-size: 14px;
}

/* Money-related action inside a due row should remain visually secondary
   until the user explicitly enters the payment flow. */

body.customers-workspace #list > .card:has(.dues) {
  border-left: 3px solid var(--cu-amber-border);
}

body.customers-workspace #list > .card:has(.dues) .dues {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--cu-amber-bg);
}

/* ---------- empty state ---------- */

body.customers-workspace .empty,
body.customers-workspace .ns-empty {
  box-sizing: border-box;

  padding: 24px 16px;

  border: 1px dashed var(--cu-border-strong);
  border-radius: var(--cu-radius-md);

  background: var(--cu-surface);
  color: var(--cu-text-secondary);

  font-size: 15px;
  line-height: 1.55;
  text-align: center;
}

/* ---------- toast: retained for existing non-validation messages ---------- */

body.customers-workspace .toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 80;

  width: max-content;
  max-width: calc(100vw - 28px);
  box-sizing: border-box;

  transform: translateX(-50%);

  padding: 11px 14px;

  border-radius: var(--cu-radius-md);

  background: #202824;
  color: #FFFFFF;

  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

/* ---------- payment dialog ---------- */

body.customers-workspace .payment-dialog {
  width: min(calc(100vw - 24px), 520px);
  max-height: min(86dvh, 680px);
  box-sizing: border-box;

  margin: auto;
  padding: 0;

  overflow: auto;

  border: 1px solid var(--cu-border);
  border-radius: 16px;

  background: var(--cu-surface);
  color: var(--cu-text);
}

body.customers-workspace .payment-dialog::backdrop {
  background: rgba(18, 28, 23, 0.48);
}

body.customers-workspace .payment-dialog > h2 {
  position: sticky;
  top: 0;
  z-index: 4;

  margin: 0;
  padding: 16px 16px 12px;

  border-bottom: 1px solid var(--cu-border);

  background: var(--cu-surface);
  color: var(--cu-text);

  font-size: 20px;
  font-weight: 780;
  line-height: 1.3;
}

body.customers-workspace #paymentChoices,
body.customers-workspace #paymentFields,
body.customers-workspace #paymentReview,
body.customers-workspace #paymentError {
  margin-inline: 16px;
}

body.customers-workspace #paymentChoices {
  margin-top: 14px;
}

body.customers-workspace #paymentFields {
  margin-top: 12px;
}

body.customers-workspace #paymentBill {
  margin: 0 0 4px;
  color: var(--cu-text);
  font-size: 16px;
  font-weight: 760;
  line-height: 1.4;
}

body.customers-workspace #paymentFields p {
  margin: 0 0 10px;
  color: var(--cu-text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

body.customers-workspace #paymentAmount,
body.customers-workspace #paymentMode {
  width: 100%;
}

body.customers-workspace #paymentAmount {
  font-variant-numeric: tabular-nums lining-nums;
}

body.customers-workspace .payment-review {
  margin-top: 14px;
  padding: 12px;

  border: 1px solid var(--cu-border);
  border-radius: var(--cu-radius-md);

  background: #F8FAF9;

  color: var(--cu-text);
  font-size: 14px;
  line-height: 1.5;
}

body.customers-workspace .payment-review:empty {
  display: none;
}

body.customers-workspace .dialog-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;

  display: flex;
  flex-wrap: wrap;
  gap: 8px;

  margin-top: 16px;
  padding: 12px 16px
    calc(12px + env(safe-area-inset-bottom));

  border-top: 1px solid var(--cu-border);

  background: rgba(255, 255, 255, 0.98);
}

/* Review is step one and should occupy the main action position. */

body.customers-workspace #paymentReviewButton {
  flex: 1 1 180px;
}

/* Confirm is intentionally not given a different alarming colour.
   It remains Nesayo green, because receiving money is not destructive.
   Separation comes from state/order, not red styling. */

body.customers-workspace #paymentConfirm {
  flex: 1 1 180px;
}

/* ---------- keyboard-open / search-focused phone mode ---------- */

@media (max-width: 699px) {
  body.customers-workspace .wrap {
    padding-top: 8px;
  }

  /*
    When the primary search receives focus, reclaim vertical space.
    The result rows and customer balances remain fully present.
  */
  body.customers-workspace:has(#q:focus) .top,
  body.customers-workspace:has(#q:focus) h1,
  body.customers-workspace:has(#q:focus) .sub,
  body.customers-workspace:has(#q:focus) .count,
  body.customers-workspace:has(#q:focus) .wrap > label[for="q"] {
    display: none;
  }

  body.customers-workspace:has(#q:focus) .customer-form:not([open]) {
    position: sticky;
    top: 0;
    z-index: 20;

    margin: -8px -12px 0;
    padding: 6px 12px;

    border-bottom: 1px solid var(--cu-border);
    background: var(--cu-bg);
  }

  body.customers-workspace:has(#q:focus)
    .customer-form:not([open])
    > summary {
    min-height: 44px;
  }

  body.customers-workspace:has(#q:focus) #q.search {
    position: sticky;
    top: 57px;
    z-index: 19;

    margin: 0 -1px 7px;
    width: calc(100% + 2px);

    background: var(--cu-surface);
  }

  body.customers-workspace:has(#q:focus) #list {
    padding-top: 1px;
  }

  body.customers-workspace #formCard {
    max-height: calc(100dvh - 58px);
  }

  body.customers-workspace .dialog-actions .btn {
    flex: 1 1 100%;
    width: 100%;
  }

  body.customers-workspace #list > .card h3 {
    align-items: flex-start;
  }
}

/* ---------- narrow 360 px tuning ---------- */

@media (max-width: 374px) {
  body.customers-workspace .wrap {
    padding-inline: 10px;
  }

  body.customers-workspace #list > .card {
    padding: 10px;
  }

  body.customers-workspace #list > .card h3 {
    gap: 7px;
  }

  body.customers-workspace .dues {
    font-size: 15px;
    padding-inline: 6px;
  }

  body.customers-workspace #list > .card .row {
    gap: 5px;
  }

  body.customers-workspace #list > .card .row .btn {
    flex: 1 1 auto;
  }
}

/* ---------- desktop ---------- */

@media (min-width: 700px) {
  body.customers-workspace .wrap {
    padding: 20px 24px 56px;
  }

  body.customers-workspace h1 {
    font-size: 28px;
  }

  body.customers-workspace .sub {
    margin-bottom: 14px;
  }

  /*
    Add customer sits at the right side of the introductory area
    without becoming the visual headline.
  */
  body.customers-workspace .customer-form:not([open]) {
    display: flex;
    justify-content: flex-end;
    margin-top: -54px;
    margin-bottom: 14px;
  }

  body.customers-workspace .customer-form[open] {
    margin: 0 0 16px;
  }

  body.customers-workspace #formCard {
    display: grid;
    grid-template-columns:
      minmax(260px, 1.55fr)
      minmax(180px, 0.75fr)
      minmax(260px, 1.35fr);
    column-gap: 16px;
    align-items: start;

    max-height: none;
    overflow: visible;

    padding: 18px;
  }

  body.customers-workspace #formTitle,
  body.customers-workspace #formCard > .meta,
  body.customers-workspace #formCard > .err,
  body.customers-workspace #formCard > .business-details,
  body.customers-workspace #formCard > .row,
  body.customers-workspace #formCard > input[type="hidden"] {
    grid-column: 1 / -1;
  }

  body.customers-workspace #formCard > label:has(+ #cName),
  body.customers-workspace #cName {
    grid-column: 1;
  }

  body.customers-workspace #formCard > label:has(+ #cPhone),
  body.customers-workspace #cPhone {
    grid-column: 2;
  }

  body.customers-workspace #formCard > label:has(+ #cAddress),
  body.customers-workspace #cAddress {
    grid-column: 3;
  }

  body.customers-workspace #cPhone {
    width: 100%;
  }

  body.customers-workspace #formCard > .row {
    position: static;

    justify-content: flex-end;

    margin: 16px 0 0;
    padding: 14px 0 0;

    border-top: 1px solid var(--cu-border);
    background: transparent;
  }

  body.customers-workspace #formCard > .row #saveBtn {
    flex: 0 0 auto;
    min-width: 146px;
  }

  body.customers-workspace .business-details {
    margin-top: 16px;
  }

  body.customers-workspace .business-details[open] {
    display: grid;
    grid-template-columns: minmax(200px, 260px) minmax(260px, 360px);
    column-gap: 16px;
  }

  body.customers-workspace .business-details > summary {
    grid-column: 1 / -1;
  }

  body.customers-workspace #cGst {
    width: 22ch;
  }

  body.customers-workspace #cEmail {
    width: 34ch;
  }

  body.customers-workspace .wrap > label[for="q"] {
    margin-top: 8px;
  }

  body.customers-workspace #q.search {
    width: min(100%, 520px);
  }

  body.customers-workspace .count {
    margin-bottom: 10px;
  }

  /*
    Desktop cards behave as dense ledger rows.
    Existing dynamic markup is preserved; no checkbox/bulk-selection column.
  */
  body.customers-workspace #list {
    gap: 0;

    border: 1px solid var(--cu-border);
    border-radius: var(--cu-radius-lg);

    overflow: hidden;

    background: var(--cu-surface);
  }

  body.customers-workspace #list > .card {
    display: grid;
    grid-template-columns:
      minmax(220px, 1.25fr)
      minmax(280px, 1.7fr)
      minmax(190px, auto);
    grid-template-areas:
      "identity meta actions";

    align-items: center;
    gap: 12px;

    min-height: 66px;

    padding: 10px 14px;

    border: 0;
    border-bottom: 1px solid var(--cu-border);
    border-radius: 0;
  }

  body.customers-workspace #list > .card:last-child {
    border-bottom: 0;
  }

  body.customers-workspace #list > .card:has(.dues) {
    border-left: 3px solid var(--cu-amber-border);
  }

  body.customers-workspace #list > .card h3 {
    grid-area: identity;
    margin: 0;
  }

  body.customers-workspace #list > .card .meta {
    grid-area: meta;
    font-size: 13px;
  }

  body.customers-workspace #list > .card > .row {
    grid-area: actions;

    justify-content: flex-end;
    align-items: center;

    margin: 0;
  }

  body.customers-workspace #list > .card .row .btn {
    min-width: 92px;
  }

  body.customers-workspace .dues {
    margin-left: auto;
    font-size: 15px;
  }

  body.customers-workspace .payment-dialog {
    width: 520px;
  }
}

/* ---------- large desktop breathing room ---------- */

@media (min-width: 1100px) {
  body.customers-workspace .wrap {
    padding-inline: 28px;
  }

  body.customers-workspace #list > .card {
    grid-template-columns:
      minmax(250px, 1.25fr)
      minmax(320px, 1.7fr)
      minmax(220px, auto);
    padding-inline: 16px;
  }
}

/* ---------- Devanagari / multilingual safety ---------- */

body.customers-workspace :lang(hi),
body.customers-workspace [lang="hi"] {
  line-height: 1.55;
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  body.customers-workspace *,
  body.customers-workspace *::before,
  body.customers-workspace *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Defect fix (2026-10-09): a bounded, self-scrolling #formCard made
   the card the sticky row's scroller; the card starts below the page title,
   so its bottom — and Save — sat under the Android keyboard. Let the card
   grow with the page: the Save row then sticks to the bottom of the visible
   viewport while any part of the form is on screen. */
body.customers-workspace #formCard {
  max-height: none !important;
  overflow: visible !important;
}
body.customers-workspace #formCard > .row {
  bottom: 0;
  margin-bottom: -14px;
}

/* Defect fix (2026-10-09): on desktop the closed form kept its full-
   width box and a -54px margin pulled it over the page subtitle. It now sits
   right-aligned under the subtitle; the summary's own "+" icon is the only one. */
@media (min-width: 700px) {
  body.customers-workspace .customer-form:not([open]) {
    margin-top: 0;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }
}

/* Defect fix (2026-10-09): a customer card can carry TWO action rows
   (Receive payment, then Edit); both were placed in the one "actions" cell,
   so Edit covered Receive payment. Give each its own column on one line;
   Edit is always the last column, so it lines up down the ledger. */
@media (min-width: 700px) {
  body.customers-workspace #list > .card {
    grid-template-columns: minmax(240px, 1.3fr) minmax(180px, 1.6fr) auto 92px;
    grid-template-areas: none;
  }
  body.customers-workspace #list > .card > h3 { grid-column: 1; grid-row: 1; }
  body.customers-workspace #list > .card > .meta { grid-column: 2; grid-row: auto; }
  body.customers-workspace #list > .card > .meta:first-of-type { grid-row: 1; }
  body.customers-workspace #list > .card > h3 { grid-row: 1 / span 2; align-self: center; }
  body.customers-workspace #list > .card > .row { grid-row: 1 / span 2; align-self: center; }
  body.customers-workspace #list > .card > .row { grid-area: auto; grid-row: 1; justify-content: flex-end; }
  body.customers-workspace #list > .card > .row:not(:last-of-type) { grid-column: 3; }
  body.customers-workspace #list > .card > .row:last-of-type { grid-column: 4; }
}

/* Design review r1 */
/* Append only. Scope every override to Customers; preserve existing IDs,
   actions, disclosure state, and the measured sticky Save implementation. */

body.customers-workspace {
  --cu-muted-aa: #606E66;
  line-height: 1.55;
}

/* Author display rules must never expose controls hidden by application state. */
body.customers-workspace [hidden] {
  display: none !important;
}

body.customers-workspace .wrap,
body.customers-workspace #list,
body.customers-workspace #list > .card,
body.customers-workspace #formCard,
body.customers-workspace .payment-dialog {
  min-width: 0;
}

body.customers-workspace .top a {
  min-width: 44px;
  padding-inline: 6px;
}

body.customers-workspace h1 {
  margin-block: 3px 10px;
  font-size: clamp(22px, 5.5vw, 28px);
  line-height: 1.5;
  letter-spacing: -0.015em;
}

/* The repeated introductory sentence is not operational data. */
body.customers-workspace .sub {
  display: none;
}

body.customers-workspace .customer-form {
  margin-bottom: 12px;
}

body.customers-workspace .customer-form > summary {
  max-width: 100%;
  min-height: 44px;
  white-space: normal;
  text-align: left;
  line-height: 1.5;
}

body.customers-workspace #formCard > .meta {
  font-size: 15px;
  line-height: 1.55;
}

body.customers-workspace label,
body.customers-workspace .business-details > summary {
  line-height: 1.55;
}

body.customers-workspace .business-details > summary {
  font-size: 15px;
}

body.customers-workspace input::placeholder {
  color: var(--cu-muted-aa);
}

body.customers-workspace input:focus-visible,
body.customers-workspace select:focus-visible,
body.customers-workspace button:focus-visible,
body.customers-workspace a:focus-visible,
body.customers-workspace summary:focus-visible,
body.customers-workspace #list :focus-visible {
  outline: 3px solid #14563D;
  outline-offset: 2px;
}

body.customers-workspace input[aria-invalid="true"],
body.customers-workspace select[aria-invalid="true"] {
  border-color: var(--cu-danger);
  box-shadow: inset 3px 0 0 var(--cu-danger);
}

body.customers-workspace .hint,
body.customers-workspace .err,
body.customers-workspace .row-error {
  font-size: 15px;
  line-height: 1.55;
}

body.customers-workspace #cPhone {
  width: min(100%, 16ch);
}

body.customers-workspace #cGst {
  width: min(100%, calc(15ch + 26px));
}

body.customers-workspace #cName,
body.customers-workspace #cAddress,
body.customers-workspace #cEmail,
body.customers-workspace #cGst,
body.customers-workspace #cPhone {
  max-width: 100%;
}

/* Keep the earlier page-scrolling form and its sticky Save/Cancel row.
   Do not create an overflow ancestor or change position: sticky. */
body.customers-workspace #formCard > .row {
  isolation: isolate;
  align-items: stretch;
}

body.customers-workspace #formCard > .row .btn {
  min-width: 0;
  min-height: 44px;
  white-space: normal;
  line-height: 1.5;
}

body.customers-workspace #q.search {
  min-width: 0;
  margin-bottom: 8px;
}

body.customers-workspace .count {
  margin-block: 0 10px;
  color: #384940;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  font-variant-numeric: tabular-nums lining-nums;
}

/* Quiet, continuous ledger instead of eight unrelated card panels. */
body.customers-workspace #list {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: visible;
  border: 1px solid var(--cu-border);
  border-radius: var(--cu-radius-md);
  background: var(--cu-surface);
}

body.customers-workspace #list > .card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 8px;
  row-gap: 3px;
  align-items: start;
  padding: 12px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--cu-border);
  border-radius: 0;
  background: var(--cu-surface);
}

body.customers-workspace #list > .card:first-child {
  border-radius: var(--cu-radius-md) var(--cu-radius-md) 0 0;
}

body.customers-workspace #list > .card:last-child {
  border-bottom: 0;
  border-radius: 0 0 var(--cu-radius-md) var(--cu-radius-md);
}

body.customers-workspace #list > .card:only-child {
  border-radius: var(--cu-radius-md);
}

body.customers-workspace #list > .card:hover {
  background: #FAFCFB;
}

body.customers-workspace #list > .card:focus-within {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--cu-green);
  outline-offset: -2px;
}

body.customers-workspace #list > .card:has(.dues) {
  border-left: 0;
}

body.customers-workspace #list > .card > h3,
body.customers-workspace #list > .card > .meta {
  grid-area: auto;
  grid-column: 1 / -1;
  grid-row: auto;
  min-width: 0;
}

body.customers-workspace #list > .card > h3 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  min-width: 0;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.5;
}

/* Works when the renderer wraps the name as the first h3 child.
   Unwrapped text nodes need the renderer fix described below. */
body.customers-workspace #list > .card > h3 > :first-child:not(.dues) {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.customers-workspace #list > .card .dues,
body.customers-workspace #list > .card:has(.dues) .dues {
  flex: 0 0 auto;
  max-width: 66%;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--cu-text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.5;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums lining-nums;
}

body.customers-workspace #list > .card .meta {
  margin: 0;
  color: var(--cu-muted-aa);
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

/* The legacy opening-balance action is still functional. Do not remove it
   with CSS: that would make one kind of balance uncollectable. */
body.customers-workspace #list > .card .meta .btn,
body.customers-workspace #list > .card .meta button {
  display: flex;
  width: max-content;
  max-width: 100%;
  min-height: 44px;
  margin: 5px 0 2px;
  padding: 9px 12px;
  border: 1px solid var(--cu-border-strong);
  border-radius: var(--cu-radius-sm);
  background: var(--cu-surface);
  color: var(--cu-green);
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
  white-space: normal;
  overflow-wrap: break-word;
}

body.customers-workspace #list > .card > .row {
  grid-area: auto;
  grid-column: 1 / -1;
  grid-row: auto;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  margin: 7px 0 0;
}

/* Only adjacent action rows share a line; don't visually move an action
   across intervening metadata or alter DOM/tab order. */
body.customers-workspace #list > .card:has(> .row + .row) > .row:has(+ .row) {
  grid-column: 1;
}

body.customers-workspace #list > .card:has(> .row + .row) > .row + .row {
  grid-column: 2;
}

body.customers-workspace #list > .card .row .btn,
body.customers-workspace #list > .card button {
  min-width: 0;
  min-height: 44px;
  max-width: 100%;
  font-size: 15px;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: break-word;
}

body.customers-workspace #list > .card .row .btn-primary {
  border-color: var(--cu-green);
  background: var(--cu-surface);
  color: var(--cu-green);
}

body.customers-workspace #list > .card .row .btn-primary:hover {
  background: var(--cu-green-soft);
  border-color: var(--cu-green-hover);
}

body.customers-workspace #list > .card .row .btn:not(.btn-primary) {
  border-color: var(--cu-border);
  background: transparent;
  color: #334A3D;
}

body.customers-workspace #list > .card .row .btn:not(.btn-primary):hover {
  background: #F1F4F2;
}

body.customers-workspace #list > .empty,
body.customers-workspace #list > .ns-empty {
  border: 0;
  border-radius: var(--cu-radius-md);
  font-size: 15px;
}

body.customers-workspace .toast,
body.customers-workspace #paymentFields p,
body.customers-workspace .payment-review {
  font-size: 15px;
  line-height: 1.55;
}

/* No clipped footer, hidden choice, or behind-keyboard confirmation. */
body.customers-workspace .payment-dialog {
  width: min(calc(100vw - 20px), 520px);
  max-width: calc(100vw - 20px);
  max-height: min(680px, calc(100dvh - 16px));
  overscroll-behavior: contain;
}

body.customers-workspace .payment-dialog > h2 {
  line-height: 1.5;
}

body.customers-workspace #paymentChoices button,
body.customers-workspace #paymentChoices label {
  min-height: 44px;
}

body.customers-workspace #paymentChoices label {
  display: flex;
  align-items: center;
  line-height: 1.5;
}

body.customers-workspace input[type="checkbox"],
body.customers-workspace input[type="radio"] {
  width: 20px;
  height: 20px;
  min-height: 0;
  padding: 0;
  accent-color: var(--cu-green);
}

body.customers-workspace .dialog-actions {
  align-items: stretch;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--cu-surface);
}

body.customers-workspace .dialog-actions .btn {
  min-width: 0;
  min-height: 44px;
  line-height: 1.5;
  white-space: normal;
}

body.customers-workspace #paymentReviewButton,
body.customers-workspace #paymentConfirm {
  flex: 1 1 180px;
}

/* Undo focus-triggered hiding and layout jumps. Keep search sticky only as
   the user scrolls; never remove the back link, title, count, or Add control. */
@media (max-width: 699px) {
  body.customers-workspace:has(#q:focus) .top {
    display: flex;
  }

  body.customers-workspace:has(#q:focus) h1,
  body.customers-workspace:has(#q:focus) .count,
  body.customers-workspace:has(#q:focus) .wrap > label[for="q"] {
    display: block;
  }

  body.customers-workspace:has(#q:focus) .sub {
    display: none;
  }

  body.customers-workspace:has(#q:focus) .customer-form:not([open]) {
    position: relative;
    top: auto;
    z-index: 12;
    margin: 0 0 12px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  body.customers-workspace:has(#q:focus) #q.search {
    position: sticky;
    top: max(0px, env(safe-area-inset-top));
    z-index: 19;
    width: 100%;
    margin: 0 0 8px;
    background: var(--cu-surface);
  }

  body.customers-workspace #list > .card > .row:has(.btn-primary) .btn-primary {
    flex: 1 1 auto;
  }

  body.customers-workspace .dialog-actions .btn {
    flex: 1 1 100%;
  }

  body.customers-workspace #paymentChoices,
  body.customers-workspace #paymentFields,
  body.customers-workspace #paymentReview,
  body.customers-workspace #paymentError {
    margin-inline: 12px;
  }

  body.customers-workspace .payment-dialog > h2 {
    padding-inline: 12px;
  }

  body.customers-workspace .dialog-actions {
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 374px) {
  body.customers-workspace #list > .card {
    padding: 11px 9px;
  }

  body.customers-workspace #list > .card > h3 {
    gap: 6px;
  }
}

@media (min-width: 700px) {
  /* Two-column form from 700px: three minimum-sized fields previously
     created horizontal scroll on small laptops / landscape tablets. */
  body.customers-workspace #formCard {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 16px;
  }

  /* Align labels over inputs; auto-placing individual grid children
     previously staggered the three fields down separate rows. */
  body.customers-workspace #formCard > label:has(+ #cName),
  body.customers-workspace #formCard > label:has(+ #cPhone) {
    grid-row: 3;
  }

  body.customers-workspace #formCard > #cName,
  body.customers-workspace #formCard > #cPhone {
    grid-row: 4;
  }

  body.customers-workspace #formCard > label:has(+ #cAddress) {
    grid-column: 1 / -1;
    grid-row: 5;
  }

  body.customers-workspace #formCard > #cAddress {
    grid-column: 1 / -1;
    grid-row: 6;
  }

  body.customers-workspace #formCard > #cAddress {
    width: min(100%, 64ch);
  }

  body.customers-workspace #formCard > #cPhone {
    width: min(100%, 16ch);
  }

  /* Details has an anonymous native content wrapper in Chromium/WebKit;
     setting grid on details itself does not make its fields grid items.
     A straightforward vertical GOV.UK-style group is reliable everywhere. */
  body.customers-workspace .business-details[open] {
    display: block;
  }

  /* Reset inherited large-screen grid placement until enough width exists. */
  body.customers-workspace #list > .card {
    grid-template-areas: none;
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 3px;
    min-height: 0;
  }

  body.customers-workspace #list > .card > h3,
  body.customers-workspace #list > .card > .meta {
    grid-area: auto;
    grid-column: 1 / -1;
    grid-row: auto;
  }

  body.customers-workspace #list > .card > .meta:first-of-type {
    grid-area: auto;
    grid-column: 1 / -1;
    grid-row: auto;
  }

  body.customers-workspace #list > .card > .row:not(:last-of-type),
  body.customers-workspace #list > .card > .row:last-of-type {
    grid-area: auto;
    grid-column: 1 / -1;
    grid-row: auto;
    justify-content: flex-start;
    margin: 7px 0 0;
  }

  body.customers-workspace #list > .card:has(> .row + .row) > .row:has(+ .row) {
    grid-column: 1;
  }

  body.customers-workspace #list > .card:has(> .row + .row) > .row + .row {
    grid-column: 2;
  }
}

@media (min-width: 1024px) {
  body.customers-workspace #formCard {
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.7fr) minmax(0, 1.35fr);
  }

  body.customers-workspace #formCard > label:has(+ #cAddress) {
    grid-column: 3;
    grid-row: 3;
  }

  body.customers-workspace #formCard > #cAddress {
    grid-column: 3;
    grid-row: 4;
  }

  body.customers-workspace #formCard > #cAddress {
    width: 100%;
  }

  /* Deliberately keep two action slots and two metadata lines separate:
     this preserves the engineer's overlapping-row correction. */
  body.customers-workspace #list > .card {
    grid-template-columns:
      minmax(0, 1.15fr)
      minmax(0, 1.2fr)
      minmax(210px, 0.95fr)
      minmax(82px, auto);
    column-gap: 12px;
    row-gap: 3px;
    align-items: center;
    min-height: 70px;
    padding: 10px 14px;
  }

  body.customers-workspace #list > .card > h3 {
    grid-area: auto;
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
  }

  body.customers-workspace #list > .card > .meta {
    grid-area: auto;
    grid-column: 2;
    grid-row: auto;
    align-self: center;
  }

  body.customers-workspace #list > .card > .meta:first-of-type {
    grid-column: 2;
    grid-row: 1;
  }

  body.customers-workspace #list > .card > .row {
    grid-area: auto;
    grid-column: 3 / 5;
    grid-row: 1 / span 2;
    align-self: center;
    justify-content: flex-end;
    margin: 0;
  }

  body.customers-workspace #list > .card:not(:has(> .row ~ .row)) > .row {
    grid-column: 3 / 5;
    grid-row: 1 / span 2;
  }

  body.customers-workspace #list > .card:has(> .row ~ .row) > .row:not(:last-of-type) {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  body.customers-workspace #list > .card:has(> .row ~ .row) > .row:last-of-type {
    grid-column: 4;
    grid-row: 1 / span 2;
  }

  body.customers-workspace #list > .card .row .btn-primary {
    width: 100%;
  }

  body.customers-workspace #list > .card .row .btn:not(.btn-primary) {
    width: auto;
    min-width: 82px;
  }
}

/* Keep Devanagari readable even in compact labels, buttons and row titles. */
body.customers-workspace :lang(hi),
body.customers-workspace :lang(mr) {
  line-height: 1.6;
}

@media (prefers-reduced-motion: reduce) {
  body.customers-workspace *,
  body.customers-workspace *::before,
  body.customers-workspace *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Design review r2 */
/* Append after r1. Preserve the measured page-scrolling form, its sticky
   Save/Cancel row, both ledger action rows and the dialog's sticky footer. */

/* Names are accounting identifiers: never abbreviate two customers into
   the same ellipsis. Keep amounts aligned but allow a separate flex line. */
body.customers-workspace #list > .card > h3 {
  flex-wrap: wrap;
  row-gap: 2px;
  overflow-wrap: anywhere;
}

body.customers-workspace #list > .card > h3 > :first-child:not(.dues) {
  flex: 1 1 140px;
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

body.customers-workspace #list > .card .dues,
body.customers-workspace #list > .card:has(.dues) .dues {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

body.customers-workspace #list > .card .meta,
body.customers-workspace .count,
body.customers-workspace #paymentChoices,
body.customers-workspace #paymentBill,
body.customers-workspace #paymentFields,
body.customers-workspace #paymentReview {
  font-variant-numeric: tabular-nums lining-nums;
}

body.customers-workspace .count {
  font-weight: 600;
}

/* Faster add/edit scanning without reducing field or button targets. */
body.customers-workspace #formCard > label,
body.customers-workspace #businessDetails > label {
  margin-top: 8px;
  margin-bottom: 4px;
}

body.customers-workspace #formCard > label:has(+ input:focus-visible),
body.customers-workspace #businessDetails > label:has(+ input:focus-visible) {
  color: var(--cu-green-hover);
}

body.customers-workspace #formCard input:not([type="hidden"]),
body.customers-workspace #formCard .err {
  scroll-margin-block-start: 12px;
  scroll-margin-block-end: 108px;
}

/* A temporary message must not obscure the form's pinned Save control. */
body.customers-workspace .toast {
  text-align: center;
  overflow-wrap: anywhere;
}

body.customers-workspace:has(#customerForm[open]) .toast {
  bottom: calc(110px + env(safe-area-inset-bottom));
}

/* Make invoice versus opening-balance choice legible and persistent when
   the renderer exposes aria-pressed on its existing selection buttons. */
body.customers-workspace #paymentChoices {
  min-width: 0;
  font-size: 15px;
  line-height: 1.55;
}

body.customers-workspace #paymentChoices > * {
  min-width: 0;
}

body.customers-workspace #paymentChoices > * + * {
  margin-block-start: 8px;
}

body.customers-workspace #paymentChoices button {
  box-sizing: border-box;
  min-height: 44px;
  max-width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--cu-border-strong);
  border-radius: var(--cu-radius-sm);
  background: var(--cu-surface);
  color: var(--cu-green);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

body.customers-workspace #paymentChoices button:hover {
  border-color: var(--cu-green);
  background: #F6FAF8;
}

body.customers-workspace #paymentChoices button[aria-pressed="true"] {
  border-color: var(--cu-green);
  background: var(--cu-green-soft);
  color: var(--cu-text);
}

/* Support accessible radio/checkbox choices if the renderer uses labels. */
body.customers-workspace #paymentChoices label:has(input[type="radio"], input[type="checkbox"]) {
  box-sizing: border-box;
  min-height: 44px;
  margin: 0;
  padding: 8px 10px;
  gap: 8px;
  border: 1px solid var(--cu-border);
  border-radius: var(--cu-radius-sm);
  cursor: pointer;
}

body.customers-workspace #paymentChoices label:has(input:checked) {
  border-color: var(--cu-green);
  background: var(--cu-green-soft);
}

body.customers-workspace #paymentChoices label:focus-within {
  outline: 3px solid var(--cu-green-hover);
  outline-offset: 2px;
}

/* The selected target and entered money are the decision-critical fields. */
body.customers-workspace #paymentFields {
  min-width: 0;
  padding-top: 12px;
  border-top: 1px solid var(--cu-border);
}

body.customers-workspace #paymentBill {
  overflow-wrap: anywhere;
}

body.customers-workspace #paymentAmount {
  font-size: 20px;
  font-weight: 750;
  line-height: 1.3;
  text-align: right;
  scroll-margin-block-end: 92px;
}

body.customers-workspace #paymentReview {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Keep the actual Review/Confirm button next to Cancel when possible. All
   controls stay in DOM order; hidden/disabled states are renderer-owned. */
body.customers-workspace .payment-dialog .dialog-actions {
  flex-wrap: wrap;
  gap: 8px;
}

body.customers-workspace .payment-dialog .dialog-actions > .btn {
  width: auto;
  min-width: 0;
}

body.customers-workspace .payment-dialog .dialog-actions > #paymentReviewButton,
body.customers-workspace .payment-dialog .dialog-actions > #paymentConfirm {
  flex: 1 1 160px;
}

body.customers-workspace .payment-dialog .dialog-actions > .btn:not(#paymentReviewButton):not(#paymentConfirm) {
  flex: 0 1 auto;
  min-width: 78px;
  max-width: 45%;
}

/* Compact the chrome, not the ledger or the counter controls. */
@media (max-width: 699px) {
  body.customers-workspace .wrap {
    padding-top: max(8px, env(safe-area-inset-top));
  }

  body.customers-workspace .top {
    margin-bottom: 0;
  }

  body.customers-workspace h1 {
    margin: 1px 0 6px;
    line-height: 1.3;
  }

  body.customers-workspace .customer-form {
    margin-bottom: 8px;
  }

  body.customers-workspace .wrap > label[for="q"] {
    margin-top: 5px;
    margin-bottom: 4px;
  }

  body.customers-workspace .count {
    margin-bottom: 8px;
  }
}

/* Header title and Add share one desktop row without reordering the DOM.
   The open form spans full width below them. */
@media (min-width: 700px) {
  body.customers-workspace .wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    column-gap: 16px;
    align-items: start;
  }

  body.customers-workspace .wrap > .top {
    grid-column: 1 / -1;
  }

  body.customers-workspace .wrap > h1 {
    grid-column: 1;
    grid-row: 2;
    align-self: center;
    margin: 0 0 10px;
    line-height: 1.28;
  }

  body.customers-workspace .wrap > .customer-form:not([open]) {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    align-self: center;
    max-width: min(44vw, 260px);
    margin: 0 0 10px;
  }

  body.customers-workspace .customer-form > summary {
    overflow-wrap: anywhere;
  }

  body.customers-workspace .wrap > .customer-form[open] {
    grid-column: 1 / -1;
    grid-row: 3;
    margin: 0 0 12px;
  }

  body.customers-workspace .wrap > label[for="q"],
  body.customers-workspace .wrap > #q.search,
  body.customers-workspace .wrap > .count,
  body.customers-workspace .wrap > #list {
    grid-column: 1 / -1;
  }

  body.customers-workspace .wrap > label[for="q"] {
    margin-top: 4px;
  }
}

@media (min-width: 1600px) {
  body.customers-workspace .wrap {
    max-width: 1280px;
  }
}
/* End design review r2 */

/* Review C1 */

/* The disclosure owns no second surface; summary and form own theirs. */
body.customers-workspace .customer-form {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

/* Preserve room for names, real contact details and opening-due facts. */
body.customers-workspace #list > .card > .meta {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Long identities scroll with the dialog instead of consuming its viewport. */
body.customers-workspace .payment-dialog > h2 {
  position: static;
}

/* A review is a readable, focusable destination. */
body.customers-workspace #paymentReview {
  scroll-margin-block: 12px;
  font-size: 15px;
  line-height: 1.55;
}

body.customers-workspace #paymentReview:focus {
  outline: 3px solid var(--cu-green-hover);
  outline-offset: 2px;
}

body.customers-workspace #paymentReview h3 {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.5;
}

body.customers-workspace #paymentReview dl {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}

body.customers-workspace #paymentReview dt,
body.customers-workspace #paymentReview dd {
  min-width: 0;
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

body.customers-workspace #paymentReview dd {
  text-align: right;
  font-variant-numeric: tabular-nums lining-nums;
}

body.customers-workspace #paymentReview .payment-review-identity {
  text-align: left;
  font-weight: 700;
}

body.customers-workspace #paymentReview p {
  margin: 12px 0 0;
}

/* Preserve the measured sticky footer and application-owned hidden states. */
body.customers-workspace .payment-dialog .dialog-actions {
  position: sticky;
  bottom: 0;
  background: var(--cu-surface);
}

body.customers-workspace #paymentChoices table {
  width: 100%;
  table-layout: fixed;
}

body.customers-workspace #paymentChoices th,
body.customers-workspace #paymentChoices td {
  vertical-align: top;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.55;
}

body.customers-workspace #paymentChoices th:nth-child(2),
body.customers-workspace #paymentChoices td:nth-child(2) {
  text-align: right;
  font-variant-numeric: tabular-nums lining-nums;
}

@media (max-width: 699px) {
  /* Match the unfocused margin: focusing search must not move the list. */
  body.customers-workspace:has(#q:focus)
    .customer-form:not([open]) {
    margin-bottom: 8px;
  }

  body.customers-workspace #paymentChoices th,
  body.customers-workspace #paymentChoices td {
    padding: 8px 4px;
  }

  body.customers-workspace #paymentChoices th:nth-child(1) {
    width: 34%;
  }

  body.customers-workspace #paymentChoices th:nth-child(2) {
    width: 28%;
  }

  body.customers-workspace #paymentChoices th:nth-child(3) {
    width: 38%;
  }

  body.customers-workspace #paymentChoices button {
    width: 100%;
    padding-inline: 6px;
  }
}

@media (min-width: 700px) {
  body.customers-workspace .wrap > .customer-form:not([open]) {
    max-width: min(48vw, 340px);
  }
}

/* End review C1 */
