/* Shared responsive overrides. Load after each page's existing inline styles. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

img {
  max-width: 100%;
}

.top,
.brand,
.brand > div,
.header-actions,
.banner-inner,
.layout > *,
.fields > *,
.card,
.portal-fields,
form,
aside {
  min-width: 0;
}

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

.banner-inner,
.privacy-document,
.notice,
.privacy-error,
.lookup-note,
.help,
.foot,
.card h2,
.card h3 {
  overflow-wrap: anywhere;
}

.banner-inner {
  width: 100%;
}

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

select {
  text-overflow: ellipsis;
}

.privacy-document {
  max-width: 100%;
  overscroll-behavior: contain;
}

.summary > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

.summary > span:first-child {
  flex: 0 1 42%;
}

.summary > strong {
  flex: 1 1 58%;
  text-align: right;
}

.total {
  gap: 16px;
  flex-wrap: wrap;
}

.total strong {
  margin-left: auto;
  overflow-wrap: anywhere;
}

/* The same sheet also fits the handoff and transaction-result layouts. */
body > header > a {
  min-width: 0;
  overflow-wrap: anywhere;
}

body > header > a > img {
  flex-shrink: 0;
}

body > main:not(.wrap) {
  min-width: 0;
  overflow-wrap: anywhere;
}

body > main:not(.wrap) dl {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body > main:not(.wrap) dt,
body > main:not(.wrap) dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 1024px) {
  .wrap {
    padding-right: 24px;
    padding-left: 24px;
  }

  .top {
    min-height: 82px;
    flex-wrap: wrap;
    gap: 12px 24px;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .brand {
    flex: 1 1 360px;
    max-width: 100%;
  }

  .brand strong {
    line-height: 1.4;
  }

  .header-link {
    display: none;
  }

  .header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    margin-left: auto;
  }

  .header-actions .badge {
    max-width: 220px;
    white-space: normal;
    text-align: right;
  }

  .language-switch {
    flex-shrink: 0;
  }

  .language-switch a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding-bottom: 40px;
  }

  .steps {
    flex-wrap: wrap;
    gap: 14px 24px;
  }

  .step,
  .num {
    flex-shrink: 0;
  }

  input:not([type="checkbox"]):not([type="hidden"]),
  select {
    font-size: 16px;
    min-height: 48px;
  }

  button,
  .button,
  .start-link {
    min-height: 48px;
    font-size: 16px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .identity .lookup {
    grid-template-columns: minmax(0, 260px) minmax(150px, 180px);
  }

  .identity #person-id,
  .identity #payer-id {
    max-width: 260px;
  }

  .banner h1 {
    font-size: clamp(28px, 4vw, 38px);
    line-height: 1.25;
  }

  .banner p {
    font-size: clamp(16px, 2.2vw, 19px);
  }
}

@media (max-width: 600px) {
  .wrap {
    padding-right: 16px;
    padding-left: 16px;
  }

  .top {
    gap: 12px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .brand {
    flex-basis: 100%;
    gap: 12px;
  }

  .seal {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
  }

  .brand strong {
    max-width: none;
    font-size: 14px;
  }

  .brand small {
    font-size: 12px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .header-actions .badge {
    flex: 0 1 auto;
    font-size: 12px;
    text-align: left;
  }

  .banner {
    min-height: 390px;
  }

  .banner-inner {
    padding: 32px 20px;
  }

  .banner .eyebrow {
    font-size: 11px;
    letter-spacing: 1.5px;
  }

  .banner-logo {
    width: 108px;
    height: 96px;
    margin-bottom: 8px;
  }

  .intro {
    padding: 28px 0 24px;
  }

  .intro h2 {
    font-size: 24px;
    line-height: 1.35;
  }

  .steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: start;
    gap: 14px 10px;
    padding-bottom: 24px;
    font-size: 13px;
  }

  .step {
    min-width: 0;
    align-items: flex-start;
    line-height: 1.5;
    gap: 8px;
  }

  .num {
    width: 26px;
    height: 26px;
  }

  .card,
  .card.aside {
    padding: 20px;
  }

  .card h2 {
    font-size: 20px;
    line-height: 1.4;
  }

  .sub {
    margin-bottom: 20px;
  }

  .fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .privacy-document {
    max-height: 320px;
    padding: 14px;
  }

  .privacy summary {
    min-height: 44px;
    padding: 8px 0;
  }

  .privacy-check {
    gap: 12px;
  }

  .privacy-check label {
    min-height: 44px;
  }

  .identity .lookup {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .identity .lookup-input > label {
    grid-column: 1;
  }

  .identity #person-id {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    max-width: 260px;
  }

  .identity .lookup > button {
    grid-column: 1;
    grid-row: 3;
    width: min(100%, 200px);
    min-height: 48px;
  }

  .identity #id-help {
    grid-column: 1;
    grid-row: 4;
  }

  .total {
    align-items: baseline;
    gap: 8px 12px;
  }

  .total strong {
    font-size: 24px;
  }

  .foot,
  .footer-blue .foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  body > header > a {
    gap: 12px;
    font-size: 14px;
    line-height: 1.45;
  }

  body > main:not(.wrap) {
    margin: 20px 16px;
    padding: 24px 20px;
  }

  body > main:not(.wrap) h1 {
    font-size: 24px;
    line-height: 1.35;
  }
}

@media (max-width: 380px) {
  .card,
  .card.aside {
    padding: 16px;
  }

  .banner-inner {
    padding-right: 16px;
    padding-left: 16px;
  }

  .language-switch a {
    padding-right: 7px;
    padding-left: 7px;
  }

  .header-actions {
    gap: 8px;
  }

  .header-actions .badge {
    max-width: 160px;
  }

  body > main:not(.wrap) dl {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  body > main:not(.wrap) dd {
    margin-bottom: 12px;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
