/* Mobile finance uses the current customer pages and their existing runtime.
   Keep this file after the shared finance and customer typography styles. */
body[data-cd-mobile="true"].cd-finance-page .fw-main {
  width: calc(100% - 40px);
  max-width: 720px;
  margin-inline: auto;
  padding: 0 0 calc(40px + env(safe-area-inset-bottom, 0px));
}

body[data-cd-mobile="true"] .fw-main .fw-layout,
body[data-cd-mobile="true"] .fw-main .fw-conditions,
body[data-cd-mobile="true"] .fw-main .fw-benefit-grid,
body[data-cd-mobile="true"] .fw-main .fw-benefit-card dl,
body[data-cd-mobile="true"] .fw-main .fw-totals {
  grid-template-columns: minmax(0, 1fr);
}

body[data-cd-mobile="true"] .fw-main .fw-layout { gap: 28px; }
body[data-cd-mobile="true"] .fw-main .fw-conditions { position: static; }
body[data-cd-mobile="true"] .fw-main :is(.fw-results, .fw-field, .fw-offer, .fw-offer-heading > div, .fw-benefit-card, .fw-totals > div) {
  min-width: 0;
}

body[data-cd-mobile="true"] .fw-main :is(.fw-field select, .fw-sort select, .fw-input input) {
  min-height: 48px;
  font-size: 16px;
}

body[data-cd-mobile="true"] .fw-main :is(.fw-button, .fw-link, .fw-reset, .fw-term-button, .fw-filters button),
body[data-cd-mobile="true"] :is(.fw-service-primary, .fw-service-secondary, .cd-finance-notice-link) {
  min-height: 44px;
  touch-action: manipulation;
}

body[data-cd-mobile="true"] .fw-main .fw-term-button { min-width: 44px; }
body[data-cd-mobile="true"] .fw-main .fw-filters { gap: 8px; }
body[data-cd-mobile="true"] .fw-main .fw-filters button { font-size: 13px; }
body[data-cd-mobile="true"] .fw-main .fw-result-toolbar {
  align-items: stretch;
  flex-direction: column;
  gap: 14px;
}
body[data-cd-mobile="true"] .fw-main .fw-sort select { max-width: none; }

body[data-cd-mobile="true"] .fw-main .fw-offer-heading {
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}
body[data-cd-mobile="true"] .fw-main .fw-offer-heading > div:first-child {
  grid-template-columns: auto minmax(0, 1fr);
}
body[data-cd-mobile="true"] .fw-main .fw-offer-value { align-self: flex-end; }
body[data-cd-mobile="true"].cd-finance-page[data-page] .fw-main .fw-metrics {
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
body[data-cd-mobile="true"] .fw-main .fw-metrics dd {
  white-space: normal;
  overflow-wrap: anywhere;
}
body[data-cd-mobile="true"] .fw-main :is(.fw-metrics dt, .fw-offer-kind, .fw-offer-heading p, .fw-offer-value > span, .fw-result-note, .fw-help, .fw-row-bottom > p, #fw-count, .fw-benefit-basis, .fw-benefit-total small) {
  font-size: 13px;
  line-height: 1.7;
}
body[data-cd-mobile="true"] .fw-main .fw-row-bottom {
  flex-direction: column;
  align-items: stretch;
}
body[data-cd-mobile="true"] .fw-main .fw-row-bottom > p { max-width: none; }
body[data-cd-mobile="true"] .fw-main .fw-row-actions {
  align-self: stretch;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}
body[data-cd-mobile="true"] .fw-main .fw-row-actions .fw-button { flex: 1 1 140px; }
body[data-cd-mobile="true"] .fw-main :is(.fw-button, .fw-link) { white-space: normal; }
body[data-cd-mobile="true"] .fw-main :is(.fw-offer h3, .fw-benefit-product, .fw-benefit-total, .fw-bridge) {
  overflow-wrap: anywhere;
}
body[data-cd-mobile="true"] .fw-main .fw-totals > div {
  flex-wrap: wrap;
  gap: 6px 16px;
}
body[data-cd-mobile="true"] .fw-main .fw-totals dd { margin-left: auto; }
body[data-cd-mobile="true"] .fw-main .fw-table-scroll {
  max-width: 100%;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
body[data-cd-mobile="true"] .fw-main .fw-help-bar {
  align-items: stretch;
  flex-direction: column;
}

/* Preserve modal open/closed and step visibility rules controlled by the runtime. */
body[data-cd-mobile="true"].cd-finance-page .modal {
  box-sizing: border-box;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
}
body[data-cd-mobile="true"].cd-finance-page .modal-box {
  max-width: 600px;
  max-height: calc(100dvh - max(12px, env(safe-area-inset-top, 0px)) - max(12px, env(safe-area-inset-bottom, 0px)));
  overscroll-behavior-y: contain;
}
body[data-cd-mobile="true"].cd-finance-page :is(.modal-head, .modal-body) { padding: 20px 16px; }
body[data-cd-mobile="true"].cd-finance-page .modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: inherit;
  gap: 12px;
}
body[data-cd-mobile="true"].cd-finance-page .modal-head > div { min-width: 0; }
body[data-cd-mobile="true"].cd-finance-page .modal-head h3 { overflow-wrap: anywhere; }
body[data-cd-mobile="true"].cd-finance-page .modal-close,
body[data-cd-mobile="true"] .cd-notice-close {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}
body[data-cd-mobile="true"].cd-finance-page .application-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 12px minmax(0, 1fr) 12px minmax(0, 1fr);
  gap: 4px;
}
body[data-cd-mobile="true"].cd-finance-page .application-progress button {
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  min-height: 56px;
  gap: 6px;
}
body[data-cd-mobile="true"].cd-finance-page .application-progress span { font-size: 12px; }
body[data-cd-mobile="true"].cd-finance-page :is(.application-step, .combined-amount-fields, .payment-method-grid) {
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}
body[data-cd-mobile="true"].cd-finance-page .application-step :is(input:not([type="hidden"]):not([type="radio"]):not([type="checkbox"]), select, textarea) {
  min-width: 0;
  min-height: 48px;
  font-size: 16px;
}
body[data-cd-mobile="true"].cd-finance-page :is(.payment-method-card, .privacy-check, .application-nav .btn) {
  min-height: 48px;
}
body[data-cd-mobile="true"].cd-finance-page .payment-method-card > span { min-width: 0; }
body[data-cd-mobile="true"].cd-finance-page :is(.field-caption, .field-help, .third-party-note, .combined-amount-fields p, .privacy-detail, .application-modal .cd-finance-roles) {
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
body[data-cd-mobile="true"].cd-finance-page .privacy-detail > summary {
  min-height: 44px;
  box-sizing: border-box;
  padding-block: 10px;
  cursor: pointer;
}
body[data-cd-mobile="true"].cd-finance-page .application-nav { flex-wrap: wrap; }
body[data-cd-mobile="true"].cd-finance-page .application-nav .btn { padding: 12px 16px; }
body[data-cd-mobile="true"] .cd-notice-dialog {
  box-sizing: border-box;
  max-width: calc(100% - 24px);
  max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overscroll-behavior-y: contain;
}
body[data-cd-mobile="true"] .cd-finance-notice > summary { min-height: 44px; }

/* Existing guide layouts already stack; enlarge only their short text links. */
body[data-cd-mobile="true"] :is(.cd-finance-notice-link, .fg-breadcrumb a, .fg-source a, .fg-note a, .fw-service-route > a, .cs-partner-actions > a) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  touch-action: manipulation;
}
