/* ==========================================================================
   Design tokens
   Every token is namespaced (--of-*) and declared on the component roots only, so
   OpenForms never defines or overrides a variable on the host page. Colour and
   border-radius tokens read the same-named OutSystems UI token first (e.g.
   --color-primary), so the host's brand palette and corner style flow in; the literal
   is the fallback. Spacing, typography and shadows use OpenForms' own values only, so
   a host type/spacing scale can't change the form's layout. See docs/customization.md.
   ========================================================================== */
:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop, #openforms-print-root, #toast-container, .openforms-toast-container) {
  --of-color-neutral-0: var(--color-neutral-0, #ffffff);
  --of-color-neutral-1: var(--color-neutral-1, #fafafb);
  --of-color-neutral-2: var(--color-neutral-2, #f5f6f8);
  --of-color-neutral-3: var(--color-neutral-3, #eeeeee);
  --of-color-neutral-4: var(--color-neutral-4, #dedede);
  --of-color-neutral-5: var(--color-neutral-5, #b0b0b0);
  --of-color-neutral-6: var(--color-neutral-6, #a0a0a0);
  --of-color-neutral-7: var(--color-neutral-7, #666666);
  --of-color-neutral-8: var(--color-neutral-8, #4a4a4a);
  --of-color-neutral-9: var(--color-neutral-9, #333333);
  --of-color-neutral-10: var(--color-neutral-10, #1a1a1a);

  --of-color-primary: var(--color-primary, #1068eb);
  --of-color-primary-selected: var(--color-primary-selected, #e7f0fd);
  --of-color-primary-hover: var(--color-primary-hover, #0d52ba);
  --of-color-secondary: var(--color-secondary, #4a5673);
  --of-color-error: var(--color-error, #d43838);
  --of-color-success: var(--color-success, #2e7d32);
  --of-color-warning: var(--color-warning, #f9a825);

  --of-font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --of-space-xs: 4px;
  --of-space-s: 8px;
  --of-space-m: 12px;
  --of-space-base: 16px;
  --of-space-l: 24px;
  --of-space-xl: 32px;

  --of-border-radius-xs: var(--border-radius-xs, 4px);
  --of-border-radius-s: var(--border-radius-s, 6px);
  --of-border-radius-m: var(--border-radius-m, 8px);
  --of-border-radius-soft: var(--border-radius-soft, 8px);
  --of-border-radius-l: var(--border-radius-l, 12px);
  --of-border-radius-pill: var(--border-radius-pill, 50px);

  --of-font-size-xs: 11px;
  --of-font-size-s: 13px;
  --of-font-size-base: 14px;
  --of-font-size-m: 16px;

  --of-font-weight-normal: 400;
  --of-font-weight-medium: 500;
  --of-font-weight-semibold: 600;
  --of-font-weight-bold: 700;

  --of-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --of-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --of-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.15);

  /* Borders. Aliases of the neutral scale by default, so they follow it unless set on their own. */
  --of-border-width: 1px;
  --of-color-border: var(--of-color-neutral-4);
  --of-color-border-subtle: var(--of-color-neutral-3);

  /* Focus ring (outline) and halo (soft glow around it) */
  --of-focus-ring-color: var(--of-color-primary);
  --of-focus-ring-width: 2px;
  --of-focus-ring-offset: 2px;
  --of-focus-halo-color: var(--of-color-primary-selected);
  --of-focus-halo-width: 3px;

  /* Inputs and the form card */
  --of-input-bg: var(--of-color-neutral-0);
  --of-input-color: var(--of-color-neutral-10);
  --of-input-padding-y: 10px;
  --of-card-bg: var(--of-color-neutral-0);
  --of-card-padding: var(--of-space-xl);
  --of-card-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);

  /* OpenForms-only tokens (no OutSystems UI equivalent): borders and text on the image lightbox */
  --of-border: rgba(255, 255, 255, 0.08);
  --of-text-primary: #f3f4f6;
  --of-text-secondary: #9ca3af;
}

.builder-layout *,
.builder-layout *::before,
.builder-layout *::after {
  box-sizing: border-box;
}

/* ==========================================================================
   Shared Utilities (Accessibility)
   ========================================================================== */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Shared Utilities (Buttons)
   ========================================================================== */
:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .pg-btn {
  background: var(--of-color-primary);
  color: var(--of-color-neutral-0);
  border: none;
  border-radius: var(--of-border-radius-soft);
  padding: var(--of-space-s) var(--of-space-base);
  font-size: var(--of-font-size-s);
  font-weight: var(--of-font-weight-medium);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all .2s ease-in-out;
  font-family: inherit
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .pg-btn:hover {
  background: var(--of-color-primary-hover);
  transform: translateY(-1px)
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .pg-btn:active {
  transform: translateY(0)
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .pg-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .pg-btn-secondary {
  background: var(--of-color-neutral-0);
  border: 1px solid var(--of-color-primary);
  color: var(--of-color-primary);
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .pg-btn-secondary:hover {
  background: var(--of-color-neutral-4);
}


/* ==========================================================================
 OpenForms Builder (3-Column Layout Canvas Frame)
 ========================================================================== */
.builder-layout {
  display: grid;
  grid-template-columns: 1fr 3fr 2fr;
  flex: 1;
  overflow: hidden;
  height: 100%;
  transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 1. Palette Panel (Left Column) */
:where(.builder-layout) .builder-palette {
  background-color: var(--of-color-neutral-0);
  border: var(--of-border-width) solid var(--of-color-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: var(--of-space-base);
  min-width: 200px;
}

:where(.builder-layout) .section-label {
  font-size: var(--of-font-size-xs);
  font-weight: var(--of-font-weight-semibold);
  color: var(--of-color-neutral-7);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--of-space-m);
}

:where(.builder-layout) .palette-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--of-space-s);
}

/* Drag Item Tiles */
:where(.builder-layout) .palette-item {
  background-color: var(--of-color-neutral-2);
  border: var(--of-border-width) solid var(--of-color-border);
  color: var(--of-color-neutral-10);
  font-size: var(--of-font-size-s);
  font-weight: var(--of-font-weight-medium);
  display: flex;
  cursor: grab;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--of-space-s);
  font-size: var(--of-font-size-xs);
  gap: 6px;
  border-radius: var(--of-border-radius-soft);
  height: 64px;
}

:where(.builder-layout) .palette-item:hover {
  background-color: var(--of-color-primary-selected);
  border-color: var(--of-color-primary);
  color: var(--of-color-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

:where(.builder-layout) .palette-item:active {
  cursor: grabbing;
}

:where(.builder-layout) .palette-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin: 0;
}

/* 2. Workspace Canvas (Center Column) */
:where(.builder-layout) .builder-canvas {
  flex: 1;
  overflow-y: auto;
  padding: var(--of-space-l);
  display: flex;
  flex-direction: column;
  background: var(--of-color-neutral-1);
  gap: var(--of-space-base);
}

:where(.builder-layout) .canvas-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--of-space-s);
}

:where(.builder-layout) .canvas-title {
  color: var(--of-color-neutral-10);
  font-size: var(--of-font-size-m);
  font-weight: var(--of-font-weight-bold);
}

/* Canvas Drop Empty state */
:where(.builder-layout) .canvas-empty-state {
  border: 2px dashed var(--of-color-neutral-4);
  border-radius: var(--of-border-radius-soft);
  background-color: var(--of-color-neutral-0);
  padding: 48px var(--of-space-l);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--of-space-m);
  color: var(--of-color-neutral-7);
  transition: all 0.2s ease;
  user-select: none;
}

:where(.builder-layout) .canvas-empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--of-color-neutral-5);
}

:where(.builder-layout) .canvas-empty-state h3 {
  font-size: var(--of-font-size-m);
  color: var(--of-color-neutral-10);
  font-weight: var(--of-font-weight-semibold);
}

:where(.builder-layout) .canvas-empty-state p {
  font-size: var(--of-font-size-s);
  max-width: 300px;
}

:where(.builder-layout) .canvas-empty-state.drag-over {
  border-color: var(--of-color-primary);
  background-color: var(--of-color-primary-selected);
  color: var(--of-color-primary);
}

/* ==========================================================================
 Canvas Section & Row Card Nesting Styling
 ========================================================================== */
:where(.builder-layout) .canvas-section {
  background-color: var(--of-color-neutral-1);
  border: 1.5px dashed var(--of-color-neutral-5);
  border-radius: var(--of-border-radius-soft);
  padding: 18px;
  margin-bottom: var(--of-space-l);
  position: relative;
  transition: all 0.2s ease;
}

:where(.builder-layout) .canvas-section:hover {
  border-color: var(--of-color-neutral-7);
}

:where(.builder-layout) .canvas-section.selected {
  border-color: var(--of-color-primary);
  border-style: solid;
  box-shadow: 0 4px 16px rgba(var(--of-color-primary), 0.08);
}

:where(.builder-layout) .canvas-section-header {
  display: flex;
  flex-flow: wrap;
  gap: var(--of-space-s);
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: var(--of-space-s);
  border-bottom: var(--of-border-width) solid var(--of-color-border-subtle);
}

:where(.builder-layout) .section-drag-handle {
  display: flex;
  align-items: center;
  gap: var(--of-space-xs);
  flex: 1;
}

:where(.builder-layout) .section-title-input:focus {
  border-bottom: 1px solid var(--of-color-primary);
}

:where(.builder-layout) .canvas-section-rows {
  display: flex;
  flex-direction: column;
  gap: var(--of-space-base);
  min-height: 40px;
}

:where(.builder-layout) .empty-section-drop-zone {
  padding: var(--of-space-s) 0;
}

:where(.builder-layout) .canvas-section.drag-over-section {
  border-top: 3px solid var(--of-color-primary);
  background-color: var(--of-color-primary-selected);
}

:where(.builder-layout) .canvas-section.dragging-section {
  opacity: 0.4;
  border: 1.5px dashed var(--of-color-primary);
  background-color: var(--of-color-neutral-2);
}

/* ==========================================================================
 Advanced Business Rules Builder Styling
 ========================================================================== */
:where(.builder-layout) .business-rules-panel {
  padding: var(--of-space-s) 0;
  border-top: var(--of-border-width) solid var(--of-color-border);
  margin-top: var(--of-space-base);
}

:where(.builder-layout) .business-rules-title {
  color: var(--of-color-neutral-8);
  font-size: var(--of-font-size-xs);
  font-weight: var(--of-font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--of-space-m);
  display: flex;
  align-items: center;
  gap: 6px;
}

:where(.builder-layout) .business-rules-title i,
:where(.builder-layout) .business-rules-title svg {
  color: var(--of-color-primary);
  width: 14px;
  height: 14px;
}

:where(.builder-layout) .rules-locale-notice {
  font-size: var(--of-font-size-xs);
  color: var(--of-color-neutral-7);
  text-align: center;
  margin-bottom: var(--of-space-m);
}

:where(.builder-layout) .rules-list-container {
  display: flex;
  flex-direction: column;
  gap: var(--of-space-m);
}

:where(.builder-layout) .formula-token-chips {
  margin-top: var(--of-space-s);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

:where(.builder-layout) .formula-chip-row-label {
  font-size: 9px;
  font-weight: var(--of-font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--of-color-neutral-6);
}

:where(.builder-layout) .formula-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

:where(.builder-layout) .formula-chip-empty {
  font-size: var(--of-font-size-xs);
  color: var(--of-color-neutral-5);
  font-style: italic;
}

:where(.builder-layout) .formula-token-chip {
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 10px;
  cursor: pointer;
  background: var(--of-color-neutral-3);
  color: var(--of-color-neutral-7);
  border: var(--of-border-width) solid var(--of-color-border);
  font-family: monospace;
  transition: all 0.15s ease;
}

:where(.builder-layout) .formula-token-chip:hover:not(:disabled) {
  background: var(--of-color-primary);
  color: var(--of-color-neutral-0);
  border-color: var(--of-color-primary);
}

:where(.builder-layout) .formula-fn-chip {
  background: var(--of-color-primary-selected);
  color: var(--of-color-primary);
  border-color: var(--of-color-primary-selected);
}

:where(.builder-layout) .rule-card {
  border: var(--of-border-width) solid var(--of-color-border);
  border-radius: var(--of-border-radius-soft);
  padding: var(--of-space-m);
  background-color: var(--of-color-neutral-1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease-in-out;
  display: flex;
  flex-direction: column;
  gap: var(--of-space-s);
}

:where(.builder-layout) .rule-card:hover {
  border-color: var(--of-color-neutral-5);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

:where(.builder-layout) .rule-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--of-space-xs);
  gap: var(--of-space-s);
}

:where(.builder-layout) .rule-section-title {
  font-size: var(--of-font-size-s);
  font-weight: var(--of-font-weight-semibold);
  color: var(--of-color-neutral-8);
}

:where(.builder-layout) .rule-target-prop {
  font-size: var(--of-font-size-xs);
  font-weight: var(--of-font-weight-semibold);
  width: auto;
  flex: 1;
  padding: var(--of-space-xs) var(--of-space-s);
  height: 28px;
}

:where(.builder-layout) .and-groups-list-container {
  display: flex;
  flex-direction: column;
  gap: var(--of-space-s);
}

:where(.builder-layout) .and-group-card {
  background-color: var(--of-color-neutral-0);
  border: var(--of-border-width) solid var(--of-color-border-subtle);
  border-radius: var(--of-border-radius-s);
  padding: var(--of-space-s) 10px;
  display: flex;
  flex-direction: column;
  gap: var(--of-space-s);
  transition: all 0.2s ease;
}

:where(.builder-layout) .and-group-card:hover {
  border-color: var(--of-color-neutral-4);
  background-color: var(--of-color-neutral-1);
}

:where(.builder-layout) .and-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

:where(.builder-layout) .and-group-title {
  font-size: 9px;
  font-weight: var(--of-font-weight-bold);
  color: var(--of-color-primary);
  letter-spacing: 0.5px;
}

:where(.builder-layout) .rules-row {
  display: flex;
  gap: 6px;
  align-items: center;
  width: 100%;
}

:where(.builder-layout) .rules-row select,
:where(.builder-layout) .rules-row input {
  padding: 5px var(--of-space-s);
  font-size: var(--of-font-size-xs);
  height: 28px;
  border-radius: var(--of-border-radius-xs);
}

:where(.builder-layout) .rules-row .rule-cond-field {
  flex: 2;
  min-width: 70px;
  width: 0;
  /* allows flex basis to govern width */
}

:where(.builder-layout) .rules-row .rule-cond-operator {
  flex: 1;
  min-width: 50px;
  width: 0;
}

:where(.builder-layout) .rules-row .rule-cond-value {
  flex: 1.5;
  min-width: 60px;
  width: 0;
}

:where(.builder-layout) .rules-row .rule-cond-value-wrap {
  display: flex;
  gap: 4px;
  flex: 1.5;
  min-width: 110px;
  width: 0;
}

:where(.builder-layout) .rules-row .rule-cond-value-wrap .rule-cond-compare-mode {
  flex: 0 0 60px;
  min-width: 60px;
  width: auto;
}

:where(.builder-layout) .rules-row .rule-cond-value-wrap .rule-cond-value,
:where(.builder-layout) .rules-row .rule-cond-value-wrap .rule-cond-compare-field {
  flex: 1;
  min-width: 0;
  width: auto;
}

/* Custom Outlined Style Buttons in Business Rules Editor */
:where(.builder-layout) .business-rules-panel .pg-btn-secondary {
  background: var(--of-color-neutral-0);
  border: var(--of-border-width) solid var(--of-color-border);
  color: var(--of-color-neutral-8);
  padding: var(--of-space-xs) var(--of-space-s);
  font-size: var(--of-font-size-xs);
  font-weight: var(--of-font-weight-medium);
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--of-space-xs);
  border-radius: var(--of-border-radius-xs);
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

:where(.builder-layout) .business-rules-panel .pg-btn-secondary:hover {
  background: var(--of-color-neutral-2);
  border-color: var(--of-color-neutral-5);
  color: var(--of-color-neutral-10);
  transform: none;
}

:where(.builder-layout) .business-rules-panel .pg-btn-secondary svg {
  width: 10px;
  height: 10px;
}

/* Action Specific Buttons overrides */
:where(.builder-layout) .business-rules-panel .rule-delete-rule,
:where(.builder-layout) .business-rules-panel .rule-delete-group,
:where(.builder-layout) .business-rules-panel .rule-delete-cond {
  color: var(--of-color-error);
  border-color: rgba(219, 60, 60, 0.15);
  background: rgba(219, 60, 60, 0.02);
}

:where(.builder-layout) .business-rules-panel .rule-delete-rule:hover,
:where(.builder-layout) .business-rules-panel .rule-delete-group:hover,
:where(.builder-layout) .business-rules-panel .rule-delete-cond:hover {
  background: rgba(219, 60, 60, 0.08);
  border-color: var(--of-color-error);
  color: var(--of-color-error);
}

:where(.builder-layout) .business-rules-panel .rule-delete-cond {
  width: 28px;
  height: 28px;
  padding: 0;
  flex-shrink: 0;
}

:where(.builder-layout) .business-rules-panel .rule-delete-cond i,
:where(.builder-layout) .business-rules-panel .rule-delete-cond svg {
  width: 12px;
  height: 12px;
}

:where(.builder-layout) .business-rules-panel .rule-add-cond,
:where(.builder-layout) .business-rules-panel .rule-add-group {
  border-style: dashed;
  width: 100%;
  justify-content: center;
}

:where(.builder-layout) .business-rules-panel .btn-add-rule {
  margin-top: var(--of-space-m);
  border-color: var(--of-color-neutral-4);
  color: var(--of-color-primary);
  background: var(--of-color-neutral-0);
  font-weight: var(--of-font-weight-semibold);
  font-size: var(--of-font-size-xs);
  height: 32px;
  width: 100%;
  justify-content: center;
}

:where(.builder-layout) .business-rules-panel .btn-add-rule:hover {
  background: var(--of-color-primary-selected);
  border-color: var(--of-color-primary);
  color: var(--of-color-primary-hover);
}

/* Empty states */
:where(.builder-layout) .rules-empty-state {
  font-size: var(--of-font-size-xs);
  color: var(--of-color-neutral-5);
  text-align: center;
  font-style: italic;
  padding: 6px 0;
}

:where(.builder-layout) .rules-empty-panel {
  padding: 20px;
  border: 1px dashed var(--of-color-neutral-4);
  border-radius: var(--of-border-radius-soft);
  background: var(--of-color-neutral-1);
}

/* ==========================================================================
 Repeatable List (Master-Detail) Designer & Player Styles
 ========================================================================== */
/* Canvas Designer Preview Styles */
:where(.builder-layout) .canvas-field-repeater-wrapper {
  background-color: var(--of-color-neutral-0);
  border: var(--of-border-width) solid var(--of-color-border-subtle);
  border-radius: var(--of-border-radius-soft);
  padding: var(--of-space-m);
  width: 100%;
}

:where(.builder-layout) .canvas-repeater-subfields-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  padding-top: var(--of-space-xs);
}

:where(.builder-layout) .canvas-repeater-subfield-tag {
  background: var(--of-color-neutral-2);
  border: var(--of-border-width) solid var(--of-color-border);
  border-radius: var(--of-border-radius-xs);
  padding: var(--of-space-xs) var(--of-space-s);
  display: flex;
  align-items: center;
  gap: var(--of-space-xs);
  font-size: var(--of-font-size-xs);
  color: var(--of-color-neutral-8);
  font-weight: var(--of-font-weight-medium);
}

:where(.builder-layout) .canvas-repeater-subfield-tag i,
:where(.builder-layout) .canvas-repeater-subfield-tag svg {
  width: var(--of-font-size-xs);
  height: var(--of-font-size-xs);
  color: var(--of-color-neutral-7);
}

:where(.builder-layout) .canvas-repeater-empty-subfields {
  font-size: var(--of-font-size-xs);
  color: var(--of-color-neutral-5);
  font-style: italic;
  padding: 6px;
  width: 100%;
}

/* Runtime Player Repeater Styles */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-repeater-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--of-space-m);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-repeater-items-list {
  display: flex;
  flex-direction: column;
  gap: var(--of-space-m);
  width: 100%;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-repeater-card {
  background-color: var(--of-color-neutral-0);
  border: var(--of-border-width) solid var(--of-color-border);
  border-radius: var(--of-border-radius-soft);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.2s ease-in-out;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-repeater-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  border-color: var(--of-color-neutral-5);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-repeater-card-header {
  background-color: var(--of-color-neutral-1);
  border-bottom: var(--of-border-width) solid var(--of-color-border-subtle);
  padding: var(--of-space-s) 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-repeater-card-title {
  font-size: var(--of-font-size-s);
  font-weight: var(--of-font-weight-bold);
  color: var(--of-color-neutral-8);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-repeater-card-delete {
  background: transparent;
  border: none;
  color: var(--of-color-error);
  cursor: pointer;
  padding: var(--of-space-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--of-border-radius-xs);
  transition: all 0.15s ease-in-out;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-repeater-card-delete:hover {
  background-color: rgba(219, 60, 60, 0.08);
  transform: scale(1.1);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-repeater-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: var(--of-space-base);
}

/* Sub field grid responsive wrapping */
@media (max-width: 768px) {
  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-repeater-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: var(--of-space-m);
  }

  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-repeater-grid .span-2 {
    grid-column: span 1;
  }
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-repeater-grid .span-2 {
  grid-column: span 2;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-sub-field-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--of-space-xs);
  width: 100%;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-sub-label {
  font-size: var(--of-font-size-xs);
  font-weight: var(--of-font-weight-semibold);
  color: var(--of-color-neutral-8);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-sub-label.required::after {
  content: " *";
  color: var(--of-color-error);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-sub-input-container {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-sub-input-container .form-input {
  padding-left: 28px;
  font-size: var(--of-font-size-s);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-sub-input-container textarea.form-input {
  padding-left: 10px;
  height: auto;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-sub-input-container select.form-input {
  padding-left: 28px;
  padding-right: 20px;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-sub-input-container .form-input-icon {
  position: absolute;
  left: 8px;
  color: var(--of-color-neutral-5);
  width: var(--of-font-size-s);
  height: var(--of-font-size-s);
  pointer-events: none;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-sub-field-wrapper.is-invalid .form-input {
  border-color: var(--of-color-error);
  background-color: rgba(219, 60, 60, 0.02);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-sub-field-wrapper.is-invalid .form-error-message {
  display: flex;
  margin-top: 2px;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-repeater-add-btn {
  margin-bottom: var(--of-space-xs);
  align-self: flex-start;
  font-weight: var(--of-font-weight-semibold);
  border-color: var(--of-color-primary);
  color: var(--of-color-primary);
  background-color: var(--of-color-neutral-0);
  height: 32px;
  padding: 0 var(--of-space-base);
  border-radius: var(--of-border-radius-soft);
  font-size: var(--of-font-size-s);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-repeater-add-btn:hover {
  background-color: var(--of-color-primary-selected);
  border-color: var(--of-color-primary-hover);
}

/* ==========================================================================
 Live Form Player (Renderer) Section Styles
 ========================================================================== */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-section {
  background-color: var(--of-color-neutral-0);
  border: var(--of-border-width) solid var(--of-color-border);
  border-radius: var(--of-border-radius-soft);
  padding: var(--of-space-l);
  margin-bottom: var(--of-space-l);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  transition: all 0.3s ease;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-section-header {
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--of-color-primary-selected);
  text-align: left;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-section-header h3 {
  font-size: var(--of-font-size-m);
  font-weight: var(--of-font-weight-semibold);
  color: var(--of-color-primary);
  margin: 0;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-section-body {
  display: flex;
  flex-direction: column;
  gap: var(--of-space-base);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .is-disabled {
  opacity: 0.6;
  pointer-events: none;
}

/* Grid Layout rows and columns styling */
:where(.builder-layout) .canvas-row {
  background-color: var(--of-color-neutral-0);
  border: var(--of-border-width) solid var(--of-color-border);
  border-radius: var(--of-border-radius-soft);
  padding: var(--of-space-base);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--of-space-m);
  transition: all 0.2s ease;
}

:where(.builder-layout) .canvas-row:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

:where(.builder-layout) .canvas-row.dragging {
  opacity: 0.4;
  border: 1.5px dashed var(--of-color-primary);
  background-color: var(--of-color-neutral-2);
}

:where(.builder-layout) .canvas-row.drag-over-row {
  border-top: 3px solid var(--of-color-primary);
  background-color: var(--of-color-primary-selected);
  transform: translateY(2px);
}

:where(.builder-layout) .canvas-field.dragging {
  opacity: 0.4;
  border: 1px dashed var(--of-color-primary);
}

/* Drag handles and operations on Rows */
:where(.builder-layout) .row-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--of-space-s);
  border-bottom: 1px dashed var(--of-color-neutral-3);
  margin-bottom: var(--of-space-xs);
}

:where(.builder-layout) .row-drag-handle {
  cursor: move;
  color: var(--of-color-neutral-5);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--of-font-size-xs);
  font-weight: var(--of-font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

:where(.builder-layout) .row-drag-handle:hover {
  color: var(--of-color-neutral-7);
}

:where(.builder-layout) .row-drag-handle svg {
  width: 14px;
  height: 14px;
}

:where(.builder-layout) .row-operations {
  display: flex;
  gap: var(--of-space-s);
}

:where(.builder-layout) .row-op-btn {
  background: none;
  border: none;
  color: var(--of-color-neutral-7);
  cursor: pointer;
  border-radius: var(--of-border-radius-xs);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

:where(.builder-layout) .row-op-btn:hover {
  background-color: var(--of-color-neutral-2);
  color: var(--of-color-neutral-10);
}

:where(.builder-layout) .row-op-btn.delete:hover {
  background-color: #fee2e2;
  color: var(--of-color-error);
}

:where(.builder-layout) .row-op-btn svg {
  width: 14px;
  height: 14px;
}

/* Column Grid */
:where(.builder-layout) .canvas-row-columns {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--of-space-base);
  min-height: 80px;
}

/* Columns cells styling */
:where(.builder-layout) .canvas-column-cell {
  background-color: var(--of-color-neutral-2);
  border: 1px dashed var(--of-color-neutral-4);
  border-radius: var(--of-border-radius-soft);
  position: relative;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  padding: var(--of-space-s);
  transition: all 0.2s ease;
}

:where(.builder-layout) .canvas-column-cell.drag-over {
  border-color: var(--of-color-primary);
  background-color: var(--of-color-primary-selected);
}

/* Column resizing & actions on Canvas Cell */
:where(.builder-layout) .column-controls {
  position: absolute;
  top: -10px;
  right: 6px;
  display: flex;
  background-color: var(--of-color-neutral-0);
  border: var(--of-border-width) solid var(--of-color-border);
  border-radius: var(--of-border-radius-pill);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  padding: 1px 3px;
  gap: 1px;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.15s ease;
}

:where(.builder-layout) .canvas-column-cell:hover .column-controls {
  opacity: 1;
}

:where(.builder-layout) .col-btn {
  background: none;
  border: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: var(--of-font-size-xs);
  font-weight: var(--of-font-weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--of-color-neutral-7);
}

:where(.builder-layout) .properties-locale-switcher {
  padding: var(--of-space-m) 14px;
  border: var(--of-border-width) solid var(--of-color-border);
  background: var(--of-color-neutral-2);
  margin-bottom: var(--of-space-base);
  border-radius: var(--of-border-radius-xs);
}

:where(.builder-layout) .col-btn:hover {
  background-color: var(--of-color-neutral-2);
  color: var(--of-color-neutral-10);
}

:where(.builder-layout) .col-badge {
  font-size: 9px;
  font-weight: var(--of-font-weight-bold);
  color: var(--of-color-neutral-7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--of-space-xs);
}

/* Dropped Fields in Columns */
:where(.builder-layout) .canvas-field {
  background-color: var(--of-color-neutral-0);
  border: var(--of-border-width) solid var(--of-color-border);
  border-radius: var(--of-border-radius-s);
  padding: 10px var(--of-space-m);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
  flex: 1;
  position: relative;
  min-height: 48px;
}

:where(.builder-layout) .canvas-field:hover {
  border-color: var(--of-color-primary);
  box-shadow: 0 2px 8px rgba(16, 104, 235, 0.05);
}

:where(.builder-layout) .canvas-field.selected {
  border-color: var(--of-color-primary);
  box-shadow: 0 0 0 2px var(--of-color-primary-selected);
  background-color: var(--of-color-primary-selected);
}

:where(.builder-layout) .canvas-field-info {
  display: flex;
  align-items: center;
  gap: var(--of-space-s);
}

:where(.builder-layout) .canvas-field-icon {
  color: var(--of-color-neutral-7);
}

:where(.builder-layout) .canvas-field.selected .canvas-field-icon {
  color: var(--of-color-primary);
}

:where(.builder-layout) .canvas-field-title {
  font-size: var(--of-font-size-s);
  font-weight: var(--of-font-weight-semibold);
  color: var(--of-color-neutral-10);
}

:where(.builder-layout) .canvas-field-key {
  font-size: var(--of-font-size-xs);
  color: var(--of-color-neutral-7);
  background-color: var(--of-color-neutral-3);
  padding: 1px 5px;
  border-radius: var(--of-border-radius-xs);
  font-family: monospace;
}

:where(.builder-layout) .canvas-field-actions {
  display: flex;
  gap: var(--of-space-xs);
}

:where(.builder-layout) .canvas-field-btn {
  background: none;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: var(--of-border-radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--of-color-neutral-7);
  cursor: pointer;
  opacity: 0.6;
}

:where(.builder-layout) .canvas-field-btn:hover {
  opacity: 1;
  background-color: var(--of-color-neutral-3);
}

:where(.builder-layout) .canvas-field-btn.delete:hover {
  background-color: #fee2e2;
  color: var(--of-color-error);
}

:where(.builder-layout) .canvas-field-btn svg {
  width: 12px;
  height: 12px;
}

/* Empty column cell drag help */
:where(.builder-layout) .column-empty-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--of-color-neutral-5);
  font-size: var(--of-font-size-xs);
  text-align: center;
  border: 1px dashed var(--of-color-neutral-4);
  border-radius: var(--of-border-radius-xs);
  pointer-events: none;
  min-height: 48px;
}

/* Column Grid Width Overrides */
:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .col-1 {
  grid-column: span 1;
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .col-2 {
  grid-column: span 2;
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .col-3 {
  grid-column: span 3;
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .col-4 {
  grid-column: span 4;
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .col-5 {
  grid-column: span 5;
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .col-6 {
  grid-column: span 6;
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .col-7 {
  grid-column: span 7;
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .col-8 {
  grid-column: span 8;
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .col-9 {
  grid-column: span 9;
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .col-10 {
  grid-column: span 10;
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .col-11 {
  grid-column: span 11;
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .col-12 {
  grid-column: span 12;
}

/* Canvas Drop Indicator on Bottom */
:where(.builder-layout) .canvas-add-row-zone {
  border: 2px dashed var(--of-color-neutral-4);
  border-radius: var(--of-border-radius-soft);
  padding: var(--of-space-m);
  text-align: center;
  color: var(--of-color-neutral-7);
  font-size: var(--of-font-size-s);
  font-weight: var(--of-font-weight-medium);
  cursor: pointer;
  background-color: var(--of-color-neutral-0);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

:where(.builder-layout) .canvas-add-row-zone:hover {
  border-color: var(--of-color-primary);
  background-color: var(--of-color-primary-selected);
  color: var(--of-color-primary);
}

:where(.builder-layout) .canvas-add-row-zone svg {
  width: 14px;
  height: 14px;
}

/* 3. Properties Panel (Right Column) */
:where(.builder-layout) .builder-properties {
  background-color: var(--of-color-neutral-0);
  border: var(--of-border-width) solid var(--of-color-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: var(--of-space-base);
  min-width: 300px;
}

:where(.builder-layout) .properties-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--of-space-m);
  height: 100%;
  color: var(--of-color-neutral-5);
  text-align: center;
  padding: var(--of-space-l);
}

:where(.builder-layout) .properties-empty svg {
  width: 40px;
  height: 40px;
}

:where(.builder-layout) .properties-empty p {
  font-size: var(--of-font-size-s);
}

:where(.builder-layout) .properties-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

:where(.builder-layout) .prop-header {
  border-bottom: var(--of-border-width) solid var(--of-color-border);
  padding-bottom: var(--of-space-m);
  margin-bottom: var(--of-space-xs);
  display: flex;
  align-items: center;
  gap: var(--of-space-s);
}

:where(.builder-layout) .prop-header svg {
  width: 16px;
  height: 16px;
  color: var(--of-color-primary);
}

:where(.builder-layout) .prop-title {
  font-size: var(--of-font-size-base);
  font-weight: var(--of-font-weight-bold);
  color: var(--of-color-neutral-10);
}

:where(.builder-layout) .prop-group {
  display: flex;
  flex-direction: column;
  gap: var(--of-space-xs);
}

:where(.builder-layout) .prop-label {
  font-size: var(--of-font-size-s);
  font-weight: var(--of-font-weight-semibold);
  color: var(--of-color-neutral-8);
}

:where(.builder-layout) .prop-input {
  width: 100%;
  padding: var(--of-space-s) 10px;
  border: var(--of-border-width) solid var(--of-color-border);
  background: var(--of-color-neutral-0);
  border-radius: var(--of-border-radius-s);
  font-family: inherit;
  color: var(--of-color-neutral-10);
  outline: none;
}

:where(.builder-layout) .prop-input:focus {
  border-color: var(--of-color-primary);
  box-shadow: 0 0 0 2px var(--of-color-primary-selected);
}

:where(.builder-layout) .prop-input:disabled {
  background: var(--of-color-neutral-3);
  cursor: not-allowed;
  opacity: 0.7;
}

:where(.builder-layout) .prop-checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--of-space-s);
  font-size: var(--of-font-size-s);
  color: var(--of-color-neutral-10);
  cursor: pointer;
  padding: var(--of-space-xs) 0;
  user-select: none;
}

:where(.builder-layout) .prop-checkbox-label input[type="checkbox"],
:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) input[type="checkbox"]:not(.form-switch input) {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--of-color-border);
  border-radius: var(--of-border-radius-xs);
  background-color: var(--of-color-neutral-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  margin: 0;
  vertical-align: middle;
}

:where(.builder-layout) .prop-checkbox-label input[type="checkbox"]:hover,
:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) input[type="checkbox"]:not(.form-switch input):hover {
  border-color: var(--of-color-primary);
  background-color: var(--of-color-primary-selected);
}

:where(.builder-layout) .prop-checkbox-label input[type="checkbox"]:checked,
:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) input[type="checkbox"]:not(.form-switch input):checked {
  background-color: var(--of-color-primary);
  border-color: var(--of-color-primary);
}

/* Premium checkmark overlay */
:where(.builder-layout) .prop-checkbox-label input[type="checkbox"]:checked::after,
:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) input[type="checkbox"]:not(.form-switch input):checked::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  top: 1px;
  left: 4.5px;
}

:where(.builder-layout) .prop-checkbox-label input[type="checkbox"]:focus,
:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) input[type="checkbox"]:not(.form-switch input):focus {
  outline: none;
  box-shadow: 0 0 0 var(--of-focus-halo-width) var(--of-focus-halo-color);
}

:where(.builder-layout) .nested-prop-box {
  background-color: var(--of-color-neutral-2);
  border: var(--of-border-width) solid var(--of-color-border);
  border-radius: var(--of-border-radius-s);
  padding: var(--of-space-m);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: var(--of-space-xs);
}

/* ==========================================================================
 OpenForms Renderer (The Active Form Component in Light Mode Card)
 ========================================================================== */
.renderer-sandbox {
  overflow-y: auto;
  flex: 1;
  display: flex;
  justify-content: center;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-form-card {
  background-color: var(--of-card-bg);
  border: var(--of-border-width) solid var(--of-color-border);
  border-radius: var(--of-border-radius-soft);
  box-shadow: var(--of-card-shadow);
  width: 100%;
  padding: var(--of-card-padding);
  display: flex;
  flex-direction: column;
  gap: var(--of-space-l);
  height: fit-content;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-form-header {
  border-bottom: 2px solid var(--of-color-neutral-2);
  padding-bottom: var(--of-space-base);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-form-title {
  font-size: 20px;
  font-weight: var(--of-font-weight-bold);
  color: var(--of-color-neutral-10);
  margin-bottom: var(--of-space-xs);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-form-desc {
  font-size: var(--of-font-size-s);
  color: var(--of-color-neutral-7);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-form-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Dynamic Rows and Columns inside Renderer */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

/* Form inputs matching OpenForms reference */
:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--of-font-family);
  width: 100%;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-label {
  color: var(--of-color-neutral-10);
  font-weight: var(--of-font-weight-semibold);
  font-size: var(--of-font-size-s);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-label.required::after {
  content: " *";
  color: var(--of-color-error);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-input-container.is-repeater-container {
  flex-direction: column;
  gap: var(--of-space-base);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-input-container.is-signature-container {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-input-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--of-color-neutral-7);
  pointer-events: none;
  display: none;
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-input {
  width: 100%;
  padding: var(--of-input-padding-y) var(--of-space-m);
  border: var(--of-border-width) solid var(--of-color-border);
  border-radius: var(--of-border-radius-soft);
  background-color: var(--of-input-bg);
  color: var(--of-input-color);
  font-size: var(--of-font-size-base);
  font-family: inherit;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  outline: none;
}

/* Customizar o ÃƒÂ­cone de calendÃƒÂ¡rio nativo do HTML5 */
:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: invert(var(--theme-calendar-invert, 0)) brightness(var(--theme-calendar-brightness, 1));
}

/* Textarea override */
:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) textarea.form-input {
  min-height: 100px;
  resize: vertical;
}

/* Select dropdown */
:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23666666' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7' /%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

/* Toggle / Switch styling */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-switch-container {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 6px 0;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--of-color-neutral-4);
  transition: .2s;
  border-radius: 24px;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-switch input:checked+.form-slider {
  background-color: var(--of-color-primary);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-switch input:checked+.form-slider:before {
  transform: translateX(20px);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-switch input:focus+.form-slider {
  box-shadow: 0 0 0 var(--of-focus-halo-width) var(--of-focus-halo-color);
}

/* File Upload drag area */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-uploader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--of-space-s);
  min-height: 120px;
  border: 2px dashed var(--of-color-neutral-4);
  border-radius: var(--of-border-radius-soft);
  padding: var(--of-space-l) 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  background-color: var(--of-color-neutral-1);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-uploader:hover {
  border-color: var(--of-color-primary);
  background-color: var(--of-color-primary-selected);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-uploader svg {
  width: 32px;
  height: 32px;
  color: var(--of-color-neutral-5);
  transition: transform 0.2s ease-in-out, color 0.2s ease-in-out;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-uploader:hover svg {
  color: var(--of-color-primary);
  transform: translateY(-4px);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-uploader.drag-over {
  border-color: var(--of-color-primary);
  background-color: var(--of-color-primary-selected);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-uploader.drag-over svg {
  color: var(--of-color-primary);
  transform: scale(1.15);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--of-color-neutral-2);
  border: var(--of-border-width) solid var(--of-color-border);
  border-radius: var(--of-border-radius-soft);
  padding: var(--of-space-s) var(--of-space-m);
  margin-top: var(--of-space-s);
  font-size: var(--of-font-size-s);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-details-left {
  display: flex;
  align-items: center;
  gap: var(--of-space-s);
  color: var(--of-color-neutral-10);
  font-weight: var(--of-font-weight-medium);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-details-left svg {
  width: 16px;
  height: 16px;
  color: var(--of-color-primary);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-delete-btn {
  background: none;
  border: none;
  color: var(--of-color-neutral-7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--of-space-xs);
  border-radius: var(--of-border-radius-soft);
  transition: all 0.2s ease-in-out;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-delete-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease-in-out, color 0.2s ease-in-out;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-delete-btn:hover {
  color: var(--of-color-error);
  background-color: var(--of-color-neutral-3);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-delete-btn:hover svg {
  transform: scale(1.15);
}

/* uploadProvider: upload in flight / failed */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-upload-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-upload-text {
  display: flex;
  flex-direction: column;
  gap: var(--of-space-xs);
  width: 100%;
  min-width: 0;
  text-align: left;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-upload-name {
  font-weight: var(--of-font-weight-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--of-color-neutral-10);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-progress {
  height: 6px;
  width: 100%;
  background-color: var(--of-color-neutral-4);
  border-radius: var(--of-border-radius-soft);
  overflow: hidden;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-progress-bar {
  height: 100%;
  width: 0;
  background-color: var(--of-color-primary);
  border-radius: var(--of-border-radius-soft);
  transition: width 0.2s ease-out;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-upload-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--of-space-s);
  font-size: var(--of-font-size-xs);
  color: var(--of-color-neutral-7);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-upload-error {
  font-size: var(--of-font-size-xs);
  color: var(--of-color-error);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-details.is-uploading .form-file-details-actions,
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-file-details.is-upload-error .form-file-details-actions {
  display: flex;
  align-items: center;
  gap: var(--of-space-s);
  flex-shrink: 0;
  margin-left: var(--of-space-m);
}

/* Signature Drawing Canvas */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-signature-box {
  background-color: var(--of-color-neutral-2);
  border: var(--of-border-width) solid var(--of-color-border);
  border-radius: var(--of-border-radius-soft);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-signature-canvas {
  width: 100%;
  height: 150px;
  background-color: var(--of-color-neutral-0);
  cursor: crosshair;
  display: block;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-signature-bar {
  padding: var(--of-space-s) var(--of-space-m);
  border-top: var(--of-border-width) solid var(--of-color-border);
  background-color: var(--of-color-neutral-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-signature-indicator {
  font-size: var(--of-font-size-xs);
  color: var(--of-color-neutral-7);
  display: flex;
  align-items: center;
  gap: var(--of-space-xs);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-signature-indicator svg {
  width: 12px;
  height: 12px;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-signature-clear {
  background: none;
  border: none;
  color: var(--of-color-neutral-8);
  font-size: var(--of-font-size-s);
  cursor: pointer;
  font-weight: var(--of-font-weight-medium);
  display: flex;
  align-items: center;
  gap: var(--of-space-xs);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-signature-clear:hover {
  color: var(--of-color-error);
}

/* Invalid state inputs styling */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-input-wrapper.is-invalid .form-input,
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-input-wrapper.is-invalid input,
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-input-wrapper.is-invalid textarea,
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-input-wrapper.is-invalid select {
  border-color: var(--of-color-error);
  background-color: rgba(219, 60, 60, 0.02);
  box-shadow: 0 0 0 3px rgba(219, 60, 60, 0.12);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-input-wrapper.is-invalid .form-label {
  color: var(--of-color-error);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-input-wrapper.is-invalid .form-input-icon {
  color: var(--of-color-error);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-error-message {
  display: none;
  align-items: center;
  gap: var(--of-space-xs);
  color: var(--of-color-error);
  font-size: var(--of-font-size-s);
  margin-top: var(--of-space-xs);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-input-wrapper.is-invalid .form-error-message {
  display: flex;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-error-message svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Submit Actions */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-actions {
  display: flex;
  justify-content: flex-end;
  border-top: var(--of-border-width) solid var(--of-color-border-subtle);
  padding-top: var(--of-space-base);
  margin-top: var(--of-space-s);
}

/* ==========================================================================
 Section Headers (Visual SubsecÃƒÆ’Ã†â€™Ãƒâ€šÃ‚Â§ÃƒÆ’Ã†â€™Ãƒâ€šÃ‚Âµes)
 ========================================================================== */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-section-header {
  display: flex;
  flex-direction: column;
  padding-top: 14px;
  padding-bottom: var(--of-space-s);
  border-bottom: 1.5px solid var(--of-color-neutral-3);
  margin-bottom: var(--of-space-m);
  margin-top: var(--of-space-base);
  width: 100%;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-section-title {
  font-size: var(--of-font-size-m);
  font-weight: var(--of-font-weight-bold);
  color: var(--of-color-neutral-10);
  margin-bottom: 2px;
  text-transform: none;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-section-subtitle {
  font-size: var(--of-font-size-s);
  color: var(--of-color-neutral-7);
  font-weight: var(--of-font-weight-normal);
  margin: 0;
}

/* Hide standard label for headers */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-input-wrapper.is-header .form-label {
  display: none;
}

/* ==========================================================================
 Designer Page Tabs System
 ========================================================================== */
:where(.builder-layout) .canvas-pages-bar {
  display: flex;
  align-items: center;
  gap: var(--of-space-s);
  border-bottom: var(--of-border-width) solid var(--of-color-border);
  padding-bottom: var(--of-space-m);
  margin-bottom: var(--of-space-base);
  flex-wrap: wrap;
  width: 100%;
}

:where(.builder-layout) .canvas-page-tab {
  display: flex;
  align-items: center;
  gap: var(--of-space-s);
  background-color: var(--of-color-neutral-0);
  border: var(--of-border-width) solid var(--of-color-border);
  border-radius: var(--of-border-radius-soft);
  padding: 6px var(--of-space-m);
  font-size: var(--of-font-size-s);
  font-weight: var(--of-font-weight-semibold);
  color: var(--of-color-neutral-8);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  user-select: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

:where(.builder-layout) .canvas-page-tab:hover {
  background-color: var(--of-color-neutral-2);
  border-color: var(--of-color-neutral-5);
  color: var(--of-color-neutral-10);
}

:where(.builder-layout) .canvas-page-tab.active {
  border-color: var(--of-color-primary);
  background-color: var(--of-color-primary-selected);
  color: var(--of-color-primary);
  box-shadow: 0 2px 6px rgba(16, 104, 235, 0.08);
}

:where(.builder-layout) .canvas-page-tab-delete {
  background: none;
  border: none;
  color: var(--of-color-neutral-5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 2px;
  border-radius: 50%;
  transition: all 0.15s ease;
  margin-left: var(--of-space-xs);
}

:where(.builder-layout) .canvas-page-tab-delete:hover {
  background-color: rgba(219, 60, 60, 0.1);
  color: var(--of-color-error);
}

:where(.builder-layout) .canvas-page-tab-delete svg {
  width: 10px;
  height: 10px;
}

:where(.builder-layout) .canvas-page-add-btn {
  background: none;
  border: 1px dashed var(--of-color-neutral-5);
  border-radius: var(--of-border-radius-soft);
  color: var(--of-color-neutral-8);
  padding: 6px var(--of-space-m);
  font-size: var(--of-font-size-s);
  font-weight: var(--of-font-weight-medium);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

:where(.builder-layout) .canvas-page-add-btn:hover {
  border-color: var(--of-color-primary);
  color: var(--of-color-primary);
  background-color: var(--of-color-primary-selected);
}

:where(.builder-layout) .canvas-page-add-btn.is-accent {
  border-style: dashed;
  border-color: var(--of-color-primary);
  color: var(--of-color-primary);
}

:where(.builder-layout) .canvas-page-add-btn.is-accent:hover {
  border-color: var(--of-color-primary-hover);
  color: var(--of-color-primary-hover);
  background-color: var(--of-color-primary-selected);
}

:where(.builder-layout) .canvas-page-add-btn svg {
  width: 12px;
  height: 12px;
}

/* ==========================================================================
 Renderer Steps Progress Bar
 ========================================================================== */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-steps-container {
  padding-bottom: var(--of-space-m);
  margin-bottom: var(--of-space-m);
  width: 100%;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-steps-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  width: 100%;
}

/* Connector Line behind bubbles */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-steps-line-bg {
  position: absolute;
  top: 15px;
  left: 20px;
  right: 20px;
  height: 2px;
  background-color: var(--of-color-neutral-3);
  z-index: 1;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-steps-line-progress {
  position: absolute;
  top: 15px;
  height: 2px;
  background-color: var(--of-color-primary);
  z-index: 2;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 3;
  cursor: pointer;
  flex: 1;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-step-bubble {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: var(--of-color-neutral-0);
  border: 2px solid var(--of-color-neutral-4);
  color: var(--of-color-neutral-7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--of-font-size-s);
  font-weight: var(--of-font-weight-bold);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-step.active .renderer-step-bubble {
  border-color: var(--of-color-primary);
  background-color: var(--of-color-primary);
  color: var(--of-color-neutral-0);
  box-shadow: 0 0 0 4px var(--of-color-primary-selected);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-step.completed .renderer-step-bubble {
  border-color: var(--of-color-primary);
  background-color: var(--of-color-primary-selected);
  color: var(--of-color-primary);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-step-label {
  font-size: var(--of-font-size-xs);
  font-weight: var(--of-font-weight-semibold);
  color: var(--of-color-neutral-7);
  transition: color 0.2s ease;
  text-align: center;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-step.active .renderer-step-label {
  color: var(--of-color-primary);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-step.completed .renderer-step-label {
  color: var(--of-color-neutral-10);
}

/* ==========================================================================
 Renderer Footer Navigation Bar
 ========================================================================== */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-navigation-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1.5px solid var(--of-color-neutral-2);
  padding-top: var(--of-space-base);
  margin-top: var(--of-space-s);
  width: 100%;
}

/* Base style for the mobile dynamic step header (hidden by default in desktop) */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-mobile-step-header {
  display: none;
}

/* ==========================================================================
 Responsive Mobile Improvements (OpenForms Renderer)
 ========================================================================== */
@media (max-width: 768px) {

  /* Reduced padding inside the renderer card */
  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-form-card {
    padding: 20px var(--of-space-base);
    border-radius: var(--of-border-radius-soft);
  }

  /* Grid collapse - Force columns to stacked full width */
  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-row {
    gap: var(--of-space-base);
  }

  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-row .form-column {
    grid-column: span 12;
    width: 100%;
  }

  /* Compact navigation steps bar for mobile */
  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-steps-container {
    padding-bottom: var(--of-space-s);
    margin-bottom: var(--of-space-s);
  }

  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-steps-line-bg,
  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-steps-line-progress {
    top: 14px;
  }

  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-step-bubble {
    width: 28px;
    height: 28px;
    font-size: var(--of-font-size-s);
  }

  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-step-label {
    display: none;
    /* Hide individual labels below bubbles to prevent overlap */
  }

  /* Compact dynamic step title exclusive for mobile */
  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-mobile-step-header {
    display: block;
    font-size: var(--of-font-size-s);
    font-weight: var(--of-font-weight-bold);
    color: var(--of-color-primary);
    text-align: center;
    margin: var(--of-space-s) auto var(--of-space-base) auto;
    padding: 6px 14px;
    background-color: var(--of-color-primary-selected);
    border-radius: 20px;
    font-family: var(--of-font-family);
    width: fit-content;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  }

  /* Touch-friendly full-width navigation bar */
  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-navigation-bar {
    flex-direction: column-reverse;
    gap: var(--of-space-m);
    padding-top: var(--of-space-base);
  }

  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-navigation-bar button {
    width: 100%;
    margin: 0;
    height: 44px;
    /* Premium WCAG standard touch target */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--of-font-size-base);
  }

  /* Touch signature box sizing */
  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-signature-container {
    height: 160px;
    /* slightly more compact height on mobile */
  }

  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-signature-container canvas {
    width: 100%;
    height: 100%;
  }
}

/* ==========================================================================
 OpenForms-styled Radio Buttons and Checkbox Groups
 ========================================================================== */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-radio-group,
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: var(--of-space-m);
  margin-top: var(--of-space-s);
  padding: var(--of-space-xs) 0;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-radio-item,
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s ease;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-radio-item:hover,
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-checkbox-item:hover {
  transform: translateX(2px);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-radio-label,
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-checkbox-label {
  font-size: var(--of-font-size-base);
  color: var(--of-color-neutral-8);
  font-weight: var(--of-font-weight-medium);
  cursor: pointer;
  transition: color 0.2s ease;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-radio-item:hover .form-radio-label,
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-checkbox-item:hover .form-checkbox-label {
  color: var(--of-color-neutral-10);
}

/* Custom OpenForms Radio Buttons */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) input[type="radio"].form-radio-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--of-color-border);
  border-radius: 50%;
  background-color: var(--of-color-neutral-0);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  margin: 0;
  vertical-align: middle;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) input[type="radio"].form-radio-input:hover {
  border-color: var(--of-color-primary);
  background-color: var(--of-color-primary-selected);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) input[type="radio"].form-radio-input:checked {
  border-color: var(--of-color-primary);
  background-color: var(--of-color-neutral-0);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) input[type="radio"].form-radio-input:checked::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--of-color-primary);
  display: block;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) input[type="radio"].form-radio-input:focus {
  outline: none;
  box-shadow: 0 0 0 var(--of-focus-halo-width) var(--of-focus-halo-color);
}

/* Checkbox group spacing override to match the Radio inputs */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-checkbox-group input[type="checkbox"].form-checkbox-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--of-color-border);
  border-radius: var(--of-border-radius-xs);
  background-color: var(--of-color-neutral-0);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  margin: 0;
  vertical-align: middle;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-checkbox-group input[type="checkbox"].form-checkbox-input:hover {
  border-color: var(--of-color-primary);
  background-color: var(--of-color-primary-selected);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-checkbox-group input[type="checkbox"].form-checkbox-input:checked {
  background-color: var(--of-color-primary);
  border-color: var(--of-color-primary);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-checkbox-group input[type="checkbox"].form-checkbox-input:checked::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 9px;
  border: solid var(--of-color-neutral-0);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
  top: 1.5px;
  left: 5px;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-checkbox-group input[type="checkbox"].form-checkbox-input:focus {
  outline: none;
  box-shadow: 0 0 0 var(--of-focus-halo-width) var(--of-focus-halo-color);
}

/* Empty or Loading Options indicators */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-options-empty,
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-options-loading {
  font-size: var(--of-font-size-s);
  color: var(--of-color-neutral-7);
  font-style: italic;
  padding: var(--of-space-xs) 0;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-options-error {
  display: block;
  font-size: var(--of-font-size-s);
  color: var(--of-color-error);
  padding: var(--of-space-xs) 0;
}

/* Accessibility outline focus styling */
:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-input:focus,
:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .pg-btn:focus,
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .renderer-step:focus,
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-switch input:focus+.form-slider,
:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) input[type="checkbox"]:focus,
:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) input[type="radio"]:focus,
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .signature-mode-tab:focus,
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-signature-clear:focus {
  outline: var(--of-focus-ring-width) solid var(--of-focus-ring-color);
  outline-offset: var(--of-focus-ring-offset);
  box-shadow: 0 0 0 var(--of-focus-halo-width) var(--of-focus-halo-color);
}

:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-input:focus {
  border-color: var(--of-color-primary);
}

/* ==========================================================================
 Question Matrix Designer & Player Styles
 ========================================================================== */

/* Designer Canvas Preview Styles */
:where(.builder-layout) .canvas-field-matrix-wrapper {
  background-color: var(--of-color-neutral-0);
  border: var(--of-border-width) solid var(--of-color-border-subtle);
  border-radius: var(--of-border-radius-soft);
  padding: var(--of-space-m);
  width: 100%;
}

:where(.builder-layout) .canvas-matrix-rows-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  padding-top: var(--of-space-xs);
}

:where(.builder-layout) .canvas-matrix-row-tag {
  background: var(--of-color-neutral-2);
  border: var(--of-border-width) solid var(--of-color-border);
  border-radius: var(--of-border-radius-xs);
  padding: var(--of-space-xs) var(--of-space-s);
  display: flex;
  align-items: center;
  gap: var(--of-space-xs);
  font-size: var(--of-font-size-xs);
  color: var(--of-color-neutral-8);
  font-weight: var(--of-font-weight-medium);
}

:where(.builder-layout) .canvas-matrix-row-tag i,
:where(.builder-layout) .canvas-matrix-row-tag svg {
  width: var(--of-font-size-xs);
  height: var(--of-font-size-xs);
  color: var(--of-color-neutral-7);
}

:where(.builder-layout) .canvas-matrix-empty-rows {
  font-size: var(--of-font-size-xs);
  color: var(--of-color-neutral-5);
  font-style: italic;
  padding: 6px;
  width: 100%;
}

/* Runtime Player Matrix Styles */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-top: var(--of-space-s);
  border: var(--of-border-width) solid var(--of-color-border);
  border-radius: var(--of-border-radius-s);
  background: var(--of-color-neutral-0);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--of-font-size-s);
  line-height: 1.5;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-table th,
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-table td {
  padding: var(--of-space-m);
  border-bottom: var(--of-border-width) solid var(--of-color-border-subtle);
  text-align: center;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-table th {
  font-weight: var(--of-font-weight-semibold);
  color: var(--of-color-neutral-9);
  background: var(--of-color-neutral-2);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-table th.form-matrix-row-label {
  text-align: left;
  font-weight: var(--of-font-weight-medium);
  color: var(--of-color-neutral-8);
  min-width: 160px;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-cell {
  vertical-align: middle;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-radio-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  width: 100%;
  height: 100%;
  min-height: 24px;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .matrix-cell-mobile-text {
  display: none;
  /* Hidden on desktop viewports */
}

/* Responsive Matrix Card folding for Mobile (max-width: 768px) */
@media (max-width: 768px) {
  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-wrapper {
    border: none;
    background: transparent;
  }

  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-table,
  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-table thead,
  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-table tbody,
  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-table th,
  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-table td,
  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-table tr {
    display: block;
    width: 100%;
  }

  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-table thead {
    display: none;
    /* Hide wide column headers */
  }

  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-table tr {
    margin-bottom: var(--of-space-base);
    border: var(--of-border-width) solid var(--of-color-border);
    border-radius: var(--of-border-radius-m);
    background: var(--of-color-neutral-0);
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    box-sizing: border-box;
  }

  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-table td {
    border-bottom: none;
    padding: var(--of-space-s) 0;
    text-align: left;
  }

  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-table th.form-matrix-row-label {
    text-align: left;
    font-weight: var(--of-font-weight-bold);
    font-size: var(--of-font-size-base);
    color: var(--of-color-neutral-10);
    padding-bottom: 10px;
    border-bottom: var(--of-border-width) solid var(--of-color-border-subtle);
    margin-bottom: 10px;
  }

  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-cell {
    display: flex;
    align-items: center;
  }

  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-matrix-radio-label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--of-space-s);
  }

  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .matrix-cell-mobile-text {
    display: inline;
    /* Visible option name on mobile */
    font-size: var(--of-font-size-s);
    color: var(--of-color-neutral-8);
  }
}

/* Layout insertion dividers */
:where(.builder-layout) .row-insertion-divider,
:where(.builder-layout) .section-insertion-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 20px;
  margin: -10px 0;
  z-index: 10;
  opacity: 0.12;
  transition: opacity 0.2s ease, height 0.2s ease, margin 0.2s ease;
}

:where(.builder-layout) .row-insertion-divider::before,
:where(.builder-layout) .section-insertion-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  border-top: 1px dashed var(--of-color-neutral-5);
  pointer-events: none;
}

:where(.builder-layout) .row-insertion-divider:hover,
:where(.builder-layout) .section-insertion-divider:hover {
  opacity: 1;
  height: 26px;
  margin: -7px 0;
}

:where(.builder-layout) .row-insertion-divider:hover::before,
:where(.builder-layout) .section-insertion-divider:hover::before {
  border-top-color: var(--of-color-primary);
  border-top-style: solid;
}

:where(.builder-layout) .insertion-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: var(--of-border-width) solid var(--of-color-border);
  background-color: var(--of-color-neutral-0);
  color: var(--of-color-neutral-7);
  cursor: pointer;
  z-index: 11;
  padding: 0;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

:where(.builder-layout) .insertion-btn:hover {
  background-color: var(--of-color-primary);
  border-color: var(--of-color-primary);
  color: var(--of-color-neutral-0);
  transform: scale(1.15);
}

/* Paragraph field text blocks */
:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .form-paragraph-text {
  font-size: var(--of-font-size-s);
  line-height: 1.6;
  color: var(--of-color-neutral-8);
  word-break: break-word;
  /* Paragraph content is plain text: keep the author's line breaks */
  white-space: pre-wrap;
}

/* ==========================================================================
   Image Lightbox / Attachment Preview Modal
   ========================================================================== */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out forwards;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .lightbox-container {
  position: relative;
  max-width: 90%;
  max-height: 85%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--of-space-m);
  animation: scaleUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--of-border-radius-m);
  border: 1px solid var(--of-border);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 30px rgba(16, 104, 235, 0.15);
  object-fit: contain;
  background-color: rgba(0, 0, 0, 0.4);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .lightbox-close-btn {
  position: absolute;
  top: -45px;
  right: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--of-text-primary);
  font-size: 24px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .lightbox-close-btn:hover {
  background: var(--of-color-error);
  border-color: var(--of-color-error);
  color: #fff;
  transform: rotate(90deg);
}

:where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .lightbox-caption {
  color: var(--of-text-secondary);
  font-size: var(--of-font-size-s);
  text-align: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--of-border);
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile Responsive Optimization for Lightbox Modal */
@media (max-width: 768px) {
  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .lightbox-container {
    max-width: 95%;
    max-height: 90%;
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
  }

  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .lightbox-img {
    max-height: 70vh;
    border-radius: var(--of-border-radius-s);
  }

  /* Place close button inside the overlay space but easily clickable on mobile */
  :where(.renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) .lightbox-close-btn {
    top: 15px;
    right: 15px;
    position: fixed;
    width: 44px;
    /* WCAG touch target */
    height: 44px;
    /* WCAG touch target */
    background: rgba(11, 15, 25, 0.8);
    border: 1px solid var(--of-border);
    font-size: 28px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 1001;
  }
}

@keyframes scaleUp {
  from {
    opacity: 0;
    transform: scale(0.92);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}















:where(.builder-layout, .renderer-sandbox, .lightbox-overlay, .openforms-action-sheet-backdrop) button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

:where(.builder-layout) .btn-sec-delete {
  padding: var(--of-space-xs) 10px;
  font-size: var(--of-font-size-xs);
  color: var(--of-color-error);
  border-color: rgba(219, 60, 60, 0.4);
}

:where(.builder-layout) .btn-sec-delete:hover {
  border-color: #fff3;
  background: rgba(219, 60, 60, 0.3);
}

/* ==========================================================================
   Print / Save-as-PDF (client-side, zero dependencies)
   Populated by OpenFormRenderer.print() — a throwaway renderer instance
   draws a flattened, read-only copy of the form into #openforms-print-root,
   which is hidden outside of @media print. While that snapshot exists, <html>
   carries .openforms-printing, which is what hides the host page: the host's own
   window.print() is left alone the rest of the time.
   The rules don't rely on "Background graphics" being enabled in the dialog:
   selected radios/checkboxes are drawn with borders, and colors are opted in with
   print-color-adjust where the browser honors it.
   ========================================================================== */

#openforms-print-root {
  display: none;
}

@media print {
  html.openforms-printing,
  html.openforms-printing body {
    background: #fff !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  html.openforms-printing body > *:not(#openforms-print-root) {
    display: none !important;
  }

  html.openforms-printing #openforms-print-root {
    display: block !important;
    position: static !important;
    width: auto !important;
    color: #111 !important;
    font-family: var(--of-font-family);
    font-size: 10.5pt;
    line-height: 1.4;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  #openforms-print-root,
  #openforms-print-root * {
    background: transparent !important;
    color: #111 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transition: none !important;
    animation: none !important;
  }

  /* Interactive chrome that means nothing on paper */
  #openforms-print-root .pg-btn,
  #openforms-print-root button,
  #openforms-print-root .renderer-steps-container,
  #openforms-print-root .renderer-navigation-bar,
  #openforms-print-root .form-error-message,
  #openforms-print-root .form-input-icon,
  #openforms-print-root .form-file-download-btn,
  #openforms-print-root .form-signature-bar,
  #openforms-print-root .signature-mode-bar,
  #openforms-print-root .form-repeater-add-btn,
  #openforms-print-root .form-repeater-card-delete,
  #openforms-print-root .form-file-uploader.is-readonly svg {
    display: none !important;
  }

  /* Document layout: no card chrome, flowing blocks (flex/grid columns of blocks don't
     fragment reliably across pages in every browser) */
  /* The sandbox is a scroll container on screen: in print that would clip or push content */
  #openforms-print-root .renderer-sandbox {
    display: block !important;
    overflow: visible !important;
    height: auto !important;
  }

  #openforms-print-root .renderer-form-card {
    display: block !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    height: auto !important;
  }

  #openforms-print-root .renderer-form-header {
    border-bottom: 2px solid #111 !important;
    padding-bottom: 8px !important;
    margin-bottom: 14px !important;
  }

  #openforms-print-root .renderer-form-title {
    font-size: 17pt !important;
    margin: 0 0 4px !important;
  }

  #openforms-print-root .renderer-form-desc,
  #openforms-print-root .openforms-print-meta {
    font-size: 9.5pt !important;
    color: #444 !important;
    margin: 0 !important;
  }

  #openforms-print-root .openforms-print-meta {
    margin-top: 4px !important;
    color: #666 !important;
  }

  #openforms-print-root .renderer-form-body,
  #openforms-print-root .renderer-section-body {
    display: block !important;
  }

  #openforms-print-root .openforms-print-page-title {
    font-size: 13pt !important;
    font-weight: 700 !important;
    margin: 18px 0 8px !important;
    padding: 0 !important;
    break-after: avoid;
    page-break-after: avoid;
  }

  #openforms-print-root .openforms-print-page-title:first-child {
    margin-top: 0 !important;
  }

  #openforms-print-root .renderer-section {
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 0 16px !important;
  }

  #openforms-print-root .renderer-section:last-child {
    margin-bottom: 0 !important;
  }

  #openforms-print-root .renderer-section-header {
    border-bottom: 1px solid #999 !important;
    margin-bottom: 10px !important;
    padding-bottom: 4px !important;
    break-after: avoid;
    page-break-after: avoid;
  }

  #openforms-print-root .renderer-section-header h3 {
    font-size: 12pt !important;
  }

  #openforms-print-root .renderer-section-body > .renderer-row + .renderer-row {
    margin-top: 10px;
  }

  /* Keep the 12-column layout on paper. Print pages are ~700px wide, which would
     otherwise trigger the (max-width: 768px) phone rules in Firefox/Safari and stack
     every field. */
  #openforms-print-root .renderer-row {
    gap: 8px 16px !important;
  }

  #openforms-print-root .renderer-row > .col-1 { grid-column: span 1 !important; }
  #openforms-print-root .renderer-row > .col-2 { grid-column: span 2 !important; }
  #openforms-print-root .renderer-row > .col-3 { grid-column: span 3 !important; }
  #openforms-print-root .renderer-row > .col-4 { grid-column: span 4 !important; }
  #openforms-print-root .renderer-row > .col-5 { grid-column: span 5 !important; }
  #openforms-print-root .renderer-row > .col-6 { grid-column: span 6 !important; }
  #openforms-print-root .renderer-row > .col-7 { grid-column: span 7 !important; }
  #openforms-print-root .renderer-row > .col-8 { grid-column: span 8 !important; }
  #openforms-print-root .renderer-row > .col-9 { grid-column: span 9 !important; }
  #openforms-print-root .renderer-row > .col-10 { grid-column: span 10 !important; }
  #openforms-print-root .renderer-row > .col-11 { grid-column: span 11 !important; }
  #openforms-print-root .renderer-row > .col-12 { grid-column: span 12 !important; }

  /* Never split a field (label + value), a header or a matrix/table row across pages */
  #openforms-print-root .form-column,
  #openforms-print-root .form-input-wrapper,
  #openforms-print-root .form-matrix-table tr,
  #openforms-print-root .form-repeater-card-header,
  #openforms-print-root .form-file-details,
  #openforms-print-root .form-signature-box {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  #openforms-print-root .openforms-print-breakable {
    break-inside: auto;
    page-break-inside: auto;
  }

  #openforms-print-root .form-repeater-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  #openforms-print-root .form-input-wrapper {
    gap: 3px !important;
  }


  #openforms-print-root .form-label {
    font-size: 9pt !important;
    font-weight: 600 !important;
    color: #444 !important;
    break-after: avoid;
    page-break-after: avoid;
  }

  #openforms-print-root .form-label.required::after {
    color: #444 !important;
  }

  #openforms-print-root .is-disabled {
    opacity: 1 !important;
  }

  /* Static values written by print(): wrap and grow instead of clipping */
  #openforms-print-root .openforms-print-value {
    display: block;
    width: 100%;
    min-height: 1.4em;
    padding: 2px 0 3px !important;
    border-bottom: 1px solid #bbb !important;
    font-size: 10.5pt;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  #openforms-print-root .openforms-print-value.is-multiline {
    padding: 6px 8px !important;
    border: 1px solid #bbb !important;
    border-radius: 3px;
  }

  #openforms-print-root .openforms-print-value.is-multiline.is-empty {
    min-height: 5em;
  }

  #openforms-print-root .form-section-title {
    font-size: 12pt !important;
  }

  #openforms-print-root .form-section-header {
    border-bottom: none !important;
    padding: 0 !important;
    margin: 6px 0 4px !important;
    break-after: avoid;
    page-break-after: avoid;
  }

  #openforms-print-root .form-section-subtitle,
  #openforms-print-root .form-paragraph-text {
    color: #333 !important;
  }

  /* Radios and checkboxes: every option is listed, the selected ones drawn with borders
     (borders print even when "Background graphics" is off) */
  #openforms-print-root input[type="radio"],
  #openforms-print-root input[type="checkbox"] {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 13px !important;
    height: 13px !important;
    min-width: 13px;
    border: 1.5px solid #777 !important;
    opacity: 1 !important;
    position: relative;
  }

  #openforms-print-root input[type="radio"] {
    border-radius: 50% !important;
  }

  #openforms-print-root input[type="checkbox"] {
    border-radius: 2px !important;
  }

  #openforms-print-root input[type="radio"]:checked {
    border: 4px solid #111 !important;
  }

  #openforms-print-root input[type="radio"]:checked::after {
    display: none !important;
  }

  #openforms-print-root input[type="checkbox"]:checked {
    border: 1.5px solid #111 !important;
  }

  #openforms-print-root input[type="checkbox"]:checked::after {
    content: "" !important;
    position: absolute !important;
    display: block !important;
    width: 4px !important;
    height: 8px !important;
    top: 0 !important;
    left: 3px !important;
    border: solid #111 !important;
    border-width: 0 2px 2px 0 !important;
    transform: rotate(45deg) !important;
    background: transparent !important;
  }

  #openforms-print-root .form-radio-group,
  #openforms-print-root .form-checkbox-group {
    gap: 4px 16px !important;
  }

  #openforms-print-root .form-radio-label,
  #openforms-print-root .form-checkbox-label {
    padding: 0 !important;
    border: none !important;
    min-height: 0 !important;
  }

  /* Matrix: always the table layout, never the phone "cards", never horizontally clipped */
  #openforms-print-root .form-matrix-wrapper {
    overflow: visible !important;
    border: 1px solid #bbb !important;
    border-radius: 3px !important;
  }

  #openforms-print-root .form-matrix-table {
    display: table !important;
    width: 100% !important;
    table-layout: auto;
  }

  #openforms-print-root .form-matrix-table thead {
    display: table-header-group !important;
  }

  #openforms-print-root .form-matrix-table tbody {
    display: table-row-group !important;
  }

  #openforms-print-root .form-matrix-table tr {
    display: table-row !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  #openforms-print-root .form-matrix-table th,
  #openforms-print-root .form-matrix-table td {
    display: table-cell !important;
    width: auto !important;
    padding: 5px 8px !important;
    border-bottom: 1px solid #ddd !important;
    text-align: center !important;
    font-size: 9.5pt !important;
    margin: 0 !important;
  }

  #openforms-print-root .form-matrix-table th.form-matrix-row-label {
    text-align: left !important;
    font-weight: 500 !important;
    min-width: 0 !important;
  }

  #openforms-print-root .form-matrix-radio-label {
    display: inline-flex !important;
    justify-content: center !important;
    min-height: 0 !important;
  }

  #openforms-print-root .matrix-cell-mobile-text {
    display: none !important;
  }

  /* Repeater items */
  #openforms-print-root .form-repeater-items-list {
    display: block !important;
  }

  #openforms-print-root .form-repeater-card {
    display: block !important;
    border: 1px solid #bbb !important;
    border-radius: 3px !important;
    margin-bottom: 8px !important;
    overflow: visible !important;
  }

  #openforms-print-root .form-repeater-card + .form-repeater-card {
    margin-top: 0 !important;
  }

  #openforms-print-root .form-repeater-card-header {
    border-bottom: 1px solid #ddd !important;
    padding: 3px 8px !important;
    break-after: avoid;
    page-break-after: avoid;
  }

  #openforms-print-root .form-repeater-grid {
    display: block !important;
    padding: 8px !important;
  }

  #openforms-print-root .form-repeater-grid > .renderer-row {
    margin-bottom: 6px !important;
  }

  /* Signatures: the stored image, scaled without distortion */
  #openforms-print-root .form-signature-box {
    border: 1px solid #bbb !important;
    border-radius: 3px !important;
    max-width: 90mm;
  }

  #openforms-print-root .openforms-print-signature {
    display: block;
    width: 100%;
    height: 32mm;
    object-fit: contain;
  }

  /* Attachments: file name in full, images large enough to read */
  #openforms-print-root .form-file-details {
    display: flex !important;
    align-items: flex-start !important;
    border: 1px solid #bbb !important;
    border-radius: 3px !important;
    padding: 6px 8px !important;
  }

  #openforms-print-root .form-file-details-left {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px;
    overflow: visible !important;
  }

  #openforms-print-root .form-file-details-left div {
    max-width: none !important;
    white-space: normal !important;
    overflow: visible !important;
    overflow-wrap: anywhere;
  }

  #openforms-print-root .form-file-preview-thumbnail {
    width: auto !important;
    height: auto !important;
    max-width: 70mm !important;
    margin: 0 0 4px !important;
    border: none !important;
  }

  #openforms-print-root .form-file-preview-thumbnail img {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 70mm !important;
    max-height: 50mm !important;
    object-fit: contain !important;
  }

  #openforms-print-root .form-file-uploader.is-readonly {
    border: 1px dashed #bbb !important;
    padding: 6px 8px !important;
    min-height: 0 !important;
  }
}

/* ==========================================================================
   Builder toasts (B9) — minimal styles for the container the builder creates
   itself when the host page has no #toast-container. That container is appended
   to <body>, outside .builder-layout, so it is a component root of its own: it is
   tagged .openforms-toast-container and carries the --of-* tokens (#toast-container
   is in the token block). Nothing here touches a host-provided container.
   Toast colours stay literal: white text on these fills keeps WCAG AA contrast
   whatever palette the host's --color-* tokens use.
   ========================================================================== */
.openforms-toast-container {
  position: fixed;
  bottom: var(--of-space-l);
  right: var(--of-space-l);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--of-space-s);
  pointer-events: none;
}

.openforms-toast-container .toast {
  display: flex;
  align-items: center;
  gap: var(--of-space-s);
  max-width: 360px;
  padding: 10px 14px;
  border-radius: var(--of-border-radius-m);
  font-family: var(--of-font-family);
  font-size: var(--of-font-size-base);
  line-height: 1.4;
  color: #fff;
  background: #1f2937;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  pointer-events: auto;
}

.openforms-toast-container .toast.toast-error { background: #b42318; }
.openforms-toast-container .toast.toast-success { background: #15803d; }

/* ==========================================================================
   Builder dialogs (A7) — the built-in replacement for window.confirm/prompt
   ========================================================================== */
.builder-layout .of-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--of-space-base);
  background: rgba(0, 0, 0, 0.45);
}

.builder-layout .of-dialog {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: var(--of-space-m);
  padding: var(--of-space-base);
  border-radius: var(--of-border-radius-m);
  background: var(--of-color-neutral-0);
  color: var(--of-color-neutral-10);
  box-shadow: var(--of-shadow-lg);
  font-family: var(--of-font-family);
  font-size: var(--of-font-size-base);
}

.builder-layout .of-dialog-message {
  margin: 0;
  line-height: 1.5;
  white-space: pre-line;
}

.builder-layout .of-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--of-space-s);
}

/* ==========================================================================
   Builder read-only mode (A7)
   ========================================================================== */
.builder-layout.is-readonly {
  grid-template-columns: 3fr 2fr;
}

.builder-layout.is-readonly .canvas-field,
.builder-layout.is-readonly .canvas-section-header {
  cursor: default;
}

.builder-layout.is-readonly .column-empty-indicator {
  display: none;
}
