/* ============================================================
   MetaForge Engine — Field CSS (Post / Page Edit Screen)
   Loaded ONLY on: post.php, post-new.php

   Sections:
     0. Design Tokens (:root)
     1. Meta box group wrapper
     2. Field base styles (.mfe-field, labels, inputs)
     3. Radio / Checkbox groups
     4. Group field
     5. Repeater (block layout)
     6. Repeater rows — handles, toggle, drag, remove
     7. Repeater — Add Row button
     8. Image / File / Color / Link field helpers
     9. Conditional logic watcher
    10. Select dropdown arrow fix
    11. TABLE layout (mfe-layout-table)
    12. ROW layout (mfe-layout-row)
   ============================================================ */

:root {
    /* Colors */
    --mfe-primary: #2271b1;
    --mfe-primary-hover: #135e96;
    --mfe-primary-soft: #f0f6fa;
    --mfe-bg-light: #f9fafb;
    --mfe-bg-white: #ffffff;
    --mfe-border: #d1d5db;
    --mfe-border-soft: #e5e7eb;
    --mfe-text-dark: #1d2327;
    --mfe-text-muted: #646970;
    --mfe-error: #d63638;
    --mfe-success: #00a32a;

    /* Geometry */
    --mfe-radius: 8px;
    --mfe-radius-sm: 4px;

    /* Shadows */
    --mfe-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --mfe-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --mfe-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* ── Gutenberg Meta Boxes Resizable Split-Pane & Horizontal Scrollbar Fix ── */
.block-editor-page .edit-post-meta-boxes-main.is-resizable,
.block-editor-page .edit-post-layout__metaboxes,
.block-editor-page .edit-post-meta-boxes-area,
.block-editor-page .editor-meta-boxes-main {
    overflow-x: hidden !important;
    max-width: 100% !important;
}

#metaforge_meta_box,
#metaforge_meta_box .inside {
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

/* ── 1. Meta box group wrapper (Clean frameless container) ── */
.mfe-post-edit-group {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 0 16px 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    max-width: 100% !important;
}

.mfe-post-edit-group h3 {
    display: none !important;
}

/* ── 2. Field base styles ── */
.mfe-field {
    margin: 0;
    padding: 10px 0;
    /* Tightened from 16px */
    border-bottom: 1px solid var(--mfe-bg-light);
    background: transparent;
}

.mfe-field:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.mfe-field>label,
.mfe-field-label {
    display: block;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--mfe-text-dark);
    font-size: 13px;
}

.mfe-input input[type="text"],
.mfe-input input[type="number"],
.mfe-input input[type="email"],
.mfe-input input[type="url"],
.mfe-input input[type="password"],
.mfe-input textarea,
.mfe-input select:not(.select2-hidden-accessible) {
    width: 100%;
    margin: 0;
    border: 1px solid var(--mfe-border);
    border-radius: 6px;
    padding: 8px 12px;
    background: var(--mfe-bg-white);
    font-size: 13px;
    color: var(--mfe-text-dark);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: auto;
    appearance: auto;
}

.mfe-input textarea {
    line-height: 1.5;
}

.mfe-input input:focus,
.mfe-input textarea:focus,
.mfe-input select:not(.select2-hidden-accessible):focus {
    border-color: var(--mfe-primary);
    box-shadow: 0 0 0 2px var(--mfe-primary-soft);
    outline: none;
}

/* ── 3. Radio / Checkbox groups ── */
.mfe-radio-group,
.mfe-checkbox-group {
    display: flex;
    flex-direction: column;
    /* default: vertical */
    gap: 4px;
}

/* Horizontal layout: items flow in a row, wrap if needed */
.mfe-radio-group.mfe-choice-layout-horizontal,
.mfe-checkbox-group.mfe-choice-layout-horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px 8px;
}

.mfe-radio-group label,
.mfe-checkbox-group label {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
    padding: 4px 0;
    cursor: pointer;
    font-weight: 400 !important;
    font-size: 13px;
    line-height: 1.2 !important;
    color: #374151;
    white-space: nowrap;
    user-select: none;
}

/* Horizontal labels: clean inline layout with padding 7px 7px */
.mfe-radio-group.mfe-choice-layout-horizontal label,
.mfe-checkbox-group.mfe-choice-layout-horizontal label {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 7px 7px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    line-height: 1.2 !important;
    transition: color 0.15s;
}

.mfe-radio-group.mfe-choice-layout-horizontal label:hover,
.mfe-checkbox-group.mfe-choice-layout-horizontal label:hover {
    background: transparent !important;
    border: none !important;
    color: var(--mfe-primary, #2271b1);
}

.mfe-radio-group input[type="radio"],
.mfe-checkbox-group input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: middle !important;
    accent-color: #0073aa;
    cursor: pointer;
    flex-shrink: 0 !important;
    position: relative !important;
    top: 0 !important;
}

.mfe-radio-group label span,
.mfe-checkbox-group label span {
    display: inline-block !important;
    line-height: 1.2 !important;
    vertical-align: middle !important;
}

/* ── 4. Group field ── */
.mfe-group-wrap {
    margin-top: 0px;
    background: var(--mfe-bg-white);
    border-radius: var(--mfe-radius);
    border: 1px solid var(--mfe-border-soft);
    padding: 0px;
}

/* ── 4.5. Nested Hierarchy — see section 7 at end of file ── */
/* All nested repeater styles consolidated at end of file. */

/* ── 5. Repeater (outer wrapper) ── */
.mfe-repeater {
    border: 1px solid var(--mfe-border-soft);
    border-radius: var(--mfe-radius);
    overflow: visible;
    /* allow inner dropdowns/overlays */
    overflow-x: auto;
    /* Support wide tables */
    background: var(--mfe-bg-light);
    margin-top: 20px;
    box-shadow: var(--mfe-shadow-sm);
}

.mfe-repeater-header {
    background: #f9fafb !important;
    border-bottom: 1px solid var(--mfe-border-soft) !important;
    padding: 6px 12px !important;
    /* ACF density */
    font-size: 10px !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    text-transform: uppercase;
    letter-spacing: .05em;
    display: flex !important;
    align-items: center !important;
}

.mfe-row-index-col {
    width: 38px;
    flex-shrink: 0;
}

.mfe-row-fields-col {
    flex: 1;
}

/* Global Actions Bar */
.mfe-repeater-actions {
    display: flex;
    gap: 4px;
    /* Tighter for Zen */
    margin-left: auto;
}

.mfe-action-btn {
    background: transparent !important;
    border: none !important;
    color: #cbd5e1 !important;
    /* Lighter idle color */
    cursor: pointer !important;
    padding: 2px !important;
    border-radius: 4px !important;
    transition: all 0.2s !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mfe-action-btn:hover {
    background: #f1f5f9 !important;
    color: var(--mfe-primary) !important;
}

.mfe-action-btn .dashicons {
    font-size: 14px;
    /* Slightly smaller icons */
    width: 14px;
    height: 14px;
}

/* ── 6. Repeater rows — handles, toggle, drag, remove ── */
.mfe-repeater-row {
    margin-bottom: -1px;
    background: #fff;
    border: 1px solid var(--mfe-border-soft);
    position: relative;
    border-radius: 6px;
    margin: 8px 12px;
    box-shadow: var(--mfe-shadow-sm);
    transition: all 0.2s ease;
    overflow: hidden;
}

.mfe-repeater-row:hover {
    box-shadow: var(--mfe-shadow);
}

.mfe-repeater-row-handle {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: move;
    background: #fdfdfd;
    border-radius: 6px 6px 0 0;
    border-bottom: 1px solid #f1f5f9;
}

/* ── Drag handle: 6-dot grip pattern — works in ALL layouts and ALL nesting depths ── */
.mfe-row-drag-handle {
    display: inline-block;
    width: 14px;
    height: 20px;
    flex-shrink: 0;
    margin-right: 10px;
    cursor: grab;
    opacity: 0.45;
    background-image: radial-gradient(circle, #64748b 1.5px, transparent 1.5px);
    background-size: 5px 5px;
    background-position: 0 0;
    background-repeat: repeat;
}

.mfe-row-drag-handle:hover {
    opacity: 0.9;
}

.mfe-row-drag-handle:active {
    cursor: grabbing;
    opacity: 1;
}

.mfe-row-index {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    margin-right: 12px;
    width: 20px;
    height: 20px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mfe-row-title-text {
    font-weight: 600;
    color: #334155;
    font-size: 13px;
}

.mfe-row-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mfe-remove-row,
.mfe-row-toggle {
    background: transparent !important;
    border: none !important;
    color: #94a3b8 !important;
    cursor: pointer !important;
    padding: 4px !important;
    border-radius: 4px !important;
    transition: all 0.2s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center;
}

.mfe-remove-row:hover {
    color: #ef4444 !important;
    background: #fef2f2 !important;
}

.mfe-row-toggle:hover {
    color: #6366f1 !important;
    background: #f5f3ff !important;
}


.mfe-action-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.mfe-repeater-rows {
    padding: 12px;
    /* Tightened from 16px */
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Reduced from 12px */
}

/* ── 6. Repeater rows ── */
.mfe-repeater-row {
    border: 1px solid var(--mfe-border-soft);
    background: var(--mfe-bg-white);
    border-radius: var(--mfe-radius);
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--mfe-shadow-sm);
    position: relative;
}

.mfe-repeater-row:hover {
    border-color: var(--mfe-primary);
    box-shadow: var(--mfe-shadow);
    transform: translateY(-1px);
}

/* Row handle (title bar at top of each row) */
.mfe-repeater-row-handle {
    position: relative;
    height: 38px;
    background: #fdfdfd;
    border-bottom: 1px solid var(--mfe-border-soft);
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--mfe-text-dark);
    cursor: pointer;
    user-select: none;
    gap: 12px;
    transition: background 0.15s;
}

.mfe-row-toggle-icon {
    font-size: 18px;
    color: #94a3b8;
}

.mfe-row-index {
    color: #94a3b8;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
}

.mfe-row-title-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #334155;
}

.mfe-repeater-row-handle:hover {
    background: #fdfdfd;
}

/* Drag handle inside the row handle */
.mfe-row-drag-handle {
    color: var(--mfe-text-muted);
    font-size: 16px;
    width: 20px;
    height: 20px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .15s;
    opacity: 0.5;
}

.mfe-repeater-row-handle:hover .mfe-row-drag-handle {
    opacity: 1;
    color: var(--mfe-primary);
}

.mfe-row-drag-handle:active {
    cursor: grabbing;
}

/* Toggle arrow icon */
.mfe-row-toggle-icon {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: var(--mfe-text-muted);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed row — hide fields */
.mfe-row-collapsed .mfe-repeater-row-fields {
    display: none;
}

.mfe-row-collapsed .mfe-repeater-row-handle {
    border-bottom: none;
}

/* Row index badge */
.mfe-row-index {
    background: var(--mfe-primary-soft);
    color: var(--mfe-primary);
    min-width: 20px;
    height: 20px;
    padding: 0px !important;
    border-radius: 50% !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}

/* Fields area inside each row */
.mfe-repeater-row-fields {
    padding: 20px;
    background: var(--mfe-bg-white);
}

/* Drag sort placeholder (SortableJS Ghost) */
.mfe-sortable-ghost {
    opacity: 0.4;
    border: 2px dashed var(--mfe-primary) !important;
    background: var(--mfe-primary-soft) !important;
}

.mfe-sortable-drag {
    cursor: grabbing !important;
    box-shadow: var(--mfe-shadow-hover) !important;
}

/* The Trash button in the header */
.mfe-repeater-row-handle .mfe-remove-row {
    display: inline-flex !important;
    margin-left: auto !important;
    background: transparent !important;
    border: none !important;
    color: #94a3b8 !important;
    font-size: 14px !important;
    width: 32px !important;
    height: 32px !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    opacity: 0.8;
}

.mfe-repeater-row-handle .mfe-remove-row .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.mfe-repeater-row-handle .mfe-remove-row:hover {
    background: #fee2e2 !important;
    color: #ef4444 !important;
    opacity: 1;
}

/* ── 7. Add Row button (Modern Action Button) ── */
.mfe-add-row-wrap {
    padding: 0;
    background: #f9fafb;
    border-top: 1px solid var(--mfe-border-soft);
    margin-left: 0;
}

.mfe-add-row-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    /* ACF-style full width */
    padding: 10px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #fff !important;
    background: #2271b1 !important;
    border: none !important;
    border-radius: 0 0 4px 4px !important;
    cursor: pointer !important;
    transition: background 0.2s !important;
}

.mfe-add-row-btn:hover {
    background: #3858e9 !important;
    box-shadow: 0 4px 10px rgba(34, 113, 177, 0.3) !important;
    color: #fff !important;
}

/* Table Layout Polish (Titan Standard) */
.mfe-repeater-table-row {
    display: flex;
    align-items: flex-start;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid #f1f5f9;
}

.mfe-repeater-table-row .mfe-repeater-row-fields {
    display: flex;
    flex: 1;
    padding: 0;
    width: 100%;
}

.mfe-table-cell-field {
    flex: 1;
    /* Auto fit */
    padding: 12px;
    border-right: 1px solid #f1f5f9;
    min-width: 100px;
}

.mfe-table-cell-drag {
    width: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fdfdfd;
    border-right: 1px solid #f1f5f9;
}

.mfe-table-cell-remove {
    width: 54px;
    /* Even more compact */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-left: 1px solid #f1f5f9;
    flex-shrink: 0;
}

/* Row Layout (20/80 Split) */
.mfe-repeater-row-layout .mfe-row-cell-field {
    display: flex;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    gap: 20px;
    align-items: center;
}

.mfe-repeater-row-layout .mfe-row-cell-field .mfe-field-label {
    width: 200px;
    flex-shrink: 0;
    margin: 0;
    font-weight: 600;
}

.mfe-repeater-row-layout .mfe-row-cell-field .mfe-field-input {
    flex: 1;
}

/* Image Cleanup - handled in Zen UX section */

/* Remove the rounded circle icon from images */
.mfe-image-field-remove-indicator,
.mfe-remove-image-btn.mfe-remove-circle {
    display: none !important;
}

/* Ensure the trash icon in header is the primary signal */
.mfe-remove-row .dashicons-trash {
    color: #94a3b8;
    transition: color 0.2s;
}

.mfe-remove-row:hover .dashicons-trash {
    color: #ef4444;
}


/* ── 8. Image / File / Color / Link field helpers ── */
/* Image styles consolidated in the Zen UX section below */

.mfe-color-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mfe-link-display {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mfe-link-preview {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #f9fafb;
    font-size: 13px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.mfe-link-preview a {
    margin-left: auto;
    color: #9ca3af;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* ── 9. Conditional logic watcher ── */
/* (display:none is set inline by PHP; this ensures transitions work) */
.mfe-condition-watcher {
    transition: opacity .15s;
}

/* ── 10. Select dropdown arrow fix ── */
.mfe-input select:not(.select2-hidden-accessible) {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1.41 0L6 4.58 10.59 0 12 1.41 6 7.41 0 1.41z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    padding-right: 32px !important;
}

/* ── 11. TABLE layout ── */
.mfe-layout-table .mfe-table-header {
    display: flex;
    background: none;
    border: 1px solid none;
    border-bottom: none;
    font-weight: 600;
    font-size: 13px;
    color: #1d2327;
}

.mfe-layout-table .mfe-table-col-drag,
.mfe-layout-table .mfe-table-cell-drag {
    width: 28px;
    /* Narrower for density */
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #ccd0d4;
}

.mfe-layout-table .mfe-table-col {
    flex: 1;
    padding: 0px;
    border-right: none;
}

.mfe-layout-table .mfe-table-col-remove,
.mfe-layout-table .mfe-table-cell-remove {
    width: 54px;
    /* Compact action column */
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── 11. TABLE layout (mfe-layout-table) ── */
.mfe-layout-table .mfe-repeater-rows {
    padding: 0;
    gap: 0;
}

.mfe-layout-table .mfe-repeater-row {
    display: flex;
    border: none;
    border-bottom: 1px solid var(--mfe-border-soft);
    border-radius: 0;
    background: var(--mfe-bg-white);
    align-items: stretch;
    /* Back to stretch for border continuity */
    box-shadow: none;
    margin-bottom: 0;
}

.mfe-layout-table .mfe-repeater-row:last-of-type {
    border-bottom: none;
}

.mfe-layout-table .mfe-repeater-row:hover {
    background: #fdfdfd;
    transform: none;
    box-shadow: none;
}

.mfe-layout-table .mfe-repeater-row-handle {
    width: 32px;
    min-height: 48px;
    /* Ensure a minimum height for the cell */
    background: var(--mfe-bg-light);
    border-right: 1px solid var(--mfe-border-soft);
    border-bottom: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
}

.mfe-layout-table .mfe-row-drag-handle {
    margin-right: 0;
}

.mfe-layout-table .mfe-repeater-row-fields {
    flex: 1;
    display: flex;
    padding: 0;
}

.mfe-layout-table .mfe-table-cell-field {
    flex: 1;
    border-right: 1px solid var(--mfe-border-soft);
    padding: 8px 16px;
    /* Slimmer vertical padding */
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center content vertically */
}

.mfe-layout-table .mfe-table-cell-field:last-child {
    border-right: none;
}

/* Hide labels in tables since column headers should be shown */
.mfe-layout-table .mfe-table-cell-field .mfe-field>label,
.mfe-layout-table .mfe-table-cell-field .mfe-field-label {
    display: none !important;
}

.mfe-layout-table .mfe-input input[type="text"],
.mfe-layout-table .mfe-input select:not(.select2-hidden-accessible) {
    padding: 6px 10px;
    font-size: 13px;
}

/* ── 12. ROW layout ── */
.mfe-layout-row .mfe-repeater-rows {
    padding: 16px;
    gap: 12px;
}

.mfe-layout-row .mfe-repeater-row {
    margin-bottom: 0;
}

.mfe-layout-row .mfe-repeater-row-handle {
    height: 100%;
    min-height: 48px;
}

.mfe-layout-row .mfe-repeater-row-fields {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 16px;
    align-items: flex-end;
}

.mfe-layout-row .mfe-row-cell-field {
    flex: 1;
    min-width: 180px;
}

.mfe-layout-row .mfe-row-cell-field .mfe-field {
    padding: 0;
    border-bottom: none;
}

.mfe-layout-row .mfe-row-cell-field .mfe-field>label,
.mfe-layout-row .mfe-row-cell-field .mfe-field-label {
    margin-bottom: 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--mfe-text-muted);
}

/* ── ZEN UI PREMIUM OVERRIDES (Final Polish) ── */

/* Table Layout (Titan Standard) */
.mfe-repeater-table-row {
    display: flex !important;
    align-items: stretch !important;
    padding: 0 !important;
    background: #fff !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.mfe-table-cell-field {
    flex: 1 !important;
    padding: 12px 15px !important;
    border-right: 1px solid #f1f5f9 !important;
    min-height: 48px !important;
}

.mfe-table-cell-field:last-child {
    border-right: none !important;
}

.mfe-table-cell-drag {
    width: 38px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #f8fafc !important;
    border-right: 1px solid #e2e8f0 !important;
    cursor: move !important;
}

.mfe-table-cell-remove {
    width: 42px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-left: 1px solid #e2e8f0 !important;
    background: #fdfdfd !important;
}

/* Row Layout (20/80 Pro Split) */
.mfe-repeater-row-layout .mfe-repeater-row-fields {
    display: block !important;
}

.mfe-repeater-row-layout .mfe-field {
    display: flex !important;
    padding: 12px 16px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    gap: 30px !important;
    background: #fff !important;
    align-items: flex-start !important;
}

.mfe-repeater-row-layout .mfe-field>label,
.mfe-repeater-row-layout .mfe-field-label {
    width: 180px !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding-top: 8px !important;
    font-weight: 600 !important;
    color: #475569 !important;
}

.mfe-repeater-row-layout .mfe-input {
    flex: 1 !important;
}

/* Golden Alignment: Add Row button backbone */
.mfe-add-row-wrap {
    padding: 15px 0 5px !important;
    margin-left: 0 !important;
    /* Perfect align with Indigo backbone */
    background: transparent !important;
}

.mfe-add-row-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 16px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
}

/* ── Image Field: Unified System ── */

/* ========================================================
   ACF-STYLE IMAGE FIELD UI
   ======================================================== */
.mfe-image-wrap.has-value .hide-if-value {
    display: none !important;
}

.mfe-image-wrap.is-empty .show-if-value {
    display: none !important;
}

/* Empty State Dashed Placeholder Box */
.mfe-image-empty {
    display: inline-block !important;
    vertical-align: top !important;
}

.mfe-image-placeholder {
    width: 100px !important;
    height: 100px !important;
    border: 2px dashed #cbd5e1 !important;
    border-radius: 8px !important;
    background: #f8fafc !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    gap: 6px !important;
    padding: 10px !important;
    box-sizing: border-box !important;
}

.mfe-image-placeholder:hover {
    border-color: var(--mfe-primary, #2271b1) !important;
    background: var(--mfe-primary-soft, #f0f6fa) !important;
}

.mfe-image-placeholder .dashicons {
    font-size: 28px !important;
    width: 28px !important;
    height: 28px !important;
    color: #94a3b8 !important;
    transition: color 0.2s ease !important;
}

.mfe-image-placeholder:hover .dashicons {
    color: var(--mfe-primary, #2271b1) !important;
}

.mfe-image-placeholder-text {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #64748b !important;
    transition: color 0.2s ease !important;
    text-align: center !important;
    line-height: 1.2 !important;
}

.mfe-image-placeholder:hover .mfe-image-placeholder-text {
    color: var(--mfe-primary, #2271b1) !important;
}

/* Filled State Premium Image Preview */
.mfe-image-preview {
    position: relative !important;
    display: inline-block !important;
    width: auto !important;
    max-width: 320px !important;
    min-width: 80px !important;
    min-height: 80px !important;
    max-height: 240px !important;
    border-radius: 6px !important;
    border: 1px solid #cbd5e1 !important;
    background: #f8fafc !important;
    overflow: hidden !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    box-sizing: border-box !important;
    vertical-align: top !important;
}

.mfe-image-preview:hover {
    border-color: var(--mfe-primary, #2271b1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

.mfe-image-preview img {
    max-width: 320px !important;
    max-height: 240px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: center !important;
    display: block !important;
}

/* Hover Action Overlay */
.mfe-image-actions {
    position: absolute !important;
    inset: 0 !important;
    background: rgba(15, 23, 42, 0.65) !important;
    /* Elegant dark backdrop */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    opacity: 0 !important;
    transition: opacity 0.2s ease !important;
    z-index: 5 !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
}

.mfe-image-preview:hover .mfe-image-actions {
    opacity: 1 !important;
}

/* Action Buttons inside Overlay */
.mfe-image-actions .mfe-icon-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 30px !important;
    height: 30px !important;
    background: #ffffff !important;
    color: #334155 !important;
    border-radius: 50% !important;
    text-decoration: none !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.2s ease !important;
    border: none !important;
    padding: 0 !important;
}

.mfe-image-actions .mfe-icon-btn:hover {
    transform: scale(1.1) !important;
}

.mfe-image-actions .mfe-upload-btn:hover {
    background: var(--mfe-primary, #2271b1) !important;
    color: #ffffff !important;
}

.mfe-image-actions .mfe-remove-btn:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
}

.mfe-image-actions .mfe-icon-btn .dashicons {
    font-size: 15px !important;
    width: 15px !important;
    height: 15px !important;
}

/* ── Table Layout / Compact Cells Adjustments ── */
.mfe-layout-table .mfe-image-placeholder,
.mfe-table-cell-field .mfe-image-placeholder {
    width: 48px !important;
    height: 48px !important;
    border-radius: 4px !important;
    gap: 2px !important;
    padding: 4px !important;
}

.mfe-layout-table .mfe-image-placeholder .dashicons,
.mfe-table-cell-field .mfe-image-placeholder .dashicons {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
}

.mfe-layout-table .mfe-image-placeholder-text,
.mfe-table-cell-field .mfe-image-placeholder-text {
    font-size: 8px !important;
}

.mfe-layout-table .mfe-image-preview,
.mfe-table-cell-field .mfe-image-preview {
    width: 48px !important;
    height: 48px !important;
    border-radius: 4px !important;
}

.mfe-layout-table .mfe-image-actions,
.mfe-table-cell-field .mfe-image-actions {
    gap: 4px !important;
}

.mfe-layout-table .mfe-image-actions .mfe-icon-btn,
.mfe-table-cell-field .mfe-image-actions .mfe-icon-btn {
    width: 20px !important;
    height: 20px !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
}

.mfe-layout-table .mfe-image-actions .mfe-icon-btn .dashicons,
.mfe-table-cell-field .mfe-image-actions .mfe-icon-btn .dashicons {
    font-size: 11px !important;
    width: 11px !important;
    height: 11px !important;
}

/* Ensure proper wrapping inside cell layouts */
.mfe-layout-table .mfe-table-cell-field .mfe-image-field {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding-bottom: 0 !important;
    position: relative !important;
}

.mfe-layout-table .mfe-image-wrap,
.mfe-table-cell-field .mfe-image-wrap,
.mfe-repeater-row .mfe-image-field .mfe-image-wrap {
    position: relative !important;
}

.mfe-repeater-row-fields .mfe-image-field {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    margin-bottom: 0 !important;
}

.mfe-row-cell-field .mfe-image-field {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
}

.mfe-row-cell-field .mfe-image-field .mfe-field-label {
    display: none !important;
}

/* Backbone rules moved to section 7 (nested repeater hierarchy) */
/* .mfe-field .mfe-repeater-rows backbone — handled below */


.mfe-add-row-btn {
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    color: #475569 !important;
    font-family: inherit !important;
    box-shadow: none !important;
}

.mfe-add-row-btn:hover {
    background: #e2e8f0 !important;
    color: #1e293b !important;
}

/* ============================================================
   MFE REPEATER UX UPGRADE — Frontend-only overrides
   Drop at end of field.css. No PHP changes required.
   Targets: block layout, table layout, row layout, image cells
   ============================================================ */

/* ── TOKEN ADDITIONS ── */
:root {
    --mfe-row-hover-bg: #f8fafc;
    --mfe-handle-bg: #f8fafc;
    --mfe-accent: #6366f1;
    --mfe-accent-soft: #eef2ff;
    --mfe-accent-hover: #4f46e5;
    --mfe-danger-soft: #fef2f2;
    --mfe-danger: #ef4444;
    --mfe-transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════════════════════════════════════
   1. REPEATER OUTER WRAPPER
   ═══════════════════════════════════════════ */
.mfe-repeater {
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
    overflow: visible !important;
    /* visible so inner dropdown/media overlays aren't clipped */
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06) !important;
    background: #f8fafc !important;
}

/* ── Header bar ── */
.mfe-repeater-header {
    background: #f1f5f9 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 8px 14px !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    letter-spacing: .07em !important;
}

/* Expand / Collapse all buttons — make them visible */
.mfe-action-btn {
    background: transparent !important;
    border: 1px solid #e2e8f0 !important;
    color: #94a3b8 !important;
    padding: 3px 7px !important;
    border-radius: 5px !important;
    font-size: 11px !important;
    transition: var(--mfe-transition) !important;
    gap: 3px !important;
}

.mfe-action-btn:hover {
    background: #fff !important;
    border-color: #cbd5e1 !important;
    color: #334155 !important;
}

/* ═══════════════════════════════════════════
   2. BLOCK LAYOUT — Row cards
   ═══════════════════════════════════════════ */
.mfe-repeater-rows {
    padding: 10px !important;
    gap: 6px !important;
}

/* Individual row card */
.mfe-repeater-row {
    background: #fff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04) !important;
    margin: 0 !important;
    transition: box-shadow 0.18s, border-color 0.18s !important;
    overflow: hidden !important;
}

.mfe-repeater-row:hover {
    border-color: #c7d2fe !important;
    box-shadow: 0 2px 8px rgba(99, 102, 241, .1) !important;
    transform: none !important;
}

/* Row handle — the clickable title bar */
.mfe-repeater-row-handle {
    height: auto !important;
    min-height: 44px !important;
    padding: 8px 12px !important;
    background: #fdfdfd !important;
    border-bottom: 1px solid #f1f5f9 !important;
    border-radius: 8px 8px 0 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    cursor: pointer !important;
    transition: background 0.15s !important;
}

.mfe-repeater-row-handle:hover {
    background: var(--mfe-row-hover-bg) !important;
}

/* Collapsed: no bottom border on handle */
.mfe-row-collapsed .mfe-repeater-row-handle {
    border-bottom: none !important;
    border-radius: 8px !important;
}

/* Drag dots — make them 3-dot grippy style */
.mfe-row-drag-handle {
    width: 16px !important;
    height: 20px !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 3px !important;
    align-content: center !important;
    justify-items: center !important;
    opacity: 0.35 !important;
    cursor: grab !important;
    flex-shrink: 0 !important;
    font-size: 0 !important;
    /* hide dashicons char */
    background-image: radial-gradient(circle, #94a3b8 1.5px, transparent 1.5px) !important;
    background-size: 6px 6px !important;
    background-repeat: repeat !important;
    background-position: center !important;
}

.mfe-repeater-row-handle:hover .mfe-row-drag-handle {
    opacity: 0.7 !important;
}

/* Row number badge */
.mfe-row-index {
    background: var(--mfe-accent-soft) !important;
    color: #647498 !important;
    min-width: 22px !important;
    height: 22px !important;
    padding: 0px !important;
    border-radius: 50% !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

/* Row title text */
.mfe-row-title-text {
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #334155 !important;
    flex: 1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-width: 0 !important;
}

/* Row actions group (trash + toggle) */
.mfe-row-actions {
    display: flex !important;
    align-items: center !important;
    gap: 2px !important;
    margin-left: auto !important;
    flex-shrink: 0 !important;
}

/* Remove row button */
.mfe-remove-row {
    width: 30px !important;
    height: 30px !important;
    border-radius: 6px !important;
    color: #cbd5e1 !important;
    transition: var(--mfe-transition) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mfe-remove-row:hover {
    background: var(--mfe-danger-soft) !important;
    color: var(--mfe-danger) !important;
}

/* Toggle button */
.mfe-row-toggle {
    width: 30px !important;
    height: 30px !important;
    border-radius: 6px !important;
    color: #cbd5e1 !important;
    transition: var(--mfe-transition) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mfe-row-toggle:hover {
    background: var(--mfe-accent-soft) !important;
    color: var(--mfe-accent) !important;
}

/* Toggle chevron rotates when open */
.mfe-repeater-row:not(.mfe-row-collapsed) .mfe-row-toggle-icon {
    transform: rotate(180deg) !important;
}

.mfe-row-toggle-icon {
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
    display: flex !important;
    align-items: center !important;
}

/* Fields body inside expanded row - Modern Block Layout Grid */
.mfe-repeater:not(.mfe-layout-table):not(.mfe-layout-row) .mfe-repeater-row-fields {
    /* padding: 10px !important; */
    background: #fff !important;
    display: grid !important;
    gap: 10px !important;
}

/* Ensure complex fields span full width of the grid */
.mfe-repeater:not(.mfe-layout-table):not(.mfe-layout-row) .mfe-repeater-row-fields>.mfe-condition-watcher:has(.mfe-field-repeater),
.mfe-repeater:not(.mfe-layout-table):not(.mfe-layout-row) .mfe-repeater-row-fields>.mfe-condition-watcher:has(.mfe-group-wrap),
.mfe-repeater:not(.mfe-layout-table):not(.mfe-layout-row) .mfe-repeater-row-fields>.mfe-condition-watcher:has(.mfe-wysiwyg-field),
.mfe-repeater:not(.mfe-layout-table):not(.mfe-layout-row) .mfe-repeater-row-fields>.mfe-condition-watcher:has(.mfe-relationship-field),
.mfe-repeater:not(.mfe-layout-table):not(.mfe-layout-row) .mfe-repeater-row-fields>.mfe-condition-watcher:has(textarea) {
    grid-column: 1 / -1 !important;
}

/* Remove bottom borders and paddings from block layout fields since they are in a grid */
.mfe-repeater:not(.mfe-layout-table):not(.mfe-layout-row) .mfe-field {
    border-bottom: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Make sure link inputs and previews fit beautifully in columns */
.mfe-repeater:not(.mfe-layout-table):not(.mfe-layout-row) .mfe-link-display {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: center !important;
    width: 100% !important;
}

.mfe-repeater:not(.mfe-layout-table):not(.mfe-layout-row) .mfe-link-preview {
    flex: 1 1 100% !important;
    min-width: 0 !important;
    padding: 8px 12px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    background: #f8fafc !important;
    font-size: 13px !important;
    color: #334155 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    box-sizing: border-box !important;
}

.mfe-repeater:not(.mfe-layout-table):not(.mfe-layout-row) .mfe-link-preview .mfe-link-label {
    font-weight: 500 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 130px !important;
}

.mfe-repeater:not(.mfe-layout-table):not(.mfe-layout-row) .mfe-link-preview a {
    margin-left: auto !important;
    color: #94a3b8 !important;
    font-size: 11px !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 120px !important;
}

.mfe-repeater:not(.mfe-layout-table):not(.mfe-layout-row) .mfe-link-display .button {
    font-size: 11px !important;
    padding: 0 10px !important;
    height: 28px !important;
    line-height: 26px !important;
    margin: 0 !important;
}

/* Sortable ghost */
.mfe-sortable-ghost {
    opacity: 0.4 !important;
    border: 2px dashed var(--mfe-accent) !important;
    background: var(--mfe-accent-soft) !important;
    border-radius: 8px !important;
}

.mfe-sortable-drag {
    cursor: grabbing !important;
    box-shadow: 0 8px 24px rgba(99, 102, 241, .18) !important;
    border-color: var(--mfe-accent) !important;
}

/* ═══════════════════════════════════════════
   3. TABLE LAYOUT — dense inline table
   ═══════════════════════════════════════════ */

/* No outer row-padding in table mode */
.mfe-layout-table .mfe-repeater-rows {
    padding: 0 !important;
    gap: 0 !important;
}

.mfe-layout-table .mfe-repeater-row {
    border: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    background: #fff !important;
    display: flex !important;
    align-items: stretch !important;
    transition: background 0.12s !important;
}

.mfe-layout-table .mfe-repeater-row:last-child {
    border-bottom: none !important;
}

.mfe-layout-table .mfe-repeater-row:hover {
    background: var(--mfe-row-hover-bg) !important;
    border-color: #f1f5f9 !important;
    box-shadow: none !important;
}

/* Drag handle cell in table */
.mfe-layout-table .mfe-repeater-row-handle,
.mfe-table-cell-drag {
    width: 80px !important;
    min-height: 52px !important;
    background: #f8fafc !important;
    border-right: 1px solid #f1f5f9 !important;
    border-bottom: none !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    padding: 0 !important;
    cursor: default !important;
    flex-shrink: 0 !important;
}

/* Hide row index & title in table mode */
.mfe-layout-table .mfe-row-index,
.mfe-layout-table .mfe-row-title-text,
.mfe-layout-table .mfe-row-title {
    display: none !important;
}

/* Row number in drag cell */
.mfe-table-cell-drag .mfe-row-index {
    display: inline-flex !important;
    background: #e2e8f0 !important;
    color: #64748b !important;
    font-size: 9px !important;
    min-width: 16px !important;
    height: 16px !important;
    padding: 0 4px !important;
    border-radius: 8px !important;
}

/* Content cells */
.mfe-layout-table .mfe-table-cell-field {
    flex: 1 !important;
    padding: 14px 14px !important;
    border-right: 1px solid #f1f5f9 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    min-width: 0 !important;
}

.mfe-layout-table .mfe-table-cell-field:last-child {
    border-right: none !important;
}

/* Slim inputs inside table cells */
.mfe-layout-table .mfe-input input[type="text"],
.mfe-layout-table .mfe-input input[type="url"],
.mfe-layout-table .mfe-input input[type="email"],
.mfe-layout-table .mfe-input select:not(.select2-hidden-accessible),
.mfe-layout-table .mfe-input textarea {
    padding: 5px 9px !important;
    font-size: 13px !important;
    border-radius: 5px !important;
}

/* Remove cell */
.mfe-layout-table .mfe-table-cell-remove {
    width: 50px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-left: 1px solid #f1f5f9 !important;
    background: #fdfdfd !important;
    flex-shrink: 0 !important;
}

/* Image in table cell — compact square */
.mfe-layout-table .mfe-image-preview,
.mfe-table-cell-field .mfe-image-preview {
    width: 52px !important;
    height: 52px !important;
    border-radius: 6px !important;
    border-width: 1.5px !important;
    cursor: pointer !important;
}

/* Always show actions overlay in table/repeater (thumbnails too small to hover reliably) */
.mfe-layout-table .mfe-image-actions,
.mfe-table-cell-field .mfe-image-actions,
.mfe-repeater-row .mfe-image-actions {
    opacity: 1 !important;
    top: 5px;
    right: 1px !important;
    gap: 1px !important;
    justify-content: right !important;
    padding: 0 !important;
}

/* ═══════════════════════════════════════════
   4. IMAGE FIELD — universal polish
   ═══════════════════════════════════════════ */

/* Image styling is now entirely handled by ACF-STYLE block above */

/* ═══════════════════════════════════════════
   5. ADD ROW BUTTON
   ═══════════════════════════════════════════ */
.mfe-add-row-wrap {
    padding: 10px 10px !important;
    background: transparent !important;
    border-top: none !important;
    margin: 0 !important;
    border-left: none !important;
}

.mfe-add-row-btn,
button.mfe-add-row {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    padding: 5px 12px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #64748b !important;
    background: transparent !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    box-shadow: none !important;
    transition: all 0.15s !important;
    font-family: inherit !important;
    width: auto !important;
}

.mfe-add-row-btn:hover,
button.mfe-add-row:hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
    color: #475569 !important;
}

/* ═══════════════════════════════════════════
   6. ROW LAYOUT — label + input side-by-side
   ═══════════════════════════════════════════ */
.mfe-layout-row .mfe-repeater-rows {
    padding: 10px !important;
    gap: 8px !important;
}

.mfe-layout-row .mfe-repeater-row {
    border-radius: 8px !important;
}

.mfe-layout-row .mfe-repeater-row-handle {
    border-radius: 8px 8px 0 0 !important;
    min-height: 42px !important;
}

.mfe-layout-row .mfe-repeater-row-fields {
    padding: 0 !important;
}

.mfe-layout-row .mfe-row-cell-field {
    padding: 10px 16px !important;
    border-bottom: 1px solid #f8fafc !important;
    gap: 20px !important;
}

.mfe-layout-row .mfe-row-cell-field:last-child {
    border-bottom: none !important;
}

/* ═══════════════════════════════════════════
   7. NESTED REPEATER — full visual hierarchy
   ═══════════════════════════════════════════ */

/* ── Nested repeater wrapper sitting inside a block row ── */
.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater,
.mfe-repeater-row-fields>.mfe-repeater {
    margin: 12px 0 4px 0 !important;
    border: 1.5px solid #c7d2fe !important;
    border-radius: 8px !important;
    background: #fafbff !important;
    box-shadow: none !important;
    overflow: visible !important;
    /* Must NOT be hidden — clips inner content */
}

/* ── Nested: header bar becomes indigo-tinted ── */
.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater>.mfe-repeater-header,
.mfe-repeater-row-fields>.mfe-repeater>.mfe-repeater-header {
    background: #f1f5f9 !important;
    border-bottom: 1.5px solid #c7d2fe !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    letter-spacing: .08em !important;
    padding: 7px 0px !important;
}

/* ── Nested rows container — indigo left backbone ── */
.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater>.mfe-repeater-rows,
.mfe-repeater-row-fields>.mfe-repeater>.mfe-repeater-rows {
    border-left: 1px solid #e5e7eb !important;
    padding: 8px 10px !important;
    gap: 6px !important;
    background: #fafbff !important;
}

/* ── Nested row cards ── */
.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater>.mfe-repeater-rows>.mfe-repeater-row,
.mfe-repeater-row-fields>.mfe-repeater>.mfe-repeater-rows>.mfe-repeater-row {
    border: 1px solid #f1f5f9 !important;
    background: #fff !important;
    border-radius: 6px !important;
}

.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater>.mfe-repeater-rows>.mfe-repeater-row:hover,
.mfe-repeater-row-fields>.mfe-repeater>.mfe-repeater-rows>.mfe-repeater-row:hover {
    border-color: #a5b4fc !important;
    box-shadow: 0 1px 6px rgba(99, 102, 241, .1) !important;
}

/* ── Nested row handle tint ── */
.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater>.mfe-repeater-rows>.mfe-repeater-row>.mfe-repeater-row-handle,
.mfe-repeater-row-fields>.mfe-repeater>.mfe-repeater-rows>.mfe-repeater-row>.mfe-repeater-row-handle {
    background: #f1f5f9 !important;
    border-bottom-color: #f1f5f9 !important;
}

/* ── Nested add-row button area ── */
.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater>.mfe-add-row-wrap,
.mfe-repeater-row-fields>.mfe-repeater>.mfe-add-row-wrap {
    border-left: 3px solid #f1f5f9 !important;
    background: #f1f5f9 !important;
    border-top: 1.5px solid #c7d2fe !important;
    padding: 10px 14px !important;
}

/* ── Level-2+ deep nesting (violet tones) ── */
.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater>.mfe-repeater-rows>.mfe-repeater-row>.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater,
.mfe-repeater-row-fields>.mfe-repeater>.mfe-repeater-rows>.mfe-repeater-row>.mfe-repeater-row-fields>.mfe-repeater {
    border-color: #ddd6fe !important;
    background: #fdf8ff !important;
}

.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater>.mfe-repeater-rows>.mfe-repeater-row>.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater>.mfe-repeater-header,
.mfe-repeater-row-fields>.mfe-repeater>.mfe-repeater-rows>.mfe-repeater-row>.mfe-repeater-row-fields>.mfe-repeater>.mfe-repeater-header {
    background: #f5f3ff !important;
    border-bottom-color: #ddd6fe !important;
    color: #7c3aed !important;
}

.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater>.mfe-repeater-rows>.mfe-repeater-row>.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater>.mfe-repeater-rows,
.mfe-repeater-row-fields>.mfe-repeater>.mfe-repeater-rows>.mfe-repeater-row>.mfe-repeater-row-fields>.mfe-repeater>.mfe-repeater-rows {
    border-left-color: #8b5cf6 !important;
    background: #fdf8ff !important;
}

.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater>.mfe-repeater-rows>.mfe-repeater-row>.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater>.mfe-add-row-wrap,
.mfe-repeater-row-fields>.mfe-repeater>.mfe-repeater-rows>.mfe-repeater-row>.mfe-repeater-row-fields>.mfe-repeater>.mfe-add-row-wrap {
    border-left-color: #8b5cf6 !important;
    background: #f5f3ff !important;
    border-top-color: #ddd6fe !important;
}

/* ── Table layout nested: compact rows, keep image cells small ── */
.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater.mfe-layout-table,
.mfe-repeater-row-fields>.mfe-repeater.mfe-layout-table {
    border-radius: 6px !important;
}

.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater.mfe-layout-table .mfe-repeater-rows,
.mfe-repeater-row-fields>.mfe-repeater.mfe-layout-table .mfe-repeater-rows {
    padding: 0 !important;
    gap: 0 !important;
    border-left: none !important;
}

.mfe-repeater-row-fields>.mfe-condition-watcher>.mfe-repeater.mfe-layout-table .mfe-add-row-wrap,
.mfe-repeater-row-fields>.mfe-repeater.mfe-layout-table .mfe-add-row-wrap {
    border-left: none !important;
}

/* ── Nested repeater: sub-field labels visible & compact ── */
.mfe-repeater-row-fields .mfe-field>label,
.mfe-repeater-row-fields .mfe-field-label {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #475569 !important;
    margin-bottom: 6px !important;
}

/* ── END MFE NESTED REPEATER STYLES ── */

/* ══════════════════════════════════════════════════════
   TARGETED FIXES — Block & Table Layout Action Columns
   ══════════════════════════════════════════════════════ */

/* BLOCK LAYOUT: Ensure row handle is flex so actions float to the right */
.mfe-layout-block .mfe-repeater-row-handle,
.mfe-repeater:not(.mfe-layout-table):not(.mfe-layout-row) .mfe-repeater-row-handle {
    display: flex !important;
    align-items: center !important;
    flex-direction: row !important;
    gap: 10px !important;
}

/* BLOCK LAYOUT: row-actions pushed to the far right */
.mfe-layout-block .mfe-row-actions,
.mfe-repeater:not(.mfe-layout-table):not(.mfe-layout-row) .mfe-row-actions {
    margin-left: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
}

/* BLOCK LAYOUT: mfe-row-toggle must look like action-btn */
.mfe-row-toggle {
    background: transparent !important;
    border: 1px solid #e2e8f0 !important;
    color: #94a3b8 !important;
    padding: 3px 7px !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 30px !important;
    height: 30px !important;
    transition: var(--mfe-transition) !important;
    flex-shrink: 0 !important;
}

.mfe-row-toggle:hover {
    background: #eef2ff !important;
    border-color: #c7d2fe !important;
    color: #6366f1 !important;
}

/* TABLE LAYOUT: action cell — show both buttons stacked or side by side */
.mfe-layout-table .mfe-table-cell-remove {
    width: 60px !important;
    min-width: 60px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    border-left: 1px solid #e2e8f0 !important;
    background: #fdfdfd !important;
    flex-shrink: 0 !important;
    padding: 6px 4px !important;
}

/* TABLE LAYOUT: mfe-row-toggle in table action column */
.mfe-layout-table .mfe-table-cell-remove .mfe-row-toggle,
.mfe-table-cell-remove .mfe-row-toggle {
    width: 26px !important;
    height: 26px !important;
    padding: 2px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 4px !important;
    color: #94a3b8 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    background: transparent !important;
    transition: var(--mfe-transition) !important;
}

.mfe-layout-table .mfe-table-cell-remove .mfe-row-toggle:hover,
.mfe-table-cell-remove .mfe-row-toggle:hover {
    background: #eef2ff !important;
    border-color: #c7d2fe !important;
    color: #6366f1 !important;
}

/* TABLE LAYOUT: remove-row button in action column */
.mfe-layout-table .mfe-table-cell-remove .mfe-remove-row,
.mfe-table-cell-remove .mfe-remove-row {
    width: 26px !important;
    height: 26px !important;
    padding: 2px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 4px !important;
    color: #94a3b8 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    background: transparent !important;
    transition: var(--mfe-transition) !important;
}

.mfe-layout-table .mfe-table-cell-remove .mfe-remove-row:hover,
.mfe-table-cell-remove .mfe-remove-row:hover {
    background: #fef2f2 !important;
    border-color: #fca5a5 !important;
    color: #ef4444 !important;
}

/* TABLE LAYOUT: row-actions wrapper in remove cell */
.mfe-table-cell-remove .mfe-row-actions {
    flex-direction: column !important;
    gap: 4px !important;
    margin-left: 0 !important;
}

/* TABLE LAYOUT: table header — add actions column header to match */
.mfe-layout-table .mfe-repeater-header.mfe-table-header {
    display: flex !important;
    align-items: center !important;
}

/* TABLE HEADER: the expand/collapse actions in header right-align */
.mfe-layout-table .mfe-repeater-header .mfe-repeater-actions {
    width: 60px !important;
    min-width: 60px !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    margin-left: 0 !important;
    border-left: 1px solid #e2e8f0 !important;
    padding: 0 4px !important;
}

/* TABLE LAYOUT: drag cell in header match width */
.mfe-layout-table .mfe-repeater-header .mfe-table-col-drag {
    width: 36px !important;
    min-width: 36px !important;
    flex-shrink: 0 !important;
    border-right: 1px solid #e2e8f0 !important;
}

/* TABLE LAYOUT: table column headers grow equally with cells */
.mfe-layout-table .mfe-repeater-header .mfe-table-col {
    flex: 1 !important;
    padding: 6px 14px !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    text-transform: uppercase !important;
    letter-spacing: .07em !important;
}

/* TABLE LAYOUT: collapsed table row — hide fields, keep handle visible */
.mfe-layout-table .mfe-row-collapsed .mfe-repeater-row-fields {
    display: none;
}

/* TABLE LAYOUT: toggle icon rotation when open */
.mfe-layout-table .mfe-repeater-row:not(.mfe-row-collapsed) .mfe-row-toggle-icon {
    transform: rotate(180deg) !important;
}

/* Ensure dashicons inside mfe-row-toggle are correct size */
.mfe-row-toggle .mfe-row-toggle-icon.dashicons {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
}

/* ── END TARGETED FIXES ── */

/* ══════════════════════════════════════════════════════
   TABLE LAYOUT — Drag handle, Summary bar, Collapse fix
   ══════════════════════════════════════════════════════ */

/* Drag handle: 6-dot grip inside the left cell */
/* .mfe-table-cell-drag .mfe-row-drag-handle {
    display: block !important;
    width: 10px !important;
    height: 16px !important;
    font-size: 0 !important;
    background-image: radial-gradient(circle, #94a3b8 1.5px, transparent 1.5px) !important;
    background-size: 5px 5px !important;
    background-repeat: repeat !important;
    opacity: 0.5 !important;
    cursor: grab !important;
    flex-shrink: 0 !important;
    margin-bottom: 4px !important;
} */

.mfe-layout-table .mfe-repeater-row:hover .mfe-table-cell-drag .mfe-row-drag-handle {
    opacity: 1 !important;
}

.mfe-table-cell-drag .mfe-row-drag-handle:active {
    cursor: grabbing !important;
}

/* TABLE ROW: base flex structure */
.mfe-layout-table .mfe-repeater-row {
    position: relative !important;
}

/* ── Summary bar: hidden when expanded, shown when collapsed ── */
.mfe-row-table-summary {
    display: none !important;
    flex: 1 !important;
    align-items: stretch !important;
    gap: 0 !important;
    padding: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

/* Show summary only when row is collapsed */
.mfe-layout-table .mfe-row-collapsed .mfe-row-table-summary {
    display: flex !important;
}

/* Hide fields when collapsed in TABLE layout */
.mfe-layout-table .mfe-row-collapsed .mfe-repeater-row-fields {
    display: none !important;
}

/* Summary: title text acts like column 1 */
.mfe-summary-title {
    flex: 1 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #334155 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding: 10px 14px !important;
    border-right: 1px solid #f1f5f9 !important;
    display: flex !important;
    align-items: center !important;
}

/* Summary: image acts like column 2 */
.mfe-summary-image {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 10px 14px !important;
}

/* Summary: small image thumbnail when has-image */
.mfe-summary-image img {
    width: 36px !important;
    height: 36px !important;
    object-fit: cover !important;
    border-radius: 4px !important;
    border: 1px solid #e2e8f0 !important;
}

/* Summary: placeholder text when no image loaded yet */
.mfe-summary-img-placeholder {
    font-size: 11px !important;
    color: #94a3b8 !important;
    font-style: italic !important;
}

/* ── Toggle icon: expanded = chevron up (∧), collapsed = chevron down (∨) ── */
/* Default (expanded): arrow points up */
.mfe-layout-table .mfe-repeater-row .mfe-row-toggle-icon {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* When expanded, icon should point UP (row is open) */
.mfe-layout-table .mfe-repeater-row:not(.mfe-row-collapsed) .mfe-row-toggle-icon {
    transform: rotate(0deg) !important;
}

/* When collapsed, icon should point DOWN (click to expand) */
.mfe-layout-table .mfe-row-collapsed .mfe-row-toggle-icon {
    transform: rotate(180deg) !important;
}

/* ── Stacked actions: buttons stacked vertically ── */
.mfe-stacked-actions {
    flex-direction: column !important;
    gap: 4px !important;
    margin-left: 0 !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ── Remove row in table: slim style ── */
.mfe-stacked-actions .mfe-remove-row {
    width: 26px !important;
    height: 26px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 4px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #94a3b8 !important;
    background: transparent !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
    padding: 0 !important;
}

.mfe-stacked-actions .mfe-remove-row:hover {
    background: #fef2f2 !important;
    border-color: #fca5a5 !important;
    color: #ef4444 !important;
}

/* ── Toggle in table stacked actions ── */
.mfe-stacked-actions .mfe-action-btn.mfe-row-toggle {
    width: 26px !important;
    height: 26px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 4px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #94a3b8 !important;
    background: transparent !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
    padding: 0 !important;
}

.mfe-stacked-actions .mfe-action-btn.mfe-row-toggle:hover {
    background: #eef2ff !important;
    border-color: #c7d2fe !important;
    color: #6366f1 !important;
}

/* ── TABLE action column fixed width ── */
.mfe-layout-table .mfe-table-cell-remove {
    width: 50px !important;
    min-width: 50px !important;
    padding: 8px 6px !important;
    flex-direction: column !important;
    gap: 4px !important;
}

/* ── TABLE add-row button: full width, right-aligned text ── */
.mfe-table-add-row-wrap {
    text-align: right !important;
    padding: 10px 12px !important;
}

.mfe-table-add-row-wrap .mfe-add-row-btn {
    display: inline-flex !important;
}

/* ── END TABLE LAYOUT FIXES ── */

/* ── END TARGETED FIXES ── */

/* ══════════════════════════════════════════════════════
   TABLE LAYOUT — FINAL CORRECT OVERRIDES
   ══════════════════════════════════════════════════════ */

/* ── Drag handle cell ── */
.mfe-table-cell-drag {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    width: 40px !important;
    min-width: 40px !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    background: #f8fafc !important;
    border-right: 1px solid #e2e8f0 !important;
    cursor: default !important;
    padding: 8px 0 !important;
}

/* The actual grab icon — inherits dot pattern from .mfe-row-drag-handle, just override sizing/margin */
.mfe-table-cell-drag .mfe-row-drag-handle {
    display: block !important;
    height: 18px !important;
    margin: 0 auto !important;
    /* Force to center vertically and horizontally if needed */
    cursor: grab !important;
    flex-shrink: 0 !important;
    opacity: 0.5 !important;
}

.mfe-layout-table .mfe-repeater-row:hover .mfe-table-cell-drag .mfe-row-drag-handle {
    opacity: 1 !important;
    color: #64748b !important;
}

.mfe-table-cell-drag .mfe-row-drag-handle:active {
    cursor: grabbing !important;
}

/* Row index badge in drag cell */
.mfe-table-cell-drag .mfe-row-index {
    display: inline-flex !important;
    background: #e2e8f0 !important;
    color: #64748b !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    min-width: 18px !important;
    height: 18px !important;
    padding: 0px !important;
    border-radius: 50% !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ── Action cell: trash + toggle HORIZONTAL on same line ── */
.mfe-layout-table .mfe-table-cell-remove {
    width: 74px !important;
    min-width: 74px !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    border-left: 1px solid #e2e8f0 !important;
    background: #fdfdfd !important;
    padding: 0 6px !important;
}

/* Row actions inside action cell */
.mfe-layout-table .mfe-table-cell-remove .mfe-row-actions {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

/* Action buttons inside action cell */
.mfe-layout-table .mfe-table-cell-remove .mfe-action-btn {
    width: 28px !important;
    height: 28px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 5px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #94a3b8 !important;
    background: transparent !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
}

.mfe-layout-table .mfe-table-cell-remove .mfe-remove-row:hover {
    background: #fef2f2 !important;
    border-color: #fca5a5 !important;
    color: #ef4444 !important;
}

.mfe-layout-table .mfe-table-cell-remove .mfe-row-toggle:hover {
    background: #eef2ff !important;
    border-color: #c7d2fe !important;
    color: #6366f1 !important;
}

/* ── Table header alignments ── */
.mfe-layout-table .mfe-repeater-header {
    display: flex !important;
    align-items: stretch !important;
    padding: 0 !important;
}

/* ── Table header: col-actions matches action cell width ── */
.mfe-layout-table .mfe-repeater-header .mfe-table-col-actions {
    width: 74px !important;
    min-width: 74px !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    border-left: 1px solid #e2e8f0 !important;
    padding: 6px 6px !important;
}

/* ── Table header: drag col matches drag cell width ── */
.mfe-layout-table .mfe-repeater-header .mfe-table-col-drag {
    width: 80px !important;
    min-width: 40px !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    border-right: 1px solid #e2e8f0 !important;
}

/* ── Table header column labels ── */
.mfe-layout-table .mfe-repeater-header .mfe-table-col {
    flex: 1 !important;
    padding: 8px 14px !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    text-transform: uppercase !important;
    letter-spacing: .07em !important;
    display: flex !important;
    align-items: center !important;
}

/* ── Add Row: Match standard small layout ── */
.mfe-table-add-row-wrap {
    padding: 8px 8px !important;
    background: transparent !important;
    border-top: none !important;
    text-align: left !important;
    /* Keep it right aligned if desired, but small */
}

/* Revert full width */
.mfe-table-add-row-wrap .mfe-add-row-btn,
.mfe-table-add-row-wrap button.mfe-add-row {
    width: auto !important;
    display: inline-flex !important;
}

/* ── Collapsed row: summary visible, fields hidden ── */
.mfe-layout-table .mfe-row-collapsed .mfe-repeater-row-fields {
    display: none;
}

.mfe-layout-table .mfe-row-collapsed .mfe-row-table-summary {
    display: flex !important;
}

/* Summary bar default hidden */
.mfe-layout-table .mfe-row-table-summary {
    display: none;
    flex: 1 !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 6px 14px !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

/* ── Toggle icon styles ── */
.mfe-layout-table .mfe-row-toggle-icon {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
}

/* ══════════════════════════════════════════════════════
   TABLE & ROW LAYOUT — Column Alignment Fix
   The general .mfe-repeater-row-fields rule has
   padding: 16px 18px !important which overrides table/row
   specific padding:0 (no !important). These rules fix that.
   ══════════════════════════════════════════════════════ */

/* TABLE LAYOUT: fields wrapper must have zero padding so cells align with header columns */
.mfe-layout-table .mfe-repeater-row-fields {
    padding: 0 !important;
    flex: 1 !important;
    display: flex !important;
    min-width: 0 !important;
}

/* ROW LAYOUT: same fix — fields wrapper needs zero padding for inline layout */
.mfe-layout-row .mfe-repeater-row-fields {
    padding: 0 !important;
}

/* Ensure last table-cell-field has no border-right to match header column spacing */
.mfe-layout-table .mfe-table-cell-field:last-child {
    border-right: none !important;
}

/* Ensure header column border consistency — use same color as cells */
.mfe-layout-table .mfe-repeater-header .mfe-table-col {
    border-right: 1px solid #f1f5f9 !important;
}

/* Last header column before actions — no border-right to avoid double border with actions border-left */
.mfe-layout-table .mfe-repeater-header .mfe-table-col:nth-last-child(2) {
    border-right: none !important;
}

/* ══════════════════════════════════════════════════════
   EXPAND/COLLAPSE ICON VISIBILITY FIX
   Make header expand/collapse all buttons more prominent
   ══════════════════════════════════════════════════════ */

/* Header expand/collapse buttons — neutral styling like row icons */
.mfe-repeater-header .mfe-action-btn {
    width: 28px !important;
    height: 28px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: 1px solid #e2e8f0 !important;
    color: #94a3b8 !important;
    padding: 0 !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
}

.mfe-repeater-header .mfe-action-btn:hover {
    background: #f1f5f9 !important;
    border-color: #c7d2fe !important;
    color: #6366f1 !important;
}

/* Dashicons inside header buttons — ensure visibility */
.mfe-repeater-header .mfe-action-btn .dashicons {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
    line-height: 1 !important;
}

/* ── BLOCK LAYOUT: Number badge position fix ── */
/* Reset order so badge stays between drag handle and title (natural DOM order) */
.mfe-repeater-row-handle .mfe-row-index {
    order: 0 !important;
}

.mfe-repeater-row-handle .mfe-row-title {
    order: 0 !important;
}

.mfe-repeater-row-handle .mfe-row-actions {
    order: 0 !important;
}

.mfe-repeater-row-handle .dashicons,
.dashicons-before:before {
    width: 14px;
    height: 14px;
}

.mfe-field {
    padding-bottom: 14px !important;
    margin-bottom: 14px !important;
    clear: both !important;
}

button.mfe-add-row-btn.mfe-add-row span {
    font-size: 12px;
    width: auto;
    height: auto;
}

/* ═══════════════════════════════════════════════════════════════
   APPEARANCE MODES — checkbox, radio, multi_select, select
   ═══════════════════════════════════════════════════════════════ */

/* ── Shared choice-list container (checkbox + radio) ── */
.mfe-choice-list {
    max-height: 260px;
    overflow-y: auto;
    padding: 6px 4px;
    border: 1px solid var(--mfe-border);
    border-radius: 6px;
    background: var(--mfe-bg-white);
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

.mfe-choice-list::-webkit-scrollbar {
    width: 5px;
}

.mfe-choice-list::-webkit-scrollbar-track {
    background: transparent;
}

.mfe-choice-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 999px;
}

/* Each label row */
.mfe-choice-list label {
    display: flex !important;
    align-items: center;
    gap: 9px;
    padding: 6px 10px;
    margin: 0 !important;
    border-radius: 5px;
    font-weight: 400 !important;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: background 0.12s;
    user-select: none;
    line-height: 1.4;
}

.mfe-choice-list label:hover {
    background: var(--mfe-primary-soft, #f0f6fa);
    color: var(--mfe-primary, #2271b1);
}

/* Checkbox appearance — highlight checked rows */
.mfe-checkbox-list label:has(input:checked) {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 600 !important;
}

/* Radio appearance — highlight selected row */
.mfe-radio-list label:has(input:checked) {
    background: #f0fdf4;
    color: #166534;
    font-weight: 600 !important;
}

/* Inputs inside choice lists */
.mfe-choice-list input[type="checkbox"],
.mfe-choice-list input[type="radio"] {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    accent-color: var(--mfe-primary, #2271b1);
    cursor: pointer;
    margin: 0 !important;
}

.mfe-radio-list input[type="radio"] {
    accent-color: #16a34a;
}

/* Label text span */
.mfe-choice-list label span {
    flex: 1;
    pointer-events: none;
}

/* Group heading injected by dynamic taxonomy AJAX */
.mfe-choice-list strong {
    display: block;
    padding: 6px 10px 2px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
}

/* ── Ensure Select2 hidden original select is completely invisible and takes no space/border ── */
select.select2-hidden-accessible,
.mfe-input select.select2-hidden-accessible,
select.mfe-select2.select2-hidden-accessible {
    border: 0 !important;
    clip: rect(0, 0, 0, 0) !important;
    -webkit-clip-path: inset(50%) !important;
    clip-path: inset(50%) !important;
    height: 1px !important;
    overflow: hidden !important;
    padding: 0 !important;
    position: absolute !important;
    width: 1px !important;
    white-space: nowrap !important;
    margin: -1px !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    outline: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ── select / multi_select: native fallback (no Select2) ── */
.mfe-input select.mfe-select2:not(.select2-hidden-accessible) {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    width: 100%;
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--mfe-border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--mfe-text-dark);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1.41 0L6 4.58 10.59 0 12 1.41 6 7.41 0 1.41z'/%3E%3C/svg%3E") no-repeat right 10px center;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: border-color .15s, box-shadow .15s;
}

/* Multi-select native fallback */
.mfe-input select.mfe-select2[multiple]:not(.select2-hidden-accessible) {
    background-image: none !important;
    padding-right: 12px !important;
    min-height: 140px;
}

.mfe-input select.mfe-select2:not(.select2-hidden-accessible):focus {
    border-color: var(--mfe-primary);
    box-shadow: 0 0 0 2px var(--mfe-primary-soft);
    outline: none;
}

/* ── Select2 container overrides ── */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    border: 1px solid var(--mfe-border) !important;
    border-radius: 6px !important;
    min-height: 36px !important;
    font-size: 13px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: border-color .15s, box-shadow .15s;
    padding-right: 32px !important;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1.41 0L6 4.58 10.59 0 12 1.41 6 7.41 0 1.41z'/%3E%3C/svg%3E") no-repeat right 12px center !important;
}

.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237c3aed' d='M1.41 7.41L6 2.83l4.59 4.58L12 6 6 0 0 6z'/%3E%3C/svg%3E") !important;
}

.select2-container--default .select2-selection--single:focus,
.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--mfe-primary) !important;
    box-shadow: 0 0 0 2px var(--mfe-primary-soft) !important;
    outline: none;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 34px !important;
    padding-left: 12px !important;
    color: var(--mfe-text-dark);
    font-size: 13px;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder,
.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
    color: #9ca3af !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    display: none !important;
    /* Hide old clunky default arrow — replaced by SVG background */
}

/* ── Select2 clear (×) button — match size with chevron SVG icon ── */
.select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute !important;
    right: 30px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    height: auto !important;
    line-height: 1 !important;
    font-size: 11px !important;
    font-weight: 400 !important;
    color: #64748b !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    width: 14px !important;
    text-align: center !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0.7;
    transition: opacity 0.15s, color 0.15s;
}

.select2-container--default .select2-selection--single .select2-selection__clear:hover {
    opacity: 1;
    color: #dc2626 !important;
}

/* When clear button is present, shift the selection text to avoid overlap */
.select2-container--default .select2-selection--single:has(.select2-selection__clear) {
    padding-right: 48px !important;
}

.select2-container--default .select2-selection--multiple {
    padding: 3px 32px 3px 6px !important;
    min-height: 40px !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: var(--mfe-primary, #2271b1) !important;
    border: none !important;
    border-radius: 4px !important;
    color: #fff !important;
    font-size: 12px !important;
    padding: 2px 8px !important;
    margin: 3px 3px 3px 0 !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: rgba(255, 255, 255, 0.7) !important;
    margin-right: 5px !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #fff !important;
}

.select2-dropdown {
    border: 1px solid var(--mfe-border) !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    font-size: 13px;
    z-index: 99999 !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--mfe-primary, #2271b1) !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background: var(--mfe-primary-soft, #f0f6fa) !important;
    color: var(--mfe-primary, #2271b1) !important;
}

.select2-search--dropdown .select2-search__field {
    border: 1px solid var(--mfe-border) !important;
    border-radius: 4px !important;
    padding: 6px 8px !important;
    font-size: 13px !important;
}

.select2-search--dropdown .select2-search__field:focus {
    border-color: var(--mfe-primary) !important;
    outline: none !important;
}

/* ── Select2 Multi-select Custom Checkboxes ── */
.select2-results__options[aria-multiselectable="true"] .select2-results__option[aria-selected] {
    position: relative !important;
    padding-left: 36px !important;
}

.select2-results__options[aria-multiselectable="true"] .select2-results__option[aria-selected]::before {
    content: "" !important;
    position: absolute !important;
    left: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 16px !important;
    height: 16px !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 4px !important;
    background: #ffffff !important;
    transition: all 0.15s ease !important;
    box-sizing: border-box !important;
}

.select2-results__options[aria-multiselectable="true"] .select2-results__option[aria-selected="true"]::before {
    background: #6366f1 !important;
    border-color: #6366f1 !important;
}

.select2-results__options[aria-multiselectable="true"] .select2-results__option[aria-selected="true"]::after {
    content: "" !important;
    position: absolute !important;
    left: 15px !important;
    top: 50% !important;
    transform: translateY(-60%) rotate(45deg) !important;
    width: 4px !important;
    height: 8px !important;
    border: solid #ffffff !important;
    border-width: 0 2px 2px 0 !important;
    transition: all 0.15s ease !important;
    box-sizing: border-box !important;
}

/* Highlighting state hover transitions */
.select2-results__options[aria-multiselectable="true"] .select2-results__option--highlighted[aria-selected]::before {
    border-color: #94a3b8 !important;
}

.select2-results__options[aria-multiselectable="true"] .select2-results__option--highlighted[aria-selected="true"]::before {
    background: #6366f1 !important;
    border-color: #6366f1 !important;
}

.select2-results__options[aria-multiselectable="true"] .select2-results__option--highlighted[aria-selected="true"]::after {
    border-color: #ffffff !important;
}



/* ── Tab Navigation Bar & Panels ── */
.mfe-tabs-nav-wrap {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box !important;
    border-bottom: 2px solid #e2e8f0;
    margin: 0;
    padding: 0 20px;
    background: transparent;
    position: relative;
    z-index: 1;
}

.mfe-tabs-nav-wrap.mfe-tabs-top {
    margin-top: 0;
    margin-bottom: 0;
}

.mfe-tabs-nav-wrap.mfe-tabs-has-preceding-fields {
    margin-top: 16px;
    margin-bottom: 0;
}

.mfe-tabs-nav-list {
    display: flex;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none !important;
    flex-wrap: wrap;
    box-sizing: border-box;
    position: relative;
    margin-bottom: -2px; /* Pulls active button over the 2px border-bottom of .mfe-tabs-nav-wrap */
    z-index: 2;
}

.mfe-tabs-nav-list > li {
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    list-style: none !important;
    display: inline-block !important;
}

.mfe-tab-nav-btn {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-bottom: 2px solid #e2e8f0 !important;
    padding: 9px 18px !important;
    border-radius: 6px 6px 0 0 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #64748b !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: all .15s ease !important;
    outline: none !important;
    box-sizing: border-box !important;
    position: relative !important;
    z-index: 1 !important;
    line-height: 1.4 !important;
    box-shadow: none !important;
    margin: 0 !important;
}

.mfe-tab-nav-btn:hover {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    border-color: #94a3b8 #94a3b8 #e2e8f0 #94a3b8 !important;
}

.mfe-tab-nav-btn.active {
    background: #ffffff !important;
    color: #2563eb !important;
    border-color: #cbd5e1 #cbd5e1 #ffffff #cbd5e1 !important;
    border-top: 2px solid #2563eb !important;
    border-bottom: 2px solid #ffffff !important;
    position: relative !important;
    z-index: 3 !important;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.03) !important;
}

.mfe-tab-nav-btn .dashicons {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
    line-height: 16px !important;
    display: inline-block !important;
}

.mfe-tab-panels-wrap {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    position: relative;
    z-index: 1;
}

/* Individual field cells */
.mfe-post-edit-group>.mfe-condition-watcher,
.mfe-tab-panel>.mfe-condition-watcher {
    box-sizing: border-box !important;
    background: #ffffff !important;
    margin-right: -1px !important;
    margin-bottom: -1px !important;
    padding: 0 !important;
    max-width: 100% !important;
}

/* Make top-level fields block (full-width stacked) inside the watcher cells */
.mfe-post-edit-group>.mfe-condition-watcher>.mfe-field,
.mfe-tab-panel>.mfe-condition-watcher>.mfe-field {
    display: block !important;
    padding: 18px 20px !important;
    border-bottom: none !important;
    background: transparent !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    max-width: 100% !important;
}

.mfe-tab-panel {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Width utility classes for flex layouts */
.mfe-condition-watcher.mfe-width-100 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    margin-right: 0 !important;
}

.mfe-condition-watcher.mfe-width-75 {
    width: 75% !important;
    max-width: 75% !important;
}

.mfe-condition-watcher.mfe-width-66 {
    width: 66.66% !important;
    max-width: 66.66% !important;
}

.mfe-condition-watcher.mfe-width-50 {
    width: 50% !important;
    max-width: 50% !important;
}

.mfe-condition-watcher.mfe-width-33 {
    width: 33.33% !important;
    max-width: 33.33% !important;
}

.mfe-condition-watcher.mfe-width-25 {
    width: 25% !important;
    max-width: 25% !important;
}

/* Full-width label on top */
.mfe-post-edit-group>.mfe-condition-watcher>.mfe-field>label,
.mfe-post-edit-group>.mfe-condition-watcher>.mfe-field>.mfe-field-label,
.mfe-tab-panel>.mfe-condition-watcher>.mfe-field>label,
.mfe-tab-panel>.mfe-condition-watcher>.mfe-field>.mfe-field-label {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 6px 0 !important;
    padding-top: 0 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #1d2327 !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
}

/* Full-width input below */
.mfe-post-edit-group>.mfe-condition-watcher>.mfe-field>.mfe-input,
.mfe-tab-panel>.mfe-condition-watcher>.mfe-field>.mfe-input {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

/* ── 2. Sleek Inputs, Selects, Textareas & Focus States ── */
.mfe-input .select2-container {
    width: 100% !important;
    max-width: 100% !important;
}

.mfe-input input[type="text"],
.mfe-input input[type="url"],
.mfe-input input[type="email"],
.mfe-input input[type="number"],
.mfe-input input[type="password"],
.mfe-input select:not(.select2-hidden-accessible),
.mfe-input textarea {
    width: 100% !important;
    max-width: 100% !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    color: #1d2327 !important;
    background-color: #ffffff !important;
    border: 1px solid #ccd0d4 !important;
    border-radius: 4px !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    transition: all 0.15s ease-in-out !important;
    box-sizing: border-box !important;
}

.mfe-input input[type="text"]:focus,
.mfe-input input[type="url"]:focus,
.mfe-input input[type="email"]:focus,
.mfe-input input[type="number"]:focus,
.mfe-input input[type="password"]:focus,
.mfe-input select:not(.select2-hidden-accessible):focus,
.mfe-input textarea:focus {
    border-color: var(--mfe-primary) !important;
    outline: none !important;
    box-shadow: 0 0 0 2px var(--mfe-primary-soft), inset 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

/* ── 3. Premium Image Field Layout ── */
.mfe-image-wrap {
    display: inline-block !important;
}

.mfe-image-placeholder {
    width: 120px !important;
    height: 120px !important;
    border: 2px dashed #ccd0d4 !important;
    border-radius: 4px !important;
    background: #fdfdfd !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    gap: 8px !important;
    padding: 12px !important;
    box-sizing: border-box !important;
}

.mfe-image-placeholder:hover {
    border-color: var(--mfe-primary) !important;
    background: var(--mfe-primary-soft) !important;
}

.mfe-image-placeholder .dashicons {
    font-size: 32px !important;
    width: 32px !important;
    height: 32px !important;
    color: #8c8f94 !important;
}

.mfe-image-placeholder:hover .dashicons {
    color: var(--mfe-primary) !important;
}

.mfe-image-placeholder-text {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #64748b !important;
}

.mfe-image-placeholder:hover .mfe-image-placeholder-text {
    color: var(--mfe-primary) !important;
}

/* Image preview: clean constraints, nice overlay */
.mfe-image-preview {
    width: auto !important;
    max-width: 320px !important;
    height: auto !important;
    min-width: 80px !important;
    min-height: 80px !important;
    max-height: 240px !important;
    border-radius: 6px !important;
    border: 1px solid #ccd0d4 !important;
    background: #f8fafc !important;
    overflow: hidden !important;
    position: relative !important;
    display: inline-block !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    box-sizing: border-box !important;
    vertical-align: top !important;
}

.mfe-image-preview img {
    max-width: 320px !important;
    max-height: 240px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: center !important;
    display: block !important;
}

.mfe-image-actions {
    background: rgba(15, 23, 42, 0.6) !important;
}

/* ── 4. Premium Repeater & Group Hierarchy ── */
.mfe-repeater {
    background: #ffffff !important;
    border: 1px solid #ccd0d4 !important;
    border-radius: 4px !important;
    box-shadow: none !important;
}

.mfe-repeater-header {
    background: #fdfdfd !important;
    border-bottom: 1px solid #ccd0d4 !important;
    padding: 10px 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.mfe-repeater-row {
    border: 1px solid #ccd0d4 !important;
    background: #ffffff !important;
    border-radius: 4px !important;
    margin-bottom: 10px !important;
    box-shadow: none !important;
    transition: border-color 0.2s !important;
}

.mfe-repeater-row:hover {
    border-color: #8c8f94 !important;
}

/* Active/expanded left indicator accent */
.mfe-repeater-row:not(.mfe-row-collapsed) {
    border-left: 3px solid var(--mfe-primary) !important;
}

.mfe-repeater-row-handle {
    background: #fdfdfd !important;
    min-height: 40px !important;
    padding: 8px 14px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    border-radius: 4px 4px 0 0 !important;
}

.mfe-repeater-row.mfe-row-collapsed .mfe-repeater-row-handle {
    border-bottom: none !important;
    border-radius: 4px !important;
}

/* Drag handle styling */
.mfe-row-drag-handle {
    opacity: 0.4 !important;
    background-image: radial-gradient(circle, #64748b 1.5px, transparent 1.5px) !important;
    background-size: 6px 6px !important;
}

.mfe-repeater-row-handle:hover .mfe-row-drag-handle {
    opacity: 0.8 !important;
}

/* Index Pill Badge */
.mfe-row-index {
    background: var(--mfe-primary-soft) !important;
    color: var(--mfe-primary) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 2px 8px !important;
    border-radius: 9999px !important;
    min-width: unset !important;
    height: unset !important;
}

/* Accent for Layout Names in titles */
.mfe-row-title-text {
    font-weight: 600 !important;
    color: #1d2327 !important;
}

/* ── 5. Premium Add Row Button ── */
.mfe-add-row-wrap {
    padding: 12px 16px !important;
}

.mfe-add-row-btn,
button.mfe-add-row {
    background: var(--mfe-primary) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 8px 16px !important;
    cursor: pointer !important;
    box-shadow: 0 1px 2px rgba(34, 113, 177, 0.2) !important;
    transition: all 0.2s ease !important;
}

.mfe-add-row-btn:hover,
button.mfe-add-row:hover {
    background: #000000 !important;
    box-shadow: 0 4px 10px rgba(34, 113, 177, 0.3) !important;
    color: #fff !important;
}

/* ── 6. Premium Relationship Field Styles ── */
.mfe-relationship-container {
    max-width: 100% !important;
    border: 1px solid #ccd0d4 !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    background: #ffffff !important;
}

.mfe-relationship-col {
    background: transparent !important;
}

.mfe-relationship-search {
    height: 34px !important;
    border: 1px solid #ccd0d4 !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    padding: 6px 12px !important;
}

.mfe-relationship-list {
    border: 1px solid #ccd0d4 !important;
    border-radius: 4px !important;
    background: #fdfdfd !important;
}

.mfe-relationship-item,
.mfe-relationship-item-selected {
    padding: 8px 12px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    font-size: 13px !important;
    color: #1d2327 !important;
    transition: background 0.15s ease !important;
}

.mfe-relationship-item:hover {
    background: var(--mfe-primary-soft) !important;
    color: var(--mfe-primary) !important;
}

.mfe-relationship-item.is-selected {
    opacity: 0.5 !important;
    background: #f1f5f9 !important;
    cursor: default !important;
}

.mfe-relationship-item-selected {
    background: #ffffff !important;
    border-left: 2px solid var(--mfe-primary) !important;
}

.mfe-relationship-item-selected:hover {
    background: #fdfdfd !important;
}

/* ── 7. Complex Fields: Full-width label stack (repeater/group/wysiwyg/relationship) ── */
/* These fields need label on top, input below — not side-by-side */
.mfe-post-edit-group>.mfe-condition-watcher>.mfe-field.mfe-field-repeater,
.mfe-post-edit-group>.mfe-condition-watcher>.mfe-field.mfe-field-group,
.mfe-tab-panel>.mfe-condition-watcher>.mfe-field.mfe-field-repeater,
.mfe-tab-panel>.mfe-condition-watcher>.mfe-field.mfe-field-group {
    flex-direction: column !important;
    gap: 8px !important;
}

.mfe-post-edit-group>.mfe-condition-watcher>.mfe-field.mfe-field-repeater>label,
.mfe-post-edit-group>.mfe-condition-watcher>.mfe-field.mfe-field-repeater>.mfe-field-label,
.mfe-post-edit-group>.mfe-condition-watcher>.mfe-field.mfe-field-group>label,
.mfe-post-edit-group>.mfe-condition-watcher>.mfe-field.mfe-field-group>.mfe-field-label,
.mfe-tab-panel>.mfe-condition-watcher>.mfe-field.mfe-field-repeater>label,
.mfe-tab-panel>.mfe-condition-watcher>.mfe-field.mfe-field-repeater>.mfe-field-label,
.mfe-tab-panel>.mfe-condition-watcher>.mfe-field.mfe-field-group>label,
.mfe-tab-panel>.mfe-condition-watcher>.mfe-field.mfe-field-group>.mfe-field-label {
    width: 100% !important;
    max-width: 100% !important;
    padding-top: 0 !important;
    font-size: 13px !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    color: #1d2327 !important;
}

.mfe-post-edit-group>.mfe-condition-watcher>.mfe-field.mfe-field-repeater>.mfe-input,
.mfe-post-edit-group>.mfe-condition-watcher>.mfe-field.mfe-field-group>.mfe-input,
.mfe-tab-panel>.mfe-condition-watcher>.mfe-field.mfe-field-repeater>.mfe-input,
.mfe-tab-panel>.mfe-condition-watcher>.mfe-field.mfe-field-group>.mfe-input {
    width: 100% !important;
}

/* ── 8. Block layout repeater: fields grid fix ── */
/* Inside a block-layout repeater row, use flex layout with width classes */
.mfe-repeater.mfe-layout-block .mfe-repeater-row-fields,
.mfe-group.mfe-layout-block .mfe-group-block-fields {
    display: flex !important;
    flex-wrap: wrap !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin-right: -1px !important;
    margin-bottom: -1px !important;
}

/* Individual field cells inside block repeater/group rows */
.mfe-repeater.mfe-layout-block .mfe-repeater-row-fields>.mfe-condition-watcher,
.mfe-group.mfe-layout-block .mfe-group-block-fields>.mfe-condition-watcher {
    box-sizing: border-box !important;
    background: #ffffff !important;
    margin-right: 0px !important;
    margin-bottom: 16px !important;
    padding: 0 4px !important;
}

.mfe-repeater.mfe-layout-block .mfe-repeater-row-fields>.mfe-condition-watcher:last-child,
.mfe-group.mfe-layout-block .mfe-group-block-fields>.mfe-condition-watcher:last-child {
    margin-bottom: 0 !important;
}

/* Fallback for cells without explicit width setting to default to 100% width */
.mfe-repeater.mfe-layout-block .mfe-repeater-row-fields>.mfe-condition-watcher:not([class*="mfe-width-"]),
.mfe-group.mfe-layout-block .mfe-group-block-fields>.mfe-condition-watcher:not([class*="mfe-width-"]) {
    width: 100% !important;
}

/* Apply the width percentage rules directly to watcher children */
.mfe-repeater.mfe-layout-block .mfe-repeater-row-fields>.mfe-condition-watcher.mfe-width-100,
.mfe-group.mfe-layout-block .mfe-group-block-fields>.mfe-condition-watcher.mfe-width-100 {
    width: 100% !important;
}

.mfe-repeater.mfe-layout-block .mfe-repeater-row-fields>.mfe-condition-watcher.mfe-width-75,
.mfe-group.mfe-layout-block .mfe-group-block-fields>.mfe-condition-watcher.mfe-width-75 {
    width: 75% !important;
}

.mfe-repeater.mfe-layout-block .mfe-repeater-row-fields>.mfe-condition-watcher.mfe-width-66,
.mfe-group.mfe-layout-block .mfe-group-block-fields>.mfe-condition-watcher.mfe-width-66 {
    width: 66.66% !important;
}

.mfe-repeater.mfe-layout-block .mfe-repeater-row-fields>.mfe-condition-watcher.mfe-width-50,
.mfe-group.mfe-layout-block .mfe-group-block-fields>.mfe-condition-watcher.mfe-width-50 {
    width: 50% !important;
}

.mfe-repeater.mfe-layout-block .mfe-repeater-row-fields>.mfe-condition-watcher.mfe-width-33,
.mfe-group.mfe-layout-block .mfe-group-block-fields>.mfe-condition-watcher.mfe-width-33 {
    width: 33.33% !important;
}

.mfe-repeater.mfe-layout-block .mfe-repeater-row-fields>.mfe-condition-watcher.mfe-width-25,
.mfe-group.mfe-layout-block .mfe-group-block-fields>.mfe-condition-watcher.mfe-width-25 {
    width: 25% !important;
}

/* Each field inside repeater row */
.mfe-repeater.mfe-layout-block .mfe-repeater-row-fields .mfe-field,
.mfe-group.mfe-layout-block .mfe-group-block-fields .mfe-field {
    border-bottom: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ── 9. Repeater row handle flex alignment fix ── */
.mfe-repeater-row-handle {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
}

/* Row title fills remaining space */
.mfe-row-title {
    flex: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

.mfe-row-title-text {
    display: block !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Row actions always on right */
.mfe-row-actions {
    margin-left: auto !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
}

/* ── 10. Table layout header drag column match ── */
.mfe-layout-table .mfe-repeater-header .mfe-table-col-drag {
    width: 38px !important;
    min-width: 38px !important;
    flex-shrink: 0 !important;
}

/* ── 11. Remove-row / toggle button icon sizes ── */
.mfe-remove-row .dashicons,
.mfe-row-toggle .dashicons {
    font-size: 15px !important;
    width: 15px !important;
    height: 15px !important;
}

/* ── 12. Metabox section header: hidden ── */
.mfe-post-edit-group h3 {
    display: none !important;
}

/* ── 13. Image field: ensure actions show always inside repeater cells ── */
.mfe-repeater .mfe-image-actions {
    opacity: 1 !important;
    justify-content: flex-end !important;
    align-items: flex-start !important;
    padding: 4px !important;
}

/* ── 14. True/False toggle styling ── */
.mfe-truefalse-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.mfe-truefalse-wrap input[type="checkbox"] {
    width: 36px !important;
    height: 20px !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    background: #cbd5e1 !important;
    border-radius: 9999px !important;
    cursor: pointer !important;
    position: relative !important;
    transition: background 0.2s !important;
    flex-shrink: 0 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.mfe-truefalse-wrap input[type="checkbox"]::after {
    content: '' !important;
    position: absolute !important;
    width: 16px !important;
    height: 16px !important;
    background: #fff !important;
    border-radius: 50% !important;
    top: 2px !important;
    left: 2px !important;
    transition: transform 0.2s !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
}

.mfe-truefalse-wrap input[type="checkbox"]:checked {
    background: var(--mfe-primary) !important;
}

.mfe-truefalse-wrap input[type="checkbox"]:checked::after {
    transform: translateX(16px) !important;
}

/* ── 15. File field styling ── */
.mfe-file-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
}

.mfe-file-wrap.is-empty .mfe-file-preview,
.mfe-file-wrap.is-empty .mfe-remove-media,
.mfe-file-preview.mfe-hidden,
.mfe-remove-media.mfe-hidden,
.mfe-select-media.mfe-hidden {
    display: none !important;
}

.mfe-file-wrap.has-file .mfe-select-media {
    display: none !important;
}

.mfe-file-preview {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 6px 14px !important;
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    color: #1e293b !important;
    max-width: 480px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

.mfe-file-preview .mfe-file-icon {
    font-size: 18px !important;
    width: 18px !important;
    height: 18px !important;
    line-height: 18px !important;
    color: #64748b !important;
    flex-shrink: 0 !important;
}

.mfe-file-preview a.mfe-filename {
    color: #2563eb !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 400px !important;
}

.mfe-file-preview a.mfe-filename:hover {
    text-decoration: underline !important;
    color: #1d4ed8 !important;
}

.mfe-file-wrap .mfe-select-media,
.mfe-file-wrap .mfe-remove-media {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    height: 34px !important;
    line-height: 32px !important;
    padding: 0 14px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    transition: all 0.15s ease !important;
}

.mfe-file-wrap .mfe-select-media {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.mfe-file-wrap .mfe-select-media:hover {
    background: #f8fafc !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

.mfe-file-wrap .mfe-remove-media {
    background: #fff1f2 !important;
    border: 1px solid #fecdd3 !important;
    color: #e11d48 !important;
}

.mfe-file-wrap .mfe-remove-media:hover {
    background: #ffe4e6 !important;
    border-color: #fda4af !important;
    color: #be123c !important;
}

.mfe-file-wrap .mfe-select-media .dashicons,
.mfe-file-wrap .mfe-remove-media .dashicons {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
    line-height: 16px !important;
    margin: 0 !important;
}

/* ── 16. Link field button styling ── */
.mfe-link-display .button {
    border-radius: 4px !important;
    font-size: 12px !important;
    height: 30px !important;
    line-height: 28px !important;
    padding: 0 12px !important;
}

/* Link Field Preview overrides */
.mfe-link-preview {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    background: #ffffff !important;
    border: 1px solid #ccd0d4 !important;
    border-radius: 4px !important;
    padding: 6px 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.mfe-link-preview .dashicons-admin-links {
    color: #8c8f94 !important;
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
}

.mfe-link-label {
    font-weight: 600 !important;
    color: #1d2327 !important;
    font-size: 13px !important;
}

.mfe-link-url-text {
    color: var(--mfe-primary) !important;
    text-decoration: underline !important;
    font-size: 12px !important;
    margin-right: auto !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 300px !important;
}

.mfe-link-actions {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
}

.mfe-link-actions button {
    background: transparent !important;
    border: none !important;
    padding: 2px !important;
    cursor: pointer !important;
    border-radius: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #8c8f94 !important;
    transition: all 0.15s ease-in-out !important;
}

.mfe-link-actions button:hover {
    background: #f0f0f1 !important;
}

.mfe-link-actions button.mfe-link-select-btn:hover {
    color: var(--mfe-primary) !important;
}

.mfe-link-actions button.mfe-link-remove-btn:hover {
    color: #d63638 !important;
}

.mfe-link-actions button .dashicons {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
}

/* ── 17. oEmbed field ── */
.mfe-oembed-wrap {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

.mfe-oembed-preview {
    border-radius: 4px !important;
    overflow: hidden !important;
    background: #f1f5f9 !important;
    border: 1px solid #ccd0d4 !important;
}

/* ── 18. Date/time field ── */
.mfe-input input[type="datetime-local"],
.mfe-input input[type="date"],
.mfe-input input[type="time"] {
    width: 100% !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    color: #1d2327 !important;
    background: #ffffff !important;
    border: 1px solid #ccd0d4 !important;
    border-radius: 4px !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    transition: all 0.15s !important;
    box-sizing: border-box !important;
}

.mfe-input input[type="datetime-local"]:focus,
.mfe-input input[type="date"]:focus,
.mfe-input input[type="time"]:focus {
    border-color: var(--mfe-primary) !important;
    outline: none !important;
    box-shadow: 0 0 0 2px var(--mfe-primary-soft) !important;
}

/* ── 19. Color picker ── */
.wp-picker-container .wp-color-result {
    border-radius: 4px !important;
    border: 1px solid #ccd0d4 !important;
}

/* ── 20. Scrollbar polish on all mfe scrollable lists ── */
.mfe-relationship-available-list::-webkit-scrollbar,
.mfe-relationship-selected-list::-webkit-scrollbar {
    width: 4px !important;
}

.mfe-relationship-available-list::-webkit-scrollbar-thumb,
.mfe-relationship-selected-list::-webkit-scrollbar-thumb {
    background: #cbd5e1 !important;
    border-radius: 4px !important;
}

/* ── 21. True/False Toggle Switch ── */
.mfe-toggle-switch {
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    cursor: pointer !important;
    user-select: none !important;
}

/* Hide the native checkbox */
.mfe-toggle-checkbox {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    box-shadow: none !important;
}

/* The pill track */
.mfe-toggle-track {
    position: relative !important;
    display: inline-block !important;
    width: 40px !important;
    height: 22px !important;
    background: #cbd5e1 !important;
    border-radius: 9999px !important;
    transition: background 0.2s ease !important;
    flex-shrink: 0 !important;
}

/* The thumb dot */
.mfe-toggle-thumb {
    position: absolute !important;
    top: 3px !important;
    left: 3px !important;
    width: 16px !important;
    height: 16px !important;
    background: #ffffff !important;
    border-radius: 50% !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
    transition: transform 0.2s ease !important;
}

/* Checked state: track turns indigo, thumb slides right */
.mfe-toggle-checkbox:checked+.mfe-toggle-track {
    background: var(--mfe-primary) !important;
}

.mfe-toggle-checkbox:checked+.mfe-toggle-track .mfe-toggle-thumb {
    transform: translateX(18px) !important;
}

/* Label text */
.mfe-toggle-label {
    font-size: 13px !important;
    color: #475569 !important;
    font-weight: 500 !important;
}

.mfe-toggle-switch:hover .mfe-toggle-track {
    box-shadow: 0 0 0 2px var(--mfe-primary-soft) !important;
}

/* Bulletproof Chevron Rotations (supports both arrow-up and arrow-down classes) */
.mfe-repeater-row.mfe-row-collapsed .mfe-row-toggle-icon.dashicons-arrow-up-alt2 {
    transform: rotate(180deg) !important;
}

.mfe-repeater-row:not(.mfe-row-collapsed) .mfe-row-toggle-icon.dashicons-arrow-up-alt2 {
    transform: none !important;
}

.mfe-repeater-row.mfe-row-collapsed .mfe-row-toggle-icon.dashicons-arrow-down-alt2 {
    transform: none !important;
}

.mfe-repeater-row:not(.mfe-row-collapsed) .mfe-row-toggle-icon.dashicons-arrow-down-alt2 {
    transform: rotate(180deg) !important;
}

/* ── 22. Group wrapper layout-row and layout-table fixes ── */
.mfe-group-wrap {
    border: 0px solid #ccd0d4 !important;
    border-radius: 4px !important;
    overflow: visible !important;
}

/* ── 23. Row layout fixes for cells inside repeaters and groups ── */
.mfe-layout-row .mfe-row-cell-field,
.mfe-layout-row .mfe-table-cell-field {
    flex: 1 !important;
    min-width: 180px !important;
    box-sizing: border-box !important;
    padding: 8px 12px !important;
    border-right: none !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
}

/* ── 24. Table Layout Precision Override ── */
.mfe-layout-table .mfe-table-header {
    display: flex !important;
    background: #f9fafb !important;
    border: 1px solid #ccd0d4 !important;
    border-bottom: none !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    color: #1d2327 !important;
    border-radius: 4px 4px 0 0 !important;
    align-items: stretch !important;
}

.mfe-layout-table .mfe-table-col {
    flex: 1 !important;
    padding: 10px 15px !important;
    border-right: 1px solid #ccd0d4 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    font-weight: 600 !important;
    color: #1d2327 !important;
}

.mfe-layout-table .mfe-table-col:last-of-type {
    border-right: none !important;
}

.mfe-layout-table .mfe-table-col-drag {
    width: 38px !important;
    min-width: 38px !important;
    flex-shrink: 0 !important;
    border-right: 1px solid #ccd0d4 !important;
    background: #f9fafb !important;
}

.mfe-layout-table .mfe-table-col-remove,
.mfe-layout-table .mfe-table-col-actions {
    width: 42px !important;
    min-width: 42px !important;
    flex-shrink: 0 !important;
    border-left: 1px solid #ccd0d4 !important;
    background: #f9fafb !important;
}

.mfe-layout-table .mfe-repeater-rows {
    border: 1px solid #ccd0d4 !important;
    border-radius: 0 0 4px 4px !important;
    background: #ffffff !important;
    overflow: hidden !important;
    margin-top: -1px !important;
}

.mfe-repeater-table-row {
    display: flex !important;
    align-items: stretch !important;
    padding: 0 !important;
    background: #ffffff !important;
    border-bottom: 1px solid #ccd0d4 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.mfe-repeater-table-row:last-child {
    border-bottom: none !important;
}

.mfe-table-cell-drag {
    width: 38px !important;
    min-width: 38px !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #f9fafb !important;
    border-right: 1px solid #ccd0d4 !important;
    cursor: move !important;
    box-sizing: border-box !important;
}

.mfe-table-cell-remove {
    width: 42px !important;
    min-width: 42px !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #ffffff !important;
    border-left: 1px solid #ccd0d4 !important;
    box-sizing: border-box !important;
}

.mfe-table-cell-field {
    flex: 1 !important;
    padding: 10px 15px !important;
    border-right: 1px solid #ccd0d4 !important;
    box-sizing: border-box !important;
    min-height: 48px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}

.mfe-table-cell-field:last-child {
    border-right: none !important;
}

/* ── 25. Universal Left Alignment Fix ── */
.mfe-field,
.mfe-field-label,
.mfe-field>label,
.mfe-input,
.mfe-input input,
.mfe-input textarea,
.mfe-input select:not(.select2-hidden-accessible),
.mfe-input .select2-container {
    margin-left: 0 !important;
    box-sizing: border-box !important;
    text-align: left !important;
}

.mfe-input {
    width: 100% !important;
    display: block !important;
    padding-left: 0 !important;
}

.mfe-input .select2-container--default {
    width: 100% !important;
    display: block !important;
}

/* ── 26. Modern Enhanced Multiselect UI (Matching Reference Design) ── */
.select2-container--default .select2-selection--multiple {
    background-color: #ffffff !important;
    border: 1px solid #d1d5db !important;
    border-radius: 8px !important;
    min-height: 42px !important;
    padding: 4px 32px 4px 8px !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
}

.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2) !important;
    outline: none !important;
}

/* Selected Pill Badges */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    padding: 4px 10px 4px 24px !important;
    margin: 3px 6px 3px 0 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #1e293b !important;
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #64748b !important;
    border-right: none !important;
    position: absolute !important;
    left: 6px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 14px !important;
    line-height: 1 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    cursor: pointer !important;
    transition: color 0.15s !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #ef4444 !important;
    background: transparent !important;
}

/* Dropdown Popup Window */
.select2-dropdown {
    border: 1px solid #cbd5e1 !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05) !important;
    overflow: hidden !important;
    padding: 6px !important;
    background: #ffffff !important;
    z-index: 999999 !important;
}

/* Option Items inside Multiselect Dropdown */
.select2-results__option {
    padding: 8px 12px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    color: #334155 !important;
    margin-bottom: 2px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    transition: background 0.15s, color 0.15s !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: #eef2ff !important;
    color: #4338ca !important;
    font-weight: 500 !important;
}

/* Multi-select inline search input reset (completely eliminates nested text input box artifact) */
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.select2-container--default .select2-selection--multiple .select2-search--inline {
    display: inline-flex !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field,
.select2-container--default .select2-selection--multiple input.select2-search__field,
.mfe-input .select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field,
.mfe-input .select2-container--default .select2-selection--multiple input.select2-search__field,
.mfe-wrap .select2-container--default .select2-selection--multiple input.select2-search__field,
#wpbody-content .select2-container--default .select2-selection--multiple input.select2-search__field,
.select2-search--inline input.select2-search__field {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 4px !important;
    margin: 2px 0 !important;
    min-height: 28px !important;
    height: 28px !important;
    line-height: 28px !important;
    font-size: 13px !important;
    font-family: inherit !important;
    color: #1e293b !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    box-sizing: border-box !important;
}

.select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field:focus,
.select2-container--default .select2-selection--multiple input.select2-search__field:focus,
.mfe-input .select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field:focus,
.mfe-input .select2-container--default .select2-selection--multiple input.select2-search__field:focus,
.mfe-wrap .select2-container--default .select2-selection--multiple input.select2-search__field:focus,
#wpbody-content .select2-container--default .select2-selection--multiple input.select2-search__field:focus,
.select2-search--inline input.select2-search__field:focus {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
}

.select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field::placeholder,
.select2-container--default .select2-selection--multiple input.select2-search__field::placeholder,
.mfe-input .select2-container--default .select2-selection--multiple input.select2-search__field::placeholder,
.mfe-wrap .select2-container--default .select2-selection--multiple input.select2-search__field::placeholder,
#wpbody-content .select2-container--default .select2-selection--multiple input.select2-search__field::placeholder,
.select2-search--inline input.select2-search__field::placeholder {
    color: #94a3b8 !important;
    opacity: 1 !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    line-height: 28px !important;
}

/* ── 27. Modern Premium Repeater Field UI ── */
.mfe-repeater {
    width: 100% !important;
    box-sizing: border-box !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    overflow: visible !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    margin-top: 6px !important;
    margin-bottom: 6px !important;
}

/* Table Header */
.mfe-repeater-header.mfe-table-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    background: #f8fafc !important;
    border-bottom: 1px solid #cbd5e1 !important;
    padding: 0 !important;
    min-height: 40px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.6px !important;
    color: #475569 !important;
    box-sizing: border-box !important;
}

.mfe-table-header .mfe-table-col-drag {
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    flex: 0 0 50px !important;
    border-right: 1px solid #e2e8f0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    box-sizing: border-box !important;
}

.mfe-table-header .mfe-table-col {
    flex: 1 1 0px !important;
    min-width: 0 !important;
    padding: 10px 14px !important;
    border-right: 1px solid #e2e8f0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    text-align: left !important;
}

.mfe-table-header .mfe-table-col:last-of-type {
    border-right: 1px solid #e2e8f0 !important;
}

.mfe-table-header .mfe-table-col-actions {
    width: 72px !important;
    min-width: 72px !important;
    max-width: 72px !important;
    flex: 0 0 72px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    box-sizing: border-box !important;
    padding: 0 4px !important;
}

.mfe-table-header .mfe-action-btn {
    width: 26px !important;
    height: 26px !important;
    border-radius: 4px !important;
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    color: #64748b !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    padding: 0 !important;
    transition: all 0.15s ease !important;
}

.mfe-table-header .mfe-action-btn:hover {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    border-color: #94a3b8 !important;
}

/* Table Rows Container */
.mfe-repeater-rows {
    width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
}

.mfe-repeater-row.mfe-repeater-table-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    border-bottom: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    transition: background 0.15s ease !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    min-height: 52px !important;
    box-sizing: border-box !important;
}

.mfe-repeater-row.mfe-repeater-table-row:last-child {
    border-bottom: none !important;
}

.mfe-repeater-row.mfe-repeater-table-row:hover {
    background: #f8fafc !important;
}

/* Drag & Index Cell */
.mfe-repeater-table-row .mfe-table-cell-drag {
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    flex: 0 0 50px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    background: #f8fafc !important;
    border-right: 1px solid #e2e8f0 !important;
    box-sizing: border-box !important;
    padding: 6px 0 !important;
    cursor: grab !important;
}

.mfe-repeater-table-row .mfe-row-drag-handle {
    cursor: grab !important;
    color: #94a3b8 !important;
    display: inline-block !important;
    width: 14px !important;
    height: 16px !important;
    margin: 0 !important;
}

.mfe-repeater-table-row .mfe-row-index {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 18px !important;
    height: 18px !important;
    background: #e2e8f0 !important;
    color: #475569 !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    border-radius: 9px !important;
    padding: 0 4px !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
}

/* Row Fields Wrapper & Grid */
.mfe-repeater-table-row .mfe-repeater-row-fields-wrapper {
    flex: 1 1 0px !important;
    min-width: 0 !important;
    width: 100% !important;
    display: flex !important;
}

.mfe-repeater-table-row .mfe-repeater-row-fields {
    display: flex !important;
    flex-direction: row !important;
    flex: 1 1 0px !important;
    width: 100% !important;
    min-width: 0 !important;
}

.mfe-repeater-table-row .mfe-table-cell-field {
    flex: 1 1 0px !important;
    min-width: 0 !important;
    padding: 10px 14px !important;
    border-right: 1px solid #e2e8f0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    position: relative !important;
}

.mfe-repeater-table-row .mfe-table-cell-field:last-child {
    border-right: 1px solid #e2e8f0 !important;
}

.mfe-repeater-table-row .mfe-table-cell-field .mfe-condition-watcher {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.mfe-repeater-table-row .mfe-table-cell-field .mfe-field {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* Hide labels in table cells since column header already shows label */
.mfe-repeater-table-row .mfe-table-cell-field .mfe-field>label,
.mfe-repeater-table-row .mfe-table-cell-field .mfe-field-label,
.mfe-layout-table .mfe-table-cell-field .mfe-field>label,
.mfe-layout-table .mfe-table-cell-field .mfe-field-label {
    display: none !important;
}

.mfe-repeater-table-row .mfe-table-cell-field .mfe-input {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.mfe-repeater-table-row .mfe-table-cell-field input[type="text"],
.mfe-repeater-table-row .mfe-table-cell-field input[type="url"],
.mfe-repeater-table-row .mfe-table-cell-field input[type="email"],
.mfe-repeater-table-row .mfe-table-cell-field input[type="number"],
.mfe-repeater-table-row .mfe-table-cell-field select {
    width: 100% !important;
    max-width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    line-height: 36px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    padding: 0 12px !important;
    font-size: 13px !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    color: #1e293b !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.mfe-repeater-table-row .mfe-table-cell-field input:focus,
.mfe-repeater-table-row .mfe-table-cell-field select:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15) !important;
    outline: none !important;
}

/* Icon picker inside table cell */
.mfe-repeater-table-row .mfe-table-cell-field .mfe-icon-picker-control {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
}

.mfe-repeater-table-row .mfe-table-cell-field .mfe-icon-preview {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    background: #f8fafc !important;
    box-sizing: border-box !important;
}

.mfe-repeater-table-row .mfe-table-cell-field .mfe-icon-input {
    flex: 1 1 0px !important;
    min-width: 80px !important;
}

.mfe-repeater-table-row .mfe-table-cell-field .mfe-icon-quick-select {
    flex: 1 1 0px !important;
    min-width: 110px !important;
    max-width: 180px !important;
}

/* Remove / Action Cell */
.mfe-repeater-table-row .mfe-table-cell-remove {
    width: 72px !important;
    min-width: 72px !important;
    max-width: 72px !important;
    flex: 0 0 72px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #f8fafc !important;
    box-sizing: border-box !important;
    padding: 0 4px !important;
}

.mfe-repeater-table-row .mfe-row-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
}

.mfe-repeater-table-row .mfe-action-btn {
    width: 28px !important;
    height: 28px !important;
    border-radius: 6px !important;
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    color: #64748b !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    padding: 0 !important;
}

.mfe-repeater-table-row .mfe-action-btn .dashicons {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
    line-height: 16px !important;
}

.mfe-repeater-table-row .mfe-action-btn:hover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

.mfe-repeater-table-row .mfe-action-btn.mfe-remove-row:hover {
    background: #fef2f2 !important;
    border-color: #fca5a5 !important;
    color: #ef4444 !important;
}

.mfe-repeater-table-row .mfe-action-btn.mfe-row-toggle:hover {
    background: #eef2ff !important;
    border-color: #c7d2fe !important;
    color: #6366f1 !important;
}

/* Empty message when 0 rows */
.mfe-repeater-empty-message {
    padding: 18px 16px !important;
    text-align: center !important;
    color: #64748b !important;
    font-size: 13px !important;
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
    display: flex;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    box-sizing: border-box !important;
}

.mfe-repeater-empty-message.mfe-hidden,
.mfe-repeater-empty-message[style*="display:none"],
.mfe-repeater-empty-message[style*="display: none"],
.mfe-repeater:has(.mfe-repeater-rows > .mfe-repeater-row:not(.mfe-repeater-template)) .mfe-repeater-empty-message {
    display: none !important;
}

.mfe-field-repeater .mfe-repeater,
.mfe-field-group .mfe-group {
    margin-top: 0 !important;
}

.mfe-repeater-empty-message .dashicons {
    color: #94a3b8 !important;
    font-size: 18px !important;
    width: 18px !important;
    height: 18px !important;
}

/* Add Row Button Bar */
.mfe-add-row-wrap {
    padding: 12px 16px !important;
    background: #f8fafc !important;
    border-top: none !important;
    display: flex !important;
    justify-content: flex-start !important;
    box-sizing: border-box !important;
}

.mfe-add-row-btn {
    background: #2563eb !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 9px 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    cursor: pointer !important;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25) !important;
    transition: all 0.15s ease !important;
}

.mfe-add-row-btn:hover {
    background: #1d4ed8 !important;
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.4) !important;
    color: #ffffff !important;
}

/* Block Layout Repeater Enhancements */
.mfe-repeater.mfe-layout-block .mfe-repeater-row {
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    margin: 10px !important;
    overflow: hidden !important;
    background: #ffffff !important;
}

.mfe-repeater.mfe-layout-block .mfe-repeater-row-handle {
    background: #f8fafc !important;
    padding: 10px 14px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.mfe-repeater.mfe-layout-block .mfe-repeater-row-fields-wrapper {
    padding: 16px !important;
}

/* ============================================================
   MetaForge Engine — Component Styles for Field Renderers
   ============================================================ */

/* Condition Watcher Initial Hidden State */
.mfe-condition-hidden {
    display: none;
}

/* Accordion Field */
.mfe-accordion-field-divider {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px 14px;
    margin: 16px 0 10px;
}

.mfe-accordion-header {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mfe-accordion-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mfe-accordion-badge {
    font-size: 11px;
    background: #e2e8f0;
    color: #475569;
    padding: 2px 8px;
    border-radius: 12px;
}

/* Tab Field Divider */
.mfe-tab-header {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #1e40af;
    display: flex;
    align-items: center;
}

.mfe-tab-header .dashicons {
    margin-right: 6px;
    font-size: 16px;
}

/* Button Field */
.mfe-button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.mfe-sub-label {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.mfe-select-full {
    width: 100% !important;
}

/* Checkbox & Radio Labels */
.mfe-choice-horizontal {
    display: inline-flex !important;
    margin-right: 15px !important;
    align-items: center !important;
}

.mfe-choice-vertical {
    display: flex !important;
    margin-bottom: 6px !important;
    align-items: center !important;
}

/* Code Editor */
.mfe-code-lang-badge {
    font-size: 11px;
    color: #64748b;
    font-weight: 400;
}

/* Color Picker */
.mfe-color-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 4px 8px;
}

.mfe-color-picker {
    width: 36px;
    height: 36px;
    border: none;
    padding: 0;
    background: none;
    cursor: pointer;
}

.mfe-color-text {
    width: 100px;
    font-family: monospace;
}

/* File Field */
.mfe-file-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Flexible Content Field */
.mfe-fc-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.mfe-fc-controls {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mfe-fc-add-label {
    font-weight: 600;
    font-size: 12px;
    color: #475569;
}

.mfe-fc-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.mfe-fc-add-btn .dashicons {
    font-size: 14px;
    line-height: normal;
    width: 14px;
    height: 14px;
}

.mfe-fc-empty-note {
    font-size: 12px;
    color: #94a3b8;
    font-style: italic;
}

.mfe-fc-row {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    overflow: hidden;
}

.mfe-fc-row-header {
    background: #f1f5f9;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}

.mfe-fc-row-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mfe-fc-drag-icon {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #94a3b8;
}

.mfe-fc-row-title {
    font-size: 13px;
    color: #334155;
}

.mfe-fc-row-slug {
    font-size: 11px;
    color: #94a3b8;
    font-family: monospace;
}

.mfe-fc-remove-row {
    color: #ef4444;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.mfe-fc-row-body {
    padding: 12px;
}

/* Gallery Field */
.mfe-gallery-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.mfe-gallery-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #cbd5e1;
}

.mfe-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mfe-gallery-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 14px;
    line-height: 1;
}

.mfe-gallery-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mfe-gallery-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.mfe-gallery-add-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.mfe-gallery-clear-btn {
    display: inline-flex;
    align-items: center;
}

/* Icon Picker */
.mfe-icon-picker-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mfe-icon-preview {
    width: 42px;
    height: 42px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #334155;
}

.mfe-icon-quick-select {
    max-width: 200px;
}

/* oEmbed */
.mfe-oembed-error {
    color: #ef4444;
    font-size: 12px;
}

.mfe-oembed-preview {
    margin-top: 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px;
}

.mfe-oembed-preview iframe {
    max-width: 100% !important;
}

/* Range Field */
.mfe-range-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}

.mfe-range-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    color: #334155;
    min-width: 32px;
    text-align: center;
}

/* Flexible Content Field */
.mfe-fc-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.mfe-fc-controls {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    padding: 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.mfe-fc-controls-label {
    font-weight: 600;
    font-size: 12px;
    color: #475569;
}

.mfe-fc-controls-empty {
    font-size: 12px;
    color: #94a3b8;
    font-style: italic;
}

.mfe-fc-add-layout-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.mfe-fc-add-layout-btn .dashicons {
    font-size: 14px;
    line-height: normal;
    width: 14px;
    height: 14px;
}

.mfe-fc-row {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}

.mfe-fc-row-header {
    background: #f1f5f9;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    cursor: grab;
}

.mfe-fc-row-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mfe-fc-row-title-wrap .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #94a3b8;
    flex-shrink: 0;
}

.mfe-fc-row-title-wrap strong {
    font-size: 13px;
    color: #334155;
}

.mfe-fc-row-title-wrap .mfe-fc-layout-slug {
    font-size: 11px;
    color: #94a3b8;
    font-family: monospace;
}

.mfe-fc-remove-row {
    color: #ef4444;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.mfe-fc-remove-row .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.mfe-fc-row-body {
    padding: 12px;
}

.mfe-fc-empty-notice {
    color: #94a3b8;
    font-size: 12px;
    margin: 0;
    font-style: italic;
}

/* Relationship Field */
.mfe-relationship-container {
    display: flex;
    gap: 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
    max-width: 680px;
    box-sizing: border-box;
}

.mfe-relationship-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 50%;
}

.mfe-relationship-col-title {
    font-weight: 600;
    font-size: 12px;
    color: #4b5563;
}

.mfe-relationship-search {
    width: 100%;
    height: 30px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    padding: 0 8px;
    font-size: 12px;
    box-sizing: border-box;
}

.mfe-relationship-list {
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
}

.mfe-relationship-available-list {
    height: 200px;
    background: #f9fafb;
}

.mfe-relationship-selected-list {
    height: 238px;
    background: #fff;
}

.mfe-relationship-item {
    padding: 6px 10px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.mfe-relationship-item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mfe-relationship-item-type {
    font-size: 10px;
    color: #6b7280;
    background: #e5e7eb;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    white-space: nowrap;
}

.mfe-relationship-item-selected {
    padding: 6px 10px;
    border-bottom: 1px solid #f3f4f6;
    cursor: grab;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
}

.mfe-relationship-item-selected .dashicons-menu {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: #94a3b8;
    margin-right: 8px;
    cursor: grab;
}

.mfe-relationship-selected-left {
    display: flex;
    align-items: center;
    flex: 1;
    overflow: hidden;
}

.mfe-relationship-selected-right {
    display: flex;
    align-items: center;
}

.mfe-relationship-remove {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: #ef4444;
    cursor: pointer;
}

/* Taxonomy Loading */
.mfe-tax-loading {
    display: none;
    margin-left: 8px;
    font-size: 12px;
    color: #888;
}

/* User Field */
.mfe-user-select {
    width: 100%;
}

/* WYSIWYG Toolbar */
.mfe-wysiwyg-embed-toolbar {
    margin-bottom: 6px;
}

.mfe-wysiwyg-embed-toolbar .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    vertical-align: middle;
}

.mfe-wysiwyg-textarea {
    width: 100%;
}

/* Date Time Field */
.mfe-datetime-input {
    max-width: 260px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    padding: 0 8px;
    font-size: 13px;
    cursor: pointer !important;
}

.mfe-datetime-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.mfe-datetime-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Number Field */
.mfe-number-input {
    width: 100%;
    max-width: 240px;
}

/* Code Editor Field */
.mfe-code-editor-textarea {
    width: 100%;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.5;
    background: #1e293b;
    color: #f8fafc;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #334155;
    tab-size: 4;
}

/* Tab Field */
.mfe-tab-endpoint {
    display: none;
}

.mfe-tab-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #1e40af;
    display: flex;
    align-items: center;
}

.mfe-tab-title .dashicons {
    margin-right: 6px;
    font-size: 16px;
}

/* File Field */
.mfe-file-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* General hidden helper */
.mfe-hidden {
    display: none !important;
}

/* Repeater Template */
.mfe-repeater-template {
    display: none !important;
}

/* Pro Inactive Field Fallback Notice */
.mfe-pro-inactive-field-box {
    padding: 16px 20px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    margin: 8px 0;
}

.mfe-pro-inactive-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.mfe-pro-inactive-title {
    color: #0f172a;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mfe-pro-inactive-badge {
    background: #e2e8f0;
    color: #475569;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.mfe-pro-inactive-lock {
    color: #64748b;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.mfe-pro-inactive-desc {
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

/* Custom Notice Styles */
.mfe-notice-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: inherit;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: opacity 0.15s, background-color 0.15s, transform 0.15s !important;
    opacity: 0.75 !important;
}

.mfe-notice-close:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.2);
}

.mfe-notice-error .mfe-notice-close:hover,
.mfe-notice-warning .mfe-notice-close:hover {
    background: rgba(0, 0, 0, 0.08);
}


/* ══════════════════════════════════════════════════════════════
   GROUP FIELD CARDS & HEADING TAGS (Post Edit Screen)
══════════════════════════════════════════════════════════════ */
.mfe-field.mfe-field-group {
    width: 100% !important;
    display: block !important;
    margin: 0 0 16px 0 !important;
    box-sizing: border-box !important;
}

.mfe-field.mfe-root-group-field,
.mfe-post-edit-group>.mfe-condition-watcher>.mfe-field.mfe-field-group,
.mfe-tab-panel>.mfe-condition-watcher>.mfe-field.mfe-field-group,
.mfe-post-edit-group>.mfe-condition-watcher>.mfe-field.mfe-field-repeater,
.mfe-tab-panel>.mfe-condition-watcher>.mfe-field.mfe-field-repeater {
    margin: 0 0 16px 0 !important;
    padding: 0 20px !important;
    border-bottom: none !important;
}

.mfe-group-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    overflow: visible !important;
    transition: border-color .2s ease, box-shadow .2s ease !important;
}

.mfe-group-card:hover {
    border-color: #cbd5e1 !important;
}

.mfe-group-header {
    background: #f8fafc !important;
    border-bottom: none !important;
    padding: 12px 18px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
}

h3.mfe-group-heading {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    line-height: 1.4 !important;
}

h3.mfe-group-heading .dashicons {
    color: #6366f1 !important;
    font-size: 18px !important;
    width: 18px !important;
    height: 18px !important;
}

h4.mfe-group-heading {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    color: #334155 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    line-height: 1.4 !important;
}

h4.mfe-group-heading .dashicons {
    color: #8b5cf6 !important;
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
}

.mfe-group-instructions {
    margin: 0 !important;
    font-size: 12px !important;
    color: #64748b !important;
}

.mfe-group-body {
    padding: 16px !important;
    background: #ffffff !important;
    overflow: visible !important;
}

/* Sub-group nested differentiation */
.mfe-subgroup-field {
    margin: 16px 0 !important;
}

.mfe-subgroup-field>.mfe-group-card {
    border: 1px solid #e5e7eb !important;
    border-radius: 6px !important;
    background: #fafafa !important;
}

.mfe-subgroup-field>.mfe-group-card>.mfe-group-header {
    background: #f1f5f9 !important;
    border-bottom: none !important;
    padding: 10px 14px !important;
}

/* ══════════════════════════════════════════════════════════════
   MODERN COLOR PICKER UI COMPONENT
══════════════════════════════════════════════════════════════ */
.mfe-field.mfe-field-color .mfe-input {
    width: auto !important;
}

/* ── Color Picker (Exact ACF Style with WordPress Iris Engine) ── */
.mfe-color-picker-wrap {
    display: inline-block !important;
    position: relative !important;
    width: auto !important;
    vertical-align: middle !important;
}

.mfe-color-picker-wrap .wp-picker-container {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    vertical-align: middle !important;
}

/* ACF Style Swatch Button with "Select Color" */
.mfe-color-picker-wrap .wp-color-result.button {
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 0 0 30px !important;
    margin: 0 !important;
    border: 1px solid #c3c4c7 !important;
    border-radius: 3px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    cursor: pointer !important;
    position: relative !important;
    vertical-align: middle !important;
    transition: border-color .15s ease, box-shadow .15s ease !important;
    background-size: 10px 10px;
    background-position: 0 0, 5px 5px;
    overflow: hidden !important;
    display: inline-flex !important;
    align-items: stretch !important;
    width: auto !important;
}

.mfe-color-picker-wrap .wp-color-result.button:hover,
.mfe-color-picker-wrap .wp-color-result.button:focus {
    border-color: #2271b1 !important;
    box-shadow: 0 0 0 1px #2271b1 !important;
}

/* Color swatch square on left (native WordPress/ACF :after) */
.mfe-color-picker-wrap .wp-color-result.button:after {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    top: -1px !important;
    left: -1px !important;
    bottom: -1px !important;
    width: 30px !important;
    border-radius: 3px 0 0 3px !important;
    border-right: 1px solid #c3c4c7 !important;
    background-color: inherit !important;
    background-image: inherit !important;
    box-sizing: border-box !important;
}

/* Show the native text "Select Color" like ACF */
.mfe-color-picker-wrap .wp-color-result-text {
    display: block !important;
    background: #f6f7f7 !important;
    border-left: 1px solid #c3c4c7 !important;
    color: #2c3338 !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 28px !important;
    height: 28px !important;
    padding: 0 10px !important;
    border-radius: 0 2px 2px 0 !important;
    text-align: center !important;
    user-select: none !important;
}

.mfe-color-picker-wrap .wp-color-result.button:hover .wp-color-result-text {
    background: #f0f0f1 !important;
    color: #1d2327 !important;
}

/* ── Closed state: HIDE input wrap and HIDE picker holder completely! ── */
.mfe-color-picker-wrap .wp-picker-container:not(.wp-picker-active) .wp-picker-input-wrap,
.mfe-color-picker-wrap .wp-picker-container:not(.wp-picker-active) .wp-picker-holder,
.mfe-color-picker-wrap .wp-picker-input-wrap.hidden {
    display: none !important;
}

/* ── Open state: show input wrap and popup panel ── */
.mfe-color-picker-wrap .wp-picker-container.wp-picker-active .wp-picker-input-wrap {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin: 0 0 0 6px !important;
    vertical-align: middle !important;
}

.mfe-color-picker-wrap .wp-picker-container.wp-picker-active .wp-picker-holder {
    display: block !important;
}

/* ACF Style Hex Input */
.mfe-color-picker-wrap input[type="text"].wp-color-picker {
    height: 30px !important;
    line-height: 28px !important;
    padding: 0 8px !important;
    border: 1px solid #c3c4c7 !important;
    border-radius: 3px !important;
    font-family: Consolas, Monaco, monospace !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #1d2327 !important;
    background: #ffffff !important;
    width: 85px !important;
    margin: 0 !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    text-transform: uppercase !important;
    text-align: center !important;
    transition: border-color .15s ease, box-shadow .15s ease !important;
}

.mfe-color-picker-wrap input[type="text"].wp-color-picker:focus {
    border-color: #2271b1 !important;
    box-shadow: 0 0 0 1px #2271b1 !important;
    outline: none !important;
}

/* ACF Style Clear / Default Button with blue border */
.mfe-color-picker-wrap .button.wp-picker-default,
.mfe-color-picker-wrap .button.wp-picker-clear {
    height: 30px !important;
    line-height: 28px !important;
    padding: 0 10px !important;
    border-radius: 3px !important;
    border: 1px solid #2271b1 !important;
    background: #ffffff !important;
    color: #2271b1 !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    margin: 0 !important;
    cursor: pointer !important;
    transition: all .15s ease !important;
}

.mfe-color-picker-wrap .button.wp-picker-default:hover,
.mfe-color-picker-wrap .button.wp-picker-clear:hover {
    background: #f0f6fc !important;
    border-color: #135e96 !important;
    color: #135e96 !important;
}

.mfe-color-picker-wrap .wp-picker-container.wp-picker-active {
    z-index: 1000 !important;
}

/* Popup Panel directly anchored below container */
.mfe-color-picker-wrap .wp-picker-holder {
    position: absolute !important;
    top: calc(100% + 6px) !important;
    left: 0 !important;
    z-index: 99999 !important;
    margin: 0 !important;
}

/* Smart flip up when positioned at the bottom of the viewport or container */
.mfe-color-picker-wrap .wp-picker-container.mfe-picker-flip-up .wp-picker-holder {
    top: auto !important;
    bottom: calc(100% + 6px) !important;
}

.mfe-color-picker-wrap .iris-picker {
    background: #ffffff !important;
    border: 1px solid #c3c4c7 !important;
    border-radius: 4px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06) !important;
    padding: 10px !important;
    margin: 0 !important;
}