@layer pages {
  .payment-heading { margin-bottom: 24px; }
  .payment-heading h1 { font-size: clamp(2.1rem, 4vw, 3rem); }
  .payment-heading p { margin-top: 10px; }
  .payment-navigation { display: flex; gap: 28px; border-bottom: 1px solid var(--line); }
  .payment-navigation a { display: inline-flex; align-items: center; min-height: 48px; padding: 10px 0; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-size: .88rem; text-decoration: none; }
  .payment-navigation a[aria-current] { border-color: var(--green); color: var(--green); font-weight: 650; }
  .payment-navigation a:hover { color: var(--green); }
  .payment-content { padding-top: 28px; }
  .payment-attention { border: 1px solid #c8bfa6; border-radius: 12px; background: #f4f0e5; padding: 20px 24px; margin-bottom: 24px; }
  .payment-attention h2 { font-size: 1.05rem; }
  .payment-attention > .muted { margin-top: 4px; font-size: .82rem; }
  .payment-attention .billing-notice { margin-top: 10px; max-width: 75ch; }
  .payment-attention .button { margin-top: 16px; }
  .payment-summary { display: grid; gap: 32px; }
  .payment-summary-with-estimate { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
  .payment-primary { min-width: 0; }
  .payment-primary .billing-panel { margin: 0 0 20px; }
  .payment-primary .billing-panel:last-child { margin-bottom: 0; }
  .payment-primary h2 { font-size: 1.12rem; }
  .payment-available { flex-basis: 100%; }
  .payment-wallet-balances.funding-balances { margin: 18px 0 22px; gap: 18px 32px; }
  .payment-wallet-balances dd { font-size: 1.1rem; }
  .payment-wallet-balances .payment-available dd { font-size: clamp(2rem, 4vw, 2.7rem); line-height: 1.2; letter-spacing: -.04em; }
  .payment-wallet-actions { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: center; }
  .payment-more { display: inline-block; margin-top: 20px; }
  .payment-debt .billing-account { margin-top: 16px; }
  .payment-debt .billing-row { padding: 18px 0; gap: 12px; }
  .payment-debt .billing-row h3 { font-size: .95rem; }
  .payment-debt .billing-row .icon { width: 16px; }
  .payment-settled { margin-top: 20px; font-size: 1.3rem; letter-spacing: -.02em; }
  .payment-estimate { padding: 20px 0; min-width: 0; }
  .payment-estimate h2 { font-size: 1.12rem; margin-bottom: 6px; }
  .payment-estimate .billing-estimates { margin-top: 18px; font-size: .86rem; }
  .payment-estimate .billing-estimates > div { border-bottom: 1px solid var(--line); }
  .payment-estimate-month { margin-top: 24px; }
  .payment-processing { margin-top: 24px; font-size: .85rem; }
  .payment-method-summary { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--line); font-size: .85rem; }
  .payment-method-summary p { margin-top: 5px; font-size: .8rem; }
  .payment-method-summary .text-link { flex-shrink: 0; }
  .payment-method-intro { margin-top: 10px; max-width: 70ch; }
  .payment-activity-month { margin: 24px 0 0; }
  .payment-activity-month > .month-field, .payment-estimate-filter > .month-field { flex: 1 1 180px; width: auto; max-width: 260px; }
  .payments-page .funding-filters .text-link { font-weight: 500; text-decoration: none; }
  .payments-page .funding-filters [aria-current=page] { font-weight: 650; text-decoration: underline; text-decoration-thickness: 2px; }
  .payment-requests { margin-bottom: 30px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
  .payment-requests > summary { font-size: 1rem; font-weight: 650; }
  .payment-requests > .quiet-note { margin-top: 10px; }
  .payment-activity + .payment-statements { margin-top: 40px; }
  .funding-contexts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 24px; margin: 28px 0; }
  .funding-contexts .billing-panel { margin-top: 0; }
  .funding-model h3 { margin-top: 12px; }
  .funding-wallet { margin-bottom: 24px; }
  .funding-balances { display: flex; gap: 24px 40px; flex-wrap: wrap; margin: 24px 0; }
  .funding-balances dt { color: var(--muted); font-size: .85rem; }
  .funding-balances dd { margin: 6px 0 0; font-weight: 600; font-size: 1.4rem; }
  .funding-change { margin-top: 18px; }
  .funding-step { max-width: 680px; margin: 0 auto; }
  .funding-step h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); margin: 14px 0 24px; }
  .funding-form { display: grid; gap: 22px; margin-top: 24px; }
  .funding-options { display: grid; gap: 10px; padding: 0; border: 0; margin: 0; }
  .funding-options legend { font-weight: 600; margin-bottom: 12px; }
  .funding-options label { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
  .funding-options input { width: 18px; height: 18px; margin: 0; accent-color: var(--green); }
  .funding-options label:has(input:checked) { border-color: var(--green); background: var(--sage); }
  .funding-confirmation { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px; margin-top: 32px; }
  .funding-filters { display: flex; flex-wrap: wrap; gap: 12px 22px; margin: 24px 0; }
  .funding-filters [aria-current=page] { font-weight: 700; text-decoration-thickness: 2px; }
  .billing-overview { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
  .billing-panel, .statement-document { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; min-width: 0; }
  .billing-panel > h2 { margin-bottom: 16px; }
  .billing-panel + .billing-panel, .statement-document + .billing-panel { margin-top: 24px; }
  .billing-overview .billing-panel { margin-top: 0; }
  .billing-account { margin-top: 22px; }
  .billing-account + .billing-account { padding-top: 20px; border-top: 1px solid var(--line); }
  .billing-account h3 { font-size: .9rem; color: var(--muted); font-weight: 500; }
  .billing-amount { font-size: 2rem; letter-spacing: -.035em; font-weight: 600; margin-top: 4px; }
  .billing-estimates { margin: 20px 0 0; }
  .billing-estimates > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; padding: 10px 0; }
  .billing-estimates dt { color: var(--muted); }
  .billing-estimates dd { margin: 0; font-weight: 600; }
  .billing-notice { margin-top: 18px; font-size: .85rem; line-height: 1.55; }
  .billing-archive { margin-top: 44px; }
  .billing-section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
  .billing-section-heading p { font-size: .85rem; }
  .billing-row { display: flex; align-items: center; gap: 22px; padding: 24px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
  .billing-row:hover h3 { text-decoration: underline; text-underline-offset: 4px; }
  .billing-row > div { flex: 1; min-width: 0; }
  .billing-row p { font-size: .82rem; margin-top: 4px; }
  .billing-row-total { flex-shrink: 0; text-align: right; }
  .billing-row-total strong, .billing-status { display: block; }
  .billing-status { font-size: .8rem; color: var(--muted); margin-top: 4px; }
  .billing-empty { padding: 24px 0; color: var(--muted); }
  .billing-back { display: inline-block; margin-bottom: 26px; }
  .billing-month-filter { display: flex; align-items: end; flex-wrap: wrap; gap: 14px; margin-bottom: 36px; }
  .billing-month-filter > div { width: 220px; max-width: 100%; }
  .billing-month-filter > .button, .billing-month-filter input[type=month], .month-selection { min-height: 48px; font-size: .9rem; line-height: 1.5; }
  .billing-estimate-filter { margin: 22px 0 0; }
  .month-picker { position: relative; }
  .month-selection { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; list-style: none; }
  .month-selection::-webkit-details-marker { display: none; }
  .month-selection > .icon { width: 18px; height: 18px; }
  .month-selection > .icon:last-child { width: 15px; height: 15px; margin-left: auto; }
  .month-picker[open] > .month-selection { border-color: var(--green); }
  .month-picker[open] > .month-selection > .icon:last-child { transform: rotate(180deg); }
  .month-popover { position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; width: min(320px, calc(100vw - 32px)); padding: 10px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 12px 36px #173c2e25; }
  .month-picker-heading { display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .month-picker-heading strong { font-size: 1.05rem; }
  .month-picker-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding-top: 10px; }
  .month-option { min-width: 0; min-height: 44px; padding: 10px 6px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--ink); font-size: .85rem; cursor: pointer; }
  .month-option:hover { background: var(--paper); }
  .month-option[aria-pressed="true"] { border-color: var(--green); background: var(--sage); color: var(--green); font-weight: 600; }
  .statement-masthead { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
  .statement-masthead > p { font-size: .8rem; text-align: right; }
  .statement-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 26px 0 32px; }
  .statement-parties dt { font-size: .8rem; color: var(--muted); }
  .statement-parties dd { margin: 6px 0 0; font-weight: 600; }
  .statement-lines-title { font-size: 1rem; }
  .statement-lines { list-style: none; padding: 0; margin: 12px 0 0; }
  .statement-lines li { display: grid; grid-template-columns: 128px minmax(0, 1fr) auto; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--line); font-size: .86rem; }
  .statement-date { color: var(--muted); }
  .statement-meal span { display: block; margin-top: 4px; }
  .statement-line-amount { white-space: nowrap; text-align: right; }
  .statement-total { display: flex; justify-content: space-between; gap: 20px; padding-top: 24px; font-size: 1.2rem; }
  .payment-attempts { list-style: none; padding: 0; margin: 22px 0 0; }
  .payment-attempts li { display: flex; justify-content: space-between; gap: 20px; padding: 16px 0; border-top: 1px solid var(--line); font-size: .86rem; }
  .payment-attempts span { display: block; margin-top: 4px; }
  .billing-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
  .billing-block-form { display: flex; align-items: end; flex-wrap: wrap; gap: 16px; margin-top: 22px; }
  .billing-block-form > div { flex: 1; min-width: min(220px, 100%); }
  .billing-finalize { margin-top: 24px; }
}
@layer responsive {
  @media (max-width: 720px) {
    .payment-summary-with-estimate { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .payment-estimate { padding: 14px 0 0; }
    .payment-navigation { gap: 24px; }
    .payment-attention { padding: 18px; }
    .payment-content { padding-top: 22px; }
    .billing-overview { grid-template-columns: 1fr; gap: 18px; }
    .statement-lines li { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; }
    .statement-meal { grid-row: 2; grid-column: 1 / -1; }
    .statement-line-amount { grid-row: 1; grid-column: 2; }
    .billing-row { gap: 12px; }
    .billing-row > .icon { display: none; }
    .billing-panel, .statement-document { padding: 22px; }
  }
  @media (max-width: 420px) {
    .payment-navigation { gap: 18px; }
    .payment-navigation a { font-size: .82rem; }
    .statement-parties { grid-template-columns: 1fr; }
    .statement-masthead { flex-direction: column; }
    .statement-masthead > p { text-align: left; }
    .billing-row { flex-wrap: wrap; }
    .billing-row > div { flex-basis: 100%; }
    .billing-row-total { display: flex; align-items: baseline; justify-content: space-between; width: 100%; text-align: left; }
  }
}
