/* Form Container */
.filemaker-form-container {
    margin: 20px 0;
    max-width: 800px;
}

/* Modal form container - ensure proper width */
.filemaker-modal .filemaker-form-container {
    max-width: none;
    width: 100%;
}

/* Ensure modal forms have proper width */
.filemaker-modal .filemaker-form {
    width: 100%;
    max-width: none;
}

/* Ensure multipage form navigation works in modals */
.filemaker-modal .filemaker-form-next,
.filemaker-modal .filemaker-form-prev {
    display: inline-block !important;
    margin: 10px 5px;
    padding: 10px 20px;
    background-color: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

.filemaker-modal .filemaker-form-next:hover,
.filemaker-modal .filemaker-form-prev:hover {
    background-color: #005177;
}

.filemaker-modal .filemaker-form-prev {
    background-color: #666;
}

.filemaker-modal .filemaker-form-prev:hover {
    background-color: #555;
}

/* Form Fields */
.filemaker-form-field {
    margin-bottom: 20px;
}

.filemaker-form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.filemaker-form-field input[type="text"],
.filemaker-form-field input[type="email"],
.filemaker-form-field input[type="number"],
.filemaker-form-field input[type="date"],
.filemaker-form-field textarea,
.filemaker-form-field select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* ── DateTime field (date + time pickers with timezone label) ── */
.fm-datetime-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fm-datetime-inputs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.fm-datetime-inputs input[type="date"],
.fm-datetime-inputs input[type="time"] {
    flex: 1;
    min-width: 120px;
    width: auto;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.fm-timezone-label {
    font-size: 0.75rem;
    color: #888;
    line-height: 1.4;
}

/* Table cell datetime: keep compact */
td .fm-datetime-inputs {
    gap: 4px;
}

td .fm-datetime-inputs input[type="date"],
td .fm-datetime-inputs input[type="time"] {
    min-width: 90px;
    padding: 4px 6px;
    font-size: 0.85rem;
}

td .fm-timezone-label {
    font-size: 0.7rem;
}

/* Mobile: stack date and time vertically */
@media (max-width: 480px) {
    .fm-datetime-inputs {
        flex-direction: column;
    }
    .fm-datetime-inputs input[type="date"],
    .fm-datetime-inputs input[type="time"] {
        width: 100%;
        flex: none;
    }
}

.filemaker-form-field textarea {
    min-height: 100px;
}

.filemaker-form-field.field-error input,
.filemaker-form-field.field-error textarea,
.filemaker-form-field.field-error select {
    border-color: #dc3232;
}

.filemaker-field-error {
    color: #dc3232;
    font-size: 0.9em;
    margin-top: 5px;
    display: none;
}

/* Radio and Checkbox Groups */
.filemaker-radio-group,
.filemaker-checkbox-group {
    margin-top: 5px;
}

.filemaker-radio-option,
.filemaker-checkbox-option {
    margin-bottom: 5px;
}

.filemaker-radio-option label,
.filemaker-checkbox-option label {
    display: inline;
    margin-left: 5px;
    font-weight: normal;
}

.filemaker-checkbox-option.filemaker-checkbox-locked label {
    color: #888;
}

.filemaker-company-groups-locked-note {
    margin: 4px 0 0 0;
    font-size: 11px;
    color: #888;
    font-style: italic;
}

.filemaker-company-groups-unlock-btn {
    margin-left: 6px;
    padding: 1px 8px;
    font-size: 11px;
    font-style: normal;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
}

.filemaker-company-groups-unlock-btn:hover {
    background: #f0f0f0;
}

/* Confirmation Checkbox (single checkbox) */
.filemaker-confirmation-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.filemaker-confirmation-checkbox input[type="checkbox"] {
    margin: 0;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

.filemaker-confirmation-checkbox label {
    margin: 0;
    cursor: pointer;
    font-weight: normal;
    line-height: 1.5;
}

/* Custom Value Input for Dropdowns */
.filemaker-custom-value-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.filemaker-custom-value-input:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Visual indicator for auto-switched custom inputs (from preloaded data) */
.filemaker-custom-value-input[data-auto-custom="true"] {
    border-left: 3px solid #f0ad4e;
    background-color: #fffbf0;
}

.filemaker-custom-value-input[data-auto-custom="true"]::before {
    content: "Custom value (not in dropdown list)";
    font-size: 11px;
    color: #856404;
    display: block;
    margin-bottom: 4px;
}

/* Form Messages */
.filemaker-form-success,
.filemaker-form-error {
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
}

.filemaker-form-success {
    background-color: #ecf8e0;
    color: #2c662d;
    border: 1px solid #c5e1a5;
}

.filemaker-form-error {
    background-color: #fde8e8;
    color: #a83232;
    border: 1px solid #f5c6cb;
}

/* Multi-page Form */
.filemaker-form-progress {
    margin-bottom: 20px;
}

/* Standard Navigation (for few pages) */
.filemaker-form-progress-steps {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid #ddd;
    flex-wrap: wrap;
}

.filemaker-form-progress-steps li {
    position: relative;
    opacity: 0.6;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.filemaker-form-progress-steps li.active {
    font-weight: bold;
    border-bottom: 2px solid #0073aa;
    opacity: 1;
}

.filemaker-form-progress-steps .page-link {
    display: block;
    padding: 10px 15px;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font-size: inherit;
    font-family: inherit;
    text-align: left;
    width: 100%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.filemaker-form-progress-steps .page-link:hover {
    background-color: #f5f5f5;
    color: #0073aa;
}

.filemaker-form-progress-steps li.active .page-link {
    color: #0073aa;
    font-weight: bold;
}

/* Dropdown Navigation (for many pages) */
.filemaker-form-progress-dropdown {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 400px;
}

.filemaker-form-progress-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.filemaker-form-progress-toggle:hover {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px rgba(0, 115, 170, 0.1);
}

.filemaker-form-progress-toggle.open {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px rgba(0, 115, 170, 0.1);
}

.filemaker-form-progress-toggle .current-page-name {
    font-weight: bold;
    color: #0073aa;
}

.filemaker-form-progress-toggle .page-counter {
    color: #666;
    font-size: 13px;
    margin-left: 8px;
}

.filemaker-form-progress-toggle .dropdown-arrow {
    font-size: 12px;
    color: #666;
    transition: transform 0.2s ease;
}

.filemaker-form-progress-toggle.open .dropdown-arrow {
    transform: rotate(180deg);
}

.filemaker-form-progress-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    margin: 2px 0 0 0;
    padding: 0;
    list-style: none;
}

.filemaker-form-progress-dropdown-menu li {
    border-bottom: 1px solid #f0f0f0;
}

.filemaker-form-progress-dropdown-menu li:last-child {
    border-bottom: none;
}

.filemaker-form-progress-dropdown-menu li.active {
    background-color: #f8f9fa;
}

.filemaker-form-progress-dropdown-menu .page-link {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font-size: inherit;
    font-family: inherit;
    text-align: left;
    transition: background-color 0.2s ease;
}

.filemaker-form-progress-dropdown-menu .page-link:hover {
    background-color: #f5f5f5;
}

.filemaker-form-progress-dropdown-menu li.active .page-link {
    background-color: #e8f4f8;
    color: #0073aa;
}

.filemaker-form-progress-dropdown-menu .page-number {
    font-weight: bold;
    color: #666;
    margin-right: 8px;
    min-width: 24px;
}

.filemaker-form-progress-dropdown-menu li.active .page-number {
    color: #0073aa;
}

.filemaker-form-progress-dropdown-menu .page-name {
    flex: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .filemaker-form-progress-steps {
        flex-direction: column;
        border-bottom: none;
        border: 1px solid #ddd;
        border-radius: 4px;
    }
    
    .filemaker-form-progress-steps li {
        border-bottom: 1px solid #f0f0f0;
        border-right: none;
    }
    
    .filemaker-form-progress-steps li:last-child {
        border-bottom: none;
    }
    
    .filemaker-form-progress-steps li.active {
        border-bottom: 1px solid #f0f0f0;
        border-left: 3px solid #0073aa;
    }
    
    .filemaker-form-progress-dropdown {
        max-width: 100%;
    }
}

/* Enhanced Navigation Styles */
.filemaker-form-progress-steps li:not(.active) .page-link {
    color: #666;
}

.filemaker-form-progress-steps li:not(.active):hover .page-link {
    color: #0073aa;
}

/* Visual feedback for completed pages */
.filemaker-form-progress-steps li.completed {
    opacity: 0.8;
}

.filemaker-form-progress-steps li.completed .page-link::after {
    content: " ✓";
    color: #46b450;
    font-weight: bold;
}

.filemaker-form-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.filemaker-form-prev,
.filemaker-form-next {
    padding: 8px 16px;
    background-color: #f7f7f7;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.filemaker-form-submit {
    margin-top: 20px;
}

.filemaker-form-submit button {
    padding: 10px 20px;
    background-color: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.filemaker-form-submit button:hover {
    background-color: #005177;
}

/* Inline fields - both float left with gap */
.filemaker-field-inline {
    display: block !important;
    width: 48% !important;
    box-sizing: border-box !important;
    float: left !important;
    margin-bottom: 20px !important;
    margin-right: 4% !important;
    clear: none !important;
}

/* Every second inline field - remove margin to prevent wrapping */
.filemaker-field-inline + .filemaker-field-inline {
    margin-right: 0 !important;
    clear: none !important;
}

/* After two inline fields, next non-inline or third inline should clear */
.filemaker-field-inline + .filemaker-field-inline + .filemaker-form-field {
    clear: both !important;
}

/* Non-inline fields clear and take full width */
.filemaker-form-field:not(.filemaker-field-inline) {
    clear: both !important;
    width: 100% !important;
    float: none !important;
}

/* Force full width for inputs */
.filemaker-field-inline input,
.filemaker-field-inline select,
.filemaker-field-inline textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Clear floats */
.filemaker-form-page:after,
.filemaker-form:after {
    content: "" !important;
    display: table !important;
    clear: both !important;
}

/* Add a visible indicator for debugging */
.filemaker-field-inline {
    position: relative !important;
}

.filemaker-field-inline:before {
    content: none !important;
    display: none !important;
}

@media (max-width: 768px) {
    .filemaker-field-inline {
        display: block !important;
        width: 100% !important;
        float: none !important;
        margin-right: 0 !important;
        clear: both !important;
        position: relative !important;
        z-index: 1 !important;
    }
    
    /* Ensure inputs are accessible on mobile */
    .filemaker-field-inline input,
    .filemaker-field-inline select,
    .filemaker-field-inline textarea {
        position: relative !important;
        z-index: 2 !important;
        pointer-events: auto !important;
    }
    
    /* Ensure labels don't block inputs */
    .filemaker-field-inline label {
        position: relative !important;
        z-index: 1 !important;
        pointer-events: none !important;
    }
}

/* Columns layout */
.fm-columns {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    width: 100%;
    clear: both;
}

.fm-column {
    min-width: 0;
    box-sizing: border-box;
}

.fm-columns-1 > .fm-column { flex: 0 0 100%; }
.fm-columns-2 > .fm-column { flex: 0 0 calc(50% - 8px); }
.fm-columns-3 > .fm-column { flex: 0 0 calc(33.333% - 11px); }
.fm-columns-4 > .fm-column { flex: 0 0 calc(25% - 12px); }

.fm-column > .filemaker-form-field {
    width: 100% !important;
    float: none !important;
    clear: none !important;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .fm-columns {
        flex-direction: column;
    }
    .fm-columns-2 > .fm-column,
    .fm-columns-3 > .fm-column,
    .fm-columns-4 > .fm-column {
        flex: 0 0 100%;
    }
}

/* Info Field Styles */
.filemaker-form-info {
    margin: 0 0 12px 0;
}

/* Section headings get breathing room above — except when first on page */
.filemaker-form-heading {
    margin-top: 28px;
}

.filemaker-form-page > .filemaker-form-heading:first-child,
.filemaker-form > .filemaker-form-heading:first-child {
    margin-top: 0;
}

/* Reset all theme heading styles within forms */
.filemaker-form-heading h1,
.filemaker-form-heading h2,
.filemaker-form-heading h3,
.filemaker-form-heading h4,
.filemaker-form-heading h5,
.filemaker-form-heading h6 {
    margin: 0;
    padding: 0;
    line-height: 1.3;
    font-family: inherit;
    letter-spacing: normal;
    text-transform: none;
    border: none;
    border-bottom: none;
    background: none;
    box-shadow: none;
}

/* h2: Hauptsektionen — klar sichtbar, dezente Trennlinie darunter */
.filemaker-form-heading h1 { font-size: 1.75rem; font-weight: 700; color: #1d2327; }
.filemaker-form-heading h2 { font-size: 1.5rem;  font-weight: 600; color: #1d2327; border-bottom: 1px solid #e5e7eb !important; padding-bottom: 6px; }
.filemaker-form-heading h3 { font-size: 1.15rem; font-weight: 600; color: #374151; }
.filemaker-form-heading h4 { font-size: 1.05rem; font-weight: 600; color: #4b5563; }
.filemaker-form-heading h5 { font-size: 0.95rem; font-weight: 600; color: #6b7280; }
.filemaker-form-heading h6 { font-size: 0.875rem; font-weight: 500; color: #6b7280; }

.filemaker-form-text {
    margin-bottom: 15px;
}

.filemaker-form-divider {
    margin: 20px 0;
}

.filemaker-form-divider hr {
    border: 0;
    height: 1px;
    margin: 0;
}

/* Save Progress */
.filemaker-save-progress {
    margin-right: 10px;
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
}

.filemaker-restore-notice {
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    padding: 10px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.filemaker-restore-link {
    color: #0073aa;
    text-decoration: underline;
    cursor: pointer;
}

.filemaker-restore-link:hover {
    color: #00a0d2;
}

.filemaker-save-message,
.filemaker-restore-message {
    background-color: #d4edda;
    color: #155724;
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
}

/* File Upload */
.filemaker-file-upload {
    margin-top: 5px;
}

.filemaker-file-preview {
    margin-top: 10px;
    max-width: 200px;
}

.filemaker-file-preview img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    padding: 3px;
}

.filemaker-remove-file {
    display: block;
    margin-top: 5px;
    background: #f44336;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
}

.filemaker-file-progress {
    margin-top: 10px;
    background-color: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.filemaker-file-progress-bar {
    height: 20px;
    background-color: #4CAF50;
    width: 0%;
    transition: width 0.3s;
}

.filemaker-file-progress-text {
    margin-top: 5px;
    font-size: 12px;
    text-align: center;
} 

/* Form submission styling */
.filemaker-form .form-status {
    margin: 15px 0;
    padding: 10px;
    border-radius: 4px;
    display: none;
}

/*
 * Slider display for number fields (field.display === 'slider').
 *
 * LimeSurvey-style layout: full-width track with the compact number input to
 * its right; min/max tick values and the anchor labels sit UNDER the track
 * ends (not beside it). Ticks and anchors reserve the same right margin as
 * the number input occupies (width + gap) so they align with the actual
 * track ends, not the full row width.
 */
/* Both classes in the selector: the container carries
   `fm-number-field fm-slider-field`, and `.fm-number-field` (further down
   in this file) sets `display: flex` for the %-suffix layout — which laid
   track row, ticks and anchors side by side and let `.fm-number-field
   input { flex: 1 }` inflate the number box while the track collapsed.
   (0,2,0) beats (0,1,0) regardless of source order. */
.fm-number-field.fm-slider-field {
    display: block;
    width: 100%;
    max-width: none;
}

.fm-slider-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Selectors carry the extra .fm-slider-field level on purpose: the generic
   `.filemaker-form-field input[type="number"] { width: 100% }` rule is
   (0,2,1) and silently beat a two-class selector (0,2,0) — the number box
   inflated to the full row width and squeezed the range track to 0px
   (measured in the render test). (0,3,0) wins.

   Fully custom track/thumb styling (appearance: none) on purpose: native
   slider rendering differs per browser (Chrome: colored dot thumb; Safari:
   white knob) AND themes/plugins (Astra, SureForms) override input defaults
   with borders/shadows/transitions that broke the native look live-side.
   Owning the appearance is the only way it looks identical everywhere.
   The blue fill left of the handle is driven by the --fill custom property
   (set by frontend-slider.js on input). */
.fm-slider-field .fm-slider-row .fm-slider-range,
.fm-slider-field .fm-slider-row .fm-slider-range:focus {
    -webkit-appearance: none;
    appearance: none;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    height: 6px;
    border: none;
    border-radius: 3px;
    background: linear-gradient(to right, #007cba var(--fill, 0%), #dde3e8 var(--fill, 0%));
    box-shadow: none;
    outline: none;
    padding: 0;
    transition: none;
    cursor: pointer;
}

/* The track pseudo-element is a separate styling target that themes hit
   independently of the input itself (box-shadow/border came from there). */
.fm-slider-field .fm-slider-range::-webkit-slider-runnable-track {
    -webkit-appearance: none;
    height: 6px;
    background: transparent;
    border: none;
    box-shadow: none;
}

.fm-slider-field .fm-slider-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #b8c2cc;
    box-shadow: none;
    cursor: pointer;
    margin-top: -7px; /* center 20px thumb on 6px track */
}

/* Firefox pendants */
.fm-slider-field .fm-slider-range::-moz-range-track {
    height: 6px;
    background: transparent;
    border: none;
    box-shadow: none;
}

.fm-slider-field .fm-slider-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #b8c2cc;
    box-shadow: none;
    cursor: pointer;
}

.fm-slider-field .fm-slider-row .fm-slider-value {
    flex: 0 0 auto;
    width: 72px;    /* px, not em — must match the ticks/anchors margin below */
    min-width: 0;
    text-align: center;
}

/* 72px input + 16px gap — keeps ticks/anchors under the track ends.
   Fixed px on purpose: an em-based calc() resolved against the ticks' own
   (smaller) font-size and reserved too little, letting the ticks stick out
   past the track end. */
.fm-slider-ticks,
.fm-slider-anchors {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-right: calc(72px + 16px);
}

.fm-slider-ticks {
    margin-top: 2px;
    font-size: 10px;
    color: #adb5bd;
}

.fm-slider-anchors {
    margin-top: 2px;
    font-size: 11.5px;
    color: #6c757d;
}

.fm-slider-anchors .fm-slider-anchor-max {
    text-align: right;
}

/* Table Fields Styling */
/*
   Form table-field container — column-count-aware responsive scaling
   mirrored from the data-display side (see docs/archive/TABLE_RESPONSIVE_SCALING.md).
   --column-count is set by ShortcodeRenderer at render time. Font and padding
   shrink as columns increase; horizontal scroll catches anything still wider.
*/
.table-field-container {
    margin: 15px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    background: #fafafa;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filemaker-table-field {
    width: 100%;
    min-width: max-content;        /* don't crush content below natural width */
    border-collapse: collapse;
    margin-bottom: 10px;
    background: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filemaker-table-field thead {
    background: #f8f9fa;
}

.filemaker-table-field th,
.filemaker-table-field td {
    /* Column-count-aware padding: 10px at 2 cols, scales down to ~5px at 10 cols */
    padding: clamp(5px, calc(11px - var(--column-count, 2) * 0.5px), 10px)
             clamp(6px, calc(12px - var(--column-count, 2) * 0.5px), 10px);
    border: 1px solid #dee2e6;
    text-align: left;
    vertical-align: middle;
}

.filemaker-table-field th {
    font-weight: 600;
    color: #495057;
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
    /* Header font scales 14px → 12px as columns grow */
    font-size: clamp(12px, calc(15px - var(--column-count, 2) * 0.25px), 14px);
}

.filemaker-table-field .required-asterisk {
    color: #dc3545;
    margin-left: 2px;
}

.filemaker-table-field input,
.filemaker-table-field select {
    width: 100%;
    /* min-width scales 120px → 80px as columns grow so wide tables can compress
       inputs to the natural column width set by browser table-layout: auto */
    min-width: clamp(80px, calc(130px - var(--column-count, 2) * 5px), 120px);
    /* Input padding scales similarly to cell padding */
    padding: clamp(3px, calc(7px - var(--column-count, 2) * 0.4px), 6px)
             clamp(4px, calc(9px - var(--column-count, 2) * 0.4px), 8px);
    border: 1px solid #ced4da;
    border-radius: 3px;
    /* Input font matches header scaling */
    font-size: clamp(12px, calc(15px - var(--column-count, 2) * 0.25px), 14px);
    background: white;
    box-sizing: border-box;
}

.filemaker-table-field input:focus,
.filemaker-table-field select:focus {
    border-color: #007cba;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

.filemaker-table-field input:invalid {
    border-color: #dc3545;
}

.table-actions {
    width: 50px;
    text-align: center;
}

.remove-table-row {
    background: transparent;
    color: #888;
    border: none;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-table-row:hover {
    color: #dc3545;
}

.remove-table-row .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}



.table-field-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #dee2e6;
}

.add-table-row {
    background: #007cba;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.add-table-row:hover {
    background: #005a87;
}

.table-row-count {
    font-size: 14px;
    color: #6c757d;
}

.table-row-count .count {
    font-weight: 600;
    color: #495057;
}

.table-field-error {
    color: #dc3545;
    font-style: italic;
    margin: 10px 0;
}

/* ── Stacked display style ────────────────────────────────────────────────────
   Transforms a regular table into a vertical card layout per row.
   Each row becomes a card; columns are shown as label-input pairs stacked
   vertically. Useful for tables with many columns that overflow horizontally
   (e.g. building descriptions, upload galleries).
   The underlying HTML is identical to the table style — only CSS changes.
   ──────────────────────────────────────────────────────────────────────────── */
.table-field-container.stacked-style > .filemaker-table-field { display: block; }
.table-field-container.stacked-style > .filemaker-table-field thead { display: none; }
.table-field-container.stacked-style > .filemaker-table-field tbody { display: flex; flex-direction: column; gap: 12px; }
.table-field-container.stacked-style .table-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    background: #fff;
    border: 1px solid #dde1e7;
    border-radius: 6px;
    padding: 14px 16px;
}
.table-field-container.stacked-style .table-row td {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    border: none;
    background: none;
}
.table-field-container.stacked-style .table-row td::before {
    content: attr(data-label);
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.table-field-container.stacked-style .table-row td.table-cell-file { align-items: flex-start; }
.table-field-container.stacked-style .table-row td input,
.table-field-container.stacked-style .table-row td select,
.table-field-container.stacked-style .table-row td textarea { width: 100%; }
.table-field-container.stacked-style .table-row td.table-actions {
    flex-direction: row;
    align-items: center;
    border-top: 1px solid #eee;
    padding-top: 8px;
    margin-top: 4px;
}
.table-field-container.stacked-style .table-row td.table-actions::before { display: none; }

/* File column inside table rows */
.table-cell-file input[type="file"] { width: 100%; }
.table-cell-file .filemaker-file-preview { margin-top: 6px; }

/* Calculated fields in tables - visual distinction */
.table-calculated-field {
    background-color: #f8f9fa !important;
    color: #495057;
}

.table-calculated-field:focus {
    background-color: #f0f1f3 !important;
}

/* Responsive table styling */
@media (max-width: 768px) {
    .table-field-container {
        padding: 10px;
    }
    
    .filemaker-table-field {
        font-size: 14px;
    }
    
    .filemaker-table-field th,
    .filemaker-table-field td {
        padding: 8px 5px;
    }
    
    .filemaker-table-field input,
    .filemaker-table-field select {
        min-width: 100px;
        font-size: 13px;
        padding: 5px 6px;
    }
    
    .table-field-controls {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .table-row-count {
        text-align: center;
    }
}

/* Compact table for small screens */
@media (max-width: 480px) {
    .filemaker-table-field {
        font-size: 12px;
    }
    
    .filemaker-table-field th,
    .filemaker-table-field td {
        padding: 6px 3px;
    }
    
    .filemaker-table-field input,
    .filemaker-table-field select {
        min-width: 80px;
        font-size: 12px;
        padding: 4px 5px;
    }
    
    .remove-table-row {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
} 

/* Fixed Rows Table - Hide actions column */
.table-field-container.fixed-rows .table-actions {
    display: none;
}

.table-field-container.fixed-rows .table-field-controls {
    display: none;
}

/* Label Column Styling */
.table-cell-label {
    background: #f8f9fa;
}

.table-label-value {
    display: block;
    font-weight: 500;
    color: #333;
    padding: 6px 0;
}

/* Auto-Fill Column Styling */
.table-cell-auto_fill {
    background: #f0f7ff;
}

.auto-fill-field {
    background: #f8fbff !important;
    color: #555;
    cursor: not-allowed;
    border-color: #c8dae8 !important;
}

.auto-fill-field:focus {
    box-shadow: none !important;
    border-color: #c8dae8 !important;
}

/* Dynamic Dropdown in Table */
.table-dynamic-dropdown {
    width: 100%;
    min-width: 150px;
}

.table-cell-dynamic_dropdown select {
    padding: 6px 8px;
}

/* Label column header styling */
.filemaker-table-field th.label-column {
    background: #e9ecef;
}

/*
 * Radio-button table column (Likert/matrix style): each option is a genuine
 * table column — one <th class="radio-option-header"> per option in the
 * header, one <td class="table-cell-radio-option"> per option in every row
 * (see ShortcodeRenderer::renderTableRow()). All radios in a row share the
 * same `name`, so they stay a single mutually-exclusive answer despite
 * spanning multiple cells.
 *
 * Previous version used two independent CSS Grids (one in the header, one
 * per row) that had to compute identical widths by coincidence — they didn't
 * always agree, causing circles to drift out of alignment with their header
 * label and the last column to overflow/clip. Real table columns are sized
 * once by the browser (table-layout:fixed) and are identical for the header
 * and every row by construction — no separate width math to keep in sync.
 */
/* Scoped under .filemaker-table-field so the specificity (0,2,1) beats the
   generic `.filemaker-table-field th { text-align: left }` rule (0,1,1) —
   a bare `.radio-option-header` class (0,1,0) silently lost that fight and
   the headers rendered left-aligned above centered circles. */
.filemaker-table-field th.radio-option-header {
    font-size: 10px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    vertical-align: bottom;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
}

.filemaker-table-field td.table-cell-radio-option {
    text-align: center;
    vertical-align: middle;
}

/* display:block + auto side margins centers the circle geometrically in its
   cell regardless of theme rules. width/min-width MUST be reset here: the
   generic `.filemaker-table-field input { width: 100%; min-width: clamp(...) }`
   rule (meant for text inputs in table cells) also hit these radios — the
   circle sat inside an invisible ~90px-wide box whose auto-margin centering
   resolved lopsided (measured: constant 20.7px shift right of the header
   label). Specificity (0,3,2) beats that generic rule (0,1,1). */
.filemaker-table-field td.table-cell-radio-option input[type="radio"] {
    display: block;
    width: auto;
    min-width: 0;
    margin: 0 auto;
    cursor: pointer;
}

/*
 * Matrix/Likert-style tables (a read-only "label" column describing each row
 * + one answer column) must NOT use the default min-width:max-content sizing
 * above — that forces the whole table to grow to fit the longest label on one
 * line, which pushes narrow answer columns (checkbox/select) off-screen for
 * long statement text. Constrain the label column's width and let it wrap
 * instead. Scoped with :has() so regular data tables (numbers, short text)
 * keep their natural auto-sizing behaviour.
 */
.filemaker-table-field:has(th.label-column) {
    table-layout: fixed;
    min-width: 0;
}

.filemaker-table-field:has(th.label-column) th.label-column,
.filemaker-table-field:has(th.label-column) td.table-cell-label {
    width: 62%;
}

/* A radio-button answer expands into N option columns and needs more total
   horizontal room than a single select/checkbox — give the label column a
   smaller share than the generic 62%. table-layout:fixed then divides the
   remaining space equally across all N radio-option <th>s automatically
   (they have no explicit width), which is exactly why per-option columns
   stay aligned without any extra CSS. */
.filemaker-table-field:has(th.radio-option-header) th.label-column,
.filemaker-table-field:has(th.radio-option-header) td.table-cell-label {
    width: 45%;
}

.filemaker-table-field:has(th.label-column) .table-label-value {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 13px;
    line-height: 1.45;
}

/* Row hover effect for tables with dynamic content */
.filemaker-table-field tbody tr:hover {
    background: #f5f8fb;
}

.filemaker-table-field tbody tr:hover .table-cell-label {
    background: #e9ecef;
}

.filemaker-table-field tbody tr:hover .table-cell-auto_fill {
    background: #e8f0fa;
}

/* Checkbox Column Styling */
.table-cell-checkbox {
    text-align: center;
    vertical-align: middle;
}

.table-checkbox-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 4px;
    margin: 0;
}

.table-checkbox {
    /* Hide default checkbox */
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-visual {
    display: inline-block;
    width: 22px;
    height: 22px;
    background: #fff;
    border: 2px solid #ccc;
    border-radius: 4px;
    transition: all 0.15s ease;
    position: relative;
}

.checkbox-visual::after {
    content: '';
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 12px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

.table-checkbox:checked + .checkbox-visual {
    background: #0073aa;
    border-color: #0073aa;
}

.table-checkbox:checked + .checkbox-visual::after {
    display: block;
}

.table-checkbox:focus + .checkbox-visual {
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.25);
}

.table-checkbox-label:hover .checkbox-visual {
    border-color: #0073aa;
}

.filemaker-table-field tbody tr:hover .table-cell-checkbox {
    background: #f8f9fa;
}

/* Nested Table Data Display */
.nested-table-data {
    width: 100%;
    border-collapse: collapse;
    margin: 5px 0;
    font-size: 0.9em;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.nested-table-data th,
.nested-table-data td {
    padding: 6px 8px;
    border: 1px solid #e8e8e8;
    text-align: left;
    vertical-align: top;
}

.nested-table-data th {
    background: #f5f5f5;
    font-weight: 600;
    font-size: 0.85em;
    color: #333;
}

.nested-table-data td {
    background: white;
}

.table-data-list {
    margin: 5px 0;
    padding-left: 20px;
    list-style-type: disc;
}

.table-data-list li {
    margin: 2px 0;
    font-size: 0.9em;
    line-height: 1.3;
}

.table-data-summary {
    font-size: 0.9em;
    color: #666;
    font-style: italic;
}

/* Responsive nested tables */
@media (max-width: 768px) {
    .nested-table-data {
        font-size: 0.8em;
    }
    
    .nested-table-data th,
    .nested-table-data td {
        padding: 4px 6px;
    }
    
    .table-data-list {
        font-size: 0.85em;
    }
}

/* Calculation Fields */
.calculation-field {
    background-color: #f8f9fa !important;
    color: #495057;
    font-family: monospace;
    position: relative;
}

.calculation-field:focus {
    background-color: #f8f9fa !important;
    cursor: not-allowed;
}

.calculation-field.calc-error {
    background-color: #f8d7da !important;
    border-color: #dc3545 !important;
    color: #721c24;
}

.calculation-field::placeholder {
    color: #6c757d;
    font-style: italic;
}

/* Visual indicator for calculated fields */
.filemaker-field-type-calculation {
    position: relative;
}

.filemaker-field-type-calculation label {
    position: relative;
}

.filemaker-field-type-calculation label::after {
    content: " (calculated)";
    font-size: 0.85em;
    color: #6c757d;
    font-weight: normal;
    font-style: italic;
}

/* ========================================
   Email Action Styles
   ======================================== */

/* Email Loading */
.filemaker-email-loading {
    background: white;
    padding: 40px 60px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.filemaker-email-loading .fm-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: fm-spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes fm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Email Prompt Modal */
.filemaker-email-prompt-modal {
    max-width: 600px;
    width: 90%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 10;
}

.filemaker-email-prompt-modal .filemaker-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    background: #f9f9f9;
    border-radius: 8px 8px 0 0;
}

.filemaker-email-prompt-modal .filemaker-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.filemaker-email-prompt-modal .filemaker-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

.filemaker-email-prompt-modal .filemaker-modal-close:hover {
    color: #333;
}

/* Email Prompt Overlay */
.filemaker-email-prompt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}

.filemaker-email-prompt-modal .filemaker-modal-body {
    padding: 20px;
}

.filemaker-email-form .fm-email-field {
    margin-bottom: 15px;
}

.filemaker-email-form .fm-email-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.filemaker-email-form .fm-email-field input,
.filemaker-email-form .fm-email-field textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.filemaker-email-form .fm-email-field input:focus,
.filemaker-email-form .fm-email-field textarea:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.filemaker-email-form .fm-email-field input[readonly],
.filemaker-email-form .fm-email-field textarea[readonly] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.filemaker-email-form .fm-email-field textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

.filemaker-email-prompt-modal .filemaker-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f9f9f9;
}

/* =====================================================================
   Midas Button System (frontend plugin UI — theme-independent)
   Used in modals, action menus, prompt dialogs. NOT in content areas.
   Content-area buttons should use wp-element-button (theme-native).
   ===================================================================== */
.midas-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    background: #f0f0f0;
    color: #333;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.1s ease;
}

.midas-btn:hover {
    background: #e5e5e5;
}

.midas-btn:active {
    transform: translateY(0);
}

.midas-btn-primary {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.midas-btn-primary:hover {
    background: #005a87;
    color: #fff;
}

/* Legacy selectors — kept for backward-compat with modals that
   still use the old class names. Will be removed in a future
   design-sprint that migrates all frontend buttons to .midas-btn. */
.filemaker-email-prompt-modal .fm-email-send {
    background: #0073aa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.filemaker-email-prompt-modal .fm-email-send:hover {
    background: #005a87;
}

.filemaker-email-prompt-modal .fm-email-cancel {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

.filemaker-email-prompt-modal .fm-email-cancel:hover {
    background: #e5e5e5;
}

/* Email Notification Toast */
.fm-email-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    z-index: 100001;
    max-width: 400px;
    animation: fm-slide-in 0.3s ease-out;
}

@keyframes fm-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.fm-email-notification-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.fm-email-notification-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.fm-email-notification .fm-email-icon {
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
}

.fm-email-notification-success .fm-email-icon {
    color: #28a745;
}

.fm-email-notification-error .fm-email-icon {
    color: #dc3545;
}

.fm-email-notification .fm-email-message {
    flex: 1;
    font-size: 14px;
}

.fm-email-notification .fm-email-recipients {
    font-size: 12px;
    margin-top: 5px;
    opacity: 0.8;
}

.fm-email-notification .fm-email-dismiss {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.5;
    padding: 0;
    line-height: 1;
}

.fm-email-notification .fm-email-dismiss:hover {
    opacity: 1;
} 

/* ========================================
   Action Menu Sub-Menu Navigation
   ======================================== */

/* Action menu header with back button */
.filemaker-action-menu-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filemaker-action-menu-header h3 {
    flex: 1;
    margin: 0;
}

/* Back button */
.filemaker-menu-back-btn {
    background: none;
    border: none;
    padding: 5px 8px;
    cursor: pointer;
    color: #666;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filemaker-menu-back-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.filemaker-menu-back-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Smooth transition for menu content */
.filemaker-action-menu-body {
    transition: opacity 0.2s ease;
}

.filemaker-action-menu-body.loading {
    opacity: 0.6;
}

/* ===================================
   Bulk Email Loading
   =================================== */
.filemaker-bulk-email-loading {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    max-width: 400px;
    margin: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.filemaker-bulk-email-loading .fm-bulk-email-note {
    font-size: 13px;
    color: #888;
    margin-top: 10px;
}

/* ===================================
   No Actions Available Message
   =================================== */
.filemaker-no-actions {
    padding: 30px;
    text-align: center;
    color: #666;
}

.filemaker-no-actions p {
    margin: 0 0 10px 0;
}

.filemaker-no-actions .hint {
    font-size: 13px;
    color: #999;
    font-style: italic;
}

/* ===================================
   Add New Button for Dynamic Dropdowns
   =================================== */
.filemaker-add-new-btn {
    display: inline-block;
    margin-left: 8px;
    padding: 6px 12px;
    background: #f0f0f1;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    color: #2271b1;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.filemaker-add-new-btn:hover {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

/* Dropdown + button wrapper */
.filemaker-dropdown-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filemaker-dropdown-wrapper select {
    flex: 1;
}

/* Mini-form container (inline expansion) */
.filemaker-mini-form-container {
    margin-top: 12px;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filemaker-mini-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
}

.filemaker-mini-form-header h4 {
    margin: 0;
    font-size: 14px;
    color: #1d2327;
}

.filemaker-mini-form-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

.filemaker-mini-form-close:hover {
    color: #d63638;
}

.filemaker-mini-form-body {
    /* Form content goes here */
}

.filemaker-mini-form-body .filemaker-form-field {
    margin-bottom: 12px;
}

.filemaker-mini-form-actions {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.filemaker-mini-form-actions .btn-add {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.filemaker-mini-form-actions .btn-add:hover {
    background: #135e96;
}

.filemaker-mini-form-actions .btn-cancel {
    background: #f0f0f1;
    color: #50575e;
    border: 1px solid #c3c4c7;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.filemaker-mini-form-actions .btn-cancel:hover {
    background: #dcdcde;
}

/* Loading state for mini-form */
.filemaker-mini-form-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

/* Error state for mini-form */
.filemaker-mini-form-error {
    color: #d63638;
    padding: 10px;
    background: #fcf0f1;
    border-radius: 4px;
}

/* Table Column "Add New" Button */
.filemaker-table-add-new-btn {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    background: #f0f0f1;
    border: 1px solid #c3c4c7;
    border-radius: 3px;
    color: #2271b1;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
    line-height: 1;
}

.filemaker-table-add-new-btn:hover {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

/* Table mini-form appears below the table */
.filemaker-table-mini-form-container {
    margin: 12px 0;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    animation: slideDown 0.2s ease-out;
}

/* ==========================================================================
   Comments-Style Table Display (CSS-Only)
   Renders actual table rows as a conversation thread - no JS transformation
   PHP adds class "comments-style" when display_style="comments"
   ========================================================================== */

/* When comments display is active, restyle the table */
.table-field-container.comments-style .filemaker-table-field {
    display: block;
    border: none;
}

/* Hide the table header row */
.table-field-container.comments-style .filemaker-table-field thead {
    display: none;
}

/* Make tbody a flex column for card layout */
.table-field-container.comments-style .filemaker-table-field tbody.table-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Reverse order when newest_first */
.table-field-container.comments-style.newest-first .filemaker-table-field tbody.table-rows {
    flex-direction: column-reverse;
}

/* Each row becomes a card */
.table-field-container.comments-style .filemaker-table-field tr.table-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: relative;
}

.table-field-container.comments-style .filemaker-table-field tr.table-row:hover {
    border-color: #c7d2fe;
    box-shadow: 0 2px 8px rgba(99,102,241,0.1);
}

/* Hide standard td styling, make cells inline */
.table-field-container.comments-style .filemaker-table-field td {
    display: block;
    border: none;
    padding: 0;
    background: transparent;
}

/* Date column - small, muted, top-left */
.table-field-container.comments-style .filemaker-table-field td:first-child {
    flex: 0 0 auto;
    font-size: 12px;
    color: #6b7280;
    order: 1;
}

.table-field-container.comments-style .filemaker-table-field td:first-child input {
    font-size: 12px;
    color: #6b7280;
    border: none;
    background: transparent;
    padding: 0;
    width: auto;
}

/* Comment/content column - full width, main content */
.table-field-container.comments-style .filemaker-table-field td:nth-child(2) {
    flex: 1 1 100%;
    order: 3;
    margin-top: 4px;
}

.table-field-container.comments-style .filemaker-table-field td:nth-child(2) textarea,
.table-field-container.comments-style .filemaker-table-field td:nth-child(2) input[type="text"] {
    width: 100%;
    min-height: 60px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    background: #fafafa;
}

.table-field-container.comments-style .filemaker-table-field td:nth-child(2) textarea:focus,
.table-field-container.comments-style .filemaker-table-field td:nth-child(2) input[type="text"]:focus {
    outline: none;
    border-color: #6366f1;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* Actions column - top right */
.table-field-container.comments-style .filemaker-table-field td.table-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    order: 2;
}

.table-field-container.comments-style .filemaker-table-field td.table-actions .remove-table-row {
    opacity: 0;
    transition: opacity 0.2s;
    background: transparent;
    color: #888;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.table-field-container.comments-style .filemaker-table-field tr.table-row:hover td.table-actions .remove-table-row {
    opacity: 1;
}

.table-field-container.comments-style .filemaker-table-field td.table-actions .remove-table-row:hover {
    color: #dc3545;
}

/* Style the Add Comment button - use consistent WordPress button styling */
.table-field-container.comments-style .add-table-row {
    background: #007cba;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
}

.table-field-container.comments-style .add-table-row:hover {
    background: #005a87;
}

/* Hide row count for cleaner look */
.table-field-container.comments-style .table-row-count {
    display: none;
}

/* ==========================================================================
   Field Hint/Tooltip Icon
   ========================================================================== */

.filemaker-field-hint {
    display: inline-block;
    margin-left: 4px;
    font-size: 14px;
    cursor: help;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.filemaker-field-hint:hover {
    opacity: 1;
}

/* Custom tooltip styling (if not using browser default) */
.filemaker-form-field label[title],
.filemaker-field-label[title] {
    cursor: help;
}

/* ==========================================================================
   Template-specific styles are now in separate CSS files:
   - templates/data/table.css
   - templates/data/list.css
   - templates/data/cards.css
   - templates/data/contact.css
   
   Custom templates can include inline <style> or a matching .css file
   in /wp-content/uploads/filemaker-templates/data/
   ========================================================================== */

/* ==========================================================================
   Admin Quick-Edit Links (Forms & Action Menus)
   Only visible to admins - provides quick access to edit forms/menus
   ========================================================================== */

.fm-admin-quick-edit {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    padding: 8px 12px;
    margin-top: 8px;
    background: #f8f9fa;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 4px 4px;
    font-size: 12px;
}

.fm-admin-quick-edit .fm-form-id,
.fm-admin-quick-edit .fm-menu-id {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.fm-admin-quick-edit .fm-form-id:hover,
.fm-admin-quick-edit .fm-menu-id:hover {
    background: #e5e7eb;
}

.fm-admin-quick-edit .fm-form-id code,
.fm-admin-quick-edit .fm-menu-id code {
    font-family: monospace;
    font-size: 11px;
    background: transparent;
    padding: 0;
}

.fm-admin-quick-edit .fm-form-id .dashicons,
.fm-admin-quick-edit .fm-menu-id .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.fm-admin-quick-edit .fm-edit-link {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #007cba;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.fm-admin-quick-edit .fm-edit-link:hover {
    background: #007cba;
    color: #fff;
}

.fm-admin-quick-edit .fm-edit-link .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Copied feedback */
.fm-admin-quick-edit .fm-form-id.copied,
.fm-admin-quick-edit .fm-menu-id.copied {
    background: #d1fae5;
    color: #059669;
}

/* In modals - adjust positioning */
.filemaker-modal .fm-admin-quick-edit {
    margin-top: 0;
    border-radius: 0;
}

/* ==========================================================================
   Number Field with Percentage
   ========================================================================== */

.fm-number-field {
    display: flex;
    align-items: stretch;   /* was: center — pill now matches input height */
    gap: 8px;
}

.fm-number-field input {
    flex: 1;
    box-sizing: border-box;
}

/* Unified pill styling — same grey badge for percentage %, scale
   (Tsd./Mio./Mrd.), and inside amount/measurement flex containers where
   it lines up with the currency/unit pill. One consistent look across
   every field type that uses a suffix. */
.fm-field-suffix {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
    white-space: nowrap;
    flex: 0 0 auto;
    min-width: 50px;
    box-sizing: border-box;
}

.fm-percentage-field input {
    max-width: 120px;
}

/* ==========================================================================
   Amount Field (Currency + Value) + Measurement Field (UNECE Rec 20)

   Shared flex layout + vertical alignment. The grey pills (fixed-mode
   currency / unit) previously rendered slightly taller than the <input>
   next to them because <input> and <span display:inline-flex> compute
   heights differently even with identical padding. Fixed here with:
     - align-items: stretch → all flex children share the container height
     - pills use display: flex (not inline-flex) so they stretch vertically
     - pills use vertical padding 0 (height comes from stretch)
     - box-sizing: border-box across all children for consistency
   ========================================================================== */

.fm-amount-field,
.fm-measurement-field {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.fm-amount-field > *,
.fm-measurement-field > * {
    box-sizing: border-box;
    line-height: 1.4;
}

/* Dropdowns (user-selectable) */
.fm-amount-field .fm-amount-currency {
    width: 80px !important;
    max-width: 80px !important;
    min-width: 80px;
    flex: 0 0 80px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
}

.fm-measurement-field .fm-measurement-unit {
    flex: 0 0 auto;
    min-width: 160px;
    max-width: 260px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
}

/* Fixed-mode grey pills — share height with the <input> via flex stretch */
.fm-amount-currency-fixed,
.fm-measurement-unit-fixed {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
    min-width: 50px;
    white-space: nowrap;
    box-sizing: border-box;
}

.fm-amount-value,
.fm-measurement-field .fm-measurement-value {
    flex: 1;
    min-width: 100px;
}

/* Responsive */
@media (max-width: 480px) {
    .fm-amount-field,
    .fm-measurement-field {
        flex-wrap: wrap;
    }

    .fm-amount-currency,
    .fm-amount-currency-fixed,
    .fm-measurement-field .fm-measurement-unit,
    .fm-measurement-unit-fixed {
        width: 100%;
        max-width: none;
    }

    .fm-amount-value,
    .fm-measurement-field .fm-measurement-value {
        width: 100%;
    }
}

/* ==========================================================================
   Address Composite Field
   --------------------------------------------------------------------------
   - Stack of rows (.fm-address-row) with 8px spacing
   - DACH locality row puts [postal code] [city] side by side, PLZ ~120px
   - UK format renders postcode on its own row after locality (handled in PHP)
   - Country fixed mode shows a grey pill (matches .fm-amount-currency-fixed)
   - Geo row shows lat + lng inputs side by side
   ========================================================================== */

.fm-address-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fm-address-field .fm-address-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.fm-address-field .fm-address-row > input,
.fm-address-field .fm-address-row > select {
    flex: 1;
    box-sizing: border-box;
    line-height: 1.4;
}

/* DACH locality row: PLZ compact, city flexible */
.fm-address-field.fm-address-format-dach .fm-address-row-locality .fm-address-postal-code {
    flex: 0 0 120px;
    min-width: 100px;
    max-width: 140px;
}

.fm-address-field.fm-address-format-dach .fm-address-row-locality .fm-address-locality {
    flex: 1;
}

/* UK format keeps locality and postcode on separate rows (PHP markup),
   no additional layout needed beyond the default flex row. */

/* Country fixed-mode pill — mirrors .fm-amount-currency-fixed sizing */
.fm-address-field .fm-address-country-fixed {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
    min-width: 50px;
    white-space: nowrap;
    box-sizing: border-box;
}

.fm-address-field .fm-address-row-country .fm-address-country {
    max-width: 280px;
}

/* Geo row: lat + lng equal width */
.fm-address-field .fm-address-row-geo .fm-address-latitude,
.fm-address-field .fm-address-row-geo .fm-address-longitude {
    flex: 1;
}

@media (max-width: 480px) {
    .fm-address-field.fm-address-format-dach .fm-address-row-locality {
        flex-wrap: wrap;
    }
    .fm-address-field.fm-address-format-dach .fm-address-row-locality .fm-address-postal-code,
    .fm-address-field.fm-address-format-dach .fm-address-row-locality .fm-address-locality {
        flex: 1 0 100%;
        max-width: none;
    }
    .fm-address-field .fm-address-row-geo {
        flex-wrap: wrap;
    }
    .fm-address-field .fm-address-row-geo .fm-address-latitude,
    .fm-address-field .fm-address-row-geo .fm-address-longitude {
        flex: 1 0 100%;
    }
}

/* ==========================================================================
   Generic Block Composite Fields (Person, Organization, future blocks)
   --------------------------------------------------------------------------
   - Vertical stack of sub-inputs, one per registered subfield
   - Mirrors .fm-address-field layout for visual consistency
   - Per-block modifier classes (.fm-block-person, .fm-block-organization)
     can override specific row layouts if needed in the future
   ========================================================================== */

.fm-block-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fm-block-field .fm-block-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.fm-block-field .fm-block-row > input {
    flex: 1;
    box-sizing: border-box;
    line-height: 1.4;
}

/* Two-column rows for short field pairs (e.g. firstName + lastName).
   Opt-in via additional row classes when a block needs side-by-side layout. */
.fm-block-field .fm-block-row-firstName + .fm-block-row-lastName {
    /* hook for future side-by-side layout */
}

@media (max-width: 480px) {
    .fm-block-field .fm-block-row {
        flex-wrap: wrap;
    }
    .fm-block-field .fm-block-row > input {
        flex: 1 0 100%;
    }
}

/* ============================================
   Form-Style Table (Subform per row)
   ============================================ */

.table-field-container.form-style {
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
    padding: 16px;
}

.form-style-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-style-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.form-style-row:hover {
    border-color: #0073aa;
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.1);
}

.form-style-row-content {
    flex: 1;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.form-style-row-actions {
    display: flex;
    gap: 8px;
    margin-left: 16px;
}

.form-style-row-actions button {
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
    transition: background 0.2s;
}

.form-style-row-actions button:hover {
    background: #f0f0f0;
}

.form-style-row-actions .remove-form-row {
    color: #d63638;
    font-size: 20px;
    line-height: 1;
}

.form-style-row-actions .remove-form-row:hover {
    background: #fee;
}

.form-style-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.form-style-controls .add-form-row {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.form-style-controls .add-form-row:hover {
    background: #005a87;
}

.form-style-controls .table-row-count {
    color: #666;
    font-size: 13px;
}

/* Form Style Modal - nested inside another modal, needs higher z-index */
/* Must override modal.css styles completely */
.filemaker-modal.form-style-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 1000100 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.filemaker-modal.form-style-modal.active {
    opacity: 1 !important;
    visibility: visible !important;
}

.filemaker-modal.form-style-modal .filemaker-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.7) !important;
    z-index: 1 !important;
}

.filemaker-modal.form-style-modal .filemaker-modal-content {
    position: relative !important;
    max-width: 800px !important;
    width: 90% !important;
    max-height: 90vh !important;
    z-index: 10 !important;
    background: #fff !important;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.filemaker-modal.form-style-modal.active .filemaker-modal-content {
    transform: scale(1) !important;
}

.filemaker-modal.form-style-modal .filemaker-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f9f9f9;
}

.filemaker-modal.form-style-modal .filemaker-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.filemaker-modal.form-style-modal .filemaker-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.filemaker-modal.form-style-modal .filemaker-modal-close:hover {
    background: #e0e0e0;
    color: #333;
}

.filemaker-modal.form-style-modal .filemaker-modal-body {
    padding: 20px;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

.filemaker-modal.form-style-modal .filemaker-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    background: #f9f9f9;
}

.filemaker-modal.form-style-modal .form-style-cancel {
    background: #f0f0f0;
    border: 1px solid #ddd;
    color: #333;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.filemaker-modal.form-style-modal .form-style-cancel:hover {
    background: #e0e0e0;
}

.filemaker-modal.form-style-modal .form-style-save {
    background: #0073aa;
    border: none;
    color: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.filemaker-modal.form-style-modal .form-style-save:hover {
    background: #005a87;
}

.form-style-modal-loading,
.form-style-modal-error {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 14px;
}

.form-style-modal-error {
    color: #d63638;
}

/* Stale Data Detection */
.fm-stale-field {
    border-left: 3px solid #f0ad4e !important;
    background-color: #fdf8e8 !important;
}

.fm-stale-indicator {
    display: inline-block;
    cursor: pointer;
    color: #f0ad4e;
    font-size: 18px;
    line-height: 1;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 3px;
    vertical-align: middle;
    transition: background-color 0.2s, color 0.2s;
}

.fm-stale-indicator:hover {
    background-color: #f0ad4e;
    color: white;
}

/* Bulk Import Section */
.filemaker-bulk-import-section {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border: 1px dashed #ccc;
    border-radius: 6px;
}

.bulk-import-divider {
    text-align: center;
    margin-bottom: 16px;
    position: relative;
}

.bulk-import-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ccc;
}

.bulk-import-divider span {
    background: #f8f9fa;
    padding: 0 12px;
    position: relative;
    color: #888;
    font-size: 13px;
    font-weight: 600;
}

.filemaker-bulk-import-section h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    color: #333;
}

.bulk-import-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.bulk-import-controls .button {
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
}

.bulk-import-status {
    margin-top: 16px;
}

.bulk-import-loading {
    color: #666;
    font-style: italic;
}

.bulk-import-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 12px 16px;
    border-radius: 4px;
}

.bulk-import-success .button {
    margin-top: 10px;
}

.bulk-import-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 4px;
}

.bulk-import-errors {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 12px 16px;
    border-radius: 4px;
}

.bulk-import-error-table {
    width: 100%;
    margin-top: 10px;
    border-collapse: collapse;
    font-size: 12px;
}

.bulk-import-error-table th,
.bulk-import-error-table td {
    padding: 4px 8px;
    border: 1px solid #ddd;
    text-align: left;
}

.bulk-import-error-table th {
    background: #f5f5f5;
    font-weight: 600;
}