/* W-2259: the affiliate program picture (ladder, estimator, founding, rewards, gifts, facts). One sheet for
   navstak.com/affiliates and Mission > Account > Affiliate. Colours are the cockpit tokens only (dark and light follow
   the page theme); in Mission the tiles take the cockpit's cut corner. No fixed colours, nothing wider than its box.
   Accent-coloured TEXT uses --nsc-acc-text (public-accent.js: the gear's hue at a lightness that reads on this theme); borders,
   bars and fills keep --nsc-holo. */
.afp { container-type: inline-size; --afp-r: 10px; --afp-fn: var(--nsc-f-n, var(--f, inherit)); --afp-fd: var(--nsc-f-d, var(--f, inherit)); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
html.ns-cockpit .afp { --afp-r: 2px 8px 2px 8px; }
.afp-sec { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.afp-lab { font: 600 12px/1.2 var(--afp-fd); letter-spacing: .1em; text-transform: uppercase; color: var(--nsc-mute); }
.afp-num { font-family: var(--afp-fn); font-variant-numeric: tabular-nums; }
.afp-note { font: 400 12px/1.3 var(--afp-fd); color: var(--nsc-mute); }
.afp-wait { padding: 14px; border: 1px dashed var(--nsc-line); border-radius: var(--afp-r); color: var(--nsc-mute); font: 400 13px/1.4 var(--afp-fd); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* ladder: columns that rise with the rate; rows with a growing bar on a phone */
.afp-ladder { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; align-items: end; }
.afp-rung { position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 10px; border: 1px solid var(--nsc-line); border-radius: var(--afp-r); background: var(--nsc-well); overflow: hidden;
  padding-top: calc(16px + var(--afp-h, 0) * 96px); }
.afp-rung > * { position: relative; }
.afp-rung .afp-bar { position: absolute; inset: 0 0 auto 0; height: calc(6px + var(--afp-h, 0) * 96px);
  background: linear-gradient(to top, color-mix(in srgb, var(--nsc-holo) 30%, transparent), color-mix(in srgb, var(--nsc-holo) 6%, transparent)); border-bottom: 2px solid var(--nsc-holo); }
.afp-rung strong { font: 700 24px/1.05 var(--afp-fn); color: var(--nsc-ink); letter-spacing: -.01em; overflow-wrap: anywhere; }
.afp-range { font: 600 13px/1.2 var(--afp-fn); color: var(--nsc-ink); }
.afp-rung.is-on { border-color: var(--nsc-holo); box-shadow: inset 0 0 0 1px var(--nsc-holo); }
.afp-rung.is-est { border-color: var(--nsc-holo); }
.afp-rung.is-est strong { color: var(--nsc-acc-text, var(--nsc-holo)); }
.afp-keep { min-height: 32px; }
.afp-chips { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 4px; margin-top: 4px; min-height: 48px; }
.afp-chip { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border: 1px solid var(--nsc-line); border-radius: 999px; font: 600 11px/1 var(--afp-fd); color: var(--nsc-mute); white-space: nowrap; }
.afp-chip.is-reward, .afp-chip.is-on { color: var(--nsc-acc-text, var(--nsc-holo)); border-color: var(--nsc-holo); }
.afp-chip.is-on { align-self: flex-start; margin-top: 4px; }

/* tiles */
.afp-tiles, .afp-est-out { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.afp-strip { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.afp-strip .afp-chip { min-height: 30px; padding: 0 10px; font-size: 12px; color: var(--nsc-ink); gap: 6px; }
.afp-strip .afp-chip b { color: var(--nsc-acc-text, var(--nsc-holo)); font-family: var(--afp-fn); }
.afp-tile { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px; border: 1px solid var(--nsc-line); border-radius: var(--afp-r); background: var(--nsc-well); }
.afp-tile strong { font: 700 22px/1.1 var(--afp-fn); color: var(--nsc-ink); overflow-wrap: anywhere; }
.afp-tile.is-accent strong, .afp-tile.is-total strong { color: var(--nsc-acc-text, var(--nsc-holo)); }
.afp-tile.is-total { border-color: var(--nsc-holo); }

/* estimator */
.afp-est { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--nsc-line); border-radius: var(--afp-r); background: var(--nsc-fill, transparent); min-width: 0; }
.afp-est-in { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: end; }
.afp-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.afp-inp { min-height: 44px; width: 100%; box-sizing: border-box; padding: 0 12px; border: 1px solid var(--nsc-line); border-radius: var(--afp-r); background: var(--nsc-well); color: var(--nsc-ink); font: 600 15px/1 var(--afp-fn); }
.afp-inp.afp-off { display: flex; align-items: center; color: var(--nsc-mute); font: 400 13px/1.2 var(--afp-fd); }
.afp-inp:focus-visible, .afp-pick:focus-visible, .afp-q summary:focus-visible { outline: 2px solid var(--nsc-holo); outline-offset: 2px; }
.afp-picks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.afp-pick { min-height: 44px; min-width: 44px; padding: 0 12px; border: 1px solid var(--nsc-line); border-radius: 999px; background: var(--nsc-well); color: var(--nsc-ink); font: 600 12px/1 var(--afp-fn); cursor: pointer; }
.afp-pick:hover { border-color: var(--nsc-holo); }
.afp-flag { align-self: flex-start; display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px; border: 1px solid var(--nsc-line); border-radius: 999px; font: 600 11px/1 var(--afp-fd); letter-spacing: .08em; text-transform: uppercase; color: var(--nsc-mute); }

/* details behind "?" */
.afp-qs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px; }
.afp-q { border: 1px solid var(--nsc-line); border-radius: var(--afp-r); background: var(--nsc-well); min-width: 0; }
.afp-q summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px; cursor: pointer; list-style: none; font: 600 13px/1.2 var(--afp-fd); color: var(--nsc-ink); }
.afp-q summary::-webkit-details-marker { display: none; }
.afp-q summary b { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--nsc-line); display: inline-grid; place-items: center; color: var(--nsc-acc-text, var(--nsc-holo)); font-size: 12px; }
.afp-q[open] summary b { background: var(--nsc-acc-text, var(--nsc-holo)); color: var(--nsc-bg); }
.afp-q > div { padding: 0 12px 12px; font: 400 13px/1.45 var(--afp-fd); color: var(--nsc-mute); }

/* rows when the program's own box is too narrow for seven columns (a phone, or Mission's content column on a tablet) */
@container (max-width: 800px) {
  .afp-ladder { grid-template-columns: 1fr; align-items: stretch; gap: 6px; }
  .afp-rung { padding: 10px 10px 14px 12px; display: grid; grid-template-columns: minmax(84px, auto) minmax(0, 1fr); column-gap: 10px; row-gap: 2px; align-items: baseline; }
  .afp-rung .afp-bar { inset: auto auto 0 0; height: 4px; width: calc(4% + var(--afp-h, 0) * 96%); border-bottom: 0; background: var(--nsc-holo); }
  .afp-rung strong { grid-row: span 2; font-size: 22px; }
  .afp-rung .afp-note, .afp-rung .afp-range { grid-column: 2; }
  .afp-keep { min-height: 0; }
  .afp-rung .afp-chips { grid-column: 1 / -1; min-height: 0; }
  .afp-rung .afp-chip.is-on { grid-column: 1 / -1; }
  .afp-est-in { grid-template-columns: 1fr; }
}

/* folds (Mission, below the application form): each section opens on its own */
.afp-fold { border: 1px solid var(--nsc-line); border-radius: var(--afp-r); background: var(--nsc-fill, transparent); min-width: 0; }
.afp-fold > summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px; cursor: pointer; list-style: none; }
.afp-fold > summary::-webkit-details-marker { display: none; }
.afp-fold > summary .afp-lab { color: var(--nsc-ink); }
.afp-fold > summary b { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--nsc-line); display: inline-grid; place-items: center; color: var(--nsc-acc-text, var(--nsc-holo)); font-size: 14px; line-height: 1; }
.afp-fold > summary b::before { content: "+"; }
.afp-fold[open] > summary b::before { content: "\2212"; }
.afp-fold > summary:focus-visible { outline: 2px solid var(--nsc-holo); outline-offset: 2px; }
.afp-fold-b { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; min-width: 0; }
.afp.is-fold { gap: 6px; }

/* two tiles a row on a narrow box, and an odd last tile takes the whole row: no orphan beside an empty cell */
@container (max-width: 640px) {
  .afp-tiles, .afp-est-out { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .afp-tiles > :last-child:nth-child(odd), .afp-est-out > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
