/* ============================================================
   INTELLIGENT FORMS -UNIFIED UI
   published-form.css
   ============================================================ */

/* ============================================================
   PUBLISHED FORM
   ============================================================ */

.published-form-shell {
  width: 100%;
  box-sizing: border-box;

  padding: 42px 24px 92px;

  background: #f5f7fa;
}

.published-form-container {
  width: min(100%, 960px);
  --published-form-inline-padding: 36px;

  margin: 0 auto 12px;

  overflow: hidden;

  border: 1px solid var(--if-border);
  border-radius: 16px;

  background: var(--if-surface);

  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.07);
}

.published-form-public-shell {
  /* Published forms use enhanced-contrast tokens because their primary
     audience may not have access to the application's administrative themes. */
  --if-text: #1e293b;
  --if-text-muted: #475569;
  --if-border: #94a3b8;
  --if-border-strong: #64748b;
  --if-secondary: #075985;
  --if-danger: #991b1b;
  padding-inline: clamp(12px, 3vw, 48px);
}

.published-form-public-shell .published-form-container {
  width: min(100%, 1440px);
  --published-form-inline-padding: clamp(24px, 3.25vw, 56px);
}

/* Keep system-generated summaries and messages within a readable measure while
   allowing authored form content to use the full configured form width. */
.published-form-public-shell
  :is(
    .published-form-summary p,
    .published-form-message
  ) {
  max-width: 80ch;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.published-form-public-shell
  :is(
    .published-form-header p,
    .published-form-section-header > p,
    .published-form-heading-description,
    .published-form-paragraph p,
    .published-form-help
  ) {
  width: 100%;
  max-width: none;
}

@media (prefers-contrast: more) {
  .published-form-public-shell {
    --if-text: #000;
    --if-text-muted: #1e293b;
    --if-border: #475569;
    --if-border-strong: #1e293b;
    --if-secondary: #034b6f;
    --if-danger: #7f1d1d;
  }

  .published-form-public-shell
    :is(.published-form-input, .published-form-select, .published-form-textarea) {
    border-width: 2px;
  }
}

@media (forced-colors: active) {
  .published-form-public-shell .published-form-container,
  .published-form-public-shell
    :is(
      .published-form-input,
      .published-form-select,
      .published-form-textarea,
      .published-form-choice,
      .published-form-summary,
      .published-form-message
    ) {
    forced-color-adjust: auto;
  }

  .published-form-field-invalid::before,
  .published-form-page-progress-value {
    background: Highlight;
  }
}

/* ============================================================
   HEADER
   ============================================================ */

.published-form-header {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  padding: 28px 32px 24px !important;

  border-bottom: 1px solid var(--if-border, #e2e8f0) !important;

  background: linear-gradient(
    180deg,
    var(--if-surface, #ffffff) 0%,
    var(--if-surface-subtle, #f8fafc) 100%
  ) !important;
}

.published-form-header h1 {
  margin: 0 !important;

  color: var(--if-primary, #041e42) !important;

  font-size: 1.35rem !important;
  font-weight: 780 !important;
  line-height: 1.2 !important;

  letter-spacing: -0.02em !important;
}

.published-form-header p {
  width: 100%;
  max-width: none !important;

  margin: 8px 0 0 !important;

  color: var(--if-text-muted, #64748b) !important;

  font-size: 0.875rem !important;

  line-height: 1.55 !important;
}

/* ============================================================
   FORM BODY
   ============================================================ */

.published-form-body {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(16px, 2vw, 28px);
  row-gap: 0;

  padding: 8px var(--published-form-inline-padding) 18px;
}

.published-form-layout-cell {
  grid-column: span var(--published-field-span, 12);
  min-width: 0;
}
.published-form-label-copy {
  display: contents;
}
.published-form-label-left {
  display: grid;
  grid-template-columns: fit-content(30%) minmax(0, 1fr);
  column-gap: 8px;
  align-items: start;
}
.published-form-label-left > .published-form-label-copy {
  display: flex;
  flex-direction: column;
  align-self: center;
  min-width: 0;
  overflow-wrap: anywhere;
}
.published-form-label-left
  > .published-form-label-copy
  > .published-form-label {
  margin: 0;
}
.published-form-label-left > .published-form-label-copy > .published-form-help {
  margin: 3px 0 0;
}
.published-form-label-left > :not(.published-form-label-copy) {
  grid-column: 2;
}
.published-form-label-below {
  display: flex;
  flex-direction: column;
}
.published-form-label-below
  > .published-form-label-copy
  > .published-form-label {
  order: 2;
  margin: 8px 0 0;
}
.published-form-label-below
  > .published-form-label-copy
  > .published-form-help {
  order: 3;
  margin: 4px 0 0;
}
.published-form-label-below > .published-form-field-error,
.published-form-label-below > .published-form-field-messages {
  order: 4;
}

.published-form-body > * {
  width: 100%;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
}

.published-form-body > :not(.published-form-layout-cell) {
  grid-column: 1 / -1;
}

/* ============================================================
   FIELD
   ============================================================ */

.published-form-field {
  padding: 22px 0;

  border-bottom: 1px solid #eef2f6;
}

.published-form-field:last-child {
  border-bottom: 0;
}

.published-form-field-invalid {
  position: relative;
}

.published-form-field-invalid::before {
  content: "";

  position: absolute;

  top: 17px;
  bottom: 17px;
  left: -16px;

  width: 3px;

  border-radius: 999px;

  background: var(--if-danger);
}

/* ============================================================
   LABELS
   ============================================================ */

.published-form-label {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.25rem;

  margin-bottom: 7px;

  color: var(--if-text);

  font-size: 1rem;
  font-weight: 720;
}

.published-form-required {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 0.75rem;
  margin-left: 3px;

  color: var(--if-danger);

  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}

.published-form-help {
  margin: -1px 0 10px;

  color: var(--if-text-muted);

  font-size: 0.875rem;

  line-height: 1.5;
}

/* ============================================================
   INPUTS
   ============================================================ */

.published-form-input,
.published-form-select,
.published-form-textarea {
  width: 100%;

  border: 1px solid var(--if-border-strong);
  border-radius: 9px;

  background: var(--if-surface);

  color: var(--if-text);

  font: inherit;

  font-size: 0.875rem;

  outline: none;

  transition:
    border-color 130ms ease,
    box-shadow 130ms ease,
    background-color 130ms ease;
}

.published-form-input,
.published-form-select {
  height: auto;
  min-height: 44px;

  padding: 0.625rem 13px;
  line-height: 1.35;
}

/* Email and phone are visually recognizable contact controls rather than
   generic text boxes. The outer shell owns focus and invalid state styling. */
.published-contact-input {
  --contact-accent: var(--if-secondary, #0a7cb4);
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: stretch;
  min-width: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--contact-accent), #cbd5e1 68%);
  border-radius: 11px;
  background: var(--if-surface, #fff);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition:
    border-color 130ms ease,
    box-shadow 130ms ease,
    background-color 130ms ease;
}

.published-contact-input-phone {
  --contact-accent: #4f7c5b;
}

.published-contact-input:focus-within {
  border-color: var(--contact-accent);
  box-shadow: 0 0 0 4px
    color-mix(in srgb, var(--contact-accent), transparent 86%);
}

.published-contact-input-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--contact-accent);
  background: color-mix(in srgb, var(--contact-accent), transparent 92%);
  border-right: 1px solid
    color-mix(in srgb, var(--contact-accent), transparent 82%);
}

.published-contact-input-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.published-contact-input-phone .published-contact-input-icon svg {
  fill: currentColor;
  stroke: none;
}

.published-contact-input .published-contact-control {
  min-width: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.published-form-field-invalid .published-contact-input {
  border-color: var(--if-danger, #b42318);
  background: color-mix(in srgb, var(--if-danger, #b42318), transparent 98%);
}

.published-contact-input.is-preview {
  pointer-events: none;
}

@media (max-width: 480px) {
  .published-contact-input {
    grid-template-columns: 42px minmax(0, 1fr);
  }
}

.published-form-textarea {
  min-height: 120px;

  padding: 12px 13px;

  resize: vertical;
}

.published-form-input:focus,
.published-form-select:focus,
.published-form-textarea:focus {
  border-color: var(--if-secondary, #0a7cb4);

  box-shadow: 0 0 0 4px
    color-mix(in srgb, var(--if-secondary, #0a7cb4), transparent 86%);
}

/* Invalid field control emphasis */

.published-form-field-invalid .published-form-input,
.published-form-field-invalid .published-form-select,
.published-form-field-invalid .published-form-textarea {
  border-color: #e2a6a1;
}

.published-form-field-invalid .published-form-input:focus,
.published-form-field-invalid .published-form-select:focus,
.published-form-field-invalid .published-form-textarea:focus {
  border-color: var(--if-danger);

  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.09);
}

/* ============================================================
   CHOICES
   ============================================================ */

.published-form-choice-list {
  display: grid;

  gap: 9px;
}

.published-form-choice-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.published-form-choice {
  min-width: 0;
  min-height: 44px;
  height: auto;
  display: flex;
  align-items: center;

  gap: 9px;

  color: var(--if-text-strong);

  font-size: 1rem;

  line-height: 1.45;

  cursor: pointer;
}

.published-form-choice input {
  width: 16px;
  height: 16px;

  margin-top: 1px;

  flex: 0 0 16px;

  accent-color: var(--if-secondary, #0a7cb4);

  cursor: pointer;
}

.published-form-multi-select {
  width: min(100%, 48rem);
  min-width: 0;
  display: grid;
  gap: 8px;
}

.published-form-multi-select-chips {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.published-form-multi-select-chip {
  min-width: 0;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 5px 5px 10px;
  border: 1px solid
    color-mix(in srgb, var(--if-secondary, #0a7cb4), transparent 55%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--if-secondary, #0a7cb4), white 92%);
  color: var(--if-primary, #041e42);
  font-size: 0.875rem;
  font-weight: 650;
  line-height: 1.3;
}

.published-form-multi-select-chip > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.published-form-multi-select-chip button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--if-primary, #041e42);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.published-form-multi-select-chip button:hover {
  background: var(--if-secondary, #0a7cb4);
  color: #fff;
}

.published-form-multi-select-disclosure {
  min-width: 0;
  border: 1px solid var(--if-border-strong, #cbd5e1);
  border-radius: 10px;
  background: var(--if-surface, #fff);
  overflow: clip;
}

.published-form-multi-select-disclosure[open] {
  border-color: var(--if-secondary, #0a7cb4);
  box-shadow: 0 0 0 3px
    color-mix(in srgb, var(--if-secondary, #0a7cb4), transparent 86%);
}

.published-form-multi-select-disclosure > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  color: var(--if-text-strong, #334155);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  text-transform: none !important;
}

.published-form-multi-select-disclosure > summary::-webkit-details-marker {
  display: none;
}

.published-form-multi-select-disclosure > summary::after {
  content: "⌄";
  flex: 0 0 auto;
  color: var(--if-secondary, #0a7cb4);
  font-size: 1rem;
}

.published-form-multi-select-disclosure[open] > summary::after {
  transform: rotate(180deg);
}

.published-form-multi-select-count {
  margin-left: auto;
  color: var(--if-text-muted, #64748b);
  font-weight: 600;
}

.published-form-multi-select-panel {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 10px;
  border-top: 1px solid var(--if-border, #dce5ed);
  background: var(--if-surface, #fff);
}

.published-form-multi-select-search {
  min-width: 0;
  display: grid;
  gap: 5px;
  color: var(--if-text-strong, #334155);
  font-size: 1rem;
  font-weight: 700;
}

/* Keep every response label on one predictable scale. This selector also
   outranks the application-wide semantic-label readability floor, whose
   inherited 1em value can otherwise vary inside nested choice controls. */
.published-form-shell
  :is(
    .published-form-label,
    .published-form-choice,
    .published-form-choice-single-label,
    .published-form-multi-select-search
  ) {
  font-size: 1rem !important;
  line-height: 1.45;
}

.published-form-multi-select-search input {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--if-border-strong, #cbd5e1);
  border-radius: 7px;
  background: #fff;
  color: var(--if-text, #1e293b);
  font: inherit;
  font-size: 0.875rem;
}

.published-form-multi-select-options {
  min-width: 0;
  max-height: 240px;
  display: grid;
  gap: 6px;
  padding: 2px;
  overflow-y: auto;
}

.published-form-multi-select-options .published-form-choice {
  min-width: 0;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--if-surface-subtle, #f8fafc);
  transition:
    background-color 120ms ease,
    border-color 120ms ease;
}

.published-form-multi-select-options .published-form-choice:hover {
  border-color: color-mix(
    in srgb,
    var(--if-secondary, #075985),
    transparent 60%
  );
  background: color-mix(in srgb, var(--if-secondary, #075985), white 94%);
}

.published-form-multi-select-options .published-form-choice:has(input:checked) {
  border-color: color-mix(
    in srgb,
    var(--if-secondary, #075985),
    transparent 45%
  );
  background: color-mix(in srgb, var(--if-secondary, #075985), white 90%);
}

.published-form-multi-select-options
  .published-form-choice:has(input:focus-visible) {
  outline: 3px solid var(--if-secondary, #075985);
  outline-offset: 2px;
}

.published-form-multi-select-options .published-form-choice input {
  width: 20px;
  height: 20px;
  min-height: 20px;
  flex-basis: 20px;
  margin: 0;
}

.published-form-multi-select-options
  .published-form-choice
  input:focus-visible {
  outline: 0 !important;
  box-shadow: none !important;
}

.published-form-multi-select-empty {
  margin: 0;
  padding: 10px;
  color: var(--if-text-muted, #64748b);
  font-size: 0.875rem;
}

/* ============================================================
   CONTENT FIELDS
   ============================================================ */

.published-form-heading {
  margin: 3px 0 0;

  color: var(--if-primary, #041e42);

  font-size: 1.08rem;
  font-weight: 760;
}

.published-form-section-title {
  margin: 2px 0 0;
  color: inherit;
  font-size: 1.08rem;
  font-weight: 780;
}

.published-form-content-title {
  margin: 0 0 5px;
  color: inherit;
  font-size: 0.875rem;
  font-weight: 760;
  line-height: 1.35;
}

.published-form-heading-description {
  margin: 6px 0 0;

  color: var(--if-text-muted);

  font-size: 0.875rem;

  line-height: 1.5;
}

.published-form-paragraph {
  color: var(--if-slate-700);

  font-size: 0.875rem;

  line-height: 1.65;
}

.published-form-paragraph strong {
  display: block;

  margin-bottom: 5px;

  color: var(--if-slate-900);

  font-size: 0.875rem;
}

.published-form-paragraph p {
  margin: 0;
}

/* ============================================================
   FIELD VALIDATION MESSAGES
   ============================================================ */

.published-form-field-messages {
  display: grid;

  gap: 6px;

  margin-top: 9px;
}

.published-form-message {
  padding-left: 20px;

  position: relative;

  font-size: 0.875rem;
  font-weight: 650;

  line-height: 1.45;
}

.published-form-message::before {
  position: absolute;

  left: 0;
  top: 0;

  width: 15px;

  text-align: center;

  font-weight: 800;
}

.published-form-message-error {
  color: var(--if-danger);
}

.published-form-message-error::before {
  content: "\00D7";
}

.published-form-message-warning {
  color: #9a6700;
}

.published-form-message-warning::before {
  content: "!";
}

.published-form-message-info {
  color: #3156a6;
}

.published-form-message-info::before {
  content: "i";
}

/* ============================================================
   PREVIEW MODE BANNER
   ============================================================ */

.published-form-preview-banner {
  position: fixed;
  top: 122px;
  left: 50%;
  z-index: 850;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  box-sizing: border-box;
  width: min(1120px, calc(var(--if-ui-viewport-width, 100vw) - 48px));
  max-width: calc(var(--if-ui-viewport-width, 100vw) - 48px);
  gap: 8px 12px;
  margin: 0;
  padding: 12px 16px;
  transform: translateX(-50%);

  border: 1px solid
    color-mix(in srgb, var(--if-secondary, #0a7cb4), transparent 55%);
  border-radius: var(--if-radius-control, 8px);

  background: #ffffff;
  box-shadow: 0 8px 22px rgba(4, 30, 66, 0.14);

  color: var(--if-primary, #041e42);

  font-size: 0.875rem;
}

.published-form-preview-banner strong {
  font-weight: 800;
}

.published-form-preview-banner > span {
  flex: 1 1 360px;
  line-height: 1.45;
}

.published-form-container:has(> .published-form-preview-banner) {
  padding-top: 70px;
}

body:has(.if-shell-compact-toggle:checked) .published-form-preview-banner {
  top: 50px;
}

.published-form-preview-back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .published-form-preview-banner {
    align-items: stretch;
    width: calc(var(--if-ui-viewport-width, 100vw) - 20px);
    max-width: calc(var(--if-ui-viewport-width, 100vw) - 20px);
    padding: 11px 12px;
  }

  .published-form-preview-back-button {
    width: 100%;
    margin-left: 0;
  }
}

/* ============================================================
   VALIDATION SUMMARY
   ============================================================ */

.published-form-summary {
  display: grid;

  grid-template-columns: 44px 1fr;

  gap: 14px;

  margin: 8px var(--published-form-inline-padding) 0;

  padding: 18px;

  border-radius: 11px;
  width: auto;
  box-sizing: border-box;
}

.published-form-summary-neutral {
  border: 1px solid color-mix(in srgb, var(--if-secondary), var(--if-border) 68%);
  background: linear-gradient(135deg, color-mix(in srgb, var(--if-secondary), white 95%), var(--if-surface));
}

.published-form-summary-neutral .published-form-summary-icon {
  background: color-mix(in srgb, var(--if-secondary), white 84%);
  color: var(--if-secondary);
}

.published-form-summary-neutral h2 {
  color: var(--if-primary);
}

.published-form-summary-icon {
  width: 42px;
  height: 42px;

  display: grid;
  place-items: center;

  border-radius: 50%;

  font-size: 1rem;
  font-weight: 800;
}

.published-form-summary h2 {
  margin: 1px 0 0;

  font-size: 0.88rem;
  font-weight: 760;
}

.published-form-summary p {
  margin: 5px 0 0;

  font-size: 0.875rem;

  line-height: 1.5;
}

/* Ready */

.published-form-summary-ready {
  border: 1px solid #b7e5ce;

  background: #f4fbf7;
}

.published-form-summary-ready .published-form-summary-icon {
  background: #ddf5e8;

  color: #18794e;
}

.published-form-summary-ready h2 {
  color: #18794e;
}

.published-form-summary-ready p {
  color: #4e6b5d;
}

/* Blocked */

.published-form-summary-blocked {
  border: 1px solid #f0b8b4;

  background: #fff8f7;
}

.published-form-summary-blocked .published-form-summary-icon {
  background: #fde8e6;

  color: var(--if-danger);
}

.published-form-summary-blocked h2 {
  color: var(--if-danger);
}

.published-form-summary-blocked p {
  color: #7a514e;
}

/* ============================================================
   SUMMARY ERRORS
   ============================================================ */

.published-form-summary-errors {
  display: grid;

  gap: 8px;

  margin-top: 13px;
}

.published-form-summary-error {
  display: grid;

  gap: 2px;

  padding: 9px 11px;

  border-left: 3px solid var(--if-danger);
  border-radius: 5px;

  background: rgba(255, 255, 255, 0.75);
}

.published-form-summary-error-link {
  width: 100%;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  text-align: left;
  cursor: pointer;
}

.published-form-summary-error-link:hover {
  background: #fff;
}

.published-form-summary-error-link:focus-visible {
  outline: 3px solid var(--if-primary, #041e42);
  outline-offset: 3px;
}

.published-form-summary-error strong {
  color: #7a271a;

  font-size: 0.875rem;
}

.published-form-summary-error span {
  color: #7a514e;

  font-size: 0.875rem;

  line-height: 1.45;
}

/* ============================================================
   SUMMARY WARNINGS
   ============================================================ */

.published-form-summary-warnings {
  display: grid;

  gap: 6px;

  margin-top: 12px;
}

.published-form-summary-warnings > div {
  padding: 8px 10px;

  border-left: 3px solid #d7a31a;
  border-radius: 4px;

  background: #fffbef;

  color: #7a5a00;

  font-size: 0.875rem;

  line-height: 1.45;
}

/* ============================================================
   SUBMIT AREA
   ============================================================ */

.published-form-submit-area {
  display: flex;
  justify-content: flex-end;

  padding: 24px var(--published-form-inline-padding) 46px;
}

.published-form-submit {
  min-width: 145px;
  height: 44px;

  padding: 0 20px;

  border: 0;
  border-radius: 9px;

  background: var(--if-primary, #041e42);

  color: var(--if-surface);

  font-size: 0.875rem;
  font-weight: 760;

  cursor: pointer;

  box-shadow: 0 4px 12px
    color-mix(in srgb, var(--if-primary, #041e42), transparent 78%);

  transition:
    background-color 130ms ease,
    transform 130ms ease,
    opacity 130ms ease;
}

.published-form-submit:hover:not(:disabled) {
  transform: translateY(-1px);

  background: color-mix(in srgb, var(--if-primary, #041e42), white 8%);
}

.published-form-submit:disabled {
  opacity: 0.45;

  cursor: not-allowed;

  box-shadow: none;
}

/* ============================================================
   LOADING / UNAVAILABLE
   ============================================================ */

.published-form-state {
  width: min(100% - 48px, 760px);

  margin: 60px auto;

  padding: 50px;

  border: 1px solid var(--if-border);
  border-radius: var(--if-radius-card);

  background: var(--if-surface);

  color: var(--if-text-muted);

  text-align: center;

  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
}

.published-form-state h1 {
  margin: 0;

  color: var(--if-primary, #041e42);

  font-size: 1.2rem;
}

.published-form-state p {
  margin: 8px 0 0;

  font-size: 0.875rem;

  line-height: 1.5;
}

.published-form-error h1 {
  color: var(--if-danger);
}

/* ============================================================
   UNSUPPORTED FIELD
   ============================================================ */

.published-form-unsupported {
  padding: 12px;

  border: 1px dashed var(--if-border-strong);
  border-radius: var(--if-radius-control);

  background: var(--if-surface-subtle);

  color: var(--if-text-muted);

  font-size: 0.875rem;
}

/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 700px) {
  .published-form-container {
    border-radius: 12px;
  }

  .published-form-body {
    padding: 6px clamp(1rem, 5vw, 1.375rem) 14px;
  }

  .published-form-summary-icon {
    width: 34px;
    height: 34px;
  }

  .published-form-submit {
    width: 100%;
  }
}
/* ============================================================
   SUBMISSION CONFIRMATION
   ============================================================ */

.published-form-confirmation {
  width: min(100%, 680px);

  margin: 50px auto;

  padding: 48px 42px;

  border: 1px solid var(--if-border);
  border-radius: 16px;

  background: var(--if-surface);

  box-shadow: var(--if-shadow-card-hover);

  text-align: center;
}

/* ============================================================
   SUCCESS ICON
   ============================================================ */

.published-form-confirmation-icon {
  width: 64px;
  height: 64px;

  display: grid;
  place-items: center;

  margin: 0 auto 20px;

  border-radius: 50%;

  background: color-mix(in srgb, var(--if-secondary, #0a7cb4), white 88%);

  color: var(--if-secondary, #0a7cb4);

  font-size: 1.7rem;
  font-weight: 800;

  box-shadow: 0 0 0 8px
    color-mix(in srgb, var(--if-secondary, #0a7cb4), transparent 92%);
}

/* ============================================================
   EYEBROW
   ============================================================ */

.published-form-confirmation .if-eyebrow {
  margin: 0 0 8px;

  color: var(--if-secondary, #0a7cb4);

  font-size: 0.875rem;
  font-weight: 800;

  letter-spacing: 0.12em;

  text-transform: uppercase;
}

/* ============================================================
   TITLE
   ============================================================ */

.published-form-confirmation h1 {
  margin: 0;

  color: var(--if-primary, #041e42);

  font-size: 1.55rem;
  font-weight: 780;

  line-height: 1.25;
}

/* ============================================================
   MESSAGE
   ============================================================ */

.published-form-confirmation-message {
  max-width: 520px;

  margin: 14px auto 0;

  color: var(--if-text-muted);

  font-size: 0.875rem;

  line-height: 1.65;
}

/* ============================================================
   SUBMISSION REFERENCE
   ============================================================ */

.published-form-confirmation-reference {
  display: grid;

  gap: 5px;

  max-width: 520px;

  margin: 28px auto;

  padding: 15px 18px;

  border: 1px solid var(--if-border);
  border-radius: 10px;

  background: var(--if-surface-subtle);
}

.published-form-confirmation-reference span {
  color: var(--if-text-muted);

  font-size: 0.875rem;
  font-weight: 800;

  letter-spacing: 0.08em;

  text-transform: uppercase;
}

.published-form-confirmation-reference strong {
  color: var(--if-primary, #041e42);

  font-size: 0.875rem;
  font-weight: 700;

  overflow-wrap: anywhere;
}

/* ============================================================
   RETURN BUTTON
   ============================================================ */

.published-form-confirmation .if-btn-primary {
  min-width: 160px;

  justify-content: center;

  margin-top: 2px;
}

/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 600px) {
  .published-form-confirmation {
    margin: 24px auto;

    padding: 36px 22px;

    border-radius: 12px;
  }

  .published-form-confirmation-icon {
    width: 56px;
    height: 56px;

    font-size: 1.45rem;
  }

  .published-form-confirmation h1 {
    font-size: 1.3rem;
  }

  .published-form-confirmation-reference {
    margin: 24px auto;
  }

  .published-form-confirmation .if-btn-primary {
    width: 100%;
  }
}

/* ============================================================
   LARGE-TEXT AND REFLOW SAFETY

   Controls must grow with user text settings instead of clipping
   labels inside heights chosen for the former, smaller type scale.
   ============================================================ */

.published-form-submit,
.published-form-ai-field-button,
.published-form-file-item .if-btn,
.published-form-resource-button {
  height: auto;
  min-height: 44px;
  padding-block: 0.65rem;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

.published-form-number-control {
  --number-accent: var(--if-secondary, #0a7cb4);
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--if-border-strong, #cbd5e1);
  border-radius: 0.5rem;
  background: var(--if-surface, #fff);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition:
    border-color 130ms ease,
    box-shadow 130ms ease,
    background-color 130ms ease;
}

.published-form-number-control[class*="published-number-"] {
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
  border-radius: 11px;
  border-color: color-mix(in srgb, var(--number-accent), #cbd5e1 68%);
}

.published-number-currency {
  --number-accent: #287052;
}
.published-number-percentage {
  --number-accent: #7556a8;
}

.published-form-number-control.published-number-percentage {
  grid-template-columns: minmax(0, 1fr) 44px;
  border-color: color-mix(in srgb, var(--number-accent), #cbd5e1 38%);
}

/* Currency has a leading affix, while percentage has a trailing affix.
   Define only the tracks that are actually present so either affix remains
   content-sized instead of inheriting the flexible input track. */
.published-form-number-control:has(> .published-form-number-affix:first-child) {
  grid-template-columns: auto minmax(0, 1fr);
}

.published-form-number-control:focus-within {
  border-color: var(--number-accent);
  box-shadow: 0 0 0 4px
    color-mix(in srgb, var(--number-accent), transparent 86%);
}

.published-form-number-control .published-form-input {
  min-width: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  box-shadow: none;
  background: transparent;
}

/* The composite control owns the visible focus treatment. Allowing the
   nested input's global outline to render as well causes it to be clipped by
   table cells into a detached vertical bar beside repeating-table values. */
.published-form-number-control .published-form-input:focus,
.published-form-number-control .published-form-input:focus-visible {
  outline: 0;
  box-shadow: none;
}

.published-form-number-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  border-right: 1px solid
    color-mix(in srgb, var(--number-accent), transparent 82%);
  background: color-mix(in srgb, var(--number-accent), transparent 92%);
  color: var(--number-accent);
  font-size: 1.05rem;
  font-weight: 800;
}

.published-form-number-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}

.published-form-number-kind {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: color-mix(in srgb, var(--number-accent), #334155 42%);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.published-form-number-affix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  padding: 0.625rem 0.75rem;
  background: var(--if-surface-subtle, #f8fafc);
  color: var(--if-text-strong, #334155);
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Percentage is a one-character suffix and should not consume the same
   horizontal space as a currency prefix. */
.published-form-number-control > .published-form-number-affix:last-child {
  min-width: 44px;
  padding-inline: 0.75rem;
  font-size: 1rem;
  border-left: 1px solid
    color-mix(in srgb, var(--number-accent), transparent 58%);
  background: color-mix(in srgb, var(--number-accent), transparent 90%);
  color: var(--number-accent);
}

.published-form-field-invalid .published-form-number-control {
  border-color: var(--if-danger, #b42318);
  background: color-mix(in srgb, var(--if-danger, #b42318), transparent 98%);
}

.published-repeating-number-control[class*="published-number-"] {
  grid-template-columns: 38px minmax(0, 1fr) auto;
}

.published-repeating-table td.published-repeating-number,
.published-repeating-table
  td.published-repeating-number
  .published-repeating-predefined-value,
.published-repeating-number-input,
.published-repeating-calculated {
  text-align: right;
}

.published-repeating-predefined-value.is-number {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.published-repeating-number-control.published-number-percentage {
  grid-template-columns: minmax(0, 1fr) 38px;
}

.published-repeating-number-control .published-form-number-icon {
  min-width: 38px;
}

@media (max-width: 480px) {
  .published-form-number-control[class*="published-number-"] {
    grid-template-columns: 42px minmax(0, 1fr) auto;
  }
  .published-form-number-control.published-number-percentage {
    grid-template-columns: minmax(0, 1fr) 42px;
  }
  .published-form-number-kind {
    display: none;
  }
}

/* Repeating tables use a true table at wide sizes and row cards when space or
   UI scaling makes a horizontal grid impractical. */
.published-repeating-table {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.published-repeating-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #d7dee7;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.published-repeating-table table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: var(--if-surface);
}
.published-repeating-table th,
.published-repeating-table td {
  padding: 10px;
  border-right: 1px solid #d7dee7;
  border-bottom: 1px solid #d7dee7;
  text-align: left;
  vertical-align: top;
}
.published-repeating-table tr > :last-child {
  border-right: 0;
}
.published-repeating-table tbody tr:last-child > * {
  border-bottom: 0;
}
.published-repeating-table thead th,
.published-repeating-table tfoot th,
.published-repeating-table tfoot td {
  background: var(--if-surface-subtle);
  color: var(--if-text-strong);
  font-size: 0.875rem;
  font-weight: 750;
}
.published-repeating-table td .published-form-input {
  width: 100%;
  min-width: 120px;
}
.published-repeating-cell-invalid {
  background: #fff7f7;
  box-shadow: inset 0 0 0 1px #c73434;
}
.published-repeating-cell-error {
  margin-top: 6px;
  color: #a12626;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.35;
}
.published-repeating-preview-value {
  min-width: 120px;
  padding: 9px 10px;
  color: var(--if-text);
  background: var(--if-surface-subtle);
  border: 1px solid var(--if-border);
  border-radius: 7px;
}
.published-repeating-placeholder {
  color: var(--if-text-muted, #64748b);
  font-style: italic;
}
.published-repeating-table-scroll .published-repeating-fixed-column {
  width: 190px;
  min-width: 190px;
  max-width: 260px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
.published-repeating-table-actions {
  width: 1%;
  min-width: 112px;
  vertical-align: middle !important;
  white-space: normal;
}
.published-repeating-table-action-buttons {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.published-repeating-table-action-buttons .if-btn {
  min-width: 44px;
  min-height: 44px;
  padding-inline: 9px;
}
.published-repeating-table-action-buttons .published-repeating-row-action {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-color: var(--if-border);
  background: transparent;
  color: var(--if-text-muted);
  font-size: 1rem;
}
.published-repeating-table-action-buttons .published-repeating-row-action:hover {
  border-color: var(--if-secondary);
  background: var(--if-secondary-soft);
  color: var(--if-primary);
}
.published-repeating-table-action-buttons .published-repeating-row-action.is-delete:hover {
  border-color: var(--if-danger);
  background: #fff5f5;
  color: var(--if-danger);
}
.published-repeating-table-add {
  justify-self: end;
}
.published-repeating-calculated {
  display: block;
  min-height: 44px;
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--if-surface-subtle);
  font-variant-numeric: tabular-nums;
}
.published-repeating-table
  td.published-repeating-number
  .published-repeating-predefined-value.is-formula,
.published-repeating-predefined-value.is-formula {
  display: block;
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--if-surface-subtle);
  color: var(--if-text-strong);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  text-align: right;
}
.published-repeating-predefined-value.is-formula.is-pending {
  color: var(--if-text-muted);
}
.published-repeating-lookup {
    min-width: 170px;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 5px;
    width: 100%;
}

.published-repeating-lookup > span {
    min-width: 0;
    flex: 1 1 auto;
    overflow-wrap: anywhere;
    color: var(--if-text-muted);
    font-size: 0.875rem;
}

.published-repeating-lookup > .if-btn {
    width: auto;
    min-width: 0;
    min-height: 44px;
    flex: 0 0 auto;
    padding: 5px 8px;
    font-size: 0.75rem;
    line-height: 1.15;
    white-space: nowrap;
}

.published-repeating-lookup-search {
    white-space: nowrap;
}
.published-repeating-multiselect {
  position: relative;
  min-width: 160px;
}
.published-repeating-multiselect summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--if-border-strong);
  border-radius: 8px;
  background: var(--if-surface);
  cursor: pointer;
}
.published-repeating-multiselect label {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 7px 4px;
}
.published-repeating-section-heading th {
  padding: 9px 12px;
  border-top: 3px solid color-mix(in srgb, var(--if-secondary), transparent 25%);
  background: color-mix(in srgb, var(--if-secondary), white 94%);
  color: var(--if-primary);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.published-repeating-summary-row > * {
  background: #f5f7fa;
  color: var(--if-text-strong, #334155);
  font-weight: 700;
  vertical-align: middle;
}
.published-repeating-subtotal-row > * {
  border-top: 2px solid color-mix(in srgb, var(--if-secondary), transparent 42%);
  border-bottom-color: #d2e2eb;
  background: color-mix(in srgb, var(--if-secondary), white 96%);
}
.published-repeating-grand-total-row > * {
  border-top: 2px solid color-mix(in srgb, var(--if-primary), transparent 20%);
  border-bottom: 1px solid #c7d3df;
  background: color-mix(in srgb, var(--if-primary), white 94%);
  color: #243b53;
  font-weight: 800;
}
.published-repeating-table
  tfoot
  .published-repeating-grand-total-row:nth-child(even)
  > * {
  background: color-mix(in srgb, var(--if-primary), white 91%);
}
.published-repeating-summary-value {
  display: grid;
  justify-items: end;
  gap: 2px;
  width: 100%;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.published-repeating-summary-value > span {
  color: var(--if-text-muted, #64748b);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.published-repeating-summary-value > strong {
  font-size: 1rem;
}
.published-repeating-section-add td {
  padding: 8px 10px;
  background: color-mix(in srgb, var(--if-secondary), white 98%);
}
.published-repeating-section-add .if-btn {
  min-height: 44px;
}

.published-populated-answer {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.published-populated-answer > fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.published-populated-answer > fieldset:disabled .published-form-input {
  background: var(--if-surface-subtle);
  color: var(--if-text-muted);
  cursor: not-allowed;
}
.published-populated-answer > button {
  justify-self: start;
}
.published-populated-awaiting {
  padding: 9px 12px;
  border: 1px dashed var(--if-border-strong);
  border-radius: 8px;
  background: var(--if-surface-subtle);
  color: var(--if-text-muted);
  font-size: 0.84rem;
}
.published-populated-awaiting strong {
  color: var(--if-text-strong);
  font-weight: 700;
}
.published-populated-answer > small {
  color: var(--if-text-muted);
  font-size: 0.75rem;
}
.published-populated-answer.is-overridden > fieldset .published-form-input {
  border-color: var(--if-secondary);
}

.published-form-submitting-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(2px);
}
.published-form-submitting-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: min(440px, 100%);
  padding: 22px;
  color: var(--if-text);
  background: var(--if-surface);
  border: 1px solid var(--if-border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.28);
}
.published-form-submitting-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1.05rem;
  color: var(--if-text-strong);
}
.published-form-submitting-card p {
  margin: 0;
  color: var(--if-text-muted);
  line-height: 1.5;
}

@media (max-width: 760px) {
  .published-repeating-table-scroll {
    overflow: visible;
    border: 0;
  }
  .published-repeating-table table,
  .published-repeating-table tbody,
  .published-repeating-table tr,
  .published-repeating-table td,
  .published-repeating-table th {
    display: block;
    min-width: 0;
  }
  .published-repeating-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  .published-repeating-table tbody {
    display: grid;
    gap: 12px;
  }
  .published-repeating-table tbody tr {
    padding: 12px;
    border: 1px solid var(--if-border);
    border-radius: 10px;
    background: var(--if-surface);
  }
  .published-repeating-table tbody td,
  .published-repeating-table tbody th {
    min-width: 0 !important;
    display: grid;
    grid-template-columns: minmax(110px, 0.45fr) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 8px 0;
    border: 0;
  }
  .published-repeating-table .published-repeating-fixed-column {
    width: auto;
    max-width: none;
  }
  .published-repeating-table tbody td::before {
    content: attr(data-label);
    color: var(--if-text-strong);
    font-size: 0.875rem;
    font-weight: 750;
  }
  .published-repeating-table tbody td.published-repeating-number::before {
    text-align: left;
  }
  .published-repeating-table .published-repeating-section-heading th {
    display: block;
    width: auto;
    padding: 10px 12px;
  }
  .published-repeating-table .published-repeating-section-add td {
    display: block;
  }
  .published-repeating-table tbody td.published-repeating-table-actions {
    display: grid;
    grid-template-columns: minmax(110px, 0.45fr) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
  }
  .published-repeating-table .published-repeating-table-action-buttons {
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
  }
  .published-repeating-table .published-repeating-table-action-buttons .if-btn {
    min-width: 44px;
    width: auto;
  }
  .published-repeating-table tfoot {
    display: block;
    margin-top: 12px;
  }
  .published-repeating-table tfoot tr {
    display: grid;
    gap: 4px;
    padding: 12px;
    border-radius: 10px;
    background: var(--if-surface-subtle);
  }
  .published-repeating-table tfoot td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border: 0;
  }
  .published-repeating-table tfoot td::before {
    content: attr(data-label);
    font-weight: 750;
  }
}

.published-form-submit-area,
.published-form-field-ai-action-row,
.published-form-ai-heading,
.published-form-ai-inline-status,
.published-form-file-item {
  min-width: 0;
  flex-wrap: wrap;
}

.published-form-ai-inline-status > div,
.published-form-file-item > div {
  min-width: 0;
}

@media (max-width: 700px) {
  .published-form-summary {
    grid-template-columns: 36px 1fr;
    margin: 8px clamp(1rem, 5vw, 1.375rem) 0;
    padding: 14px;
  }
}

@media (max-width: 420px) {
  .published-form-summary {
    grid-template-columns: 1fr;
  }

  .published-form-summary-icon {
    width: 42px;
    height: 42px;
  }

  .published-form-field-ai-action-row > *,
  .published-form-file-item .if-btn,
  .published-form-resource-button {
    width: 100%;
  }
}

.published-form-confirmation-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;

  gap: 10px;

  margin-top: 4px;
}

@media (max-width: 600px) {
  .published-form-confirmation-actions {
    align-items: stretch;

    flex-direction: column;
  }

  .published-form-confirmation-actions .if-btn {
    width: 100%;

    justify-content: center;
  }
}

/* ============================================================
   AI REVIEW
   ============================================================ */

.published-form-ai-section {
  margin-top: 24px;

  padding: 20px;

  border: 1px solid var(--if-border);
  border-radius: 12px;

  background: var(--if-surface);
}

.published-form-ai-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 20px;
}

.published-form-ai-heading h2 {
  margin: 3px 0 0;

  color: var(--if-primary, #041e42);

  font-size: 0.95rem;
}

.published-form-ai-heading p:last-child {
  margin: 5px 0 0;

  color: var(--if-text-muted);

  font-size: 0.875rem;
}

.published-form-ai-notice {
  display: flex;
  flex-direction: column;

  gap: 3px;

  margin-top: 15px;

  padding: 11px 13px;

  border-radius: var(--if-radius-control);

  background: color-mix(in srgb, var(--if-secondary, #0a7cb4), white 95%);
}

.published-form-ai-notice strong {
  color: var(--if-primary, #041e42);

  font-size: 0.875rem;
}

.published-form-ai-notice span {
  color: var(--if-text-muted);

  font-size: 0.875rem;
}

.published-form-ai-results {
  display: grid;
  min-width: 0;
  max-width: 100%;

  gap: 10px;

  margin-top: 15px;
}

.published-form-ai-result {
  min-width: 0;
  max-width: 100%;
  padding: 13px 14px;

  border: 1px solid var(--if-border);
  border-radius: 9px;
}

.published-form-ai-result-header {
  display: flex;
  justify-content: space-between;

  gap: 16px;
}

.published-form-ai-result-label {
  display: block;

  margin-bottom: 3px;

  color: var(--if-text-muted);

  font-size: 0.875rem;
  font-weight: 800;

  text-transform: uppercase;
}

.published-form-ai-result strong {
  color: var(--if-primary, #041e42);

  font-size: 0.875rem;
}

.published-form-ai-feedback {
  min-width: 0;
  max-width: 100%;
  margin: 8px 0 0;

  color: var(--if-slate-700);

  font-size: 0.875rem;

  line-height: 1.55;
}

.published-form-ai-meta {
  display: flex;
  gap: 12px;

  margin-top: 9px;

  color: var(--if-slate-400);

  font-size: 0.875rem;
}

.published-form-ai-current,
.published-form-ai-stale {
  font-size: 0.875rem;
  font-weight: 800;
}

.published-form-ai-current {
  color: #18794e;
}

.published-form-ai-stale {
  color: #b45309;
}

.published-form-ai-result-approved {
  border-color: #bfe3d0;

  background: #f4fbf7;
}

.published-form-ai-result-warning {
  border-color: #f3d6a4;

  background: #fff9ee;
}

.published-form-ai-result-error {
  border-color: #f0c7c3;

  background: #fff5f4;
}

.published-form-ai-result-stale {
  border-color: var(--if-border);

  background: var(--if-surface-subtle);

  opacity: 0.8;
}

.published-form-ai-error {
  margin-top: 12px;

  padding: 11px 13px;

  border: 1px solid #f0c7c3;
  border-radius: var(--if-radius-control);

  background: #fff5f4;

  color: var(--if-danger);

  font-size: 0.875rem;
}

@media (max-width: 650px) {
  .published-form-ai-heading {
    flex-direction: column;
  }
}
/* ============================================================
   FILE UPLOAD -RESPONDENT / SUBMISSION EDIT
   ============================================================ */

.published-form-file-upload {
  display: grid;

  gap: 12px;
}

/* ============================================================
   FILE PICKER
   ============================================================ */

.published-form-file-picker {
  position: relative;

  padding: 16px;

  border: 1px dashed var(--if-border-strong);
  border-radius: 10px;

  background: var(--if-surface-subtle);

  transition:
    border-color 0.15s ease,
    background-color 0.15s ease;
}

.published-form-file-picker:hover {
  border-color: var(--if-secondary, #0a7cb4);

  background: color-mix(in srgb, var(--if-secondary, #0a7cb4), white 97%);
}

/* ============================================================
   NATIVE INPUT FILE
   ============================================================ */

.published-form-file-picker input[type="file"] {
  display: block;

  width: 100%;

  margin: 0 0 9px;

  color: var(--if-slate-700);

  font-size: 0.875rem;

  cursor: pointer;
}

.published-form-file-picker input[type="file"]::file-selector-button {
  margin-right: 10px;

  padding: 8px 12px;

  border: 1px solid var(--if-primary, #041e42);

  border-radius: 7px;

  background: var(--if-primary, #041e42);

  color: var(--if-surface);

  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;

  cursor: pointer;

  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.published-form-file-picker input[type="file"]::file-selector-button:hover {
  opacity: 0.9;
}

.published-form-file-picker input[type="file"]:focus-visible {
  outline: 2px solid var(--if-secondary, #0a7cb4);

  outline-offset: 3px;
}

/* ============================================================
   FILE HELP TEXT
   ============================================================ */

.published-form-file-picker .published-form-help {
  margin-top: 4px;
}

.published-form-file-picker .published-form-help + .published-form-help {
  margin-top: 2px;
}

/* ============================================================
   UPLOADED FILE LIST
   ============================================================ */

.published-form-file-list {
  display: grid;

  gap: 7px;
}

.published-form-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 16px;

  min-width: 0;

  padding: 10px 12px;

  border: 1px solid var(--if-border);
  border-radius: var(--if-radius-control);

  background: var(--if-surface);
}

.published-form-file-item > div {
  display: flex;
  flex-direction: column;

  min-width: 0;

  gap: 2px;
}

.published-form-file-item strong {
  overflow: hidden;
  overflow-wrap: anywhere;

  color: var(--if-text-strong);

  font-size: 0.875rem;
  font-weight: 700;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.published-form-file-item span {
  color: var(--if-text-muted);

  font-size: 0.875rem;
}

.published-form-file-item .if-btn {
  flex: 0 0 auto;

  min-height: 44px;

  padding: 5px 9px;

  border-color: var(--if-border);

  background: var(--if-surface);

  color: var(--if-text-muted);

  font-size: 0.875rem;
}

.published-form-file-item .if-btn:hover:not(:disabled) {
  border-color: #f0c7c3;

  background: #fff5f4;

  color: var(--if-danger);
}

/* ============================================================
   FILE UPLOAD ERRORS
   ============================================================ */

.published-form-file-upload .published-form-message-error {
  margin-top: 0;
}

/* ============================================================
   DISABLED / SAVING
   ============================================================ */

.published-form-file-picker input[type="file"]:disabled {
  cursor: not-allowed;

  opacity: 0.6;
}

.published-form-file-item button:disabled {
  cursor: not-allowed;

  opacity: 0.55;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
  .published-form-file-picker {
    padding: 13px;
  }

  .published-form-file-item {
    align-items: stretch;

    flex-direction: column;

    gap: 9px;
  }

  .published-form-file-item .if-btn {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .published-form-shell {
    padding: 20px 12px 64px;
  }

  .published-form-submit-area {
    padding: 22px clamp(1rem, 5vw, 1.375rem) 32px;
  }
}
.published-form-resource-link {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid
    color-mix(in srgb, var(--if-secondary, #0a7cb4), transparent 76%);
  border-radius: 10px;
  background: color-mix(in srgb, var(--if-secondary, #0a7cb4), white 96%);
}

.published-form-resource-link > strong {
  color: var(--if-primary, #041e42);
  font-size: 0.875rem;
}

.published-form-resource-link > p {
  margin: 0;
  color: var(--if-text, #475569);
  font-size: 0.875rem;
  line-height: 1.55;
}

.published-form-resource-button {
  margin-top: 3px;
}

/* ============================================================
   AI REVIEW -FIELD ACTIONS + WHOLE FORM PAGE
   ============================================================ */

.published-form-field-ai-review {
  display: grid;
  gap: 10px;
  margin-top: 11px;
}

.published-form-field-ai-action-row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.published-form-ai-field-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border: 1px solid var(--if-primary, #041e42);
  border-radius: 7px;
  background: var(--if-primary, #041e42);
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 760;
  cursor: pointer;
}

.published-form-ai-field-button:hover:not(:disabled) {
  filter: brightness(1.08);
}

.published-form-ai-field-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.published-form-ai-requirement-badge {
  padding: 4px 7px;
  border: 1px solid var(--if-border);
  border-radius: 999px;
  background: var(--if-surface-subtle, #f8fafc);
  color: var(--if-text-muted, #64748b);
  font-size: 0.75rem;
  font-weight: 760;
}

.published-form-ai-inline-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid color-mix(in srgb, var(--if-secondary, #0a7cb4), white 68%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--if-secondary, #0a7cb4), white 96%);
}

.published-form-ai-inline-status > div {
  display: grid;
  gap: 2px;
}

.published-form-ai-inline-status strong {
  color: var(--if-primary, #041e42);
  font-size: 0.875rem;
}

.published-form-ai-inline-status span:not(.published-form-ai-spinner) {
  color: var(--if-text-muted, #64748b);
  font-size: 0.875rem;
}

.published-form-ai-spinner {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid color-mix(in srgb, var(--if-secondary, #0a7cb4), white 72%);
  border-top-color: var(--if-secondary, #0a7cb4);
  border-radius: 50%;
  animation: published-form-ai-spin 0.8s linear infinite;
}

@keyframes published-form-ai-spin {
  to {
    transform: rotate(360deg);
  }
}

.published-form-ai-inline-result .published-form-ai-result {
  margin: 0;
}

.published-form-whole-ai-page {
  min-width: 0;
  max-width: 100%;
  padding: 30px 0 18px;
}

.published-form-whole-ai-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--if-primary, #041e42), white 92%);
  color: var(--if-primary, #041e42);
  font-size: 0.75rem;
  font-weight: 850;
}

.published-form-whole-ai-page h2 {
  margin: 4px 0 0;
  color: var(--if-primary, #041e42);
  font-size: 1.1rem;
}

.published-form-whole-ai-intro {
  width: 100%;
  max-width: none;
  margin: 8px 0 0;
  color: var(--if-text-muted, #64748b);
  font-size: 0.875rem;
  line-height: 1.6;
}

.published-form-whole-ai-actions {
  margin-top: 16px;
}

.published-form-ai-whole-waiting {
  margin-top: 14px;
}

.published-form-ai-response {
  margin: 8px 0 0;
  color: var(--if-text, #1f2937);
  font-size: 0.875rem;
  font-weight: 650;
  line-height: 1.55;
  white-space: pre-wrap;
}

/* Published form flow and navigation. Loaded after form-sections-flow.css. */

.published-form-page-progress {
  width: auto;
  margin-inline: var(--published-form-inline-padding);
  padding: 14px 0 4px;
}

.published-form-page-progress-text {
  margin-bottom: 7px;
  color: var(--if-text-muted);
  font-size: 0.875rem;
  font-weight: 750;
  padding-right: 4px;
  text-align: right;
}

.published-form-page-progress-track {
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--if-slate-100);
}

.published-form-page-progress-value {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--if-primary), var(--if-secondary));
  transition: width 180ms ease;
}

.published-form-section-header {
  margin: 0 0 22px;
  padding: 0 0 17px;
  border-bottom: 1px solid var(--if-border);
}

.published-form-section-header h2 {
  margin: 2px 0 0;
  color: var(--if-primary);
  font-size: 1.08rem;
  font-weight: 780;
}

.published-form-section-header > p:last-child:not(.if-eyebrow) {
  margin: 7px 0 0;
  color: var(--if-text-muted);
  font-size: 0.875rem;
  line-height: 1.55;
}

.published-form-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  padding-bottom: 42px;
  padding-inline: var(--published-form-inline-padding);
  border-top: 1px solid var(--if-border);
}

.published-form-navigation-primary {
  display: flex;
  justify-content: flex-end;
  margin-left: auto;
}

.published-form-navigation .published-form-submit {
  min-width: 150px;
}

.published-form-page-top-anchor {
  height: 0;
  scroll-margin-top: 76px;
}

.published-form-nav-button {
  min-width: 112px;
  min-height: 44px;
  height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0.65rem 15px;
  border: 1px solid var(--if-border-strong);
  border-radius: 7px;
  background: var(--if-surface);
  color: var(--if-primary);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 750;
  line-height: 1.3;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition:
    background var(--if-transition-fast),
    border-color var(--if-transition-fast),
    color var(--if-transition-fast),
    transform var(--if-transition-fast);
}

.published-form-nav-button:hover:not(:disabled) {
  border-color: var(--if-secondary);
  background: var(--if-secondary-soft);
  color: var(--if-primary);
}

.published-form-nav-button:active:not(:disabled) {
  transform: translateY(1px);
}

.published-form-nav-button:focus-visible {
  outline: 2px solid var(--if-secondary);
  outline-offset: 2px;
}

.published-form-nav-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.published-form-nav-button-continue {
  border-color: var(--if-primary);
  background: var(--if-primary);
  color: var(--if-primary-contrast, #fff);
}

.published-form-nav-button-continue:hover:not(:disabled) {
  border-color: var(--if-secondary);
  background: var(--if-secondary);
  color: var(--if-secondary-contrast, #fff);
}

.published-form-nav-button-back {
  background: var(--if-surface);
  color: var(--if-primary);
}

@media (max-width: 900px) {
  .published-form-layout-cell {
    grid-column: 1 / -1;
  }

  .published-form-label-left {
    display: block;
  }

  .published-form-label-left > .published-form-label-copy {
    margin-bottom: 10px;
  }
}

@media (max-width: 620px) {
  .published-form-navigation {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .published-form-navigation > div,
  .published-form-navigation .if-btn,
  .published-form-navigation .published-form-submit {
    width: 100%;
  }

  .published-form-navigation-primary {
    width: 100%;
  }

  .published-form-nav-button {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .published-form-page-progress {
    margin-inline: clamp(1rem, 5vw, 1.375rem);
  }

  .published-form-navigation {
    padding-bottom: 32px;
  }
}

@media (max-width: 760px) {
  .published-form-navigation {
    position: sticky;
    z-index: 20;
    bottom: 0;
    margin-inline: -1rem;
    padding: 0.75rem 1rem max(0.75rem, env(safe-area-inset-bottom));
    border-top: 1px solid var(--if-border, #e2e8f0);
    background: color-mix(in srgb, var(--if-surface, #fff), transparent 4%);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(10px);
  }
}

/* Long choice labels remain content-sized and reflow without overlap. */
.published-form-choice > :is(input[type="checkbox"], input[type="radio"]) {
  flex: 0 0 auto;
  margin-top: 0.2em;
}

.published-form-choice > span:not(.user-toggle) {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.4;
}

@media screen {
  .published-form-ai-requirement-badge {
    font-size: 0.875rem !important;
    line-height: 1.25 !important;
  }
}

@media (max-width: 700px) {
  .published-form-header {
    padding: 23px 22px 20px !important;
  }

  .published-form-header h1 {
    font-size: 1.2rem !important;
  }
}
