/* Extracted record/filter layer from styles.css. Keep this file loaded after styles.css and before styles-mobile.css. */

/* Shared record filtering surface. Keep this reusable for Store Database tables. */
.record-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) repeat(4, minmax(132px, .72fr)) minmax(260px, .95fr) auto;
  gap: 10px;
  align-items: end;
  margin: 10px 0 12px;
  padding: 10px;
  border: 1px solid #eadbdd;
  border-radius: 18px;
  background: rgba(255, 250, 247, .82);
}
.record-filter-bar .field {
  margin: 0;
  min-width: 0;
}
.record-filter-branch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: end;
  min-width: 0;
}
.record-branch-staff-scope {
  min-height: 44px;
  min-width: 78px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.record-branch-staff-scope.is-active {
  border-color: var(--brand);
  background: var(--soft-accent-bg);
  color: var(--brand);
}
.record-branch-staff-scope:disabled {
  opacity: .5;
}
.record-filter-search {
  min-width: 220px;
}
.record-filter-bar input,
.record-filter-bar select {
  min-height: 44px;
  border-radius: 14px;
  font-size: 14px;
}
.record-filter-bar .date-range-control {
  min-width: 0;
}
.record-filter-bar .range-trigger {
  min-height: 44px;
  border-radius: 14px;
}
.record-filter-bar .range-picker-label b {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.record-filter-reset {
  min-width: 46px;
  min-height: 44px;
  padding-inline: 12px;
  border-radius: 14px;
}
.mobile-preview-settings {
  max-width: 620px;
}

/* Admin desktop phone preview. This mirrors the small-screen layout without changing role/data state. */
body.mobile-preview-mode {
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(255,250,246,.95), rgba(244,234,231,.92) 44%, #efe5e2 100%);
}
body.mobile-preview-mode #app {
  width: min(430px, 100vw);
  min-height: 100vh;
  margin: 0 auto;
  border-inline: 1px solid rgba(213,188,176,.88);
  background: #fffaf7;
  box-shadow: 0 18px 54px rgba(57,34,25,.22);
  overflow: hidden;
}
body.mobile-preview-mode .app-shell {
  display: block;
  min-height: 100vh;
}
body.mobile-preview-mode .sidebar {
  display: none;
}
body.mobile-preview-mode .main {
  padding: 10px 10px calc(112px + env(safe-area-inset-bottom));
}
body.mobile-preview-mode .topbar {
  position: sticky;
  top: 0;
  z-index: 35;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: -10px -10px 10px;
  padding: calc(9px + env(safe-area-inset-top)) 10px 9px;
  border-bottom: 1px solid rgba(234,219,221,.92);
  background: rgba(248,241,239,.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 22px rgba(78,37,48,.06);
}
body.mobile-preview-mode .topbar-title h1 {
  font-size: 22px;
  line-height: 1.05;
}
body.mobile-preview-mode .topbar-actions {
  width: 100%;
  grid-template-columns: minmax(0, 1fr) 48px 72px;
  gap: 6px;
  justify-content: stretch;
  align-items: stretch;
}
body.mobile-preview-mode .topbar-actions .admin-switcher {
  grid-column: 1 / -1;
}
body.mobile-preview-mode .topbar-actions .lang-icon {
  width: 48px;
  min-height: 42px;
}
body.mobile-preview-mode .topbar-actions .btn.danger {
  min-height: 42px;
  padding-inline: 10px;
  font-size: 13px;
}
body.mobile-preview-mode .record-step-card,
body.mobile-preview-mode .card,
body.mobile-preview-mode .task-card {
  border-radius: 18px;
}
body.mobile-preview-mode .record-filter-bar {
  grid-template-columns: 1fr;
}
body.mobile-preview-mode .mobile-bottom-nav {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 45;
  display: grid;
  width: min(410px, calc(100vw - 18px));
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(213,188,176,.92);
  border-radius: 20px;
  background: rgba(255,250,246,.96);
  box-shadow: 0 16px 42px rgba(57,34,25,.22);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}
body.mobile-preview-mode .mobile-tab-btn {
  min-width: 0;
  min-height: 50px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: #8a716b;
  display: grid;
  place-items: center;
  gap: 1px;
  padding: 4px 2px;
  font-size: 10px;
  font-weight: 900;
}
body.mobile-preview-mode .mobile-tab-btn span {
  font-size: 19px;
  line-height: 1;
}
body.mobile-preview-mode .mobile-tab-btn b {
  font-size: 10.5px;
  line-height: 1;
}
body.mobile-preview-mode .mobile-tab-btn.active {
  background: #8f4850;
  color: #fff;
  box-shadow: 0 9px 18px rgba(143,72,80,.22);
}
body.mobile-preview-mode .record-form-body,
body.mobile-preview-mode .record-step-card,
body.mobile-preview-mode .customer-payment-details-panel,
body.mobile-preview-mode .customer-payment-row-card,
body.mobile-preview-mode .customer-payment-linked-so {
  min-width: 0;
}
body.mobile-preview-mode .basic-entry-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  overflow: visible;
  padding: 10px;
}
body.mobile-preview-mode .basic-info-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
body.mobile-preview-mode .basic-entry-grid .field {
  min-width: 0;
}
body.mobile-preview-mode .basic-info-grid .field {
  min-width: 0;
  margin: 0;
}
body.mobile-preview-mode .basic-entry-grid input,
body.mobile-preview-mode .basic-entry-grid select,
body.mobile-preview-mode .basic-info-grid input,
body.mobile-preview-mode .basic-info-grid select {
  width: 100%;
  min-width: 0;
  padding: 10px 8px;
  font-size: 14px;
}
body.mobile-preview-mode .customer-payment-details-head {
  grid-template-columns: 1fr;
  gap: 8px;
}
body.mobile-preview-mode .customer-payment-reset {
  grid-column: 1 / -1;
  justify-self: stretch;
  width: 100%;
  min-height: 42px;
  border-radius: 14px;
}
body.mobile-preview-mode .customer-payment-compact-invoice {
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
}
body.mobile-preview-mode .customer-payment-primary-grid,
body.mobile-preview-mode .customer-payment-extra-row,
body.mobile-preview-mode .customer-payment-row-card,
body.mobile-preview-mode .customer-payment-row-card-fields,
body.mobile-preview-mode .customer-payment-card-grid,
body.mobile-preview-mode .customer-payment-linked-so,
body.mobile-preview-mode .customer-payment-linked-summary-stack,
body.mobile-preview-mode .customer-payment-linked-stats {
  grid-template-columns: 1fr;
}
body.mobile-preview-mode .customer-payment-row-title,
body.mobile-preview-mode .customer-payment-style-stack,
body.mobile-preview-mode .customer-payment-other-style-field,
body.mobile-preview-mode .customer-payment-type-field,
body.mobile-preview-mode .customer-payment-deposit-field,
body.mobile-preview-mode .customer-payment-full-field,
body.mobile-preview-mode .customer-payment-primary-grid.is-deposit #depositAmountField,
body.mobile-preview-mode .customer-payment-primary-grid.is-deposit #fullAmountField {
  grid-column: 1;
  grid-row: auto;
}
body.mobile-preview-mode .customer-payment-row-title {
  padding-top: 0;
}
body.mobile-preview-mode .customer-payment-primary-grid select,
body.mobile-preview-mode .customer-payment-primary-grid input,
body.mobile-preview-mode .customer-payment-row-card select,
body.mobile-preview-mode .customer-payment-row-card input,
body.mobile-preview-mode .customer-payment-row-card-fields select,
body.mobile-preview-mode .customer-payment-row-card-fields input,
body.mobile-preview-mode .customer-payment-style-stack select,
body.mobile-preview-mode .customer-payment-style-stack input,
body.mobile-preview-mode .customer-payment-other-style-field input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  height: 46px;
}
body.mobile-preview-mode .customer-payment-amount-field .amount-digit-row {
  grid-template-columns: repeat(5, minmax(0, 1fr)) 5px repeat(2, minmax(0, 1fr));
  min-width: 0;
  min-height: 42px;
  gap: 3px;
  padding: 3px;
}
body.mobile-preview-mode .customer-payment-amount-field .amount-lock-window,
body.mobile-preview-mode .customer-payment-amount-field .amount-lock-window .amount-digit,
body.mobile-preview-mode .customer-payment-amount-field .amount-lock-window .amount-cent-digit {
  min-height: 32px !important;
}
body.mobile-preview-mode .customer-payment-amount-field .amount-lock-window .amount-digit,
body.mobile-preview-mode .customer-payment-amount-field .amount-lock-window .amount-cent-digit {
  font-size: 17px;
}
body.mobile-preview-mode .customer-payment-linked-so .readonly-field,
body.mobile-preview-mode .customer-payment-linked-so .invoice-number-control,
body.mobile-preview-mode .customer-payment-linked-so .invoice-digit-row,
body.mobile-preview-mode .customer-payment-compact-invoice .invoice-digit-row {
  min-height: 44px;
  height: 44px;
}
body.mobile-preview-mode .customer-payment-compact-invoice .invoice-lock-window,
body.mobile-preview-mode .customer-payment-compact-invoice .invoice-lock-window .invoice-digit,
body.mobile-preview-mode .customer-payment-linked-so .invoice-lock-window,
body.mobile-preview-mode .customer-payment-linked-so .invoice-lock-window .invoice-digit {
  min-height: 34px !important;
}

@media (max-width: 900px) {
  .module-switch-row {
    grid-template-columns: 1fr;
  }
  .module-switch-control {
    justify-items: start;
  }
  .function-role-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .record-filter-bar {
    grid-template-columns: 1fr 1fr;
  }
  .record-filter-search,
  .record-filter-bar .date-range-control {
    grid-column: 1 / -1;
  }
  .record-filter-reset {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .module-switch-group-head,
  .module-switch-title b {
    align-items: flex-start;
  }
  .function-role-grid {
    grid-template-columns: 1fr;
  }
  .record-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .record-filter-search,
  .record-filter-bar .date-range-control {
    grid-column: 1 / -1;
  }
}

/* P1 source-of-truth layout: Customer Payment create/edit must share the same field rhythm. */
#editRecordForm .customer-payment-details-panel,
#editRecordForm .customer-payment-rows,
#editRecordForm .customer-payment-linked-so,
#editRecordForm .customer-payment-linked-summary-stack,
#editRecordForm [data-edit-customer-payment-row].customer-payment-row-card {
  max-width: 100%;
  min-width: 0;
  overflow: visible;
}

#editRecordForm [data-edit-customer-payment-row].customer-payment-row-card {
  grid-template-columns: 82px minmax(220px, .85fr) minmax(220px, .85fr) minmax(260px, 1fr) minmax(260px, 1fr) !important;
  align-items: end;
}

#editRecordForm [data-edit-customer-payment-row] .customer-payment-row-title {
  grid-column: 1 !important;
  grid-row: 1 !important;
  align-self: center;
  padding-top: 20px;
}

#editRecordForm [data-edit-customer-payment-row] .customer-payment-style-stack {
  grid-column: 3 !important;
  grid-row: 1 !important;
}

#editRecordForm [data-edit-customer-payment-row] .customer-payment-type-field {
  grid-column: 2 !important;
  grid-row: 1 !important;
}

#editRecordForm [data-edit-customer-payment-row] .customer-payment-deposit-field {
  grid-column: 4 !important;
  grid-row: 1 !important;
}

#editRecordForm [data-edit-customer-payment-row] .customer-payment-full-field {
  grid-column: 4 / -1 !important;
  grid-row: 1 !important;
}

#editRecordForm [data-edit-customer-payment-row].is-deposit .customer-payment-full-field {
  grid-column: 5 !important;
  grid-row: 1 !important;
}

#editRecordForm [data-edit-customer-payment-row] .customer-payment-other-style-field {
  grid-column: 3 !important;
  grid-row: 2 !important;
}

#editRecordForm [data-edit-customer-payment-row] .customer-payment-row-card-fields {
  grid-column: 2 / -1 !important;
  grid-row: 2 !important;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) !important;
}

#editRecordForm [data-edit-customer-payment-row] .customer-payment-row-card-fields [data-edit-row-other-bank-field] {
  grid-column: 1 / -1;
}

#editRecordForm .customer-payment-amount-field,
#editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field {
  min-width: 0;
  max-width: none;
}

#editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-digit-row {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  grid-template-columns: repeat(5, minmax(22px, 1fr)) 6px repeat(2, minmax(22px, 1fr)) !important;
  gap: 4px;
  overflow: hidden;
}

#editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-lock-window,
#editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-lock-window .amount-digit,
#editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-lock-window .amount-cent-digit {
  min-width: 0;
  width: 100%;
}

#editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-lock-window .amount-digit,
#editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-lock-window .amount-cent-digit {
  font-size: clamp(15px, 1.12vw, 19px) !important;
}

#editRecordForm #editLinkedSOField.customer-payment-linked-so {
  grid-template-columns: 120px minmax(220px, 320px) minmax(260px, 1fr) !important;
}

/* Final launch guardrail: desktop task boards must be exactly 3 cards per row. */
#taskResults .task-board.task-summary-grid {
  width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  justify-content: stretch !important;
  justify-items: stretch !important;
  align-items: start;
}

#taskResults .task-board.task-summary-grid > .task-summary-card {
  width: 100%;
  max-width: none;
}

body.mobile-preview-mode #taskResults .task-board.task-summary-grid,
body.mobile-preview-mode .task-board.task-summary-grid {
  grid-template-columns: 1fr !important;
}

@media (max-width: 1240px) {
  #editRecordForm [data-edit-customer-payment-row].customer-payment-row-card {
    grid-template-columns: 76px repeat(2, minmax(0, 1fr)) !important;
  }
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-row-title {
    grid-column: 1 !important;
    grid-row: 1 !important;
  }
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-style-stack {
    grid-column: 3 !important;
    grid-row: 1 !important;
  }
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-type-field {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-deposit-field {
    grid-column: 2 !important;
    grid-row: 2 !important;
  }
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-full-field {
    grid-column: 2 / -1 !important;
    grid-row: 2 !important;
  }
  #editRecordForm [data-edit-customer-payment-row].is-deposit .customer-payment-full-field {
    grid-column: 3 !important;
    grid-row: 2 !important;
  }
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-other-style-field {
    grid-column: 2 / -1 !important;
    grid-row: 3 !important;
  }
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-row-card-fields {
    grid-column: 2 / -1 !important;
    grid-row: 3 !important;
  }
}

@media (max-width: 820px) {
  #editRecordForm [data-edit-customer-payment-row].customer-payment-row-card,
  #editRecordForm #editLinkedSOField.customer-payment-linked-so {
    grid-template-columns: 1fr !important;
  }
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-row-title,
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-style-stack,
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-other-style-field,
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-type-field,
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-deposit-field,
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-full-field,
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-row-card-fields {
    grid-column: auto !important;
    grid-row: auto !important;
  }
}

body.mobile-preview-mode #editRecordForm [data-edit-customer-payment-row].customer-payment-row-card,
body.mobile-preview-mode #editRecordForm #editLinkedSOField.customer-payment-linked-so {
  grid-template-columns: 1fr !important;
}

body.mobile-preview-mode #editRecordForm [data-edit-customer-payment-row] .customer-payment-row-title,
body.mobile-preview-mode #editRecordForm [data-edit-customer-payment-row] .customer-payment-style-stack,
body.mobile-preview-mode #editRecordForm [data-edit-customer-payment-row] .customer-payment-type-field,
body.mobile-preview-mode #editRecordForm [data-edit-customer-payment-row] .customer-payment-deposit-field,
body.mobile-preview-mode #editRecordForm [data-edit-customer-payment-row] .customer-payment-full-field,
body.mobile-preview-mode #editRecordForm [data-edit-customer-payment-row] .customer-payment-row-card-fields {
  grid-column: auto !important;
  grid-row: auto !important;
}

body.mobile-preview-mode .modal-backdrop {
  place-items: start center;
  padding: 8px;
}

body.mobile-preview-mode .modal-card:has(#editRecordForm) {
  width: min(430px, calc(100vw - 18px)) !important;
  max-width: min(430px, calc(100vw - 18px)) !important;
  max-height: calc(100dvh - 16px);
  border-radius: 20px;
  padding: 12px;
}

body.mobile-preview-mode .function-status-row,
body.mobile-preview-mode .module-switch-row,
body.mobile-preview-mode .function-role-grid {
  grid-template-columns: 1fr !important;
}

body.mobile-preview-mode .module-switch-control {
  justify-items: start;
}

body.mobile-preview-mode .function-role-grid {
  width: 100%;
}

/* P1 source-of-truth: filter bars and dropdown pickers reuse this rhythm. */
.cs-filter-bar,
.audit-filter-bar,
.record-filter-bar,
.task-filters {
  overflow: visible;
}

.cs-filter-bar {
  grid-template-columns: minmax(230px, 1.12fr) repeat(5, minmax(132px, .5fr)) minmax(220px, .76fr) 48px !important;
  gap: 10px;
  align-items: end;
}

.audit-filter-bar {
  grid-template-columns: minmax(260px, 1.25fr) repeat(3, minmax(170px, .62fr)) auto !important;
  gap: 10px;
  align-items: end;
}

.task-filters {
  grid-template-columns: minmax(230px, 1.18fr) minmax(210px, .7fr) minmax(145px, .52fr) minmax(145px, .52fr) minmax(160px, .58fr) minmax(220px, .78fr) !important;
  gap: 10px;
  align-items: stretch;
}

.task-filter-branch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  min-width: 0;
}

.task-filter-branch select {
  min-width: 0;
}

.task-branch-staff-scope,
.cs-branch-staff-scope {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffaf7;
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  padding: 0 10px;
  cursor: pointer;
  white-space: nowrap;
}

.task-branch-staff-scope.is-active,
.cs-branch-staff-scope.is-active {
  border-color: #9f5365;
  background: #f4dfe4;
  color: #8f4850;
}

.task-branch-staff-scope:disabled,
.cs-branch-staff-scope:disabled {
  opacity: .48;
  cursor: not-allowed;
}

.cs-branch-staff-scope {
  width: 100%;
  margin-bottom: 6px;
}

.task-filters .date-range-control,
.task-filters .range-trigger,
.task-filters .range-summary {
  min-width: 0;
  max-width: 100%;
}

.task-filters .range-boundary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-multi-filter {
  position: relative;
  min-width: 0;
  overflow: visible;
}

.cs-multi-filter > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  width: 100%;
  padding: 0 14px;
}

.cs-multi-filter > summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-multi-filter > div.cs-multi-panel {
  left: 0;
  right: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  width: min(360px, calc(100vw - 48px)) !important;
  min-width: min(300px, calc(100vw - 48px)) !important;
  max-width: min(420px, calc(100vw - 48px)) !important;
  padding: 10px;
}

.cs-multi-filter[data-cs-multi="branch"] > div.cs-multi-panel {
  width: min(300px, calc(100vw - 48px)) !important;
  min-width: min(260px, calc(100vw - 48px)) !important;
}

.cs-multi-filter[data-cs-multi="module"] > div.cs-multi-panel {
  left: auto;
  right: 0;
  width: min(430px, calc(100vw - 48px)) !important;
  min-width: min(340px, calc(100vw - 48px)) !important;
  max-width: min(430px, calc(100vw - 48px)) !important;
}

.cs-multi-filter label {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 36px;
  margin: 0;
  padding: 7px 8px;
}

.cs-multi-filter label input {
  justify-self: center;
  width: 16px;
  height: 16px;
  margin: 0;
}

.cs-multi-filter label span {
  min-width: 0;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  line-height: 1.25;
}

body.mobile-preview-mode .cs-filter-bar,
body.mobile-preview-mode .audit-filter-bar,
body.mobile-preview-mode .record-filter-bar,
body.mobile-preview-mode .task-filters {
  grid-template-columns: 1fr !important;
}

body.mobile-preview-mode .task-filter-branch {
  grid-template-columns: 1fr;
}

body.mobile-preview-mode .task-branch-staff-scope {
  width: 100%;
}

body.mobile-preview-mode .cs-multi-filter > div.cs-multi-panel,
body.mobile-preview-mode .cs-multi-filter[data-cs-multi="branch"] > div.cs-multi-panel,
body.mobile-preview-mode .cs-multi-filter[data-cs-multi="module"] > div.cs-multi-panel {
  left: 0;
  right: auto;
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
}

/* Mobile launch guardrails: Customer Payment amount and linked SO summaries must not overflow. */
body.mobile-preview-mode .customer-payment-amount-field .amount-digit-row,
body.mobile-preview-mode #editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-digit-row {
  grid-template-columns: repeat(5, minmax(18px, 1fr)) 5px repeat(2, minmax(18px, 1fr)) !important;
  gap: 2px;
  padding: 3px;
  min-height: 40px;
  border-radius: 16px;
}

body.mobile-preview-mode .customer-payment-amount-field .amount-lock-window,
body.mobile-preview-mode .customer-payment-amount-field .amount-lock-window .amount-digit,
body.mobile-preview-mode .customer-payment-amount-field .amount-lock-window .amount-cent-digit,
body.mobile-preview-mode #editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-lock-window,
body.mobile-preview-mode #editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-lock-window .amount-digit,
body.mobile-preview-mode #editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-lock-window .amount-cent-digit {
  width: 100%;
  min-width: 0;
  min-height: 30px !important;
}

body.mobile-preview-mode .customer-payment-amount-field .amount-lock-window .amount-digit,
body.mobile-preview-mode .customer-payment-amount-field .amount-lock-window .amount-cent-digit,
body.mobile-preview-mode #editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-lock-window .amount-digit,
body.mobile-preview-mode #editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-lock-window .amount-cent-digit {
  height: 30px;
  line-height: 30px;
  font-size: clamp(14px, 4vw, 17px) !important;
}

body.mobile-preview-mode .customer-payment-linked-summary {
  padding: 8px;
}

body.mobile-preview-mode .customer-payment-linked-stats {
  grid-template-columns: 1fr;
  gap: 5px;
}

body.mobile-preview-mode .customer-payment-linked-summary ul {
  display: grid;
  gap: 6px;
  max-height: min(260px, 48vh);
  margin: 8px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

body.mobile-preview-mode .customer-payment-linked-summary li {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 7px;
  border: 1px solid #f0dedb;
  border-radius: 10px;
  background: #fff;
}

body.mobile-preview-mode .modal-card:has(#editRecordForm) .customer-payment-row-card {
  padding: 8px;
  gap: 8px;
}

body.mobile-preview-mode .modal-card:has(#editRecordForm) .customer-payment-row-card-fields {
  padding: 8px;
}

body.mobile-preview-mode .cs-heatmap-title {
  display: grid;
  grid-template-columns: 1fr !important;
  gap: 10px;
  padding: 10px;
}

body.mobile-preview-mode .cs-heatmap-count {
  display: inline-flex;
  width: fit-content;
  min-width: 0;
  max-width: 100%;
  gap: 6px;
  align-items: baseline;
  text-align: left;
  justify-items: start;
}

body.mobile-preview-mode .cs-heatmap-count span {
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal;
}

body.mobile-preview-mode .cs-heatmap-title h3 {
  font-size: clamp(19px, 5.6vw, 24px);
  line-height: 1.12;
}

body.mobile-preview-mode .cs-heatmap {
  grid-template-columns: 1fr !important;
}

body.mobile-preview-mode .cs-heatmap > .empty {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  padding: 18px 12px;
  text-align: center;
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal;
  line-height: 1.35;
}

body.mobile-preview-mode .cs-amount-stats {
  grid-template-columns: 1fr !important;
}

body.mobile-preview-mode .cs-date-lane,
body.mobile-preview-mode .cs-document-panel,
body.mobile-preview-mode .cs-compact-row {
  min-width: 0;
}

body.mobile-preview-mode .cs-document-summary,
body.mobile-preview-mode .cs-mini-details {
  grid-template-columns: 1fr !important;
}

body.mobile-preview-mode .cs-timeline-item {
  grid-template-columns: 1fr !important;
}

body.mobile-preview-mode .record-list-card,
body.mobile-preview-mode .deleted-records-card {
  overflow: visible;
}

body.mobile-preview-mode .record-list-card > summary,
body.mobile-preview-mode .deleted-records-card > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

body.mobile-preview-mode .record-list-card .compact-table,
body.mobile-preview-mode .deleted-records-card .compact-table {
  border: 0;
  background: transparent;
  overflow: visible;
}

body.mobile-preview-mode .record-list-card .compact-table table,
body.mobile-preview-mode .record-list-card .compact-table thead,
body.mobile-preview-mode .record-list-card .compact-table tbody,
body.mobile-preview-mode .record-list-card .compact-table tr,
body.mobile-preview-mode .record-list-card .compact-table td,
body.mobile-preview-mode .deleted-records-card .compact-table table,
body.mobile-preview-mode .deleted-records-card .compact-table thead,
body.mobile-preview-mode .deleted-records-card .compact-table tbody,
body.mobile-preview-mode .deleted-records-card .compact-table tr,
body.mobile-preview-mode .deleted-records-card .compact-table td {
  display: block;
  width: 100%;
  min-width: 0 !important;
  box-sizing: border-box;
}

body.mobile-preview-mode .record-list-card .compact-table thead,
body.mobile-preview-mode .deleted-records-card .compact-table thead {
  display: none;
}

body.mobile-preview-mode .record-list-card .compact-table tbody,
body.mobile-preview-mode .deleted-records-card .compact-table tbody {
  display: grid;
  gap: 10px;
}

body.mobile-preview-mode .record-list-card .summary-row,
body.mobile-preview-mode .deleted-records-card .summary-row {
  position: relative;
  display: grid;
  gap: 7px;
  padding: 12px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(78,37,48,.055);
}

body.mobile-preview-mode .record-list-card .summary-row td,
body.mobile-preview-mode .deleted-records-card .summary-row td {
  display: grid;
  grid-template-columns: minmax(94px, .42fr) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 0;
  border: 0;
  font-size: 14px;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

body.mobile-preview-mode .record-list-card .summary-row td::before,
body.mobile-preview-mode .deleted-records-card .summary-row td::before {
  content: attr(data-cell);
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  line-height: 1.2;
  text-transform: none;
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
}

body.mobile-preview-mode .record-list-card .summary-row td > *,
body.mobile-preview-mode .deleted-records-card .summary-row td > * {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

body.mobile-preview-mode .record-list-card .summary-row .select-col,
body.mobile-preview-mode .deleted-records-card .summary-row .select-col {
  position: absolute;
  top: 10px;
  right: 10px;
  width: auto !important;
  padding: 0;
}

body.mobile-preview-mode .record-list-card .summary-row .select-col::before,
body.mobile-preview-mode .deleted-records-card .summary-row .select-col::before {
  display: none;
}

body.mobile-preview-mode .record-list-card .summary-row .select-col + td,
body.mobile-preview-mode .deleted-records-card .summary-row .select-col + td {
  padding-right: 42px;
}

body.mobile-preview-mode .record-list-card .record-action-cell,
body.mobile-preview-mode .deleted-records-card .record-action-cell {
  grid-template-columns: 1fr;
}

body.mobile-preview-mode .record-list-card .record-action-cell .btn,
body.mobile-preview-mode .deleted-records-card .record-action-cell .btn {
  width: 100%;
  margin: 0 0 6px;
}

body.mobile-preview-mode .record-list-card .details-row,
body.mobile-preview-mode .deleted-records-card .details-row {
  display: block;
}

body.mobile-preview-mode .record-list-card .details-row.hidden,
body.mobile-preview-mode .deleted-records-card .details-row.hidden {
  display: none !important;
}

body.mobile-preview-mode .record-list-card .details-row td,
body.mobile-preview-mode .deleted-records-card .details-row td {
  display: block;
  padding: 0;
  border: 0;
}

body.mobile-preview-mode .record-list-card .details-row td::before,
body.mobile-preview-mode .deleted-records-card .details-row td::before {
  display: none;
}

body.mobile-preview-mode .modal-card #editRecordForm [data-edit-customer-payment-row] .customer-payment-row-card-fields,
body.mobile-preview-mode .modal-card #editRecordForm .customer-payment-row-card-fields,
body.mobile-preview-mode .customer-payment-row-card .customer-payment-row-card-fields {
  grid-template-columns: 1fr !important;
  align-items: stretch;
}

body.mobile-preview-mode .modal-card #editRecordForm [data-edit-customer-payment-row] .customer-payment-row-card-fields .field,
body.mobile-preview-mode .modal-card #editRecordForm .customer-payment-row-card-fields .field,
body.mobile-preview-mode .customer-payment-row-card .customer-payment-row-card-fields .field {
  min-width: 0;
  width: 100%;
}

@media (max-width: 760px) {
  .customer-payment-amount-field .amount-digit-row,
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-digit-row {
    grid-template-columns: repeat(5, minmax(18px, 1fr)) 5px repeat(2, minmax(18px, 1fr)) !important;
    gap: 2px;
    padding: 3px;
    min-height: 40px;
    border-radius: 16px;
  }
  .customer-payment-amount-field .amount-lock-window,
  .customer-payment-amount-field .amount-lock-window .amount-digit,
  .customer-payment-amount-field .amount-lock-window .amount-cent-digit,
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-lock-window,
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-lock-window .amount-digit,
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-lock-window .amount-cent-digit {
    width: 100%;
    min-width: 0;
    min-height: 30px !important;
  }
  .customer-payment-amount-field .amount-lock-window .amount-digit,
  .customer-payment-amount-field .amount-lock-window .amount-cent-digit,
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-lock-window .amount-digit,
  #editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-lock-window .amount-cent-digit {
    height: 30px;
    line-height: 30px;
    font-size: clamp(14px, 4vw, 17px) !important;
  }
  .customer-payment-linked-summary {
    padding: 8px;
  }
  .customer-payment-linked-stats {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .customer-payment-linked-summary ul {
    display: grid;
    gap: 6px;
    max-height: min(260px, 48vh);
    margin: 8px 0 0;
    padding: 0;
    overflow: auto;
    list-style: none;
  }
  .customer-payment-linked-summary li {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 7px;
    border: 1px solid #f0dedb;
    border-radius: 10px;
    background: #fff;
  }
  .modal-card:has(#editRecordForm) .customer-payment-row-card {
    padding: 8px;
    gap: 8px;
  }
  .modal-card:has(#editRecordForm) .customer-payment-row-card-fields {
    padding: 8px;
  }
  .modal-card #editRecordForm [data-edit-customer-payment-row] .customer-payment-row-card-fields,
  .modal-card #editRecordForm .customer-payment-row-card-fields,
  .customer-payment-row-card .customer-payment-row-card-fields {
    grid-template-columns: 1fr !important;
    align-items: stretch;
  }
  .modal-card #editRecordForm [data-edit-customer-payment-row] .customer-payment-row-card-fields .field,
  .modal-card #editRecordForm .customer-payment-row-card-fields .field,
  .customer-payment-row-card .customer-payment-row-card-fields .field {
    min-width: 0;
    width: 100%;
  }
  .cs-heatmap-title {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 10px;
    padding: 10px;
  }
  .cs-heatmap-count {
    display: inline-flex;
    width: fit-content;
    min-width: 0;
    max-width: 100%;
    gap: 6px;
    align-items: baseline;
    text-align: left;
    justify-items: start;
  }
  .cs-heatmap-count span {
    overflow-wrap: normal;
    word-break: normal;
    white-space: normal;
  }
  .cs-heatmap-title h3 {
    font-size: clamp(19px, 5.6vw, 24px);
    line-height: 1.12;
  }
  .cs-heatmap {
    grid-template-columns: 1fr !important;
  }
  .cs-heatmap > .empty {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    padding: 18px 12px;
    text-align: center;
    overflow-wrap: normal;
    word-break: normal;
    white-space: normal;
    line-height: 1.35;
  }
  .cs-date-lane,
  .cs-document-panel,
  .cs-compact-row {
    min-width: 0;
  }
  .cs-document-summary,
  .cs-mini-details {
    grid-template-columns: 1fr !important;
  }
  .cs-timeline-item {
    grid-template-columns: 1fr !important;
  }
  .record-list-card .summary-row td,
  .deleted-records-card .summary-row td {
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 8px;
    line-height: 1.22;
    overflow-wrap: anywhere;
  }
  .record-list-card .summary-row td::before,
  .deleted-records-card .summary-row td::before,
  .record-list-card .summary-row td > *,
  .deleted-records-card .summary-row td > * {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}
