/* Tokens sit in :where() (zero specificity) so a theme can override them with any selector. */
:where(.ft-form, .ft-confirmation) {
	--ft-accent: #1d4ed8;
	--ft-on-accent: #fff;
	--ft-error: #b91c1c;
	--ft-error-bg: #fef2f2;
	--ft-border: #6b7280;
}
.ft-form { max-width: 40rem; }
.ft-field { margin: 0 0 1.25rem; }
.ft-field[hidden], .ft-page[hidden] { display: none; }
.ft-field > label, .ft-field legend { display: block; font-weight: 600; margin-bottom: .35rem; }
.ft-field fieldset { border: 0; margin: 0; padding: 0; }
.ft-field input[type=text], .ft-field input[type=email], .ft-field input[type=tel], .ft-field input[type=number],
.ft-field input[type=date], .ft-field select, .ft-field textarea {
	box-sizing: border-box; width: 100%; min-height: 2.5rem; padding: .5rem .65rem;
	border: 1px solid var(--ft-border); border-radius: 4px; font: inherit; background: #fff; color: #111;
}
.ft-choice { display: flex; align-items: center; gap: .5rem; min-height: 1.75rem; margin: .25rem 0; }
.ft-choice input { width: 1.5rem; height: 1.5rem; min-width: 24px; min-height: 24px; margin: 0; flex: none; }
.ft-choice label { padding-block: .15rem; }
/* Address: one labelled text input per part, stacked. */
.ft-addr-part { margin: 0 0 .75rem; }
.ft-addr-part label { display: block; font-weight: 400; margin-bottom: .2rem; }
/* Rating: real radios, visually stars. Filled vs outline glyph shapes (not colour alone); works without JS. */
.ft-rating { display: flex; flex-wrap: wrap; align-items: center; }
.ft-rating legend { flex: 0 0 100%; }
.ft-rating .ft-star { position: relative; margin: .25rem 0; gap: 0; }
.ft-rating .ft-star input { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 24px; min-height: 24px; opacity: 0; cursor: pointer; z-index: 1; }
.ft-rating .ft-star label { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; padding: 0; font-size: 1.75rem; line-height: 1; color: var(--ft-accent); }
.ft-rating .ft-star label::before { content: "\2606"; content: "\2606" / ""; }
.ft-rating .ft-star:hover label::before, .ft-rating .ft-star:has(~ .ft-star:hover) label::before,
.ft-rating .ft-star input:checked + label::before, .ft-rating .ft-star:has(~ .ft-star input:checked) label::before { content: "\2605"; content: "\2605" / ""; }
.ft-rating:hover .ft-star:hover ~ .ft-star label::before { content: "\2606"; content: "\2606" / ""; }
.ft-rating .ft-star input:focus-visible + label { outline: 3px solid var(--ft-accent); outline-offset: 2px; box-shadow: 0 0 0 2px #fff; }
.ft-rating .ft-star input:focus-visible { outline: 0; box-shadow: none; }
/* White inner ring + accent outline: visible on light and dark host backgrounds. */
.ft-form :focus-visible, .ft-confirmation:focus-visible, .ft-error-summary:focus-visible {
	outline: 3px solid var(--ft-accent); outline-offset: 2px; box-shadow: 0 0 0 2px #fff;
}
/* 2.4.11: keep focused controls clear of a sticky theme header when scrolled into view. */
.ft-form input, .ft-form select, .ft-form textarea, .ft-form button, .ft-form fieldset, .ft-error-summary, .ft-confirmation { scroll-margin-top: 7rem; scroll-margin-bottom: 4rem; }
.ft-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ft-req { color: inherit; }
.ft-error, .ft-error-summary {
	background: var(--ft-error-bg); color: var(--ft-error); border-radius: 4px;
}
.ft-error { margin: .35rem 0 0; padding: .25rem .5rem; width: fit-content; max-width: 100%; font-weight: 600; }
.ft-has-error input, .ft-has-error select, .ft-has-error textarea {
	border-color: var(--ft-error); box-shadow: inset 0 0 0 1px var(--ft-error);
}
.ft-help { margin: .3rem 0 0; font-size: .9em; color: inherit; color: color-mix(in srgb, currentColor 80%, transparent); }
.ft-error-summary { border: 2px solid var(--ft-error); padding: .75rem 1rem; margin-bottom: 1rem; }
.ft-error-summary p { margin: 0 0 .5rem; font-weight: 600; }
.ft-error-summary ul { margin: 0; padding-left: 1.25rem; }
.ft-error-summary a { color: inherit; text-decoration: underline; text-underline-offset: .15em; display: inline-block; min-height: 24px; }
.ft-nav { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.ft-btn { min-height: 44px; min-width: 44px; padding: .6rem 1.25rem; border-radius: 4px; border: 2px solid var(--ft-accent); font: inherit; cursor: pointer; }
.ft-submit, .ft-next { background: var(--ft-accent); color: var(--ft-on-accent); }
.ft-prev { background: #fff; color: var(--ft-accent); }
.ft-btn:disabled { opacity: .6; cursor: wait; }
.ft-progress { font-weight: 600; }
/* Self-contained surface: contrast holds on any host background. */
.ft-confirmation { padding: 1rem; border: 2px solid #15803d; border-radius: 4px; background: #f0fdf4; color: #14532d; }
.ft-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ft-signature .ft-sig-pad { max-width: 600px; border: 2px solid currentColor; border-radius: 4px; background: #fff; }
.ft-signature .ft-sig-canvas { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; touch-action: none; cursor: crosshair; }
.ft-signature .ft-sig-clear { margin: .5rem 0 .75rem; background: #fff; color: var(--ft-accent); }
.ft-signature .ft-sig-clear:focus-visible { outline: 3px solid var(--ft-accent); outline-offset: 2px; }
.ft-repeater .ft-rep-row { margin: 0 0 1rem; padding: .75rem; border: 1px solid currentColor; border-radius: 4px; }
.ft-repeater .ft-rep-title { display: block; margin-bottom: .5rem; font-weight: 600; }
.ft-repeater .ft-rep-cell { margin-bottom: .75rem; }
.ft-repeater .ft-rep-remove, .ft-repeater .ft-rep-add { background: #fff; color: var(--ft-accent); }
.ft-repeater .ft-rep-add[aria-disabled="true"], .ft-repeater .ft-rep-remove[aria-disabled="true"] { opacity: .6; cursor: not-allowed; }
.ft-repeater .ft-rep-add:focus-visible, .ft-repeater .ft-rep-remove:focus-visible { outline: 3px solid var(--ft-accent); outline-offset: 2px; }
.ft-repeater .ft-rep-max[hidden], .ft-repeater .ft-btn[hidden] { display: none; }
.ft-save, .ft-save-panel .ft-btn { background: #fff; color: var(--ft-accent); }
.ft-save:focus-visible, .ft-save-panel .ft-btn:focus-visible, .ft-save-panel input:focus-visible { outline: 3px solid var(--ft-accent); outline-offset: 2px; }
.ft-save[hidden], .ft-save-panel[hidden], .ft-save-panel [hidden] { display: none; }
.ft-save-panel { margin-top: 1rem; padding: .75rem; border: 1px solid currentColor; border-radius: 4px; }
.ft-save-panel label { display: block; margin: .5rem 0 .25rem; }
.ft-save-panel input { min-height: 44px; width: 100%; max-width: 32rem; box-sizing: border-box; margin-bottom: .5rem; }
.ft-resume-notice { padding: .75rem; border: 2px solid currentColor; border-radius: 4px; }
