.mf-head,
.mf-ro,
.mf-wallets,
.mf-filter,
.mf-table {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}

.mf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 12px;
}

.mf-head > div {
  min-width: 0;
}

.mf-head span {
  display: block;
  color: var(--color-brand-600, #2f66d0);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 18px;
}

.mf-head h2 {
  margin: 7px 0 5px;
  color: var(--color-text, #152235);
  font-size: 28px;
  line-height: 36px;
  letter-spacing: -.025em;
}

.mf-head p {
  max-width: 760px;
  margin: 0;
  color: var(--color-text-secondary, #4a5d73);
  font-size: 14px;
  line-height: 22px;
}

.mf-ro {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 16px;
  padding: 13px 16px;
  border: 1px solid #efdbad;
  border-left: 3px solid var(--color-warning, #9a6208);
  border-radius: var(--radius-control, 9px);
  background: #fff9e8;
  color: #71571e;
  font-size: 13px;
  line-height: 20px;
}

.mf-ro b {
  flex: 0 0 auto;
  color: var(--color-warning, #9a6208);
}

.mf-wallets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.mf-wallets article {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--color-border, #d6e0e9);
  border-radius: var(--radius-card, 16px);
  background: var(--color-surface, #fff);
  box-shadow: var(--shadow-card, 0 10px 30px rgb(30 48 70 / 7%));
}

.mf-wallets article > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.mf-wallets header b {
  color: var(--color-warning, #9a6208);
  font-size: 14px;
}

.mf-wallets header span,
.mf-wallets small,
.mf-wallets p span {
  color: var(--color-text-muted, #6f7f91);
  font-size: 12px;
  line-height: 18px;
}

.mf-wallets header span {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.mf-wallets > article > strong {
  display: block;
  margin: 18px 0 4px;
  overflow-wrap: anywhere;
  color: var(--color-text, #152235);
  font-size: 30px;
  line-height: 36px;
  font-variant-numeric: tabular-nums;
}

.mf-wallets article > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.mf-wallets p {
  display: grid;
  gap: 5px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border-radius: var(--radius-control, 9px);
  background: var(--color-surface-muted, #f6f8fb);
}

.mf-wallets p b {
  overflow-wrap: anywhere;
  color: var(--color-text, #152235);
  font-variant-numeric: tabular-nums;
}

.mf-filter {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(5, minmax(0, 1fr)) auto;
  gap: 10px;
  width: 100%;
  margin: 0 0 12px;
  padding: 14px;
  border: 1px solid var(--color-border, #d6e0e9);
  border-radius: var(--radius-control, 9px);
  background: var(--color-surface, #fff);
  box-shadow: 0 8px 24px rgb(30 48 70 / 5%);
}

.mf-filter input,
.mf-filter select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--color-border, #d6e0e9);
  border-radius: var(--radius-control, 9px);
  background: var(--color-surface, #fff);
  color: var(--color-text, #152235);
}

.mf-filter input:focus-visible,
.mf-filter select:focus-visible {
  border-color: var(--color-brand-500, #3d78f2);
  box-shadow: var(--focus-ring, 0 0 0 3px rgb(47 102 208 / 18%));
}

.mf-filter > .button {
  min-height: 42px;
  white-space: nowrap;
}

.mf-table {
  width: 100%;
  margin-top: 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border: 1px solid var(--color-border, #d6e0e9);
  border-radius: var(--radius-card, 16px);
  background: var(--color-surface, #fff);
  scrollbar-color: #aebfd0 #eef3f7;
  scrollbar-width: thin;
}

.mf-table table {
  width: 100%;
  min-width: 1100px;
  border: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.mf-table th {
  padding: 12px 14px;
  background: var(--color-surface-muted, #f6f8fb);
  color: var(--color-text-secondary, #4a5d73);
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 18px;
  white-space: nowrap;
}

.mf-table td {
  min-width: 0;
  padding: 14px;
  color: var(--color-text, #152235);
  line-height: 20px;
  vertical-align: top;
}

.mf-table td small {
  display: block;
  margin-top: 4px;
  color: var(--color-text-muted, #6f7f91);
  font-size: 12px;
  line-height: 18px;
  overflow-wrap: anywhere;
}

.mf-snap {
  display: grid;
  gap: 3px;
  min-width: 0;
  font-size: 11px;
  white-space: nowrap;
}

.mf-pages {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
  padding: 14px;
}

.mf-pages b {
  color: var(--color-text-secondary, #4a5d73);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.mf-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #dce2e8;
  border-radius: 999px;
  background: #f1f4f7;
  color: var(--state-pending, #4a5d73);
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  white-space: nowrap;
}

.mf-status.completed {
  border-color: #bee5d8;
  background: #e9f7f1;
  color: var(--color-success, #087a55);
}

.mf-status.cancelled, .mf-status.failed {
  border-color: #edc6cb;
  background: #fceff1;
  color: var(--state-danger, #c33e4a);
}

.mf-gold {
  border-color: var(--color-warning, #9a6208);
  background: var(--color-warning, #9a6208);
  color: #fff;
}

html.merchant-portal .button.mf-gold {
  border-color: var(--color-warning, #9a6208);
  background: var(--color-warning, #9a6208);
}

.mf-gold:hover:not(:disabled) {
  border-color: #7d4f06;
  background: #7d4f06;
}

.mf-modal {
  box-sizing: border-box;
  padding: 16px;
  overflow: auto;
}

.mf-modal .modal-card {
  box-sizing: border-box;
  width: min(680px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 32px);
  margin: 0;
  padding: 28px 30px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--color-border, #d6e0e9);
  border-radius: var(--radius-dialog, 20px);
  background: var(--color-surface, #fff);
  box-shadow: var(--shadow-overlay, 0 24px 68px rgb(7 19 34 / 24%));
}

html.merchant-portal .mf-modal {
  padding: 16px;
}

html.merchant-portal .mf-modal .modal-card {
  width: min(680px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 32px);
  padding: 28px 30px;
  border-radius: var(--radius-dialog, 20px);
}

.mf-modal .modal-card h2 {
  margin: 0 42px 18px 0;
  color: var(--color-text, #152235);
  font-size: 24px;
  line-height: 32px;
}

.mf-modal .modal-card > p {
  margin: 0 0 20px;
  color: var(--color-text-secondary, #4a5d73);
  font-size: 13px;
  line-height: 20px;
}

.mf-modal .close {
  position: absolute;
  top: 16px;
  right: 18px;
  display: grid;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-control, 9px);
  background: transparent;
  color: var(--color-text-muted, #6f7f91);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.mf-modal .close:hover {
  background: var(--color-surface-muted, #f6f8fb);
  color: var(--color-brand-700, #2452aa);
}

.mf-modal .close:focus-visible {
  outline: 2px solid var(--color-brand-500, #3d78f2);
  outline-offset: 2px;
  box-shadow: var(--focus-ring, 0 0 0 3px rgb(47 102 208 / 18%));
}

.mf-modal form {
  display: grid;
  min-width: 0;
  gap: 16px;
}

.mf-modal label {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: var(--color-text-secondary, #4a5d73);
  font-size: 13px;
  font-weight: 700;
  line-height: 20px;
}

.mf-modal input,
.mf-modal select,
.mf-modal textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--color-border, #d6e0e9);
  border-radius: var(--radius-control, 9px);
  background: var(--color-surface, #fff);
  color: var(--color-text, #152235);
  line-height: 20px;
}

.mf-modal textarea {
  min-height: 100px;
  resize: vertical;
}

.mf-modal input:focus-visible,
.mf-modal select:focus-visible,
.mf-modal textarea:focus-visible {
  border-color: var(--color-brand-500, #3d78f2);
  outline: 2px solid transparent;
  box-shadow: var(--focus-ring, 0 0 0 3px rgb(47 102 208 / 18%));
}

.mf-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.mf-modal .form-message {
  min-height: 20px;
  margin: 0;
  color: var(--color-text-secondary, #4a5d73);
  font-size: 12px;
  line-height: 18px;
  overflow-wrap: anywhere;
}

.mf-modal .form-message.success {
  color: var(--color-success, #087a55);
}

.mf-modal .form-message.error {
  color: var(--color-danger, #bd3e4b);
}

.mf-bank {
  display: none;
  position: fixed;
  z-index: 10050;
  box-sizing: border-box;
  width: min(100% - 16px, 420px);
  max-width: calc(100vw - 16px);
  max-height: min(300px, calc(100dvh - 16px));
  padding: 8px;
  overflow: hidden;
  border: 1px solid var(--color-border, #d6e0e9);
  border-radius: 12px;
  background: var(--color-surface, #fff);
  box-shadow: var(--shadow-overlay, 0 24px 68px rgb(7 19 34 / 24%));
}

.mf-bank.open {
  display: block;
}

.mf-bank input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--color-border, #d6e0e9);
  border-radius: var(--radius-control, 9px);
}

.mf-bank > div {
  max-height: 230px;
  margin-top: 8px;
  overflow-x: hidden;
  overflow-y: auto;
}

.mf-bank button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: var(--color-surface, #fff);
  color: var(--color-text, #152235);
  text-align: left;
  cursor: pointer;
}

.mf-bank button:hover,
.mf-bank button:focus-visible {
  background: #edf4ff;
}

.mf-bank small {
  color: var(--color-text-muted, #6f7f91);
  font-size: 12px;
}

@media (max-width: 1280px) {
  .mf-wallets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mf-filter {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .mf-filter {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .mf-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .mf-wallets {
    grid-template-columns: 1fr;
  }

  .mf-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mf-ro {
    flex-direction: column;
    gap: 5px;
  }
}

@media (max-width: 700px) {
  .mf-filter {
    gap: 10px;
  }

  .mf-filter > .button {
    min-height: 44px;
  }

  .mf-table {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .mf-table table,
  .mf-table tbody,
  .mf-table tr,
  .mf-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .mf-table table {
    border: 0;
  }

  .mf-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .mf-table tr {
    box-sizing: border-box;
    margin: 0 0 12px;
    padding: 12px 14px;
    border: 1px solid var(--color-border, #d6e0e9);
    border-radius: 14px;
    background: var(--color-surface, #fff);
    box-shadow: 0 8px 24px rgb(30 48 70 / 5%);
  }

  .mf-table td {
    display: grid;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    border: 0;
    color: var(--color-text, #152235);
    line-height: 20px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .mf-table td::before {
    content: attr(data-label);
    grid-column: 1;
    grid-row: 1 / span 3;
    color: var(--color-text-muted, #6f7f91);
    font-size: 12px;
    line-height: 18px;
  }

  .mf-table td > * { grid-column: 2; }

  .mf-table td[colspan] {
    display: block;
    padding: 22px 8px;
    text-align: center;
  }

  .mf-table td[colspan]::before {
    display: none;
    content: none;
  }

  .mf-snap {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .mf-pages {
    justify-content: space-between;
    gap: 8px;
    padding: 12px 0;
  }

  .mf-pages .mini-action {
    min-height: 44px;
  }
}

@media (max-width: 640px) {
  .mf-modal {
    padding: 12px;
  }

  .mf-modal .modal-card {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    padding: 24px 20px;
  }

  html.merchant-portal .mf-modal .modal-card {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    padding: 24px 20px;
  }

  .mf-modal .modal-card h2 {
    font-size: 22px;
    line-height: 30px;
  }

  .mf-pair {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .mf-head h2 {
    font-size: 24px;
    line-height: 32px;
  }

  .mf-filter {
    grid-template-columns: 1fr;
    padding: 13px;
  }

  .mf-wallets > article > strong {
    font-size: 25px;
    line-height: 32px;
  }

  .mf-table tr {
    padding: 11px 12px;
    border-radius: 12px;
  }

  .mf-table td {
    grid-template-columns: minmax(86px, 38%) minmax(0, 1fr);
    gap: 8px;
  }

  .mf-modal {
    padding: 10px;
  }

  .mf-modal .modal-card,
  html.merchant-portal .mf-modal .modal-card {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 20px);
    padding: 20px 16px;
  }

  .mf-modal .close {
    top: 12px;
    right: 12px;
  }

  .mf-bank button {
    min-height: 44px;
  }
}

@media (max-width: 390px) {
  .mf-table td {
    grid-template-columns: minmax(82px, 40%) minmax(0, 1fr);
  }

  .mf-wallets article {
    padding: 17px;
  }

  .mf-modal .modal-card,
  html.merchant-portal .mf-modal .modal-card {
    padding-inline: 14px;
  }
}

.mf-ledger-table{min-width:760px!important}.mf-ledger-table th,.mf-ledger-table td{padding:10px 8px}.mf-ledger-table td:nth-child(2){max-width:170px;white-space:normal;overflow-wrap:anywhere}.mf-ledger-table td:nth-child(3){max-width:175px;white-space:normal}.mf-ledger-table td:nth-child(n+3):nth-child(-n+6){text-align:right;font-variant-numeric:tabular-nums}.mf-ledger-table .mf-snap{max-width:250px;white-space:normal;font-size:12px}.mf-ledger-table .mf-snap>span{min-width:200px}.mf-kind.payin{color:var(--color-brand-600,#2f66d0)}.mf-kind.payout{color:#7048a5}.mf-kind.adjustment{color:#52657d}@media(max-width:700px){.mf-ledger-table{min-width:0!important}.mf-ledger-table td:nth-child(n){max-width:none;text-align:left;padding:8px 0}.mf-ledger-table .mf-snap>span{min-width:0}}

.mf-recovery{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:8px 0;padding:10px 12px;border:1px solid var(--color-border,#d6e0e9);border-radius:10px;background:#fff9e8;color:#71571e;font-size:13px;line-height:20px}.mf-recovery>span{flex:1;min-width:180px}.mf-recovery .button{min-height:42px}.mf-modal [aria-live]{min-height:20px}

.mf-ledger-table .mf-balance{text-align:right!important;font-variant-numeric:tabular-nums;white-space:nowrap}.mf-ledger-table td.mf-balance>span{display:block;white-space:nowrap;line-height:20px}
@media(max-width:700px){.mf-table:has(>.mf-ledger-table){overflow-x:auto}.mf-ledger-table{display:table!important;width:max-content;min-width:760px!important}.mf-ledger-table thead{position:static;clip:auto;width:auto;height:auto;overflow:visible;display:table-header-group}.mf-ledger-table tbody{display:table-row-group}.mf-ledger-table tr{display:table-row;width:auto;padding:0;border:0;overflow:visible}.mf-ledger-table td{display:table-cell!important;width:auto;padding:10px 8px!important}.mf-ledger-table td::before{display:none;content:none}}

.mf-wallets>article>strong{display:block;max-width:100%;overflow-x:auto;white-space:nowrap;overflow-wrap:normal;font-variant-numeric:tabular-nums}

.mf-modal #mfForm{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.mf-modal #mfForm>.mf-pair,.mf-modal #mfForm>.form-message,.mf-modal #mfForm>button{grid-column:1/-1}.mf-modal #mfForm>button{position:sticky;bottom:0;z-index:2}.mf-status{gap:5px}.mf-status::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor}.mf-table:has(#mfSettlements) th:nth-child(3),#mfSettlements td:nth-child(3){text-align:right;font-variant-numeric:tabular-nums}@media(max-width:640px){.mf-modal #mfForm{grid-template-columns:1fr}}

.mf-filter>label{display:grid;flex:0 1 220px;min-width:0;gap:6px;font-size:12px;color:var(--color-text-secondary,#4a5d73)}@media(max-width:430px){.mf-filter>label{flex-basis:100%}}
