/* Shared layout base layer.
   Put reusable grid/filter/card/detail rules in the matching manifest layer so
   future modules do not patch one-off mobile overrides into unrelated CSS. */

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.service-charge-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.service-charge-copy small {
  color: var(--muted);
  font-weight: 800;
}

.customer-payment-details-head,
body.mobile-preview-mode .customer-payment-details-head {
  display: grid;
  grid-template-columns: minmax(140px, .8fr) minmax(150px, .8fr) minmax(150px, .8fr) minmax(170px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.customer-payment-details-head .customer-payment-staff-grid,
body.mobile-preview-mode .customer-payment-details-head .customer-payment-staff-grid {
  display: contents;
}

.customer-payment-service-charge-row,
body.mobile-preview-mode .customer-payment-service-charge-row {
  display: grid;
  grid-template-columns: minmax(190px, .35fr) minmax(220px, .65fr);
  align-items: end;
  width: min(620px, 100%);
  max-width: 100%;
  justify-content: stretch;
  gap: 10px;
}

.customer-payment-service-charge-row > summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  place-items: initial;
  width: auto;
  min-width: min(260px, 100%);
  height: auto;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.15;
}

.customer-payment-service-charge-row:not([open]),
body.mobile-preview-mode .customer-payment-service-charge-row:not([open]) {
  width: min(260px, 100%);
  max-width: 100%;
  grid-template-columns: minmax(0, 1fr);
}

body.mobile-preview-mode .customer-payment-service-charge-row > summary {
  width: auto;
  min-width: min(260px, 100%);
}

.service-charge-plus {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #f6e2e9;
  color: var(--brand);
  font-weight: 950;
}

.customer-payment-service-charge-field {
  max-width: 100%;
}

.customer-payment-service-charge-row:not([open]) .customer-payment-service-charge-field {
  display: none;
}

.staff-user-form.staff-user-editor-grid {
  align-items: end;
}

.staff-user-form.staff-user-editor-grid .field {
  min-width: 0;
  margin: 0;
}

.staff-user-form.staff-user-editor-grid .staff-user-save-btn {
  min-height: 48px;
  align-self: end;
}

.staff-branch-field {
  position: relative;
  overflow: visible;
}

.staff-branch-value {
  display: none;
}

.staff-branch-display {
  min-height: 47px;
}

.staff-branch-picker {
  position: relative;
  width: 100%;
}

.staff-branch-picker > summary {
  min-height: 47px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}

.staff-branch-picker > summary::-webkit-details-marker {
  display: none;
}

.staff-branch-picker > summary::after {
  content: "⌄";
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  transition: transform .16s ease;
}

.staff-branch-picker[open] > summary::after {
  transform: rotate(180deg);
}

.staff-branch-picker > summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

.staff-branch-panel {
  position: fixed;
  z-index: 6200;
  top: var(--staff-branch-panel-top, 80px);
  left: var(--staff-branch-panel-left, 12px);
  width: var(--staff-branch-panel-width, min(320px, calc(100vw - 24px)));
  max-height: var(--staff-branch-panel-max-height, min(260px, calc(100vh - 96px)));
  overflow: auto;
  margin: 0;
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-strong);
  box-shadow: 0 18px 42px rgba(78, 37, 48, .14);
  overscroll-behavior: contain;
}

.staff-branch-picker[open] > .staff-branch-panel {
  display: grid;
}

.staff-branch-choice {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffaf8;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.2;
}

.staff-branch-choice input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 0;
}

.staff-branch-choice span {
  min-width: 0;
  overflow-wrap: anywhere;
}

#editUserForm.staff-user-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#editUserForm.staff-user-editor-grid .active-toggle {
  align-self: center;
  margin: 0;
}

#editUserForm.staff-user-editor-grid .modal-actions {
  grid-column: 1 / -1;
}

@media (max-width: 760px) {
  #userForm.staff-user-editor-grid,
  #editUserForm.staff-user-editor-grid {
    grid-template-columns: 1fr;
  }

  .staff-branch-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .staff-user-form.staff-user-editor-grid .staff-user-save-btn,
  #editUserForm.staff-user-editor-grid .active-toggle,
  #editUserForm.staff-user-editor-grid .modal-actions {
    width: 100%;
  }
}

.customer-payment-row-card,
#editRecordForm [data-edit-customer-payment-row].customer-payment-row-card {
  display: grid;
  grid-template-columns: minmax(68px, .34fr) minmax(170px, 1fr) minmax(150px, .78fr) minmax(220px, 1fr) minmax(220px, 1fr);
  gap: 10px;
  align-items: end;
  overflow: hidden;
}

.customer-payment-row-card .customer-payment-row-card-fields,
#editRecordForm [data-edit-customer-payment-row] .customer-payment-row-card-fields {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
  min-width: 0;
}

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

#editRecordForm [data-edit-customer-payment-row].is-confirmed-locked {
  border-color: #c9968f !important;
  background: repeating-linear-gradient(135deg, rgba(248, 241, 243, .82), rgba(248, 241, 243, .82) 8px, rgba(241, 231, 234, .82) 8px, rgba(241, 231, 234, .82) 16px) !important;
  box-shadow: inset 0 0 0 1px rgba(143, 72, 80, .12);
}

#editRecordForm [data-edit-customer-payment-row].is-confirmed-locked input:disabled,
#editRecordForm [data-edit-customer-payment-row].is-confirmed-locked select:disabled,
#editRecordForm [data-edit-customer-payment-row].is-confirmed-locked textarea:disabled,
#editRecordForm [data-edit-customer-payment-row].is-confirmed-locked button:disabled {
  cursor: not-allowed;
  opacity: .74;
}

.customer-payment-amount-field,
.customer-payment-amount-field .amount-number-control,
.customer-payment-amount-field .amount-digit-wrap,
.customer-payment-amount-field .amount-digit-row {
  min-width: 0;
  max-width: 100%;
}

.customer-payment-amount-field .amount-digit-row,
#editRecordForm [data-edit-customer-payment-row] .customer-payment-amount-field .amount-digit-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(22px, 1fr)) 6px repeat(2, minmax(22px, .82fr));
  gap: 3px;
  overflow: hidden;
}

.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 {
  min-width: 0;
  width: 100%;
}

.task-board.task-summary-grid,
#taskResults .task-board.task-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 16px;
  align-items: start;
}

.task-board.task-summary-grid > .task-summary-card {
  min-width: 0;
}

.task-payment-rows {
  display: grid;
  gap: 10px;
}

.task-payment-row-detail {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fffdfa;
  min-width: 0;
}

.task-payment-row-detail > b {
  display: block;
  margin-bottom: 8px;
  color: var(--brand);
}

.task-payment-row-detail dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(118px, 1fr));
  gap: 8px;
  margin: 0;
}

.task-payment-row-detail div,
.task-payment-row-detail dd,
.task-payment-row-detail dt {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
  white-space: normal;
}

.task-view-details .task-detail-items,
.task-view-details .task-payment-rows {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}
