/* The form system's styles (every form, front and back), moved unchanged out of application/views/form_builder_script.php
   - two inline blocks, ~12 KB of every page (QA #39). The page links this file where the first block was. */
        /* QME Form System Styling */
        .qme-form-system .form-check-inline {
            display: inline-flex !important;
            align-items: center;
            margin-right: 1.5rem;
        }

        .qme-form-system .form-check-input {
            margin-top: 0 !important;
            cursor: pointer;
        }

        .qme-form-system .upload-feedback {
            font-size: 14px;
            display: block;
        }

        .qme-form-system .thanks-wrapper {
            animation: qmeFadeIn 0.5s ease-in-out;
        }

        .qme-error-msg {
            animation: qmeShake 0.4s ease-in-out;
            font-weight: 500;
            font-size: 14px !important; /* it carries Bootstrap .small (80% = 11.2px); 14px is the floor */
        }

        .qme-conditional-field-hidden {
            display: none !important;
        }

        @keyframes qmeShake {
            0%, 100% { transform: translateX(0); }
            25% { transform: translateX(-5px); }
            75% { transform: translateX(5px); }
        }

        .form-control.is-invalid {
            border-color: #e74a3b !important;
            box-shadow: 0 0 0 0.2rem rgba(231, 74, 59, 0.25) !important;
            background-image: none !important; /* Hide default browser error icon if any */
        }
        .select2-container--default.qme-select2-invalid .select2-selection--single,
        .select2-container--default.qme-select2-invalid .select2-selection--multiple {
            border-color: #e74a3b !important;
            box-shadow: 0 0 0 0.2rem rgba(231, 74, 59, 0.25) !important;
        }

        @keyframes qmeFadeIn {
            from {
                opacity: 0;
                transform: translateY(10px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .flatpickr-calendar {
            z-index: 99999 !important;
        }

        /* ── Unified Form Field Sizing ─────────────────────────── */
        .qme-form-system .form-control,
        .qme-form-system select,
        #automation-app :is(.input, .select, .textarea),
        .qme-form-system .select2-container--default .select2-selection--single,
        .qme-form-system .select2-container--default .select2-selection--multiple {
            font-size: 16px;
            min-height: 42px;
            display: flex;
            align-items: center;
            background: var(--qme-input-bg, #fff);
            border: 1px solid var(--qme-input-border, #d1d5db);
            border-radius: 5px;
        }
        .qme-form-system .select2-container--default .select2-selection--single {
            padding: 6px 12px;
        }
        .qme-form-system .select2-container--default .select2-selection--single .select2-selection__rendered {
            line-height: 28px;
            padding-left: 0;
        }
        .qme-form-system .select2-container--default .select2-selection--single .select2-selection__arrow {
            height: 40px;
        }
        .qme-form-system .select2-container--default .select2-selection--multiple {
            padding: 4px 8px;
            min-height: 42px;
        }
        .qme-form-system .select2-container--default .select2-selection--multiple .select2-selection__choice {
            margin-top: 4px;
        }
        .qme-form-system .select2-container {
            width: 100% !important;
        }

        /* Tags input wrapper consistency */
        .qme-form-system div.tagsinput {
            font-size: 16px;
            min-height: 42px;
            padding: 4px 8px;
            background: var(--qme-input-bg, #fff);
            border: 1px solid var(--qme-input-border, #d1d5db) !important;
            border-radius: 5px;
            display: flex;
            flex-wrap: wrap;
            align-items: center;
        }
        .qme-form-system div.tagsinput span.tag {
            background: var(--site_color_g, #6560f0);
            color: #fff;
            border: none;
            border-radius: 4px;
            padding: 5px 10px;
            margin: 3px 4px 3px 0;
            font-size: 15px;
            display: inline-flex;
            align-items: center;
            line-height: 1.3;
        }
        .qme-form-system div.tagsinput span.tag a {
            color: rgba(255,255,255,.85);
            font-weight: bold;
            font-size: 14px;
            margin-left: 8px;
            padding: 0 2px;
            text-decoration: none;
            cursor: pointer;
        }
        .qme-form-system div.tagsinput span.tag a:hover {
            color: #fff;
        }
        .qme-form-system div.tagsinput input {
            font-size: 14px;
            margin: 2px 0;
            border: none !important;
            outline: none !important;
            background: transparent !important;
            box-shadow: none !important;
            min-height: auto !important;
            height: auto !important;
            padding: 2px 4px !important;
            display: inline-block !important;
            width: auto !important;
        }
        .qme-form-system div.tagsinput div {
            display: inline-block;
        }
        /* Hide original input once tagsinput plugin wraps it */
        .qme-form-system input.qme-tags-input {
            display: none !important;
        }

        /* Repeater group (e.g. "Add another decision-maker") */
        .qme-form-system .qme-repeater {
            margin-bottom: 18px;
        }
        .qme-form-system .qme-repeater-head {
            font-size: 15px;
            color: #334155;
        }
        .qme-form-system .qme-repeater-item {
            background: #f8fafc;
            border: 1px solid #e2e8f0 !important;
            border-radius: 8px;
            padding: 16px 12px 4px !important;
            position: relative;
        }
        .qme-form-system .qme-repeater-item + .qme-repeater-item {
            margin-top: 12px;
        }
        .qme-form-system .qme-repeater-remove-wrap {
            position: absolute;
            top: 8px;
            right: 12px;
            width: auto !important;
        }
        /* validation messages under a field (jQuery validate label.error, invalid-feedback): never below 14px */
        .qme-form-system label.error, .qme-form-system .invalid-feedback { font-size: 14px !important; }
        .qme-form-system .qme-repeater-remove {
            font-size: 14px;
            font-weight: 600;
            text-decoration: none !important;
        }
        .qme-form-system .qme-repeater-add {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 14px;
            font-weight: 600;
            padding: 8px 16px;
            border-radius: 20px;
            color: var(--site_color_g, #6560f0);
            border-color: var(--site_color_g, #6560f0);
            background: #fff;
        }
        .qme-form-system .qme-repeater-add:hover {
            color: #fff;
            background: var(--site_color_g, #6560f0);
        }
        .qme-form-popup-backdrop {
            position: fixed;
            inset: 0;
            z-index: 100000;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
            background: rgba(15, 23, 42, .62);
        }
        .qme-form-popup {
            width: min(460px, 100%);
            padding: 28px;
            border-radius: 14px;
            background: #fff;
            box-shadow: 0 24px 70px rgba(15, 23, 42, .3);
            text-align: center;
        }
        .qme-form-popup-icon {
            width: 54px;
            height: 54px;
            margin: 0 auto 16px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #fff1f2;
            color: #dc2626;
            font-size: 26px;
            font-weight: 700;
        }
        .qme-form-popup-message {
            color: #475569;
            line-height: 1.6;
        }
        .qme-form-popup-message a {
            color: var(--site_color_g, #2563eb) !important;
            font-weight: 700;
            text-decoration: underline !important;
            text-underline-offset: 3px;
        }
        .qme-form-popup-message a:hover,
        .qme-form-popup-message a:focus {
            color: #1d4ed8 !important;
            text-decoration-thickness: 2px !important;
        }

/* ---- the second block (it followed the date picker's script) ---- */
        body .qme-form-system_front .form-section-title {
            border-bottom: 2px solid var(--site_color_g);
            padding-bottom: 10px;
            margin-top: 0;
            margin-bottom: 10px;
            font-weight: 600;
        }

        body .qme-form-system_front .input-group-append {
            position: absolute;
            right: 0;
            height: 100%;
        }

        body .qme-form-system_front .input-group-append span {
            color: var(--site_color_g);
            display: block;
            ;
            height: 100%;
        }

        /* The Popover Box */
        .qme-custom-popover {
            position: absolute;
            background: #2d3436;
            color: #fff;
            padding: 10px 15px;
            border-radius: 6px;
            font-size: 14px;
            max-width: 280px;
            z-index: 99999999 !important;
            /* Forces it above EVERYTHING */
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
            line-height: 1.5;
            display: none;
        }

        body .qme-form-system_front label {
            display: block;
            margin-bottom: 4px;
            font-weight: 500;
        }

        /* CTA button style aligned with loan page look/feel */
        body .qme-form-container .qme-cta-btn {
            background-color: var(--sinace-base) !important;
            border: none !important;
            min-width: 250px;
            border-radius: 6px;
            font-weight: 600 !important;
            transition: all 0.25s ease;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
        }
        body .qme-form-container .qme-cta-btn:hover {
            filter: brightness(0.95);
            transform: translateY(-1px);
        }
        body .qme-form-container .qme-cta-close-btn {
            color: var(--sinace-base);
            font-weight: 600 !important;
        }
        body .qme-form-container .qme-toggle-form-wrapper {
            margin-top: 16px;
        }

        /* The little triangle at the bottom */
        .qme-custom-popover:after {
            content: "";
            position: absolute;
            top: 100%;
            left: 50%;
            margin-left: -8px;
            border-width: 8px;
            border-style: solid;
            border-color: #2d3436 transparent transparent transparent;
        }
