/* The internal operations system is intentionally shown at 80% scale. */
html.system-ui-scale {
  zoom: .8;
}

html.system-ui-scale body,
html.system-ui-scale .system-shell,
html.system-ui-scale .system-main {
  min-height: 125vh;
}

html.system-ui-scale .sidebar {
  height: 125vh;
}

html.system-ui-scale .modal,
html.system-ui-scale .modal-backdrop {
  height: 125vh;
  width: 125vw;
}

/* Every system modal shares one dependable viewport and scrolling model. */
.modal .modal-dialog {
  height: calc(125dvh - 32px);
  margin-bottom: 16px;
  margin-top: 16px;
}

.modal .modal-content {
  display: flex;
  flex-direction: column;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

.modal .modal-content > form {
  display: flex;
  flex-direction: column;
  max-height: 100%;
  min-height: 0;
}

.modal .modal-header,
.modal .modal-footer {
  flex: 0 0 auto;
}

.modal .modal-header {
  align-items: flex-start;
  min-height: 70px;
  padding-right: 74px;
  position: relative;
}

.modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal .modal-close {
  align-items: center;
  appearance: none;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #dce3eb);
  border-radius: 12px;
  color: var(--muted, #64748b);
  display: inline-flex;
  height: 40px;
  justify-content: center;
  margin: 0;
  padding: 0;
  position: absolute;
  right: 18px;
  top: 15px;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
  width: 40px;
  z-index: 4;
}

.modal .modal-close svg {
  height: 18px;
  pointer-events: none;
  stroke-width: 2.2;
  width: 18px;
}

.modal .modal-close:hover,
.modal .modal-close:focus-visible {
  background: var(--primary-soft, #f2effa);
  border-color: color-mix(in srgb, var(--primary, #2b1273) 35%, white);
  color: var(--primary, #2b1273);
  outline: none;
  transform: translateY(-1px);
}

.branch-account-editor-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.branch-account-editor {
  background: color-mix(in srgb, var(--surface, #fff) 94%, var(--primary, #2b1273));
  border: 1px solid var(--line, #dce3eb);
  border-radius: 16px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(150px, .8fr) minmax(180px, 1fr) minmax(220px, 1.4fr) auto;
  padding: 14px;
}

.branch-account-editor .field-wrap {
  margin: 0;
}

.branch-account-editor .account-active-field {
  align-items: center;
  display: flex;
  min-width: 82px;
  padding-top: 24px;
}

.branch-account-editor .account-active-field label {
  align-items: center;
  display: flex;
  gap: 8px;
}

.branch-account-editor .account-delete-field {
  align-items: center;
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.branch-account-editor .account-delete-field label {
  align-items: center;
  color: #b42318;
  display: flex;
  gap: 8px;
}

.branch-payment-heading {
  border-top: 1px solid var(--line, #dce3eb);
  margin-top: 24px;
  padding-top: 22px;
}

.branch-payment-heading h3 {
  color: var(--ink, #0f172a);
  font-size: 18px;
  margin: 0 0 4px;
}

.branch-payment-heading p {
  color: var(--muted, #64748b);
  font-size: 13px;
  margin: 0;
}

.payment-account-avatar img {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.store-directory-list {
  background: var(--surface, #fff);
  border: 1px solid var(--line, #dce3eb);
  border-radius: 18px;
  display: grid;
  overflow: hidden;
}

.store-directory-row {
  align-items: center;
  color: inherit;
  display: grid;
  gap: 18px;
  grid-template-columns: auto minmax(190px, 1.4fr) minmax(180px, 1fr) minmax(80px, .45fr) minmax(150px, .8fr) auto;
  padding: 16px 18px;
  text-decoration: none;
  transition: background .16s ease;
}

.store-directory-row + .store-directory-row {
  border-top: 1px solid var(--line, #dce3eb);
}

.store-directory-row:hover {
  background: var(--primary-soft, #f4f1fb);
}

.store-directory-icon {
  align-items: center;
  background: var(--primary-soft, #f4f1fb);
  border-radius: 12px;
  color: var(--primary, #2b1273);
  display: flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.store-directory-icon svg {
  height: 19px;
  width: 19px;
}

.store-directory-name,
.store-directory-meta {
  min-width: 0;
}

.store-directory-name small,
.store-directory-name strong,
.store-directory-meta small,
.store-directory-meta strong {
  display: block;
}

.store-directory-name small,
.store-directory-meta small {
  color: var(--muted, #64748b);
  font-size: 11px;
  margin-bottom: 3px;
}

.store-directory-name strong {
  color: var(--ink, #0f172a);
  font-size: 15px;
}

.store-directory-meta strong {
  color: var(--text, #334155);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .modal .modal-dialog {
    height: 125dvh;
    margin: 0;
    max-width: none;
    width: 100%;
  }

  .modal .modal-content {
    border-radius: 0;
    height: 100%;
  }

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

  .branch-account-editor .account-active-field {
    padding-top: 0;
  }

  .store-directory-row {
    gap: 8px 12px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 14px;
  }

  .store-directory-meta {
    grid-column: 2;
  }

  .store-directory-row > .round-action {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
}
