/* Tona Forms: the form itself. Everything is scoped to .tf so it can sit on
   any website (inside a shadow root for the script embed, inline on the
   hosted page and in the builder preview). Theme comes from --tf-* variables. */
.tf {
  --tf-ink: #171b22; --tf-ink-2: #555e6b; --tf-ink-3: #8a929e;
  --tf-bg: #ffffff; --tf-field: #ffffff; --tf-line: #d2d6dd; --tf-soft: #f3f4f6;
  --tf-bad: #b3261e; --tf-bad-soft: #fbe6e4; --tf-ok: #1d7a4a;
  --tf-accent: #0f6a86; --tf-radius: 10px; --tf-font: inherit;
  --tf-gap: 18px; --tf-h: 42px;
  --tf-accent-soft: color-mix(in srgb, var(--tf-accent) 12%, transparent);
  container-type: inline-size;
  display: block; margin: 0; color: var(--tf-ink); font-family: var(--tf-font); font-size: 15px; line-height: 1.5;
  text-align: left; -webkit-font-smoothing: antialiased;
}
.tf *, .tf *::before, .tf *::after { box-sizing: border-box; }
.tf [hidden] { display: none !important; }
.tf.tf-d-compact { --tf-gap: 12px; --tf-h: 38px; font-size: 14px; }
.tf.tf-m-dark {
  --tf-ink: #eef0f3; --tf-ink-2: #b4bac4; --tf-ink-3: #8a929e; --tf-bg: #171b22; --tf-field: #1f242d; --tf-line: #3a414d; --tf-soft: #242a33;
  --tf-bad: #ff8a80; --tf-bad-soft: rgba(255, 138, 128, .12); --tf-ok: #6fd3a0; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  .tf.tf-m-auto {
    --tf-ink: #eef0f3; --tf-ink-2: #b4bac4; --tf-ink-3: #8a929e; --tf-bg: #171b22; --tf-field: #1f242d; --tf-line: #3a414d; --tf-soft: #242a33;
    --tf-bad: #ff8a80; --tf-bad-soft: rgba(255, 138, 128, .12); --tf-ok: #6fd3a0; color-scheme: dark;
  }
}

.tf-head { margin: 0 0 22px; display: grid; gap: 6px; }
.tf-title { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 600; letter-spacing: -.02em; }
.tf-desc { margin: 0; color: var(--tf-ink-2); }

.tf-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--tf-gap); }
@container (min-width: 440px) {
  .tf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tf-grid > * { grid-column: 1 / -1; }
  .tf-grid > .tf-w-half { grid-column: auto / span 1; }
  .tf-parts-address { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .tf-parts-address .tf-p-street, .tf-parts-address .tf-p-line2 { grid-column: 1 / -1; }
  .tf-parts-address .tf-p-city { grid-column: span 2; } .tf-parts-address .tf-p-state { grid-column: span 2; } .tf-parts-address .tf-p-zip { grid-column: span 2; }
  .tf-parts-address .tf-p-country { grid-column: 1 / -1; }
  .tf-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tf-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* rows: up to four fields side by side; they stack on narrow forms */
.tf-row { display: flex; flex-direction: column; gap: var(--tf-gap) 14px; min-width: 0; }
.tf-row:not(:has(> .tf-field:not([hidden]))) { display: none; }
.tf-row > .tf-field { align-content: start; }
@container (min-width: 440px) {
  .tf-row { flex-flow: row wrap; }
  .tf-row > * { flex: 1 1 0; }
  .tf-row-4 > * { flex-basis: calc(50% - 7px); }
}
@container (min-width: 540px) {
  .tf-row-4 > * { flex-basis: 0; }
}

.tf-field { display: grid; gap: 7px; min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset.tf-field { min-inline-size: 0; }
.tf-label { display: block; padding: 0; font-weight: 600; font-size: .93em; color: var(--tf-ink); }
.tf-req { color: var(--tf-bad); font-weight: 600; }
.tf-help { margin: 0; color: var(--tf-ink-3); font-size: .86em; }
.tf-error { margin: 0; color: var(--tf-bad); font-size: .86em; font-weight: 500; display: flex; gap: 6px; align-items: baseline; }
.tf-error::before { content: "!"; flex: none; display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--tf-bad); color: var(--tf-bg); font-size: 10.5px; font-weight: 700; transform: translateY(2px); }

.tf-input {
  width: 100%; min-width: 0; height: var(--tf-h); padding: 0 12px; margin: 0;
  border: 1px solid var(--tf-line); border-radius: var(--tf-radius); background: var(--tf-field); color: var(--tf-ink);
  font: inherit; font-size: 1em; line-height: 1.4; box-shadow: 0 1px 1px rgba(20, 26, 36, .03);
  transition: border-color .12s, box-shadow .12s; -webkit-appearance: none; appearance: none;
}
textarea.tf-input { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.tf-input::placeholder { color: var(--tf-ink-3); opacity: 1; }
.tf-input:hover { border-color: color-mix(in srgb, var(--tf-ink) 30%, var(--tf-line)); }
.tf-input:focus { outline: none; border-color: var(--tf-accent); box-shadow: 0 0 0 3px var(--tf-accent-soft); }
.tf-invalid .tf-input { border-color: var(--tf-bad); }
.tf-invalid .tf-input:focus { box-shadow: 0 0 0 3px var(--tf-bad-soft); }
.tf-select { position: relative; }
.tf-select::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; border: solid var(--tf-ink-3); border-width: 0 1.6px 1.6px 0; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.tf-select .tf-input { padding-right: 34px; cursor: pointer; }
.tf-count { justify-self: end; font-size: .8em; color: var(--tf-ink-3); font-variant-numeric: tabular-nums; margin-top: -2px; }
.tf-count.tf-over { color: var(--tf-bad); }

/* choices */
.tf-choices { display: grid; gap: 8px; }
.tf-choice {
  position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; min-height: var(--tf-h);
  border: 1px solid var(--tf-line); border-radius: var(--tf-radius); background: var(--tf-field); cursor: pointer;
  transition: border-color .12s, background .12s; font-weight: 450;
}
.tf-choice:hover { border-color: color-mix(in srgb, var(--tf-ink) 30%, var(--tf-line)); }
.tf-choice:has(input:checked) { border-color: var(--tf-accent); background: color-mix(in srgb, var(--tf-accent) 7%, var(--tf-field)); }
.tf-choice:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--tf-accent-soft); }
.tf-choice input[type=radio], .tf-choice input[type=checkbox] {
  flex: none; width: 18px; height: 18px; margin: 1px 0 0; border: 1.5px solid var(--tf-line); background: var(--tf-field);
  -webkit-appearance: none; appearance: none; display: grid; place-items: center; cursor: pointer; transition: border-color .12s, background .12s;
}
.tf-choice input[type=radio] { border-radius: 50%; }
.tf-choice input[type=checkbox] { border-radius: 5px; }
.tf-choice input:checked { border-color: var(--tf-accent); background: var(--tf-accent); }
.tf-choice input[type=radio]:checked { box-shadow: inset 0 0 0 3.5px var(--tf-field); }
.tf-choice input[type=checkbox]:checked::after { content: ""; width: 9px; height: 5px; border: solid #fff; border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }
.tf-choice input:focus { outline: none; }
.tf-other { flex-wrap: wrap; align-items: center; }
.tf-other .tf-other-text { flex: 1 1 140px; height: 32px; }
.tf-consent { border: 0; padding: 2px 0; min-height: 0; background: none !important; font-size: .95em; color: var(--tf-ink-2); }
.tf-consent:hover { border: 0; }
.tf-invalid .tf-choice { border-color: color-mix(in srgb, var(--tf-bad) 55%, var(--tf-line)); }
.tf-invalid .tf-consent input { border-color: var(--tf-bad); }

/* rating */
.tf-rating { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.tf-rating input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tf-rating label { cursor: pointer; padding: 2px; border-radius: 8px; line-height: 0; }
.tf-rating svg { width: 32px; height: 32px; fill: var(--tf-soft); stroke: var(--tf-line); stroke-width: 1.2; stroke-linejoin: round; transition: fill .1s, stroke .1s, transform .1s; }
.tf-rating input:checked ~ label svg, .tf-rating label:hover svg, .tf-rating label:hover ~ label svg { fill: #f2b33d; stroke: #d9952a; }
.tf-rating label:hover svg { transform: scale(1.08); }
.tf-rating input:focus-visible + label { box-shadow: 0 0 0 3px var(--tf-accent-soft); }
.tf-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* name & address */
.tf-parts { display: grid; gap: 10px 12px; grid-template-columns: minmax(0, 1fr); }
.tf-parts-name { grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr)); }
.tf-part { display: grid; gap: 4px; min-width: 0; }
.tf-sublabel { font-size: .8em; color: var(--tf-ink-3); }

/* files */
.tf-drop {
  position: relative; display: grid; justify-items: center; gap: 6px; padding: 22px 16px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--tf-line); border-radius: var(--tf-radius); background: var(--tf-soft); color: var(--tf-ink-2); font-size: .93em;
  transition: border-color .12s, background .12s;
}
.tf-drop:hover, .tf-drop.tf-over { border-color: var(--tf-accent); background: color-mix(in srgb, var(--tf-accent) 6%, var(--tf-field)); }
.tf-drop svg { width: 26px; height: 26px; fill: none; stroke: var(--tf-accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tf-drop b { color: var(--tf-accent); font-weight: 600; }
.tf-files { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.tf-files:empty { display: none; }
.tf-files span { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 10px; border-radius: 99px; background: var(--tf-field); border: 1px solid var(--tf-line); color: var(--tf-ink); font-size: .85em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.tf-js .tf-file { display: none; }
.tf:not(.tf-js) .tf-drop { display: none; }
.tf:not(.tf-js) .tf-file { position: static; width: auto; height: auto; opacity: 1; pointer-events: auto; }
.tf-invalid .tf-drop { border-color: var(--tf-bad); }

/* layout fields */
.tf-t-heading { gap: 4px; padding-top: 6px; }
.tf-t-heading:not(:first-child) { margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--tf-line); }
.tf-h { margin: 0; font-size: 1.15em; font-weight: 600; letter-spacing: -.01em; }
.tf-sub, .tf-text { margin: 0; color: var(--tf-ink-2); }
.tf-hidden-note { display: inline-flex; padding: 6px 10px; border-radius: 8px; border: 1px dashed var(--tf-line); color: var(--tf-ink-3); font-size: .85em; font-family: ui-monospace, monospace; }

/* labels inside the field */
.tf-l-inside .tf-field:not(fieldset):not(.tf-t-consent):not(.tf-t-heading):not(.tf-t-paragraph):not(.tf-t-file) { position: relative; }
.tf-l-inside .tf-field:not(fieldset):not(.tf-t-consent):not(.tf-t-heading):not(.tf-t-paragraph):not(.tf-t-file):not(.tf-t-select) > .tf-label { position: absolute; left: 13px; top: 7px; font-size: .74em; font-weight: 600; color: var(--tf-ink-3); pointer-events: none; z-index: 1; }
.tf-l-inside .tf-field:not(fieldset):not(.tf-t-consent):not(.tf-t-heading):not(.tf-t-paragraph):not(.tf-t-file):not(.tf-t-select) > .tf-input { height: calc(var(--tf-h) + 12px); padding-top: 18px; }
.tf-l-inside .tf-t-textarea > textarea.tf-input { padding-top: 24px !important; height: auto !important; }

/* pages */
.tf-steps { list-style: none; margin: 0 0 22px; padding: 0; display: flex; gap: 6px; counter-reset: s; }
.tf-step { flex: 1; display: grid; gap: 6px; font-size: .82em; color: var(--tf-ink-3); min-width: 0; }
.tf-step::before { content: ""; height: 4px; border-radius: 4px; background: var(--tf-line); }
.tf-step.tf-on, .tf-step.tf-done { color: var(--tf-ink); }
.tf-step.tf-on::before, .tf-step.tf-done::before { background: var(--tf-accent); }
.tf-step-n { display: none; }
.tf-step-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tf:not(.tf-js) .tf-steps, .tf:not(.tf-js) .tf-pnav { display: none; }
.tf-js.tf-paged .tf-page:not(.tf-on) { display: none; }
.tf-js.tf-paged .tf-actions { display: none; }
.tf:not(.tf-js) .tf-page + .tf-page { margin-top: var(--tf-gap); padding-top: var(--tf-gap); border-top: 1px solid var(--tf-line); }
.tf-pnav { display: flex; gap: 10px; justify-content: space-between; margin-top: 22px; }
.tf-pnav .tf-next { margin-left: auto; }
.tf-pnav .tf-submit { margin-left: auto; }

/* buttons */
.tf-actions { display: flex; margin-top: 24px; }
.tf-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: calc(var(--tf-h) + 4px); padding: 0 22px;
  border: 1px solid var(--tf-accent); border-radius: var(--tf-radius); background: var(--tf-accent); color: #fff;
  font: inherit; font-weight: 600; font-size: 1em; cursor: pointer; transition: filter .12s, transform .08s, opacity .12s;
}
.tf-btn:hover { filter: brightness(.93); }
.tf-btn:active { transform: translateY(1px); }
.tf-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--tf-accent-soft); }
.tf-btn.tf-ghost { background: transparent; color: var(--tf-ink); border-color: var(--tf-line); }
.tf-btn[disabled] { opacity: .6; cursor: progress; }
.tf-b-full .tf-submit { width: 100%; }
.tf-busy .tf-submit::before { content: ""; width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; animation: tf-spin .7s linear infinite; }
@keyframes tf-spin { to { transform: rotate(360deg); } }

.tf-alert { margin: 0 0 18px; padding: 11px 14px; border-radius: var(--tf-radius); background: var(--tf-bad-soft); color: var(--tf-bad); font-size: .93em; font-weight: 500; }
.tf-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.tf-brand { margin: 18px 0 0; text-align: center; font-size: 12px; }
.tf-brand a { color: var(--tf-ink-3); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.tf-brand a:hover { color: var(--tf-ink-2); }
.tf-brand b { font-weight: 600; color: var(--tf-ink-2); }

/* thank-you */
.tf-done-box { display: grid; justify-items: center; text-align: center; gap: 12px; padding: 34px 18px; border-radius: calc(var(--tf-radius) + 4px); background: color-mix(in srgb, var(--tf-ok) 7%, var(--tf-bg)); border: 1px solid color-mix(in srgb, var(--tf-ok) 22%, transparent); animation: tf-in .35s ease-out; }
.tf-done-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--tf-ok); color: #fff; box-shadow: 0 10px 24px -10px var(--tf-ok); }
.tf-done-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; animation: tf-draw .4s .15s ease-out forwards; }
.tf-done-box p { margin: 0; max-width: 46ch; color: var(--tf-ink); font-size: 1.02em; }
@keyframes tf-draw { to { stroke-dashoffset: 0; } }
@keyframes tf-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .tf * { animation: none !important; transition: none !important; } .tf-done-icon svg { stroke-dashoffset: 0; } }
