/* =========================================================
   FormYar — public form & shared form renderer styles
   Used by form.html, builder canvas and preview modal
   ========================================================= */

/* ============ public page shell ============ */
.public-body {
  background:
    radial-gradient(ellipse 60% 40% at 85% 0%, rgba(4, 120, 87, 0.1), transparent 65%),
    radial-gradient(ellipse 50% 35% at 10% 5%, rgba(16, 185, 129, 0.07), transparent 65%),
    var(--bg);
  min-height: 100vh;
}
.pub-nav {
  height: 66px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 clamp(16px, 4vw, 40px);
  max-width: 1180px;
  margin-inline: auto;
  width: 100%;
}
.pub-nav .brand {
  font-size: 17px;
}
.pub-nav .brand small {
  display: none;
}
.pub-nav-right {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pub-nav-right .pub-nav-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 9px;
  transition: 0.16s;
}
.pub-nav-right .pub-nav-link:hover {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}
.pub-nav-right .pub-nav-link .icon {
  width: 16px;
  height: 16px;
}
.pub-danger-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--amber-soft);
  color: #a16207;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 20px;
  padding: 4px 10px;
}
[data-theme="dark"] .pub-danger-badge {
  color: var(--amber);
}
.pub-danger-badge .icon {
  width: 12px;
  height: 12px;
}
.pub-main {
  padding: 6px 16px 72px;
}
.pub-foot {
  text-align: center;
  padding: 26px 20px 36px;
  color: var(--muted-2);
  font-size: 11.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.pub-foot .pf-brand {
  font-weight: 800;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.pub-foot .pf-brand .icon {
  width: 14px;
  height: 14px;
  color: var(--brand);
}

/* ============ form renderer root ============ */
.fy-public {
  --fy-bg: #f3faf6;
  --fy-card: #ffffff;
  --fy-card-2: #f8fcfa;
  --fy-ink: #0c1f19;
  --fy-ink-2: #203a32;
  --fy-muted: #5b746d;
  --fy-muted-2: #839a92;
  --fy-line: #dfeee8;
  --fy-line-2: #cfe4db;
  --fy-soft: #eef8f4;
  --fy-ring: color-mix(in srgb, var(--fa-accent, #047857) 22%, transparent);
  --fa-accent: #047857;
  --fa-radius: 14px;
  --fy-shadow: 0 30px 80px -32px rgba(16, 21, 50, 0.24), 0 8px 24px -12px rgba(16, 21, 50, 0.08);
  font-family: var(--font);
  color: var(--fy-ink);
  background: var(--fy-bg);
  min-height: 100vh;
  padding: 26px 16px 64px;
  position: relative;
  isolation: isolate;
}
.fy-public[data-form-theme="dark"] {
  --fy-bg: #06110f;
  --fy-card: #0e211d;
  --fy-card-2: #122a24;
  --fy-ink: #eefdf7;
  --fy-ink-2: #cfeee3;
  --fy-muted: #9bb9b0;
  --fy-muted-2: #78948b;
  --fy-line: #1d3a32;
  --fy-line-2: #294c42;
  --fy-soft: #112c26;
  --fy-shadow: 0 34px 90px -34px rgba(0, 0, 0, 0.7);
}
.fy-public::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 380px;
  background:
    radial-gradient(ellipse 55% 100% at 78% 0%, color-mix(in srgb, var(--fa-accent) 17%, transparent), transparent 70%),
    radial-gradient(ellipse 45% 80% at 18% 10%, rgba(16, 185, 129, 0.09), transparent 70%);
  z-index: -1;
  pointer-events: none;
}
.fy-form-shell {
  max-width: 760px;
  margin-inline: auto;
  position: relative;
}

/* ============ hero / cover ============ */
.fy-form-hero {
  position: relative;
  border-radius: 26px 26px 0 0;
  overflow: hidden;
  color: #fff;
  padding: 32px 38px 62px;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(135deg, var(--fa-accent), #0d9488 70%, #10b981 170%);
  isolation: isolate;
}
.fy-form-hero.has-cover {
  padding: 34px 38px 68px;
  min-height: 272px;
}
.fy-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.02);
  z-index: -2;
}
.fy-hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 20, 15, 0.18) 0%, rgba(4, 20, 15, 0.44) 55%, rgba(3, 16, 12, 0.84) 100%),
    linear-gradient(100deg, color-mix(in srgb, var(--fa-accent) 48%, transparent), transparent 65%);
  z-index: -1;
}
.fy-form-hero:not(.has-cover)::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.11);
  top: -120px;
  inset-inline-start: -70px;
  z-index: -1;
}
.fy-form-hero:not(.has-cover)::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  bottom: -90px;
  inset-inline-end: 60px;
  z-index: -1;
}
.fy-hero-content {
  position: relative;
  z-index: 1;
  max-width: 620px;
}
.fy-hero-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 4px 11px 4px 6px;
  backdrop-filter: blur(8px);
  margin-bottom: 14px;
}
.fy-hero-logo {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #fff;
  color: var(--fa-accent);
  display: grid;
  place-items: center;
}
.fy-hero-logo .icon {
  width: 13px;
  height: 13px;
  stroke-width: 2.1;
}
.fy-hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}
.fy-form-hero h1 {
  font-size: clamp(21px, 3.4vw, 30px);
  line-height: 1.45;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 20px rgba(9, 12, 30, 0.25);
}
.fy-form-hero p {
  font-size: 13px;
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.86);
  margin-top: 7px;
  max-width: 570px;
}
.fy-hero-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.fy-hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(6px);
  border-radius: 20px;
  padding: 3px 9px;
}
.fy-hero-meta .icon {
  width: 12px;
  height: 12px;
}
.fy-progress {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.18);
  z-index: 2;
}
.fy-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: #fff;
  border-radius: 0 4px 4px 0;
  transition: width 0.45s var(--ease);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.75);
}

/* ============ card ============ */
.fy-form-card {
  background: var(--fy-card);
  border-radius: 0 0 26px 26px;
  box-shadow: var(--fy-shadow);
  border: 1px solid var(--fy-line);
  border-top: 0;
  position: relative;
}
.fy-form {
  padding: 34px 38px 30px;
}
.fy-fields {
  display: flex;
  flex-direction: column;
  gap: 25px;
}
.fy-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.fy-row > .fy-field {
  min-width: 0;
}

/* ============ field ============ */
.fy-field {
  position: relative;
  min-width: 0;
  scroll-margin: 100px;
}
.fy-label {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 14px;
  font-weight: 700;
  color: var(--fy-ink);
  line-height: 1.7;
  margin-bottom: 6px;
}
.fy-label .fy-req {
  color: #f43f5e;
  font-size: 15px;
  line-height: 1;
}
.fy-field-desc {
  font-size: 11.5px;
  color: var(--fy-muted);
  line-height: 1.9;
  margin: -3px 0 9px;
}
.fy-control-area {
  position: relative;
}
.fy-help {
  font-size: 10.5px;
  color: var(--fy-muted-2);
  line-height: 1.8;
  margin-top: 7px;
}
.fy-error {
  font-size: 10.5px;
  color: #e11d48;
  line-height: 1.7;
  margin-top: 5px;
  display: none;
  align-items: center;
  gap: 4px;
}
[data-form-theme="dark"] .fy-error {
  color: #fb7185;
}
.fy-field.has-error .fy-error {
  display: flex;
}
.fy-field.has-error .fy-input,
.fy-field.has-error .fy-select,
.fy-field.has-error .fy-options .fy-option {
  border-color: #f43f5e;
}
.fy-field.is-hidden {
  display: none !important;
}
.fy-field.is-logic-highlight {
  animation: fyLogicPulse 0.9s var(--ease);
}
@keyframes fyLogicPulse {
  0% { background: color-mix(in srgb, var(--fa-accent) 12%, transparent); }
  100% { background: transparent; }
}

/* ============ inputs ============ */
.fy-input,
.fy-select {
  width: 100%;
  min-height: 48px;
  border: 1.5px solid var(--fy-line);
  background: var(--fy-card-2);
  color: var(--fy-ink);
  border-radius: var(--fa-radius);
  padding: 10px 15px;
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  outline: 0;
  display: block;
}
.fy-input::placeholder {
  color: var(--fy-muted-2);
  font-size: 12.5px;
}
.fy-input:hover,
.fy-select:hover {
  border-color: var(--fy-line-2);
}
.fy-input:focus,
.fy-select:focus {
  border-color: var(--fa-accent);
  background: var(--fy-card);
  box-shadow: 0 0 0 4px var(--fy-ring);
}
.fy-textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.9;
}
.fy-select {
  appearance: none;
  cursor: pointer;
  padding-left: 40px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238f96b1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 15px center;
}
.fy-input[type="date"],
.fy-input[type="time"] {
  padding-inline-end: 12px;
}
.fy-input[dir="ltr"],
.fy-input[type="email"],
.fy-input[type="url"],
.fy-input[type="tel"],
.fy-input[type="number"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.fy-input[type="number"] {
  direction: ltr;
  text-align: right;
}

/* ============ options ============ */
.fy-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fy-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid var(--fy-line);
  background: var(--fy-card-2);
  border-radius: var(--fa-radius);
  padding: 10px 13px;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s, box-shadow 0.16s, transform 0.16s;
  user-select: none;
}
.fy-option:hover {
  border-color: var(--fy-line-2);
  background: var(--fy-card);
}
.fy-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.fy-control {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--fy-line-2);
  background: var(--fy-card);
  display: grid;
  place-items: center;
  flex: none;
  transition: 0.16s;
  border-radius: 50%;
}
.fy-option[data-type="checkbox"] .fy-control,
.fy-option[data-type="checkbox"] .fy-control {
  border-radius: 6px;
}
.fy-control .fy-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fa-accent);
  transform: scale(0);
  transition: transform 0.16s var(--ease);
}
.fy-control .fy-check {
  width: 10px;
  height: 6px;
  border-inline-start: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0);
  margin-top: -2px;
  transition: transform 0.16s var(--ease);
}
.fy-option.is-checked {
  border-color: var(--fa-accent);
  background: color-mix(in srgb, var(--fa-accent) 6%, var(--fy-card));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--fa-accent) 35%, transparent);
}
.fy-option.is-checked .fy-control {
  border-color: var(--fa-accent);
  background: var(--fa-accent);
}
.fy-option.is-checked .fy-dot {
  background: #fff;
  transform: scale(1);
}
.fy-option.is-checked .fy-check {
  transform: rotate(-45deg) scale(1);
}
.fy-option.is-checked .fy-option-text {
  font-weight: 700;
  color: var(--fy-ink);
}
.fy-option-text {
  font-size: 13px;
  line-height: 1.7;
  color: var(--fy-ink-2);
  flex: 1;
}

/* correct answer marker (quiz admin preview only) */
.fy-option .correct-tag {
  font-size: 9px;
  font-weight: 700;
  color: #047857;
  background: #d1fae5;
  border-radius: 20px;
  padding: 1px 7px;
}

/* ============ rating ============ */
.fy-rating {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--fy-card-2);
  border: 1.5px solid var(--fy-line);
  border-radius: var(--fa-radius);
  padding: 10px 14px;
}
.fy-rating-stars {
  display: flex;
  gap: 2px;
}
.fy-star {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--fy-line-2);
  transition: color 0.14s, transform 0.14s, background 0.14s;
}
.fy-star .icon {
  width: 27px;
  height: 27px;
  stroke-width: 1.6;
  transition: fill 0.14s;
}
.fy-star:hover {
  transform: translateY(-2px) scale(1.06);
  background: var(--fy-soft);
}
.fy-star.on,
.fy-star.hover,
.fy-star.is-hover {
  color: #f59e0b;
}
.fy-star.on .icon,
.fy-star.hover .icon,
.fy-star.is-hover .icon {
  fill: currentColor;
  stroke: currentColor;
}
.fy-rating-label {
  font-size: 11.5px;
  color: var(--fy-muted);
  font-weight: 600;
  margin-inline-start: auto;
}

/* ============ NPS ============ */
.fy-nps {
  background: var(--fy-card-2);
  border: 1.5px solid var(--fy-line);
  border-radius: var(--fa-radius);
  padding: 13px 13px 10px;
}
.fy-nps-row {
  display: flex;
  gap: 4px;
}
.fy-nps-btn {
  flex: 1;
  min-width: 0;
  height: 38px;
  border-radius: 8px;
  border: 1.5px solid var(--fy-line);
  background: var(--fy-card);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--fy-muted);
  display: grid;
  place-items: center;
  transition: 0.15s;
}
.fy-nps-btn:hover {
  border-color: var(--fa-accent);
  color: var(--fa-accent);
  transform: translateY(-1px);
}
.fy-nps-btn.on {
  background: var(--fa-accent);
  border-color: var(--fa-accent);
  color: #fff;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--fa-accent) 32%, transparent);
}
.fy-nps-scale {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 9.5px;
  color: var(--fy-muted-2);
  margin-top: 9px;
}

/* ============ scale ============ */
.fy-scale {
  background: var(--fy-card-2);
  border: 1.5px solid var(--fy-line);
  border-radius: var(--fa-radius);
  padding: 11px;
}
.fy-scale-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 7px;
}
.fy-scale-btn {
  border: 1.5px solid var(--fy-line);
  background: var(--fy-card);
  border-radius: 10px;
  padding: 9px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: 0.15s;
}
.fy-scale-btn b {
  font-size: 12.5px;
  color: var(--fy-ink);
  width: 23px;
  height: 23px;
  border-radius: 7px;
  background: var(--fy-soft);
  display: grid;
  place-items: center;
}
.fy-scale-btn span {
  font-size: 9px;
  color: var(--fy-muted);
  line-height: 1.4;
  text-align: center;
}
.fy-scale-btn:hover {
  border-color: var(--fa-accent);
  transform: translateY(-1px);
}
.fy-scale-btn.on {
  border-color: var(--fa-accent);
  background: color-mix(in srgb, var(--fa-accent) 7%, var(--fy-card));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--fa-accent) 30%, transparent);
}
.fy-scale-btn.on b {
  background: var(--fa-accent);
  color: #fff;
}
.fy-scale-btn.on span {
  color: var(--fy-ink);
  font-weight: 700;
}

/* ============ upload ============ */
.fy-upload {
  display: flex;
  align-items: center;
  gap: 13px;
  border: 1.5px dashed var(--fy-line-2);
  background: var(--fy-card-2);
  border-radius: var(--fa-radius);
  padding: 17px 18px;
  cursor: pointer;
  transition: 0.18s;
  position: relative;
}
.fy-upload:hover {
  border-color: var(--fa-accent);
  background: color-mix(in srgb, var(--fa-accent) 4%, var(--fy-card));
}
.fy-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.fy-upload-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--fa-accent) 11%, var(--fy-card));
  color: var(--fa-accent);
  display: grid;
  place-items: center;
  flex: none;
}
.fy-upload-icon .icon {
  width: 20px;
  height: 20px;
}
.fy-upload-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.fy-upload-text b {
  font-size: 12.5px;
  color: var(--fy-ink);
}
.fy-upload-text small {
  font-size: 10px;
  color: var(--fy-muted-2);
}
.fy-upload-name {
  font-size: 10px;
  color: #047857;
  font-weight: 700;
  margin-inline-start: auto;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fy-upload.has-file {
  border-style: solid;
  border-color: #34d399;
  background: #ecfdf5;
}
[data-form-theme="dark"] .fy-upload.has-file {
  background: #0c2a23;
  border-color: #10b981;
}
[data-form-theme="dark"] .fy-upload-name {
  color: #34d399;
}

/* ============ signature ============ */
.fy-signature {
  border: 1.5px dashed var(--fy-line-2);
  border-radius: var(--fa-radius);
  background: var(--fy-card);
  padding: 9px;
  overflow: hidden;
}
.fy-signature canvas {
  width: 100%;
  height: 150px;
  display: block;
  border-radius: 9px;
  background:
    linear-gradient(var(--fy-card-2), var(--fy-card-2)),
    repeating-linear-gradient(0deg, transparent, transparent 29px, var(--fy-line) 29px, var(--fy-line) 30px);
  cursor: crosshair;
  touch-action: none;
}
.fy-signature-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 4px 0;
}
.fy-signature-foot span {
  font-size: 10px;
  color: var(--fy-muted-2);
}
.fy-signature-foot button {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--fy-muted);
  padding: 3px 9px;
  border-radius: 7px;
}
.fy-signature-foot button:hover {
  background: var(--fy-soft);
  color: #e11d48;
}

/* ============ matrix ============ */
.fy-matrix-wrap {
  overflow-x: auto;
  border: 1.5px solid var(--fy-line);
  border-radius: var(--fa-radius);
  background: var(--fy-card);
  -webkit-overflow-scrolling: touch;
}
.fy-matrix {
  width: 100%;
  border-collapse: collapse;
  min-width: 430px;
}
.fy-matrix th {
  font-size: 10px;
  font-weight: 700;
  color: var(--fy-muted);
  padding: 10px 8px;
  text-align: center;
  background: var(--fy-card-2);
  border-bottom: 1px solid var(--fy-line);
  white-space: nowrap;
}
.fy-matrix th:first-child {
  text-align: right;
  padding-inline-start: 14px;
  min-width: 92px;
}
.fy-matrix td {
  padding: 8px;
  text-align: center;
  border-bottom: 1px solid var(--fy-line);
}
.fy-matrix tr:last-child td {
  border-bottom: 0;
}
.fy-matrix td:first-child {
  font-size: 11.5px;
  color: var(--fy-ink-2);
  text-align: right;
  padding-inline-start: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.fy-matrix-cell {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  cursor: pointer;
}
.fy-matrix-cell input {
  position: absolute;
  opacity: 0;
}
.fy-matrix-cell span {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 1.5px solid var(--fy-line-2);
  display: block;
  transition: 0.15s;
  position: relative;
}
.fy-matrix-cell span::after {
  content: "";
  position: absolute;
  inset: 3.5px;
  border-radius: 50%;
  background: var(--fa-accent);
  transform: scale(0);
  transition: transform 0.15s var(--ease);
}
.fy-matrix-cell:hover span {
  border-color: var(--fa-accent);
}
.fy-matrix-cell input:checked + span {
  border-color: var(--fa-accent);
}
.fy-matrix-cell input:checked + span::after {
  transform: scale(1);
}

/* ============ payment ============ */
.fy-payment {
  border: 1.5px solid color-mix(in srgb, var(--fa-accent) 24%, var(--fy-line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--fa-accent) 7%, var(--fy-card)), var(--fy-card) 65%);
  border-radius: var(--fa-radius);
  padding: 15px;
}
.fy-payment-head {
  display: flex;
  align-items: center;
  gap: 11px;
}
.fy-payment-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--fa-accent) 13%, var(--fy-card));
  color: var(--fa-accent);
  display: grid;
  place-items: center;
  flex: none;
}
.fy-payment-icon .icon {
  width: 20px;
  height: 20px;
}
.fy-payment-head b {
  font-size: 14px;
  display: block;
  letter-spacing: -0.01em;
}
.fy-payment-head small {
  font-size: 10px;
  color: var(--fy-muted);
  display: block;
  margin-top: 1px;
}
.fy-payment-secure {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  font-weight: 700;
  color: #047857;
  background: #d1fae5;
  border-radius: 20px;
  padding: 2px 7px;
  flex: none;
}
[data-form-theme="dark"] .fy-payment-secure {
  background: #0c2a23;
  color: #34d399;
}
.fy-payment-secure .icon {
  width: 10px;
  height: 10px;
}
.fy-pay-btn {
  width: 100%;
  margin-top: 13px;
  min-height: 44px;
  border-radius: calc(var(--fa-radius) - 3px);
  background: var(--fa-accent);
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: 0.18s;
  box-shadow: 0 10px 22px -10px color-mix(in srgb, var(--fa-accent) 70%, transparent);
}
.fy-pay-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}
.fy-pay-btn .icon {
  width: 15px;
  height: 15px;
}
.fy-pay-btn.is-loading {
  opacity: 0.8;
  pointer-events: none;
}
.fy-pay-btn.is-loading .icon {
  animation: spin 0.9s linear infinite;
}
.fy-pay-btn.is-paid {
  background: #059669;
  box-shadow: 0 10px 22px -10px rgba(5, 150, 105, 0.6);
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============ display fields ============ */
.fy-field-display {
  margin-block: 2px;
}
.fy-display-heading h3 {
  font-size: 19px;
  line-height: 1.55;
  color: var(--fy-ink);
  letter-spacing: -0.02em;
}
.fy-display-heading p {
  font-size: 12px;
  color: var(--fy-muted);
  line-height: 1.9;
  margin-top: 4px;
}
.fy-display-paragraph {
  font-size: 12.5px;
  color: var(--fy-muted);
  line-height: 2;
  background: var(--fy-card-2);
  border-inline-start: 3px solid color-mix(in srgb, var(--fa-accent) 50%, transparent);
  border-radius: 8px;
  padding: 10px 14px;
}
.fy-display-divider {
  border: 0;
  height: 1px;
  background: var(--fy-line);
  margin: 2px 0;
}
.fy-display-image {
  width: 100%;
  border-radius: var(--fa-radius);
  object-fit: cover;
  max-height: 300px;
}
.fy-display-section {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.fy-display-section::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--fy-line);
}
.fy-display-section span {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--fa-accent);
  background: color-mix(in srgb, var(--fa-accent) 10%, transparent);
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ============ submit & note ============ */
.fy-submit {
  width: 100%;
  min-height: 52px;
  border-radius: calc(var(--fa-radius) + 1px);
  background: linear-gradient(135deg, var(--fa-accent), color-mix(in srgb, var(--fa-accent) 70%, #10b981));
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 28px;
  transition: transform 0.18s, box-shadow 0.18s, filter 0.18s;
  box-shadow: 0 16px 34px -16px color-mix(in srgb, var(--fa-accent) 75%, transparent);
}
.fy-submit:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
.fy-submit:active {
  transform: translateY(0) scale(0.995);
}
.fy-submit .icon {
  width: 18px;
  height: 18px;
}
.fy-submit.is-loading {
  pointer-events: none;
  opacity: 0.85;
}
.fy-submit.is-loading .icon {
  animation: spin 1s linear infinite;
}
.fy-form-note {
  text-align: center;
  font-size: 10px;
  color: var(--fy-muted-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 13px;
}
.fy-form-note .icon {
  width: 12px;
  height: 12px;
}
.fy-powered {
  text-align: center;
  font-size: 9.5px;
  color: var(--fy-muted-2);
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px dashed var(--fy-line);
}
.fy-powered b {
  color: var(--fa-accent);
  font-weight: 800;
}

/* ============ success screen ============ */
.fy-success {
  padding: 46px 34px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.fy-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.fy-confetti i {
  position: absolute;
  top: -12px;
  left: var(--x);
  width: 7px;
  height: 11px;
  border-radius: 2px;
  background: var(--c);
  animation: confettiFall var(--d) ease-in forwards;
  animation-delay: 0.1s;
  transform: rotate(var(--r));
}
@keyframes confettiFall {
  0% { opacity: 0; transform: translateY(-10px) rotate(var(--r)); }
  12% { opacity: 1; }
  100% { opacity: 0.65; transform: translateY(430px) rotate(calc(var(--r) + 210deg)); }
}
.fy-success-icon {
  width: 68px;
  height: 68px;
  border-radius: 23px;
  background: linear-gradient(145deg, #d1fae5, #a7f3d0);
  color: #047857;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  box-shadow: 0 18px 36px -18px rgba(16, 185, 129, 0.65);
  animation: successPop 0.5s var(--ease);
}
.fy-success-icon .icon {
  width: 32px;
  height: 32px;
  stroke-width: 2.4;
}
[data-form-theme="dark"] .fy-success-icon {
  background: linear-gradient(145deg, #0c3a2e, #14532d);
  color: #34d399;
}
@keyframes successPop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
.fy-success h2 {
  font-size: 23px;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.fy-success > p {
  font-size: 12.5px;
  color: var(--fy-muted);
  line-height: 2;
  max-width: 380px;
}
.fy-score {
  margin: 20px 0 4px;
  background: var(--fy-card-2);
  border: 1.5px solid var(--fy-line);
  border-radius: 18px;
  padding: 14px 34px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--fy-muted);
}
.fy-score b {
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--fy-ink);
}
.fy-score span {
  font-size: 10.5px;
  font-weight: 700;
  margin-top: 5px;
  color: var(--fy-muted);
}
.fy-score.passed {
  border-color: #6ee7b7;
  background: #ecfdf5;
}
.fy-score.passed span {
  color: #047857;
}
.fy-score.failed {
  border-color: #fecdd3;
  background: #fff1f2;
}
.fy-score.failed span {
  color: #be123c;
}
[data-form-theme="dark"] .fy-score.passed {
  background: #0c2a23;
  border-color: #065f46;
}
[data-form-theme="dark"] .fy-score.passed span {
  color: #34d399;
}
[data-form-theme="dark"] .fy-score.failed {
  background: #2c1219;
  border-color: #881337;
}
[data-form-theme="dark"] .fy-score.failed span {
  color: #fb7185;
}
.fy-success-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 22px;
}
.fy-success-actions .btn {
  min-height: 42px;
  font-size: 12.5px;
  padding: 8px 17px;
  border-radius: 11px;
}
.fy-success-id {
  font-size: 10px;
  color: var(--fy-muted-2);
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px dashed var(--fy-line);
  width: 100%;
  max-width: 300px;
}
.fy-success-id span {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
  color: var(--fy-muted);
}

/* ============ builder canvas overrides ============ */
.builder-canvas .fy-public {
  min-height: 0;
  padding: 0;
  background: transparent;
  border-radius: 24px;
}
.builder-canvas .fy-public::before {
  display: none;
}
.builder-canvas .fy-form-shell {
  max-width: 100%;
}
.builder-canvas .fy-form-hero,
.builder-canvas .fy-form-hero.has-cover {
  border-radius: 20px 20px 0 0;
  padding: 28px 30px 48px;
  min-height: 150px;
}
.builder-canvas .fy-form-hero.has-cover {
  min-height: 210px;
}
.builder-canvas .fy-form-hero h1 {
  font-size: 24px;
}
.builder-canvas .fy-form-card {
  border-radius: 0 0 20px 20px;
  box-shadow: 0 20px 50px -24px rgba(16, 21, 50, 0.28);
}
.builder-canvas .fy-form {
  padding: 26px 30px 28px;
}
.builder-canvas .fy-fields {
  gap: 20px;
}
.builder-canvas .fy-control-area,
.builder-canvas .fy-submit {
  pointer-events: none;
  user-select: none;
}
.builder-canvas .fy-upload,
.builder-canvas .fy-signature canvas {
  pointer-events: none;
}
.builder-canvas .fy-field {
  outline: 1.5px dashed transparent;
  outline-offset: 8px;
  border-radius: 6px;
  transition: outline-color 0.15s, background 0.15s;
  cursor: pointer;
}
.builder-canvas .fy-field:hover {
  outline-color: color-mix(in srgb, var(--fa-accent) 38%, transparent);
}
.builder-canvas .fy-field.is-selected {
  outline-color: var(--fa-accent);
  background: color-mix(in srgb, var(--fa-accent) 3%, transparent);
}
.builder-canvas .fy-field-display.is-selected,
.builder-canvas .fy-field-display:hover {
  background: color-mix(in srgb, var(--fa-accent) 4%, transparent);
}
.builder-canvas .fy-field.drag-over-top::before,
.builder-canvas .fy-field.drag-over-bottom::after {
  content: "";
  position: absolute;
  inset-inline: -6px;
  height: 3px;
  border-radius: 3px;
  background: var(--fa-accent);
  z-index: 3;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--fa-accent) 18%, transparent);
}
.builder-canvas .fy-field.drag-over-top::before {
  top: -13px;
}
.builder-canvas .fy-field.drag-over-bottom::after {
  bottom: -13px;
}
.builder-canvas .fy-field.is-dragging {
  opacity: 0.4;
}

/* field chrome */
.fy-field-tools {
  position: absolute;
  top: -17px;
  inset-inline-end: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--fa-accent);
  color: #fff;
  border-radius: 8px;
  padding: 2px;
  z-index: 4;
  box-shadow: 0 4px 12px -3px color-mix(in srgb, var(--fa-accent) 60%, transparent);
  opacity: 0;
  transform: translateY(3px);
  transition: 0.15s;
  pointer-events: none;
}
.fy-field.is-selected .fy-field-tools,
.fy-field:hover .fy-field-tools {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.fy-field-tools .fyt-btn {
  width: 25px;
  height: 25px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #fff;
  transition: background 0.14s;
}
.fy-field-tools .fyt-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
.fy-field-tools .fyt-btn.danger:hover {
  background: #e11d48;
}
.fy-field-tools .fyt-btn .icon {
  width: 13px;
  height: 13px;
}
.fy-field-tools .fyt-type {
  font-size: 8.5px;
  font-weight: 700;
  padding: 0 6px;
  opacity: 0.85;
  white-space: nowrap;
}
.fy-field-drag {
  position: absolute;
  top: -17px;
  inset-inline-start: 0;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--fa-accent);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: grab;
  z-index: 4;
  opacity: 0;
  transition: 0.15s;
}
.fy-field-drag .icon {
  width: 13px;
  height: 13px;
}
.fy-field:hover .fy-field-drag,
.fy-field.is-selected .fy-field-drag {
  opacity: 1;
}

/* ============ responsive ============ */
@media (max-width: 700px) {
  .pub-nav {
    height: 60px;
    padding-inline: 14px;
  }
  .pub-nav-right .pub-nav-link {
    padding: 6px 9px;
    font-size: 11px;
  }
  .pub-nav-right .pub-nav-link span {
    display: none;
  }
  .pub-main {
    padding: 2px 10px 44px;
  }
  .fy-public {
    padding: 12px 8px 40px;
    border-radius: 0;
    min-height: auto;
  }
  .fy-form-shell {
    max-width: 100%;
  }
  .fy-form-hero {
    border-radius: 20px 20px 0 0;
    padding: 24px 22px 46px;
    min-height: 160px;
  }
  .fy-form-hero.has-cover {
    min-height: 230px;
    padding: 26px 22px 54px;
  }
  .fy-form-hero h1 {
    font-size: 20px;
  }
  .fy-form-hero p {
    font-size: 11.5px;
    line-height: 1.8;
  }
  .fy-hero-brand {
    font-size: 10.5px;
    margin-bottom: 10px;
  }
  .fy-hero-meta {
    gap: 5px;
    margin-top: 12px;
  }
  .fy-hero-meta span {
    font-size: 9px;
    padding: 2px 7px;
  }
  .fy-form-card {
    border-radius: 0 0 20px 20px;
  }
  .fy-form {
    padding: 22px 18px 24px;
  }
  .fy-fields {
    gap: 21px;
  }
  .fy-row {
    grid-template-columns: 1fr;
    gap: 21px;
  }
  .fy-label {
    font-size: 13px;
  }
  .fy-input,
  .fy-select {
    min-height: 46px;
    font-size: 13px;
    border-radius: min(var(--fa-radius), 13px);
  }
  .fy-option {
    padding: 9px 11px;
    border-radius: min(var(--fa-radius), 13px);
  }
  .fy-option-text {
    font-size: 12px;
  }
  .fy-star {
    width: 33px;
    height: 33px;
  }
  .fy-star .icon {
    width: 25px;
    height: 25px;
  }
  .fy-nps {
    padding: 10px 8px 9px;
  }
  .fy-nps-row {
    gap: 3px;
  }
  .fy-nps-btn {
    height: 33px;
    font-size: 10px;
    border-radius: 6px;
  }
  .fy-nps-scale {
    font-size: 8.5px;
  }
  .fy-scale-row {
    grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
    gap: 5px;
  }
  .fy-scale-btn {
    padding: 7px 3px;
  }
  .fy-scale-btn span {
    font-size: 8px;
  }
  .fy-upload {
    padding: 13px;
    gap: 10px;
  }
  .fy-upload-icon {
    width: 36px;
    height: 36px;
  }
  .fy-upload-name {
    display: none;
  }
  .fy-signature canvas {
    height: 120px;
  }
  .fy-payment {
    padding: 13px;
  }
  .fy-payment-head b {
    font-size: 12.5px;
  }
  .fy-payment-secure {
    display: none;
  }
  .fy-submit {
    min-height: 50px;
    font-size: 14px;
  }
  .fy-success {
    padding: 36px 20px 30px;
    min-height: 380px;
  }
  .fy-success h2 {
    font-size: 20px;
  }
  .fy-success-icon {
    width: 60px;
    height: 60px;
    border-radius: 20px;
  }
  .fy-score {
    padding-inline: 26px;
  }
  .fy-powered {
    font-size: 9px;
  }
  .public-body .toast-wrap {
    bottom: 20px;
  }
  .pub-foot {
    padding-bottom: 24px;
  }
}

@media (max-width: 380px) {
  .fy-form {
    padding-inline: 14px;
  }
  .fy-nps-btn {
    height: 30px;
    font-size: 9px;
  }
  .fy-option {
    gap: 8px;
  }
  .fy-option-text {
    font-size: 11.5px;
  }
}
