@font-face {
    font-family: 'MoskvichSans-Medium';
    src: url('/assets/fonts/MoskvichSans-Medium.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-header: 'MoskvichSans-Medium', sans-serif;
    --input-height: 3.5rem;
}

body[data-theme="cpb"] {
    --theme-header: #BA4618;
    --theme-header-dark: #a13d15;
    --theme-header-focus-shadow: rgba(186, 70, 24, .25);
    --theme-button: #BA4618;
    --theme-button-dark: #a13d15;
    --theme-button-focus-shadow: rgba(186, 70, 24, .25);
    --theme-primary-focus: #BA4618;
    --theme-focus-shadow: rgba(186, 70, 24, .25);
    --theme-choices-chip-bg: #fdf3ed;
    --theme-choices-chip-border: #e5c4ad;
    --theme-choices-chip-text: #BA4618;
    --theme-choices-close-border: #a13d15;
}

body.embed-mode[data-theme="cpb"] {
    --theme-header: #FF5101;
    --theme-header-dark: #e54900;
    --theme-header-focus-shadow: rgba(255, 81, 1, .25);
    --theme-button: #FF5101;
    --theme-button-dark: #e54900;
    --theme-button-focus-shadow: rgba(255, 81, 1, .25);
    --theme-primary-focus: #FF5101;
    --theme-focus-shadow: rgba(255, 81, 1, .25);
    --theme-choices-chip-bg: #fff4ef;
    --theme-choices-chip-border: #ffd0b8;
    --theme-choices-chip-text: #FF5101;
    --theme-choices-close-border: #e54900;
}

body[data-theme="czn"] {
    --theme-header: #2062a5;
    --theme-header-dark: #1c568f;
    --theme-header-focus-shadow: rgba(32, 98, 165, .25);
    --theme-primary-focus: #007BFF;
    --theme-focus-shadow: rgba(0, 123, 255, .25);
    --theme-choices-chip-bg: #eef4fa;
    --theme-choices-chip-border: #b8d2eb;
    --theme-choices-chip-text: #2062a5;
    --theme-choices-close-border: #1c568f;
}

body[data-theme="mk"] {
    --theme-header: #2062a5;
    --theme-header-dark: #1c568f;
    --theme-header-focus-shadow: rgba(32, 98, 165, .25);
    --theme-primary-focus: #007BFF;
    --theme-focus-shadow: rgba(0, 123, 255, .25);
    --theme-choices-chip-bg: #eef4fa;
    --theme-choices-chip-border: #b8d2eb;
    --theme-choices-chip-text: #2062a5;
    --theme-choices-close-border: #1c568f;
}

html,
body {
    height: 100%;
    min-height: 100%;
}

body {
    background-color: #f7f6f4;
    font-family: var(--font-main);
    color: #3A3C42;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    margin: 0;
}

.main-container {
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 1rem;
    padding-bottom: 1rem;
    width: 100%;
}

.header-flex {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    width: 100%;
    flex-wrap: nowrap;
}

.logo {
    max-width: 120px;
    width: 35%;
    height: auto;
    flex-shrink: 0;
}

h1.h3.header-title {
    font-family: var(--font-header);
    color: var(--theme-header);
    font-size: 1.6rem; /* Increased from 1.3rem */
    margin: 0;
    font-weight: 500;
    text-align: right;
    flex-shrink: 1;
    line-height: 1.2;
}

h2.h4 {
    color: var(--theme-header);
    font-family: var(--font-main);
    font-weight: 500;
    font-size: 1.15rem; /* Further reduced from 1.3rem */
}

.logo-qr-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.logo-qr-group .logo {
    width: auto;
}

.reg-qr-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.4;
    flex-shrink: 0;
    line-height: 1;
}
.reg-qr-btn:hover {
    opacity: 0.75;
}

.reg-qr-icon {
    display: block;
    width: 28px;
    height: 28px;
    background-color: var(--theme-header);
    -webkit-mask-image: url('/assets/images/qr.svg');
    mask-image: url('/assets/images/qr.svg');
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.card {
    border-radius: 1.5rem;
    border: none;
    background-color: #fff;
    width: 100%;
}

.custom-input,
.custom-select {
    font-size: 1.15rem;
    height: var(--input-height);
    padding: 0 1.35rem;
    border-radius: 1.25rem;
    background-color: #f8f8f8;
}

textarea.custom-input {
    resize: none;
}

.custom-input::placeholder {
    color: #9ca3af;
    opacity: 1;
}

.custom-select.select-placeholder {
    color: #9ca3af;
}

.custom-input:focus,
.custom-select:focus {
    border-color: var(--theme-primary-focus);
    box-shadow: 0 0 0 .2rem var(--theme-focus-shadow);
    background-color: #fff;
}

.custom-select option {
    padding: 10px 15px;
    font-size: 1.15rem;
    color: #3A3C42;
}

.custom-select option:disabled {
    color: #9ca3af;
}

.option-cpb {
    color: var(--theme-header) !important;
    font-size: 1.15rem !important;
    font-weight: 700 !important;
}

.option-mfc {
    color: #0d6efd !important;
    font-size: 1.15rem !important;
    font-weight: 500 !important;
}

body[data-theme="cpb"] .custom-select:has(option.option-cpb:checked) {
    color: var(--theme-header);
    font-weight: 700;
}

body[data-theme="czn"] .custom-select:has(option.option-mfc:checked) {
    color: #0d6efd;
    font-weight: 500;
}

.form-check {
    display: flex;
    align-items: center;
    min-height: 1.4em;
}

.form-check-input {
    width: 1.4em;
    height: 1.4em;
    margin-top: 0;
    border-radius: .35rem;
    border: 2px solid #adb5bd;
    cursor: pointer;
    flex-shrink: 0;
}

.form-check-label {
    cursor: pointer;
    margin-left: 0.5em;
}

.form-check-input:checked {
    background-color: var(--theme-header);
    border-color: var(--theme-header);
}

.form-check-input:focus {
    box-shadow: 0 0 0 .2rem var(--theme-header-focus-shadow);
    border-color: var(--theme-header);
}

.link-custom {
    color: var(--theme-header);
    text-decoration: underline;
}

.link-custom:hover {
    color: var(--theme-header-dark);
}

.btn-custom {
    background-color: var(--theme-button, var(--theme-header));
    border-color: var(--theme-button, var(--theme-header));
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    padding: .85rem 1.5rem;
    border-radius: 1rem;
    transition: background-color .2s ease-in-out, border-color .2s ease-in-out, opacity .2s ease-in-out;
}

/* Optimized buttons for mobile navigation */
@media (max-width: 575px) {
    .wizard-nav .btn {
        font-size: 1rem !important;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

.btn-custom:hover:not(:disabled),
.btn-custom:focus:not(:disabled) {
    background-color: var(--theme-button-dark, var(--theme-header-dark));
    border-color: var(--theme-button-dark, var(--theme-header-dark));
    color: #fff;
}

.btn-custom:focus:not(:disabled) {
    box-shadow: 0 0 0 .2rem var(--theme-button-focus-shadow, var(--theme-header-focus-shadow));
}

.btn-custom:disabled {
    opacity: 1;
    color: #fff;
    background-color: var(--theme-button, var(--theme-header));
    border-color: var(--theme-button, var(--theme-header));
}

.btn-custom.disabled-look {
    opacity: 0.65;
    cursor: default;
    background-color: #e0e0e0 !important;
    border-color: #e0e0e0 !important;
}

.modal-custom-content {
    border-radius: 1.5rem;
    color: #fff;
    border: none;
    padding: 1rem;
    transition: background-color .3s ease-in-out;
}

.modal-custom-content.modal-state-success {
    background-color: #198754;
}

.modal-custom-content.modal-state-info {
    background-color: #0d6efd;
}

.modal-custom-content.modal-state-danger {
    background-color: #dc3545;
}

.modal-header .btn-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 10;
    filter: invert(1) grayscale(100%) brightness(200%);
}

.modal-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    width: 100%;
    text-align: center;
}

.lead-modal {
    font-size: 1.3rem;
    font-weight: 400;
    color: #fff;
}

.modal-candidate-id {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    padding: .5rem 0;
}

#qrCodeContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

#qrCodeImage {
    background-color: #fff;
    padding: 1.25rem;
    border-radius: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#qrCodeImage img {
    display: block;
    max-width: 100%;
    height: auto;
}

.btn-custom-modal {
    background-color: #fff;
    border: 1px solid #3A3C42;
    color: #3A3C42;
    font-weight: 700;
    font-size: 1.2rem;
    padding: .75rem 1.5rem;
    border-radius: 1rem;
}

.btn-custom-modal:hover {
    background-color: #f1f1f1;
    border-color: #3A3C42;
    color: #3A3C42;
}

.btn-custom-modal:focus {
    box-shadow: 0 0 0 .2rem rgba(255, 255, 255, .5);
}

.choices {
    font-size: 1.15rem;
    margin-bottom: 0 !important; /* Override library default margin */
}

.choices__inner {
    padding: .95rem 1.35rem;
    border-radius: 1.25rem;
    border: 1px solid #e5e7eb;
    min-height: auto;
    background-color: #f8f8f8;
}

.choices[data-type*="select-multiple"] .choices__inner {
    padding-bottom: calc(.95rem - 8px);
}

.choices.is-focused .choices__inner {
    background-color: #fff;
    border-color: var(--theme-primary-focus);
    box-shadow: 0 0 0 .2rem var(--theme-focus-shadow);
}

/* 1. Chips container and text color */
.choices__list--multiple .choices__item {
    background-color: var(--theme-choices-chip-bg) !important;
    border: 1px solid var(--theme-choices-chip-border) !important;
    border-radius: 0.75rem !important;
    color: var(--theme-choices-chip-text) !important;
    font-size: 1rem !important;
    font-weight: 500 !important;
}

/* 2. Force theme color text on all parts of the chip */
.choices__list--multiple .choices__item,
.choices__list--multiple .choices__item * {
    color: var(--theme-choices-chip-text) !important;
}

/* 3. The remove button (cross) - using library selector to ensure override */
.choices[data-type*="select-multiple"] .choices__button,
.choices[data-type*="text"] .choices__button,
.choices__list--multiple .choices__button {
    border-left: none !important;
    margin-left: 8px !important;
    margin-right: -4px !important;
    opacity: 0.7 !important;
    /* Since background is light, we want the cross to be dark/theme-colored */
    /* If cross is white SVG, we invert it to make it black */
    filter: brightness(0) !important; 
}

.choices[data-type*="select-multiple"] .choices__button:hover,
.choices__list--multiple .choices__button:hover {
    opacity: 1 !important;
}

.choices__list--dropdown {
    border-radius: 1.25rem;
    z-index: 20;
}

.choices__list--dropdown .choices__item {
    font-size: 1.15rem;
}

.choices__list--dropdown .choices__item--selectable {
    padding-right: 1.35rem !important; /* Match input padding, remove huge library default */
}
.choices__list--dropdown .choices__item--selectable::after {
    display: none !important; /* Hide 'Press to select' text */
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: #f8f8f8;
    color: #3A3C42;
}

/* When dropdown is open - create seamless connection between field and dropdown */
/* Normal dropdown (opens downward) */
.choices.is-open:not(.is-flipped) .choices__inner {
    border-top-left-radius: 1.25rem !important;
    border-top-right-radius: 1.25rem !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.choices.is-open:not(.is-flipped) .choices__list--dropdown {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    border-bottom-left-radius: 1.25rem !important;
    border-bottom-right-radius: 1.25rem !important;
    margin-top: -1px;
}

/* Flipped dropdown (opens upward) */
.choices.is-open.is-flipped .choices__inner {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    border-bottom-left-radius: 1.25rem !important;
    border-bottom-right-radius: 1.25rem !important;
}

.choices.is-open.is-flipped .choices__list--dropdown {
    border-top-left-radius: 1.25rem !important;
    border-top-right-radius: 1.25rem !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    margin-bottom: -1px;
}

.form-control.is-valid,
.custom-select.is-valid {
    border-color: #198754 !important;
    background-image: none !important;
}

.form-control.is-valid.api-valid {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right calc(.375em + .1875rem) center !important;
    background-size: calc(.75em + .375rem) calc(.75em + .375rem) !important;
}

.form-control.is-invalid,
.custom-select.is-invalid {
    border-color: #dc3545 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right calc(.375em + .1875rem) center !important;
    background-size: calc(.75em + .375rem) calc(.75em + .375rem) !important;
}

.choices.is-valid .choices__inner {
    border-color: #198754 !important;
}

.choices.is-invalid .choices__inner {
    border-color: #dc3545 !important;
}

/* Validation для альтернативных display modes */
.radio-group.is-invalid .radio-option {
    border-color: #dc3545;
}
.checkbox-group.is-invalid .checkbox-option {
    border-color: #dc3545;
}
.toggle-switch.is-invalid .toggle-track {
    border-color: #dc3545 !important;
}

/* Эффект мигания для групп */
.radio-group.is-invalid.animate-error .radio-option,
.checkbox-group.is-invalid.animate-error .checkbox-option,
.toggle-switch.is-invalid.animate-error .toggle-track {
    animation: form-error-blink 0.3s 2;
}

.captcha-container {}

.captcha-image {
    height: var(--input-height);
    width: 150px;
    max-width: 100%;
    border-radius: 1.25rem;
    background-color: #f8f8f8;
    border: 1px solid #e5e7eb;
    object-fit: cover;
}

.captcha-container .custom-input {
    flex-grow: 1;
}

.btn-captcha-refresh {
    flex-shrink: 0;
    width: auto; /* Allow w-100 from HTML to work on mobile */
    min-width: 58px;
    height: var(--input-height);
    padding: 0;
    border-radius: 1.25rem;
    border: 1px solid #e5e7eb;
    background-color: #f8f8f8;
    color: var(--theme-header);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

@media (min-width: 576px) {
    .btn-captcha-refresh {
        width: 58px; /* Fixed size on desktop */
    }
}

.btn-captcha-refresh:hover {
    background-color: #e9ecef;
}

.btn-captcha-refresh:focus {
    box-shadow: 0 0 0 .2rem var(--theme-focus-shadow);
}

@media (min-width: 576px) {
    .header-flex {
        margin-bottom: 2.5rem;
        gap: 0;
    }

    .logo {
        max-width: 180px;
    }

    h1.h3.header-title {
        font-size: 2.25rem;
        text-align: right;
    }
}

@keyframes form-error-blink {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }

    50% {
        box-shadow: 0 0 8px 2px rgba(220, 53, 69, 0.5);
    }
}

.is-invalid.animate-error {
    animation: form-error-blink 0.3s 2;
}

/* Подсказки валидации не сдвигают соседние поля */
[data-field-container] .invalid-feedback {
    position: absolute;
    bottom: -1.25rem;
    left: 0;
    font-size: 0.8rem;
}

.choices.is-invalid.animate-error .choices__inner {
    animation: form-error-blink 0.3s 2;
}

/* Two-line select option styles for Choices.js */
.choices[data-type*="select-one"] .choices__inner {
    display: flex;
    align-items: center;
    min-height: var(--input-height);
    padding-top: 0;
    padding-bottom: 0;
}

/* Placeholder styling for Choices.js - match other input placeholders */
.choices__placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
}

/* Style for placeholder in CLOSED select (the visible button text when nothing selected) */
.choices[data-type*="select-one"] .choices__inner .choices__item[data-value=""],
.choices[data-type*="select-one"] .choices__inner .choices__item.is-placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
}

/* Ensure selected items in SINGLE select keep their normal color */
.choices[data-type*="select-one"] .choices__inner .choices__item:not([data-value=""]):not(.is-placeholder) {
    color: #3A3C42 !important;
}

/* Hide only placeholder from dropdown, disabled options should be visible as separators */
.choices__list--dropdown .choices__item[data-value=""] {
    display: none !important;
}

/* Title and subtitle in selected item (visible in the select button) */
.choices-item-title {
    font-size: 1.05rem;
    font-weight: 400;
    color: #3A3C42;
    line-height: 1.3;
}

.choices-item-subtitle {
    font-size: 0.90rem;
    color: #6b7280;
    line-height: 1.3;
    margin-top: 2px;
}

/* Title and subtitle in dropdown options */
.choices__list--dropdown .choices-option-title {
    font-size: 1.10rem;
    font-weight: 600;
    color: #3A3C42;
    line-height: 1.4;
}

.choices__list--dropdown .choices-option-subtitle {
    font-size: 0.90rem;
    color: #6b7280;
    line-height: 1.3;
    margin-top: 3px;
}

/* Hover and highlight states for dropdown */
.choices__list--dropdown .choices__item--selectable.is-highlighted .choices-option-title {
    color: #3A3C42;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted .choices-option-subtitle {
    color: #4b5563;
}

/* Disabled option styling */
.choices__list--dropdown .choices__item--disabled .choices-option-title {
    color: #9ca3af;
}

.choices__list--dropdown .choices__item--disabled .choices-option-subtitle {
    color: #d1d5db;
}

/* Adjust dropdown item padding for two-line options */
.choices__list--dropdown .choices__item:has(.choices-option-subtitle) {
    padding: 12px 16px;
}

/* Image and Cover field styles - match form aesthetics */
.image-field-container img,
.cover-field-container img {
    border-radius: 1.25rem;
}

.image-field-container .image-placeholder,
.cover-field-container .cover-placeholder {
    border-radius: 1.25rem;
    border: 1px solid #e5e7eb;
}

/* MeasureInfo field styles */
.measure-info-container {
    border-radius: 1.25rem;
}

.measure-info-container.card-bordered {
    border: 1px solid #e5e7eb;
    background-color: #fff;
    padding: 1.25rem;
}

.measure-info-container.card-filled {
    background-color: #f8f8f8;
    padding: 1.25rem;
}

.measure-info-container.card-minimal {
    padding: 0.5rem 0;
}

/* Название мероприятия - стиль как у Spacer Label */
.measure-info-title {
    margin-bottom: 0.75rem;
}

.measure-info-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 0.35rem 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 0.25rem;
}

@media (max-width: 575px) {
    .measure-info-row {
        flex-direction: column;
        gap: 0.1rem;
    }
}

.measure-info-row .measure-info-value {
    flex: 0 1 auto;
    text-align: left;
    max-width: 100%;
}

/* Mobile specific adjustment removed as default is now left aligned */

.measure-info-row:last-child {
    border-bottom: none;
}

.measure-info-label {
    color: #6b7280;
    font-size: 0.95rem;
}

.measure-info-value {
    font-weight: 500;
    color: #3A3C42;
    font-size: 0.95rem;
}

/* Описание мероприятия — типографика санитизированного HTML */
.measure-description {
    font-size: 0.95rem;
    color: #3A3C42;
    line-height: 1.55;
}

.measure-description > div {
    margin-top: 0.35rem;
}

.measure-description p {
    margin: 0 0 0.5em;
}

.measure-description p:last-child {
    margin-bottom: 0;
}

.measure-description ul,
.measure-description ol {
    margin: 0.25em 0 0.5em;
    padding-left: 1.5em;
}

.measure-description li {
    margin-bottom: 0.2em;
}

.measure-description a {
    color: #2563eb;
    text-decoration: underline;
}

.measure-description a:hover {
    color: #1d4ed8;
}

.measure-description h1,
.measure-description h2,
.measure-description h3,
.measure-description h4,
.measure-description h5,
.measure-description h6 {
    margin: 0.5em 0 0.25em;
    font-weight: 600;
    line-height: 1.3;
}

.measure-description h1 { font-size: 1.25rem; }
.measure-description h2 { font-size: 1.15rem; }
.measure-description h3 { font-size: 1.05rem; }

/* ========================================
   RADIO GROUP
   ======================================== */

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-group .radio-option {
    padding: 0.65rem 1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    transition: border-color 0.2s, background-color 0.2s;
}

.radio-group .radio-option:hover {
    border-color: var(--theme-header, #2062a5);
    background-color: rgba(0, 0, 0, 0.02);
}

.radio-group .radio-option:has(input:checked) {
    border-color: var(--theme-header, #2062a5);
    background-color: rgba(32, 98, 165, 0.05);
}

.radio-group .form-check-input:checked {
    background-color: var(--theme-header, #2062a5);
    border-color: var(--theme-header, #2062a5);
}

.radio-group .radio-option-title {
    display: block;
    font-weight: 600;
}

.radio-group .radio-option-subtitle {
    display: block;
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.15rem;
}

/* ========================================
   CHECKBOX GROUP
   ======================================== */

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-group .checkbox-option {
    padding: 0.65rem 1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    transition: border-color 0.2s, background-color 0.2s;
}

.checkbox-group .checkbox-option:hover {
    border-color: var(--theme-header, #2062a5);
    background-color: rgba(0, 0, 0, 0.02);
}

.checkbox-group .checkbox-option:has(input:checked) {
    border-color: var(--theme-header, #2062a5);
    background-color: rgba(32, 98, 165, 0.05);
}

.checkbox-group .form-check-input:checked {
    background-color: var(--theme-header, #2062a5);
    border-color: var(--theme-header, #2062a5);
}

.checkbox-group .checkbox-option-title {
    display: block;
    font-weight: 600;
}

.checkbox-group .checkbox-option-subtitle {
    display: block;
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.15rem;
}

/* ========================================
   TOGGLE SWITCH (2 or 3 positions with sliding pill)
   ======================================== */

.toggle-switch {
    position: relative;
}

.toggle-track {
    display: flex;
    border: 1px solid #dee2e6;
    border-radius: 1.25rem; /* Match custom-input radius */
    overflow: hidden;
    position: relative;
    background: #fff;
}
.toggle-track .toggle-option {
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-pill {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 0;
    background: var(--theme-button, var(--theme-header, #2062a5));
    transition: left 0.25s ease, width 0.25s ease, opacity 0.25s ease;
    z-index: 0;
    opacity: 0;
}

.toggle-track .toggle-option {
    flex: 1;
    position: relative;
    z-index: 1;
    /* Match .custom-input height via variable */
    height: var(--input-height);
    padding: 0 1.35rem;
    font-size: 1.15rem;
    line-height: 1.2; /* Tighter line height */
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: center;
    color: #495057;
    transition: color 0.2s;
    /* Flex alignment is handled by display: flex on the element itself or parent? 
       Parent .toggle-track has display: flex. 
       .toggle-option is a button. Buttons center content by default, but let's be explicit. */
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-track .toggle-option:not(:last-child) {
    border-right: 1px solid #dee2e6;
}

.toggle-track .toggle-option.active {
    color: #fff;
}

.toggle-track .toggle-option:hover:not(.active) {
    background-color: rgba(0, 0, 0, 0.03);
}

/* Field alignment - выравнивание полей в ряду по верхнему краю */
[data-field-container] {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: relative;
}

/* ========================================
   WIZARD MODE (block-by-block carousel)
   ======================================== */

.wizard-step {
    display: none;
    width: 100%;
}
.wizard-step.active {
    display: block;
}

/* Slide animations */
.wizard-step.wizard-slide-in-right {
    animation: wizardSlideInRight 0.35s ease-out;
}
.wizard-step.wizard-slide-in-left {
    animation: wizardSlideInLeft 0.35s ease-out;
}
.wizard-step.wizard-fade-in {
    animation: wizardFadeIn 0.35s ease-out;
}

@keyframes wizardSlideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes wizardSlideInLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes wizardFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Progress indicator */
.wizard-progress {
    text-align: center;
    padding: 1rem 0 0.5rem;
}
.wizard-dots {
    display: inline-flex;
    gap: 0.5rem;
}
.wizard-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dee2e6;
    transition: background 0.3s, transform 0.3s;
}
.wizard-dot.active {
    background: var(--theme-header, #2062a5);
    transform: scale(1.3);
}
.wizard-dot.completed {
    background: var(--theme-header, #2062a5);
    opacity: 0.5;
}

/* Navigation buttons */
.wizard-nav {
    margin-top: 1rem;
    margin-bottom: 1rem;
}
.wizard-nav .btn {
    border-radius: 1rem;
}

/* Отступ снизу для абсолютного invalid-feedback */
.card .row.gy-4 {
    padding-bottom: 0.5rem;
}

/* ========================================
   DESKTOP COMPACT MODE (Scale down by ~20%)
   ======================================== */
@media (min-width: 992px) {
    :root {
        --input-height: 3rem;
    }

    h1.h3.header-title {
        font-size: 1.8rem !important;
    }

    .logo {
        max-width: 160px !important;
    }

    .card {
        padding: 2.5rem 3rem !important; /* Reduced from p-5 */
    }

    .custom-input,
    .custom-select {
        font-size: 0.95rem !important;
        height: var(--input-height) !important;
        padding: 0 1.2rem !important;
    }

    .choices__inner {
        padding: 0.65rem 1.2rem !important;
        min-height: var(--input-height) !important;
        font-size: 0.95rem !important;
    }

    .choices[data-type*="select-one"] .choices__inner {
        display: flex;
        align-items: center;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .choices__placeholder,
    .choices__inner .choices__item.is-placeholder {
        font-size: 0.95rem !important;
        color: #9ca3af !important;
    }

    /* Target the selected item text specifically in single select */
    .choices__list--single {
        padding: 0 !important;
    }
    .choices__list--single .choices__item {
        font-size: 0.95rem !important;
        padding: 0 !important;
    }

    .choices[data-type*="select-multiple"] .choices__inner {
        padding-bottom: calc(0.65rem - 6px) !important; /* Adjust for chips */
    }

    .btn-custom,
    .wizard-nav .btn {
        font-size: 1.05rem !important;
        padding: 0.7rem 1.5rem !important;
    }

    h2.h4 {
        font-size: 1.25rem !important;
    }

    .toggle-track .toggle-option {
        height: var(--input-height) !important; 
        font-size: 1rem !important;
        padding: 0 1rem !important;
    }

    [data-field-container] .form-label {
        min-height: 2.3rem !important; /* Enough for 2 lines at 0.9rem font-size */
        display: flex !important;
        align-items: flex-end !important;
        font-size: 0.9rem !important;
        margin-bottom: 0.35rem !important;
        line-height: 1.2 !important;
    }

    .choices__list--dropdown .choices__item {
        font-size: 0.95rem !important;
    }

    .choices-item-title, 
    .choices-option-title {
        font-size: 0.95rem !important;
    }

    .choices-item-subtitle, 
    .choices-option-subtitle {
        font-size: 0.8rem !important;
    }

    .choices__list--multiple .choices__item {
        font-size: 0.85rem !important;
        padding: 0.2rem 0.6rem !important;
        margin-bottom: 4px !important;
    }

    .radio-group .radio-option, 
    .checkbox-group .checkbox-option {
        padding: 0.45rem 0.85rem !important;
        font-size: 0.95rem !important;
    }

    .form-check-label,
    .radio-option-title,
    .checkbox-option-title {
        font-size: 0.9rem !important;
        line-height: 1.3 !important;
    }

    .captcha-image {
        height: var(--input-height) !important;
        width: 120px !important;
    }

    .btn-captcha-refresh {
        width: var(--input-height) !important;
        height: var(--input-height) !important;
    }
}

/* Fix label alignment on desktop: ensure all labels take up at least 2 lines of height */
@media (min-width: 768px) {
    [data-field-container] .form-label {
        min-height: 2.5rem; /* Reduced from 3rem to reduce gap */
        display: flex;
        align-items: flex-end; /* Align text to bottom to stick to input */
        line-height: 1.25; /* Slightly tighter line height */
    }
}

/* ========================================
   EMBED MODE (iframe embedding)
   ======================================== */

html.embed-mode {
    background: transparent !important;
    background-color: transparent !important;
    min-height: auto !important;
    /* html clips, body scrolls */
    height: 100%;
    overflow: hidden;
}

body.embed-mode {
    background: transparent !important;
    background-color: transparent !important;
    min-height: auto !important;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;           /* Firefox */
    -ms-overflow-style: none;        /* IE/Edge */
}

body.embed-mode::-webkit-scrollbar {
    display: none;                   /* Chrome/Safari/Opera */
}

body.embed-mode.scroll-fade {
    -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 4rem), transparent 100%);
    mask-image: linear-gradient(to bottom, black calc(100% - 4rem), transparent 100%);
}

body.embed-mode .main-container {
    padding: 0.5rem;
    margin: 0;
    min-height: auto;
    padding-bottom: 2.5rem; /* Space for scroll indicator */
}

body.embed-mode .header-flex {
    display: none !important;
}

/* Ensure the form container has no extra spacing */
body.embed-mode .container {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Wizard navigation buttons consistency ONLY in embed mode */
body.embed-mode .wizard-prev.btn-outline-secondary {
    background-color: #fff !important;
    border-color: #dee2e6 !important;
    color: #6c757d !important;
}

body.embed-mode .wizard-prev.btn-outline-secondary:hover {
    background-color: #f8f9fa !important;
    border-color: #adb5bd !important;
}

body.embed-mode .wizard-nav .btn-custom {
    opacity: 1 !important;
    background-color: var(--theme-button, var(--theme-header)) !important;
    border-color: var(--theme-button, var(--theme-header)) !important;
}

/* Full-width form in wizard + embed mode */
body.embed-mode.wizard-active .main-container {
    max-width: 100% !important;
    padding-left: 0;
    padding-right: 0;
}

body.embed-mode.wizard-active .main-container > .row > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
}

/* Embed close button (inside first card in iframe) */
body.embed-mode .card {
    position: relative;
}
.embed-close-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 100;
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0.25rem;
}
.embed-close-btn:hover {
    color: #333;
}

/* Scroll fade arrow on html (outside body mask) */
html.embed-mode.scroll-fade::after {
    content: '\25BC';
    position: fixed;
    bottom: 0.4rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    color: #FF5101;
    pointer-events: none;
    z-index: 200;
    filter: drop-shadow(0 0 4px white) drop-shadow(0 0 8px white);
    animation: scrollBounce 1.5s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

/* Embed: progress banner while registration is in progress */
.embed-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    background: #fff;
    border-radius: 1.5rem;
    position: relative;
    z-index: 10;
}

.embed-progress-icon {
    width: 48px;
    height: 48px;
    color: var(--theme-button, var(--theme-header));
    margin-bottom: 1.25rem;
    animation: embedSpin 2s linear infinite;
}
.embed-progress-icon svg {
    width: 100%;
    height: 100%;
}

@keyframes embedSpin {
    to { transform: rotate(360deg); }
}

.embed-progress-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: #3A3C42;
    margin-bottom: 1.25rem;
    min-height: 1.5em;
}

.embed-progress-track {
    width: 100%;
    max-width: 260px;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.embed-progress-bar {
    height: 100%;
    width: 0;
    background: var(--theme-button, var(--theme-header));
    border-radius: 3px;
    transition: width 1.5s ease;
}

/* Inline result display in embed mode (instead of Bootstrap modal overlay) */
body.embed-mode #statusModal.embed-inline-result {
    display: block !important;
    position: static;
    opacity: 1;
    visibility: visible;
    background: none;
    padding: 0;
}
body.embed-mode #statusModal.embed-inline-result .modal-dialog {
    margin: 0 auto;
    max-width: 100%;
    min-height: auto;
    transform: none;
    padding: 0;
    align-items: stretch;
}
body.embed-mode #statusModal.embed-inline-result .modal-content {
    border-radius: 1.5rem;
}
body.embed-mode #statusModal.embed-inline-result .modal-header .btn-close {
    display: none;
}

/* Compact QR code in embed */
body.embed-mode #statusModal.embed-inline-result .modal-title {
    font-size: 1.4rem;
}
body.embed-mode #statusModal.embed-inline-result .lead-modal {
    font-size: 1.1rem;
}
body.embed-mode #statusModal.embed-inline-result #qrCodeImage {
    padding: 0.75rem;
    border-radius: 1rem;
}
body.embed-mode #statusModal.embed-inline-result #qrCodeImage img {
    max-width: 180px;
    height: auto;
}
body.embed-mode #statusModal.embed-inline-result .modal-body {
    padding: 1rem 1.5rem 1.5rem;
}
body.embed-mode #statusModal.embed-inline-result .modal-candidate-id {
    font-size: 1.8rem;
    padding: 0.25rem 0;
}
body.embed-mode #statusModal.embed-inline-result .btn-custom-modal {
    font-size: 1rem;
    padding: 0.6rem 1.25rem;
}

/* Route disabled message */
.route-disabled-message {
    text-align: center;
    padding: 2rem 1rem;
    color: #495057;
    font-size: 1.05rem;
    line-height: 1.6;
}