/*
 * Layout corrections used only by the PayPOS Android WebView. The native app
 * adds PayPOSAndroid/ to its user agent, and wrapper-start.php adds the class.
 */
html.paypos-android-webview {
  width: 100%;
  min-width: 0;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: auto;
  touch-action: pan-y;
}

html.paypos-android-webview body {
  width: 100%;
  min-width: 0;
  min-height: 100%;
  height: auto;
  overflow: visible;
  overscroll-behavior-y: auto;
  touch-action: pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@supports (overflow: clip) {
  html.paypos-android-webview body {
    overflow-x: clip;
  }
}

/* The first declaration is a fallback for WebViews without env() support. */
html.paypos-android-webview .screen {
  width: 100%;
  max-width: 430px;
  height: auto;
  min-height: 100vh;
  margin-right: auto;
  margin-left: auto;
  padding: 20px 20px 24px;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  padding-right: calc(20px + env(safe-area-inset-right, 0px));
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(20px + env(safe-area-inset-left, 0px));
}

@supports (min-height: 100dvh) {
  html.paypos-android-webview .screen {
    min-height: 100dvh;
  }
}

html.paypos-android-webview button,
html.paypos-android-webview a,
html.paypos-android-webview input,
html.paypos-android-webview select,
html.paypos-android-webview textarea {
  max-width: 100%;
  touch-action: manipulation;
}

/* Android WebView keeps its keyboard focus ring after a touch. The app
 * already provides :active states and native haptic feedback, so suppress
 * that persistent ring only inside the embedded app. */
html.paypos-android-webview button,
html.paypos-android-webview a[href],
html.paypos-android-webview [role="button"],
html.paypos-android-webview input[type="button"],
html.paypos-android-webview input[type="submit"],
html.paypos-android-webview input[type="reset"] {
  -webkit-tap-highlight-color: transparent;
}

html.paypos-android-webview button:focus,
html.paypos-android-webview a[href]:focus,
html.paypos-android-webview [role="button"]:focus,
html.paypos-android-webview input[type="button"]:focus,
html.paypos-android-webview input[type="submit"]:focus,
html.paypos-android-webview input[type="reset"]:focus {
  outline: none !important;
  outline-offset: 0 !important;
}

html.paypos-android-webview .pos-action-dock {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/*
 * Some Android 8.1 vendor WebViews lay out the transaction grid children on
 * separate rows. Flexbox keeps the icon, copy, value and chevron on one line,
 * matching the responsive browser presentation.
 */
html.paypos-android-webview .transaction-row {
  display: -webkit-flex;
  display: flex;
  width: 100%;
  min-height: 64px;
  align-items: center;
  gap: 0;
  padding: 10px 11px;
}

html.paypos-android-webview .transaction-icon {
  flex: 0 0 32px;
  margin-right: 10px;
}

html.paypos-android-webview .transaction-copy {
  flex: 1 1 auto;
  min-width: 0;
}

html.paypos-android-webview .transaction-reference {
  font-size: 14px;
  line-height: 1.25;
}

html.paypos-android-webview .transaction-detail {
  font-size: 11px;
  line-height: 1.3;
}

html.paypos-android-webview .transaction-created {
  font-size: 10px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

html.paypos-android-webview .transaction-value {
  flex: 0 0 74px;
  min-width: 74px;
  margin-left: 8px;
  text-align: right;
}

html.paypos-android-webview .transaction-amount {
  font-size: 14px;
  line-height: 1.25;
}

html.paypos-android-webview .transaction-status {
  font-size: 10px;
  line-height: 1.25;
}

html.paypos-android-webview .chevron {
  flex: 0 0 14px;
  margin-left: 6px;
}

@media (max-width: 320px) {
  html.paypos-android-webview .transaction-row {
    padding-right: 9px;
    padding-left: 9px;
  }

  html.paypos-android-webview .transaction-icon {
    margin-right: 8px;
  }

  html.paypos-android-webview .transaction-value {
    flex-basis: 68px;
    min-width: 68px;
    margin-left: 6px;
  }

  html.paypos-android-webview .chevron {
    display: none;
  }
}

/* Keep the dashboard inside the T650p viewport; its transaction list scrolls. */
html.paypos-android-webview body[data-page="paypos-accueil"] {
  height: auto;
  overflow: visible;
}

html.paypos-android-webview body[data-page="paypos-accueil"] .screen {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}

html.paypos-android-webview body[data-page="paypos-accueil"] .transaction-row {
  min-height: 56px;
  padding-top: 7px;
  padding-bottom: 7px;
}

@supports (min-height: 100dvh) {
  html.paypos-android-webview body[data-page="paypos-accueil"] .screen {
    min-height: 100dvh;
  }
}

html.paypos-android-webview body[data-page="paypos-accueil"] .recent-payments {
  flex: 1 0 auto;
  overflow: visible;
  overscroll-behavior: auto;
}

@media (max-height: 700px) {
  html.paypos-android-webview body[data-page="paypos-accueil"] .transaction-row {
    min-height: 54px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  html.paypos-android-webview body[data-page="paypos-accueil"] .pos-action-dock {
    padding-top: 8px;
  }
}

/* -------------------------------------------------------------------------
 * Amount entry: replace the vendor WebView grid with a deterministic
 * three-column flex keypad and leave enough room for the full currency code.
 * ---------------------------------------------------------------------- */
html.paypos-android-webview body[data-page="paypos-montant"] {
  height: auto;
  overflow: visible;
}

html.paypos-android-webview body[data-page="paypos-montant"] .screen {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}

@supports (min-height: 100dvh) {
  html.paypos-android-webview body[data-page="paypos-montant"] .screen {
    min-height: 100dvh;
  }
}

html.paypos-android-webview body[data-page="paypos-montant"] .amount-copy {
  width: 100%;
}

html.paypos-android-webview body[data-page="paypos-montant"] .amount-label {
  box-sizing: border-box;
  width: 100%;
  padding-right: 68px;
  padding-left: 4px;
}

html.paypos-android-webview .currency-picker {
  width: 68px;
  height: 32px;
}

html.paypos-android-webview .currency-picker select {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0 21px 0 8px;
  font-size: 11px;
  line-height: 30px;
  text-indent: 0;
}

html.paypos-android-webview .currency-chevron {
  top: 9px;
  right: 7px;
  width: 12px;
  height: 12px;
}

html.paypos-android-webview body[data-page="paypos-montant"] .keypad {
  display: -webkit-flex;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  width: 100%;
  grid-template-columns: none;
  grid-template-rows: none;
  gap: 0;
}

html.paypos-android-webview body[data-page="paypos-montant"] .key {
  display: -webkit-flex;
  display: flex;
  flex: 0 0 31.5%;
  height: 54px;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  margin: 0 0 8px;
}

html.paypos-android-webview body[data-page="paypos-montant"] .key:nth-last-child(-n+3) {
  margin-bottom: 0;
}

html.paypos-android-webview body[data-page="paypos-montant"] .key[data-key="backspace"] {
  order: 12;
}

html.paypos-android-webview body[data-page="paypos-montant"] #amountForm .pos-action-dock {
  padding-top: 8px;
}

@media (max-height: 650px) {
  html.paypos-android-webview body[data-page="paypos-montant"] .key {
    height: 48px;
    min-height: 48px;
    margin-bottom: 6px;
  }

  html.paypos-android-webview body[data-page="paypos-montant"] .key:nth-last-child(-n+3) {
    margin-bottom: 0;
  }
}

/* -------------------------------------------------------------------------
 * Payment methods and delivery channels: stable horizontal cards for old
 * Android vendor WebViews. This also covers the configurable methods page.
 * ---------------------------------------------------------------------- */
html.paypos-android-webview .payment-list,
html.paypos-android-webview .channel-list {
  display: block;
}

html.paypos-android-webview .payment-option,
html.paypos-android-webview .channel-option {
  display: -webkit-flex;
  display: flex;
  width: 100%;
  min-height: 68px;
  align-items: center;
  grid-template-columns: none;
  margin: 0 0 10px;
}

html.paypos-android-webview .payment-option:last-child,
html.paypos-android-webview .channel-option:last-child {
  margin-bottom: 0;
}

html.paypos-android-webview .payment-option > .icon,
html.paypos-android-webview .channel-option > .icon {
  flex: 0 0 42px;
  margin-right: 10px;
}

html.paypos-android-webview .payment-option > .copy,
html.paypos-android-webview .channel-option > .copy {
  flex: 1 1 auto;
  min-width: 0;
}

html.paypos-android-webview .payment-option .label,
html.paypos-android-webview .channel-option .label,
html.paypos-android-webview .payment-option .description,
html.paypos-android-webview .channel-option .description {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: break-word;
}

html.paypos-android-webview .payment-option > .chevron,
html.paypos-android-webview .channel-option > .chevron {
  flex: 0 0 18px;
  margin-left: 8px;
}

html.paypos-android-webview .payment-toggle > .toggle-ui {
  flex: 0 0 38px;
  margin-left: 8px;
}

/* Settings fields use one reliable column instead of a two-column grid. */
html.paypos-android-webview .settings-grid {
  display: block;
}

html.paypos-android-webview .settings-field {
  display: block;
  margin-bottom: 10px;
}

html.paypos-android-webview .settings-field:last-child {
  margin-bottom: 0;
}

/* -------------------------------------------------------------------------
 * Shared transaction and information blocks used by channel/send/waiting/
 * detail/result screens. Margins replace unsupported flex gap behavior.
 * ---------------------------------------------------------------------- */
html.paypos-android-webview .transaction-main,
html.paypos-android-webview .selected-payment,
html.paypos-android-webview .reference-line {
  gap: 0;
}

html.paypos-android-webview .transaction-main > :first-child,
html.paypos-android-webview .selected-payment > :first-child {
  margin-right: 10px;
}

html.paypos-android-webview .transaction-summary .reference-wrap {
  max-width: 64%;
}

html.paypos-android-webview .transaction-summary .reference-line > .edit-reference {
  margin-left: 4px;
}

html.paypos-android-webview .transaction-summary .reference-input {
  max-width: 100%;
}

html.paypos-android-webview .transaction-summary .payment-name {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: break-word;
}

html.paypos-android-webview body[data-page="paypos-attente"] .details {
  display: -webkit-flex;
  display: flex;
  gap: 0;
}

html.paypos-android-webview body[data-page="paypos-attente"] .details > .detail {
  flex: 1 1 0;
}

html.paypos-android-webview body[data-page="paypos-attente"] .details > .detail + .detail {
  margin-left: 7px;
}

html.paypos-android-webview .actions {
  display: -webkit-flex;
  display: flex;
  flex-direction: column;
  gap: 0;
}

html.paypos-android-webview .actions > * + * {
  margin-top: 8px;
}

html.paypos-android-webview .link-information-list > div {
  display: -webkit-flex;
  display: flex;
  grid-template-columns: none;
  gap: 0;
}

html.paypos-android-webview .link-information-list dt {
  flex: 0 0 38%;
  margin-right: 10px;
}

html.paypos-android-webview .link-information-list dd {
  flex: 1 1 auto;
}

/* Send/contact and QR screens. */
html.paypos-android-webview .form-heading,
html.paypos-android-webview .qr-heading {
  gap: 0;
}

html.paypos-android-webview .form-heading > :first-child,
html.paypos-android-webview .qr-heading > :first-child {
  margin-right: 10px;
}

html.paypos-android-webview .submit-button {
  gap: 0;
}

html.paypos-android-webview .submit-button > svg {
  margin-right: 8px;
}

html.paypos-android-webview .qr-frame {
  display: -webkit-flex;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Pagination controls and two-column waiting values remain centered without Grid. */
html.paypos-android-webview .pagination-arrow,
html.paypos-android-webview .pagination-page {
  display: -webkit-inline-flex;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* One-cell grids are only used for centering; Flexbox is safer on VAOS 8.1. */
html.paypos-android-webview .back,
html.paypos-android-webview .close,
html.paypos-android-webview .back-button,
html.paypos-android-webview .menu-button,
html.paypos-android-webview .edit-reference,
html.paypos-android-webview .edit-icon,
html.paypos-android-webview .transaction-icon,
html.paypos-android-webview .payment-option > .icon,
html.paypos-android-webview .channel-option > .icon,
html.paypos-android-webview .field-icon,
html.paypos-android-webview .toggle-password,
html.paypos-android-webview .form-icon,
html.paypos-android-webview .qr-heading-icon,
html.paypos-android-webview .success-icon,
html.paypos-android-webview .error-icon,
html.paypos-android-webview .waiting-icon,
html.paypos-android-webview .paypos-payment-toast-icon {
  display: -webkit-flex;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Explicit margins replace flex gap on WebViews where that property is ignored. */
html.paypos-android-webview .turnover-meta {
  gap: 0;
}

html.paypos-android-webview .turnover-meta > .meta-separator {
  margin-right: 8px;
  margin-left: 8px;
}

html.paypos-android-webview .status-row,
html.paypos-android-webview .qr-status,
html.paypos-android-webview .secure-badge,
html.paypos-android-webview .paypos-payment-toast {
  gap: 0;
}

html.paypos-android-webview .status-row > .status-dot,
html.paypos-android-webview .qr-status > .status-dot {
  margin-right: 7px;
}

html.paypos-android-webview .secure-badge > svg,
html.paypos-android-webview .paypos-payment-toast-icon {
  margin-right: 7px;
}

html.paypos-android-webview .history-heading {
  gap: 0;
}

html.paypos-android-webview .history-heading > .new-payment-compact {
  margin-left: 12px;
}

html.paypos-android-webview .pagination,
html.paypos-android-webview .pagination-pages {
  gap: 0;
}

html.paypos-android-webview .pagination-pages > * {
  margin-right: 3px;
  margin-left: 3px;
}

html.paypos-android-webview .pagination > .pagination-arrow:first-child {
  margin-right: 8px;
}

html.paypos-android-webview .pagination > .pagination-arrow:last-child {
  margin-left: 8px;
}

html.paypos-android-webview input,
html.paypos-android-webview select,
html.paypos-android-webview textarea {
  min-width: 0;
}

/* -------------------------------------------------------------------------
 * Responsive device classes
 *
 *  - The rules above remain the canonical compact layout for 360 x 720 POS
 *    terminals.
 *  - Wider portrait terminals gain breathing room without stretching cards.
 *  - Tablet landscape uses page-specific two-column layouts so that the
 *    additional width shortens, rather than merely enlarges, each workflow.
 * ---------------------------------------------------------------------- */
@media screen and (orientation: portrait) and (min-width: 480px) {
  html.paypos-android-webview .screen {
    max-width: 560px;
    padding: 24px 26px 28px;
    padding-top: calc(24px + env(safe-area-inset-top, 0px));
    padding-right: calc(26px + env(safe-area-inset-right, 0px));
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    padding-left: calc(26px + env(safe-area-inset-left, 0px));
  }

  html.paypos-android-webview .topbar {
    margin-bottom: 18px;
  }

  html.paypos-android-webview .transaction-row {
    min-height: 72px;
    padding: 12px 14px;
  }

  html.paypos-android-webview .transaction-reference,
  html.paypos-android-webview .transaction-amount {
    font-size: 15px;
  }

  html.paypos-android-webview .transaction-detail {
    font-size: 12px;
  }

  html.paypos-android-webview .transaction-created,
  html.paypos-android-webview .transaction-status {
    font-size: 11px;
  }

  html.paypos-android-webview .payment-option,
  html.paypos-android-webview .channel-option {
    min-height: 76px;
    padding-right: 16px;
    padding-left: 16px;
  }

  html.paypos-android-webview .settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  html.paypos-android-webview .settings-field {
    margin-bottom: 0;
  }
}

@media screen and (orientation: portrait) and (min-width: 700px) {
  html.paypos-android-webview .screen {
    max-width: 760px;
    padding-right: 32px;
    padding-left: 32px;
  }

  html.paypos-android-webview body[data-page="list-links"] .transaction-list,
  html.paypos-android-webview body[data-page="paypos-moyens-paiement"] .payment-list,
  html.paypos-android-webview body[data-page="paypos-canaux"] .channel-list,
  html.paypos-android-webview .configurable-payment-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    border: 0;
  }

  html.paypos-android-webview body[data-page="list-links"] .transaction-row {
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  html.paypos-android-webview .payment-option,
  html.paypos-android-webview .channel-option {
    height: 100%;
    margin-bottom: 0;
  }
}

@media screen and (orientation: landscape) and (min-width: 700px) {
  html.paypos-android-webview {
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  html.paypos-android-webview body {
    min-height: 100%;
    overflow-y: visible;
  }

  html.paypos-android-webview .screen {
    width: 100%;
    max-width: 1180px;
    min-height: 100vh;
    height: auto;
    margin: 0 auto;
    padding: 14px 28px 20px;
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
    padding-right: calc(28px + env(safe-area-inset-right, 0px));
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    padding-left: calc(28px + env(safe-area-inset-left, 0px));
    overflow: visible;
  }

  html.paypos-android-webview .topbar {
    min-height: 42px;
    margin-bottom: 12px;
  }

  html.paypos-android-webview .logo {
    font-size: 23px;
  }

  html.paypos-android-webview h1 {
    font-size: 21px;
  }

  html.paypos-android-webview .pos-action-dock {
    position: static;
    margin-top: 0;
    padding-top: 10px;
    padding-bottom: 0;
    background: transparent;
  }

  html.paypos-android-webview .settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  html.paypos-android-webview .settings-field {
    margin-bottom: 0;
  }

  /* Dashboard: activity summary on the left, five recent links on the right. */
  html.paypos-android-webview body[data-page="paypos-accueil"] {
    height: auto;
    overflow-y: visible;
  }

  html.paypos-android-webview body[data-page="paypos-accueil"] .screen {
    display: grid;
    grid-template-columns: minmax(280px, .82fr) minmax(390px, 1.18fr);
    grid-auto-rows: auto;
    column-gap: 28px;
    align-content: start;
  }

  html.paypos-android-webview body[data-page="paypos-accueil"] .topbar {
    grid-column: 1 / -1;
  }

  html.paypos-android-webview body[data-page="paypos-accueil"] .draft-notice,
  html.paypos-android-webview body[data-page="paypos-accueil"] .partner-home-banner,
  html.paypos-android-webview body[data-page="paypos-accueil"] .welcome,
  html.paypos-android-webview body[data-page="paypos-accueil"] .turnover-card,
  html.paypos-android-webview body[data-page="paypos-accueil"] .pos-action-dock {
    grid-column: 1;
  }

  html.paypos-android-webview body[data-page="paypos-accueil"] .recent-payments {
    grid-column: 2;
    grid-row: 2 / span 5;
    min-height: 0;
    overflow: visible;
  }

  html.paypos-android-webview body[data-page="paypos-accueil"] .transaction-row {
    min-height: 62px;
    padding: 8px 12px;
  }

  html.paypos-android-webview body[data-page="paypos-accueil"] .turnover-card {
    margin-bottom: 12px;
    padding: 18px;
  }

  html.paypos-android-webview body[data-page="paypos-accueil"] .turnover-amount {
    font-size: 31px;
  }

  /* History: ten links become a balanced two-column card list. */
  html.paypos-android-webview body[data-page="list-links"] .transaction-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    border: 0;
  }

  html.paypos-android-webview body[data-page="list-links"] .transaction-row {
    min-height: 76px;
    height: 100%;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
  }

  html.paypos-android-webview body[data-page="list-links"] .pagination {
    margin-top: 14px;
  }

  /* Amount entry: summary and action remain left, keypad moves right. */
  html.paypos-android-webview body[data-page="paypos-montant"] {
    height: auto;
    overflow-y: visible;
  }

  html.paypos-android-webview body[data-page="paypos-montant"] .screen {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  html.paypos-android-webview body[data-page="paypos-montant"] #amountForm {
    display: grid;
    grid-template-columns: minmax(280px, .85fr) minmax(360px, 1.15fr);
    grid-template-rows: auto auto auto 1fr;
    gap: 10px 28px;
    min-height: 0;
  }

  html.paypos-android-webview body[data-page="paypos-montant"] #amountForm > h1,
  html.paypos-android-webview body[data-page="paypos-montant"] .amount-card,
  html.paypos-android-webview body[data-page="paypos-montant"] .reference-field,
  html.paypos-android-webview body[data-page="paypos-montant"] #amountForm > .pos-action-dock {
    grid-column: 1;
  }

  html.paypos-android-webview body[data-page="paypos-montant"] #amountForm > h1 {
    grid-row: 1;
    margin-bottom: 0;
  }

  html.paypos-android-webview body[data-page="paypos-montant"] .amount-card {
    grid-row: 2;
    min-height: 116px;
    height: 116px;
    margin-bottom: 0;
  }

  html.paypos-android-webview body[data-page="paypos-montant"] .reference-field {
    grid-row: 3;
    min-height: 66px;
    margin-bottom: 0;
  }

  html.paypos-android-webview body[data-page="paypos-montant"] #amountForm > .pos-action-dock {
    grid-row: 4;
    align-self: end;
  }

  html.paypos-android-webview body[data-page="paypos-montant"] .keypad {
    display: grid;
    grid-column: 2;
    grid-row: 1 / span 4;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(54px, 1fr));
    gap: 9px;
    min-height: 286px;
    margin: 0;
  }

  html.paypos-android-webview body[data-page="paypos-montant"] .key,
  html.paypos-android-webview body[data-page="paypos-montant"] .key:nth-last-child(-n+3) {
    width: 100%;
    height: auto;
    min-height: 54px;
    margin: 0;
  }

  html.paypos-android-webview body[data-page="paypos-montant"] .key[data-key="backspace"] {
    order: initial;
  }

  /* Tip choice: amount context on the left, choices on the right. */
  html.paypos-android-webview .tips-page {
    display: grid;
    grid-template-columns: minmax(280px, .82fr) minmax(420px, 1.18fr);
    grid-template-rows: auto 1fr;
    gap: 14px 30px;
    overflow: visible;
  }

  html.paypos-android-webview .tips-heading,
  html.paypos-android-webview .tips-base {
    grid-column: 1;
  }

  html.paypos-android-webview .tips-heading {
    grid-row: 1;
    align-self: end;
    margin-bottom: 0;
  }

  html.paypos-android-webview .tips-base {
    grid-row: 2;
    min-height: 112px;
    margin-bottom: 0;
  }

  html.paypos-android-webview .tips-form {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  html.paypos-android-webview .tips-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  html.paypos-android-webview .tip-option {
    min-height: 126px;
  }

  /* Payment method and channel selection use equal-width cards. */
  html.paypos-android-webview body[data-page="paypos-moyens-paiement"] .payment-list,
  html.paypos-android-webview .configurable-payment-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  html.paypos-android-webview body[data-page="paypos-moyens-paiement"] .payment-option,
  html.paypos-android-webview .configurable-payment-list .payment-option {
    min-height: 78px;
    height: 100%;
    margin-bottom: 0;
  }

  html.paypos-android-webview body[data-page="paypos-canaux"] .screen {
    display: grid;
    grid-template-columns: minmax(280px, .78fr) minmax(420px, 1.22fr);
    grid-template-rows: auto auto 1fr;
    gap: 0 28px;
  }

  html.paypos-android-webview body[data-page="paypos-canaux"] .topbar {
    grid-column: 1 / -1;
  }

  html.paypos-android-webview body[data-page="paypos-canaux"] h1,
  html.paypos-android-webview body[data-page="paypos-canaux"] .transaction-summary {
    grid-column: 1;
  }

  html.paypos-android-webview body[data-page="paypos-canaux"] #channelForm {
    grid-column: 2;
    grid-row: 2 / span 2;
  }

  html.paypos-android-webview body[data-page="paypos-canaux"] .channel-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  html.paypos-android-webview body[data-page="paypos-canaux"] .channel-option {
    min-height: 92px;
    height: 100%;
    margin-bottom: 0;
  }

  /* Settings: identity/language on the left and gratuity setup on the right. */
  html.paypos-android-webview body[data-page="menu-page"] .settings-form:has(.settings-card) {
    display: grid;
    grid-template-columns: minmax(300px, .9fr) minmax(400px, 1.1fr);
    grid-template-rows: auto auto auto;
    gap: 12px 22px;
  }

  html.paypos-android-webview body[data-page="menu-page"] .settings-form:has(.settings-card) .settings-card {
    margin-bottom: 0;
  }

  html.paypos-android-webview body[data-page="menu-page"] .settings-form:has(.settings-card) .settings-card:nth-of-type(1),
  html.paypos-android-webview body[data-page="menu-page"] .settings-form:has(.settings-card) .settings-card:nth-of-type(2) {
    grid-column: 1;
  }

  html.paypos-android-webview body[data-page="menu-page"] .settings-form:has(.settings-card) .settings-card:nth-of-type(3) {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  html.paypos-android-webview body[data-page="menu-page"] .settings-form:has(.settings-card) > .pos-action-dock {
    grid-column: 1 / -1;
  }

  html.paypos-android-webview .tip-percent-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  /* Send: transaction context remains visible while the right side is used. */
  html.paypos-android-webview body[data-page="send-payment"] .screen {
    display: grid;
    grid-template-columns: minmax(280px, .8fr) minmax(400px, 1.2fr);
    grid-template-rows: auto auto auto 1fr;
    gap: 0 30px;
  }

  html.paypos-android-webview body[data-page="send-payment"] .topbar {
    grid-column: 1 / -1;
  }

  html.paypos-android-webview body[data-page="send-payment"] .partner-payment-badge {
    display: none;
  }

  html.paypos-android-webview body[data-page="send-payment"] h1,
  html.paypos-android-webview body[data-page="send-payment"] .transaction-summary {
    grid-column: 1;
  }

  html.paypos-android-webview body[data-page="send-payment"] .form-card,
  html.paypos-android-webview body[data-page="send-payment"] .qr-card,
  html.paypos-android-webview body[data-page="send-payment"] .softpos-capture {
    grid-column: 2;
    grid-row: 2 / span 2;
    align-self: start;
    width: 100%;
    margin-top: 0;
  }

  html.paypos-android-webview body[data-page="send-payment"] .pos-action-dock {
    grid-column: 2;
    grid-row: 4;
    align-self: end;
  }

  html.paypos-android-webview body[data-page="send-payment"] .qr-frame {
    min-height: 220px;
  }

  /* Waiting and paid details: status left, full link data right. */
  html.paypos-android-webview body[data-page="paypos-attente"] .screen,
  html.paypos-android-webview body[data-page="payment-detail"] .screen {
    display: grid;
    grid-template-columns: minmax(310px, .9fr) minmax(390px, 1.1fr);
    grid-template-rows: auto auto auto auto auto;
    gap: 0 24px;
  }

  html.paypos-android-webview body[data-page="paypos-attente"] .topbar,
  html.paypos-android-webview body[data-page="payment-detail"] .topbar,
  html.paypos-android-webview body[data-page="paypos-attente"] > .screen > h1,
  html.paypos-android-webview body[data-page="payment-detail"] > .screen > h1 {
    grid-column: 1 / -1;
  }

  html.paypos-android-webview body[data-page="paypos-attente"] .transaction-summary,
  html.paypos-android-webview body[data-page="payment-detail"] .transaction-summary,
  html.paypos-android-webview body[data-page="paypos-attente"] .state-card,
  html.paypos-android-webview body[data-page="payment-detail"] .state-card {
    grid-column: 1;
  }

  html.paypos-android-webview body[data-page="paypos-attente"] .link-information,
  html.paypos-android-webview body[data-page="payment-detail"] .link-information {
    grid-column: 2;
    grid-row: 3 / span 2;
    align-self: stretch;
    margin-top: 0;
  }

  html.paypos-android-webview body[data-page="paypos-attente"] .actions,
  html.paypos-android-webview body[data-page="payment-detail"] .actions {
    display: flex;
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: stretch;
    margin-top: 14px;
  }

  html.paypos-android-webview body[data-page="paypos-attente"] .actions > *,
  html.paypos-android-webview body[data-page="payment-detail"] .actions > * {
    flex: 1 1 0;
    min-width: 0;
  }

  html.paypos-android-webview body[data-page="paypos-attente"] .actions > * + *,
  html.paypos-android-webview body[data-page="payment-detail"] .actions > * + * {
    margin-top: 0;
    margin-left: 9px;
  }

  html.paypos-android-webview body[data-page="payment-detail"] .receipt-print-actions {
    flex: 2 1 0;
  }

  html.paypos-android-webview body[data-page="payment-detail"] .print-status {
    grid-column: 1 / -1;
  }

  /* Immediate success/failure results keep the transaction beside its state. */
  html.paypos-android-webview body[data-page="paypos-succes"] .screen,
  html.paypos-android-webview body[data-page="paypos-echec"] .screen {
    display: grid;
    grid-template-columns: minmax(300px, .9fr) minmax(390px, 1.1fr);
    grid-template-rows: auto auto auto auto;
    gap: 0 26px;
  }

  html.paypos-android-webview body[data-page="paypos-succes"] .topbar,
  html.paypos-android-webview body[data-page="paypos-echec"] .topbar {
    grid-column: 1 / -1;
  }

  html.paypos-android-webview body[data-page="paypos-succes"] > .screen > h1,
  html.paypos-android-webview body[data-page="paypos-echec"] > .screen > h1,
  html.paypos-android-webview body[data-page="paypos-succes"] .transaction-summary,
  html.paypos-android-webview body[data-page="paypos-echec"] .transaction-summary {
    grid-column: 1;
  }

  html.paypos-android-webview body[data-page="paypos-succes"] .state-card,
  html.paypos-android-webview body[data-page="paypos-echec"] .state-card {
    grid-column: 2;
    grid-row: 2 / span 2;
  }

  html.paypos-android-webview body[data-page="paypos-succes"] .actions,
  html.paypos-android-webview body[data-page="paypos-echec"] .actions {
    display: flex;
    grid-column: 1 / -1;
    flex-direction: row;
    margin-top: 14px;
  }

  html.paypos-android-webview body[data-page="paypos-succes"] .actions > *,
  html.paypos-android-webview body[data-page="paypos-echec"] .actions > * {
    flex: 1 1 0;
    min-width: 0;
  }

  html.paypos-android-webview body[data-page="paypos-succes"] .actions > * + *,
  html.paypos-android-webview body[data-page="paypos-echec"] .actions > * + * {
    margin-top: 0;
    margin-left: 9px;
  }

  /* Login becomes a calm two-panel screen on a counter tablet. */
  html.paypos-android-webview body[data-page="paypos-login"] .screen {
    display: grid;
    grid-template-columns: minmax(280px, .85fr) minmax(390px, 1.15fr);
    grid-template-rows: auto 1fr;
    gap: 0 54px;
    align-items: center;
  }

  html.paypos-android-webview body[data-page="paypos-login"] .topbar {
    grid-column: 1 / -1;
    align-self: start;
  }

  html.paypos-android-webview body[data-page="paypos-login"] .intro {
    grid-column: 1;
    grid-row: 2;
    margin-bottom: 0;
    text-align: left;
  }

  html.paypos-android-webview body[data-page="paypos-login"] .login-form {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    max-width: 520px;
    justify-self: end;
  }
}

/* A8 can report a short CSS viewport after system/navigation bars. */
@media screen and (orientation: landscape) and (min-width: 700px) and (max-height: 560px) {
  html.paypos-android-webview .screen {
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  html.paypos-android-webview .topbar {
    margin-bottom: 8px;
  }

  html.paypos-android-webview body[data-page="paypos-montant"] .keypad {
    min-height: 248px;
  }

  html.paypos-android-webview body[data-page="paypos-montant"] .amount-card {
    min-height: 96px;
    height: 96px;
  }

  html.paypos-android-webview body[data-page="paypos-attente"] .state-card,
  html.paypos-android-webview body[data-page="payment-detail"] .state-card {
    padding-top: 12px;
  }

  html.paypos-android-webview body[data-page="paypos-attente"] .waiting-icon,
  html.paypos-android-webview body[data-page="payment-detail"] .success-icon {
    width: 54px;
    height: 54px;
    margin-bottom: 8px;
  }
}
