/* Shared responsive guardrails for the GlobalLinks pages. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-width: 0;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

img,
video,
canvas,
iframe {
  max-width: 100%;
}

input,
select,
textarea,
button {
  max-width: 100%;
}

/* Keep wide data readable while containing its scroll within the table area. */
.table-scroll,
.table-wrap,
.table-wrapper,
.table-responsive,
.history-table-wrap,
.earnings-table-wrap,
.recovery-history,
.deposit-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

/* Keep the nine-column admin deposit table readable on narrow screens.
   The table scrolls inside its own panel instead of shrinking to phone width. */
.deposit-view:not(.withdrawal-view) .table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.deposit-view:not(.withdrawal-view) .table-scroll > table {
  width: 100%;
  min-width: 1120px;
  table-layout: fixed;
}

/* Keep the ten-column withdrawal queue readable on both dashboard routes. */
.withdrawal-view .table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: #bdcddd #f1f5f9;
  scrollbar-width: thin;
}

.withdrawal-view .table-scroll > table {
  width: 100%;
  min-width: 1280px;
  table-layout: fixed;
}

.withdrawal-view .table-scroll th,
.withdrawal-view .table-scroll td {
  padding-inline: 12px;
}

.withdrawal-view .table-scroll th:nth-child(1),
.withdrawal-view .table-scroll td:nth-child(1) { width: 11%; }
.withdrawal-view .table-scroll th:nth-child(2),
.withdrawal-view .table-scroll td:nth-child(2) { width: 12%; }
.withdrawal-view .table-scroll th:nth-child(3),
.withdrawal-view .table-scroll td:nth-child(3) { width: 8%; }
.withdrawal-view .table-scroll th:nth-child(4),
.withdrawal-view .table-scroll td:nth-child(4) { width: 10%; }
.withdrawal-view .table-scroll th:nth-child(5),
.withdrawal-view .table-scroll td:nth-child(5) { width: 7%; }
.withdrawal-view .table-scroll th:nth-child(6),
.withdrawal-view .table-scroll td:nth-child(6) { width: 9%; }
.withdrawal-view .table-scroll th:nth-child(7),
.withdrawal-view .table-scroll td:nth-child(7) { width: 15%; }
.withdrawal-view .table-scroll th:nth-child(8),
.withdrawal-view .table-scroll td:nth-child(8) { width: 8%; }
.withdrawal-view .table-scroll th:nth-child(9),
.withdrawal-view .table-scroll td:nth-child(9) { width: 9%; }
.withdrawal-view .table-scroll th:nth-child(10),
.withdrawal-view .table-scroll td:nth-child(10) { width: 11%; }

.withdrawal-mobile-hint { display: none; }
@media (max-width: 780px) {
  .withdrawal-view .withdrawal-mobile-hint {
    display: block;
    margin: 0 16px 10px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
  }
}

.withdrawal-view .table-scroll::-webkit-scrollbar {
  height: 8px;
}

.withdrawal-view .table-scroll::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.withdrawal-view .table-scroll::-webkit-scrollbar-thumb {
  border: 2px solid #f1f5f9;
  border-radius: 999px;
  background: #bdcddd;
}

@media (max-width: 600px) {
  .contact-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .validation-requirements {
    flex-wrap: wrap;
    justify-content: flex-start;
    white-space: normal;
    column-gap: 12px;
    row-gap: 4px;
  }

  .footer-actions {
    flex-wrap: wrap;
  }

  .footer-actions > * {
    min-width: 0;
  }

  .balance-banner {
    flex-wrap: wrap;
  }

  .balance-banner p {
    flex: 1 1 100%;
    text-align: left;
  }

  .account-fields > div {
    flex-wrap: wrap;
    gap: 6px 12px;
  }

  .account-fields dd {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .bottom-nav {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 359px) {
  .login-card,
  .register-card,
  .access-card {
    padding-right: 18px;
    padding-left: 18px;
  }

  .contact-row {
    gap: 10px;
  }

  .account-topbar {
    flex-wrap: wrap;
  }

  .account-topbar h1 {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

@media (max-height: 620px) and (max-width: 600px) {
  body:has(.login-card),
  body:has(.register-card),
  body:has(.access-card) {
    align-items: start;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

/* Keep mobile form focus steady and preserve the browser's native edit menu. */
input,
textarea,
select,
[contenteditable="true"] {
  -webkit-user-select: text !important;
  user-select: text !important;
  -webkit-touch-callout: default;
}

.password-input {
  position: relative;
  min-width: 0;
}

.password-input > input {
  padding-right: 48px !important;
  margin-bottom: 0 !important;
}

.recovery-card form > .password-input,
.withdraw-card form > .password-input {
  width: 100%;
}

.recovery-card form > .password-input > input {
  width: 100%;
  padding: 12px;
  border: 1px solid #dfe9e1;
  border-radius: 9px;
  background: #fbfdfb;
  color: #365c42;
  font-size: 13px;
}

.withdraw-card form > .password-input > input {
  display: block;
  width: 100%;
  height: 42px;
  padding: 10px 12px;
  border: 1px solid #dce5ef;
  border-radius: 9px;
  color: #244458;
  font: 12px 'Segoe UI', Arial, sans-serif;
}

.access-card .password-input,
.withdraw-card form > .password-input {
  margin-bottom: 19px;
}

.password-input > .password-toggle {
  position: absolute !important;
  top: 50% !important;
  right: 2px !important;
  display: grid !important;
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: translateY(-50%) !important;
  place-items: center !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #788b82 !important;
  cursor: pointer;
}

.password-input > .password-toggle svg {
  width: 18px !important;
  height: 18px !important;
}

@media (max-width: 780px) {
  html {
    scroll-padding-block: 20px;
    scroll-behavior: auto;
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  textarea,
  select,
  [contenteditable="true"] {
    font-size: 16px !important;
    scroll-margin-block: 20px;
  }

  /* Keep mobile browsers from zooming and shifting focused form controls.
     The extra specificity wins over page-level input font declarations. */
  html body input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  html body textarea,
  html body select,
  html body [contenteditable="true"] {
    font-size: 16px !important;
    line-height: 1.35;
  }

  html:has(input:focus, textarea:focus, select:focus, [contenteditable="true"]:focus),
  body:has(input:focus, textarea:focus, select:focus, [contenteditable="true"]:focus) {
    scroll-behavior: auto !important;
  }

  /* The fixed dock stays out of the keyboard area while a field is active. */
  body:has(input:focus, textarea:focus, select:focus, [contenteditable="true"]:focus) .bottom-nav {
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
    transition: none !important;
  }

}
