/* QubixPay — global mobile / small-screen fixes */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Safe area (notched phones) */
@supports (padding: max(0px)) {
  .safe-px {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

@media (max-width: 767px) {
  /* —— Landing / docs / test headers —— */
  .landing-header > div {
    gap: 0.5rem;
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .qp-brand {
    min-width: 0;
    flex: 1 1 auto;
    max-width: calc(100% - 3rem);
  }

  .qp-brand .qp-logo {
    width: 2.25rem;
    height: 2.25rem;
  }

  .qp-brand-sub {
    display: none;
  }

  .qp-brand-title {
    font-size: 0.9375rem !important;
    line-height: 1.2 !important;
  }

  .landing-header-actions {
    flex-shrink: 0;
    gap: 0.5rem;
  }

  .landing-hero h1 {
    font-size: 1.75rem !important;
    line-height: 1.15 !important;
  }

  .landing-hero-lead {
    font-size: 1rem !important;
  }

  /* —— Docs —— */
  .gateway-docs-layout {
    grid-template-columns: 1fr !important;
  }

  .gateway-toc {
    position: static;
  }

  .gateway-section {
    padding: 1.25rem !important;
    border-radius: 24px !important;
  }

  .gateway-section h1 {
    font-size: 1.375rem !important;
  }

  .gateway-code {
    padding: 0.75rem;
    border-radius: 12px;
  }

  .gateway-code pre {
    font-size: 11px;
  }

  .gateway-btn-row {
    flex-direction: column;
  }

  .gateway-btn-row a {
    width: 100%;
    text-align: center;
  }

  /* —— Test console —— */
  .gateway-test-actions {
    flex-direction: column !important;
  }

  .gateway-test-actions button {
    width: 100%;
  }

  .gateway-pay-actions {
    flex-direction: column !important;
  }

  .gateway-pay-actions button,
  .gateway-pay-actions .gateway-input {
    width: 100%;
  }

  .gateway-pay-meta-row {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.25rem;
  }

  /* —— Dashboard —— */
  .dash-header .dash-content {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .dash-content.max-w-7xl {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .dash-page-title {
    font-size: 1.125rem !important;
  }

  .dash-breadcrumb {
    font-size: 0.6875rem;
  }

  .dash-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .dash-hero-title {
    font-size: 1.25rem;
  }

  .dash-stat-head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .dash-stat-head .dash-btn {
    width: 100%;
    justify-content: center;
  }

  .dash-action-card {
    min-height: 0;
    padding: 1.25rem;
  }

  .dash-action-card-body {
    flex-direction: column;
    align-items: flex-start;
  }

  .dash-modal {
    max-width: calc(100vw - 1.5rem) !important;
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
  }

  .dash-modal .grid {
    grid-template-columns: 1fr !important;
  }

  .dash-inset-panel {
    padding: 0.875rem !important;
  }

  /* History uses card layout via dash-table--stack in dashboard.css */

  .dash-sidebar {
    width: min(88vw, 300px);
  }

}

@media (max-width: 380px) {
  .dash-metrics-grid--payments {
    grid-template-columns: 1fr !important;
  }
}
