/* Form runtime (public/assets/js/form-engine.js). Prefix yf-. Tokens from tokens.css (Direction D); controls and .btn come from base.css (load both first). */
.yf-form { display: grid; gap: var(--gwc-space-5); min-width: 0; }
.yf-form [hidden] { display: none !important; }
.yf-note { margin: 0; font-size: var(--gwc-fs-sm); color: var(--gwc-text-muted); }

/* 12-column grid: yf-w-full 12, twothirds 8, half 6, third 4, quarter 3. One column below 40rem. */
.yf-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gwc-space-5) var(--gwc-space-5); }
.yf-field { grid-column: 1 / -1; min-width: 0; }
.yf-field > :last-child { margin-bottom: 0; }
@media (min-width: 40rem) {
  .yf-w-twothirds { grid-column: span 8; }
  .yf-w-half { grid-column: span 6; }
  .yf-w-third { grid-column: span 4; }
  .yf-w-quarter { grid-column: span 3; }
}

.yf-label { display: block; margin: 0 0 var(--gwc-space-2); font-weight: var(--gwc-fw-semibold); font-size: var(--gwc-fs-sm); color: var(--gwc-ink); max-width: none; }
.yf-req { color: var(--gwc-error); font-weight: var(--gwc-fw-semibold); }
.yf-field--ph-req { position: relative; }   /* placeholder-only field: the asterisk sits inside the control */
.yf-req--ph { position: absolute; top: 0.8rem; right: 0.9rem; line-height: 1; font-size: 1.1rem; pointer-events: none; }
.yf-req--ph.yf-req--sel { right: 2.3rem; }
.yf-help { margin: var(--gwc-space-1) 0 0; font-size: var(--gwc-fs-sm); color: var(--gwc-text-muted); }
.yf-error { margin: var(--gwc-space-1) 0 0; color: var(--gwc-error); font-size: var(--gwc-fs-sm); font-weight: var(--gwc-fw-semibold); }
.yf-error::before { content: "\26A0\FE0E  "; }
.yf-heading { margin: var(--gwc-space-3) 0 0; font-size: var(--gwc-fs-h4); line-height: var(--gwc-lh-snug); font-weight: var(--gwc-fw-regular); }
.yf-paragraph { margin: 0; color: var(--gwc-text); }

/* Choices: radios, checkboxes, single checkbox and consent */
.yf-options { display: grid; gap: var(--gwc-space-1); }
.yf-choice { display: flex; align-items: flex-start; gap: var(--gwc-space-3); margin: 0; min-height: var(--gwc-tap); padding: var(--gwc-space-2) 0; font-weight: var(--gwc-fw-regular); font-size: var(--gwc-fs-base); color: var(--gwc-text); cursor: pointer; }
.yf-choice input { flex: none; width: 1.25rem; height: 1.25rem; margin: 0.2rem 0 0; accent-color: var(--gwc-primary); cursor: pointer; }
.yf-options:has(.yf-choice) { grid-auto-flow: row; }
.yf-choice.yf-consent { min-height: 0; padding: 0; font-size: var(--gwc-fs-sm); line-height: 1.55; color: var(--gwc-text-muted); }
.yf-consent input { margin-top: 0.1rem; }
.yf-field[data-key] > .yf-choice.yf-consent { max-width: var(--gwc-measure); }
.yf-time12 { display: flex; gap: var(--gwc-space-2); }
.yf-time12 .yf-input { width: auto; min-width: 5rem; }

.yf-calc { display: flex; align-items: center; background: var(--gwc-surface); border-color: var(--gwc-border); font-variant-numeric: tabular-nums; color: var(--gwc-ink); font-weight: var(--gwc-fw-semibold); }
.yf-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Error summary and status */
.yf-summary { border: 1px solid var(--gwc-error); border-left-width: 4px; background: var(--gwc-error-bg); border-radius: var(--gwc-radius-sm); padding: var(--gwc-space-4); }
.yf-summary:focus-visible { outline: 3px solid var(--gwc-focus); outline-offset: 2px; }
.yf-summary__title { margin: 0 0 var(--gwc-space-2); font-family: var(--gwc-font-text); font-size: var(--gwc-fs-base); font-weight: var(--gwc-fw-bold); color: var(--gwc-error); }
.yf-summary ul { margin: 0; padding-left: var(--gwc-space-5); }
.yf-summary a { color: var(--gwc-error); font-weight: var(--gwc-fw-semibold); }
.yf-status { margin: 0; padding: var(--gwc-space-3) var(--gwc-space-4); border-radius: var(--gwc-radius-sm); max-width: none; font-weight: var(--gwc-fw-semibold); }
.yf-ok { background: var(--gwc-success-bg); color: var(--gwc-success); border-left: 4px solid var(--gwc-success); }
.yf-bad { background: var(--gwc-error-bg); color: var(--gwc-error); border-left: 4px solid var(--gwc-error); }
.yf-actions { margin-top: var(--gwc-space-2); }
.yf-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* Steps (page_break): progress list, step title. */
.yf-steps { display: flex; flex-wrap: wrap; gap: var(--gwc-space-2); list-style: none; margin: 0; padding: 0; }
.yf-steps__item { flex: 1 1 8rem; min-width: 0; padding-top: var(--gwc-space-2); border-top: 3px solid var(--gwc-border); font-size: var(--gwc-fs-sm); color: var(--gwc-text-muted); }
.yf-steps__item.is-done { border-top-color: var(--gwc-primary); color: var(--gwc-ink); }
.yf-steps__item.is-current { border-top-color: var(--gwc-primary); color: var(--gwc-ink); font-weight: var(--gwc-fw-bold); }
.yf-step-title { margin: 0; }
.yf-step-title:focus-visible { outline: 3px solid var(--gwc-focus); outline-offset: 2px; }

/* Notice: info | warning | stop. Text with values is plain text (textContent). */
.yf-notice { border: 1px solid var(--gwc-border); border-left-width: 4px; border-radius: var(--gwc-radius-sm); padding: var(--gwc-space-4); background: var(--gwc-surface); }
.yf-notice__text { margin: 0; max-width: none; white-space: pre-line; color: var(--gwc-ink); }
.yf-notice--info { border-left-color: var(--gwc-primary); }
.yf-notice--warning { border-left-color: var(--gwc-gold, #B9873C); background: var(--gwc-warning-bg, var(--gwc-surface)); }
.yf-notice--stop { border-left-color: var(--gwc-error); background: var(--gwc-error-bg); }
.yf-paragraph { white-space: pre-line; }

/* Currency / percent affix around a number input. */
.yf-affix { display: flex; align-items: stretch; }
.yf-affix .yf-input { flex: 1 1 auto; min-width: 0; }
.yf-affix__pre, .yf-affix__post { display: inline-flex; align-items: center; padding-inline: var(--gwc-space-3); border: 1px solid var(--gwc-border); background: var(--gwc-surface); color: var(--gwc-text-muted); }
.yf-affix__pre { border-right: 0; border-radius: var(--gwc-radius-sm) 0 0 var(--gwc-radius-sm); }
.yf-affix__post { border-left: 0; border-radius: 0 var(--gwc-radius-sm) var(--gwc-radius-sm) 0; }
.yf-affix__pre + .yf-input { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.yf-input:has(+ .yf-affix__post) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.yf-prefilled { font-weight: var(--gwc-fw-regular); color: var(--gwc-text-muted); font-size: var(--gwc-fs-sm); }

/* Repeatable rows (group). */
.yf-rows { display: grid; gap: var(--gwc-space-4); margin-bottom: var(--gwc-space-3); }
.yf-row { margin: 0; padding: var(--gwc-space-4); border: 1px solid var(--gwc-border); border-radius: var(--gwc-radius-sm); background: var(--gwc-surface); min-width: 0; }
.yf-row__title { padding: 0 var(--gwc-space-2); font-weight: var(--gwc-fw-bold); font-size: var(--gwc-fs-sm); color: var(--gwc-ink); }
.yf-row__grid { gap: var(--gwc-space-4); }
.yf-row__actions { margin-top: var(--gwc-space-3); }
.yf-addrow, .yf-removerow, .yf-edit { min-height: 44px; }

/* File field: the list of uploaded files. */
.yf-files { list-style: none; margin: var(--gwc-space-2) 0 0; padding: 0; display: grid; gap: var(--gwc-space-2); }
.yf-files__item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--gwc-space-2); padding: var(--gwc-space-2) var(--gwc-space-3); border: 1px solid var(--gwc-border); border-radius: var(--gwc-radius-sm); background: var(--gwc-surface); overflow-wrap: anywhere; }

/* Review step. */
.yf-review { display: grid; gap: var(--gwc-space-5); }
.yf-review__sec { border: 1px solid var(--gwc-border); border-radius: var(--gwc-radius-sm); padding: var(--gwc-space-4); background: var(--gwc-surface); }
.yf-review__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--gwc-space-2); margin-bottom: var(--gwc-space-3); }
.yf-review__h { margin: 0; font-family: var(--gwc-font-text); font-size: var(--gwc-fs-base); font-weight: var(--gwc-fw-bold); color: var(--gwc-ink); }
.yf-review__list { margin: 0; display: grid; gap: var(--gwc-space-2); }
.yf-review__row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--gwc-space-3); }
.yf-review__row dt { font-size: var(--gwc-fs-sm); color: var(--gwc-text-muted); }
.yf-review__row dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.yf-review__note { border-left-width: 4px; }
.yf-review__note--flags { border-left-color: var(--gwc-gold, #B9873C); background: var(--gwc-warning-bg, var(--gwc-surface)); }
.yf-review__note--missing { border-left-color: var(--gwc-error); background: var(--gwc-error-bg); }
.yf-review__note ul { margin: var(--gwc-space-2) 0 0; padding-left: var(--gwc-space-5); }
@media (max-width: 40rem) { .yf-review__row { grid-template-columns: 1fr; gap: 0; } }

/* Phone field with the country picker inside the same box: flag + dial code on the left, a searchable list under the box. */
.yf-tel { position: relative; display: flex; align-items: stretch; border: 1px solid var(--gwc-border-strong, var(--gwc-border)); border-radius: var(--gwc-radius-sm); background: var(--gwc-bg, #fff); min-width: 0; }
.yf-tel:focus-within { outline: 3px solid var(--gwc-focus); outline-offset: 2px; }
.yf-field .yf-tel input.yf-tel__input { flex: 1 1 auto; min-width: 0; border: 0; border-radius: 0 var(--gwc-radius-sm) var(--gwc-radius-sm) 0; box-shadow: none; outline: 0; background: transparent; }
.yf-cc { flex: 0 0 auto; display: flex; }
.yf-cc__btn { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 3rem; padding: 0 0.7rem 0 0.8rem; border: 0; border-right: 1px solid var(--gwc-border); border-radius: var(--gwc-radius-sm) 0 0 var(--gwc-radius-sm); background: var(--gwc-surface); color: var(--gwc-ink); font: inherit; font-size: 1rem; cursor: pointer; }
.yf-cc__btn:hover { background: var(--gwc-surface-2, var(--gwc-surface)); }
.yf-cc__btn:focus-visible { outline: 0; background: var(--gwc-bg, #fff); box-shadow: inset 0 0 0 3px var(--gwc-focus); }
.yf-cc__dial { font-variant-numeric: tabular-nums; }
.yf-cc__chev { flex: none; width: 0.45rem; height: 0.45rem; margin: -0.15rem 0 0 0.1rem; border-right: 2px solid var(--gwc-ink); border-bottom: 2px solid var(--gwc-ink); transform: rotate(45deg); }
.yf-cc__btn[aria-expanded="true"] .yf-cc__chev { transform: rotate(-135deg); margin-top: 0.2rem; }
.yf-flag { flex: none; width: 1.25rem; height: 0.9375rem; object-fit: cover; border-radius: 2px; background: var(--gwc-surface-2, #eee); box-shadow: 0 0 0 1px rgb(20 40 75 / 0.22); }
.yf-cc__panel { position: absolute; z-index: 40; left: 0; top: calc(100% + 6px); width: max(100%, 21rem); max-width: calc(100vw - 2rem); background: var(--gwc-bg, #fff); border: 1px solid var(--gwc-border-strong, var(--gwc-border)); border-radius: var(--gwc-radius-sm); box-shadow: 0 12px 32px rgb(20 40 75 / 0.22); overflow: hidden; }
.yf-cc__panel[hidden] { display: none; }
.yf-cc .yf-cc__q { display: block; width: 100%; min-height: 3rem; margin: 0; padding: 0.6rem 0.9rem; border: 0; border-bottom: 1px solid var(--gwc-border); border-radius: 0; box-shadow: none; background: var(--gwc-bg, #fff); font-size: 1rem; }
.yf-cc .yf-cc__q:focus-visible { outline: 3px solid var(--gwc-focus); outline-offset: -3px; }
.yf-cc__list { list-style: none; margin: 0; padding: 0.25rem 0; max-height: 16rem; overflow-y: auto; overscroll-behavior: contain; }
.yf-cc__grp { padding: 0.6rem 0.9rem 0.25rem; font-size: 0.6875rem; font-weight: var(--gwc-fw-semibold); letter-spacing: 0.08em; text-transform: uppercase; color: var(--gwc-text-muted); }
.yf-cc__grp:not(:first-child) { margin-top: 0.25rem; border-top: 1px solid var(--gwc-border); padding-top: 0.75rem; }
.yf-cc__opt { display: flex; align-items: center; gap: 0.7rem; min-height: 2.75rem; padding: 0.4rem 0.9rem; font-size: 1rem; color: var(--gwc-ink); cursor: pointer; }
.yf-cc__opt[hidden], .yf-cc__grp[hidden], .yf-cc__none[hidden] { display: none; }
.yf-cc__opt.is-active { background: var(--gwc-surface-2, var(--gwc-surface)); }
.yf-cc__opt[aria-selected="true"] { font-weight: var(--gwc-fw-semibold); box-shadow: inset 3px 0 0 var(--gwc-accent, var(--gwc-ink)); }
.yf-cc__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yf-cc__code { flex: none; color: var(--gwc-text-muted); font-variant-numeric: tabular-nums; }
.yf-cc__none { padding: 0.9rem; color: var(--gwc-text-muted); font-size: 0.9375rem; }
.yf-input[aria-invalid="true"] { border-color: var(--gwc-error); }
.yf-tel:has([aria-invalid="true"]) { border-color: var(--gwc-error); }

.yf-field textarea.yf-input { display: block; }   /* no inline baseline gap under a textarea */
.yf-captcha { max-width: none; margin: calc(var(--gwc-space-2) - var(--gwc-space-5)) 0 0; font-size: var(--gwc-fs-xs); line-height: 1.4; color: var(--gwc-text-muted); }   /* tucked under the last field (cancels most of the form gap) */
.yf-captcha a { color: inherit; font-weight: 700; text-decoration: none; }
.yf-captcha a:hover { text-decoration: underline; }
