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

@font-face {
    font-family: 'Circe';
    src: url('/assets/fonts/Circe-Light.woff') format('woff');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Circe';
    src: url('/assets/fonts/Circe-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Circe';
    src: url('/assets/fonts/Circe-Bold.woff') format('woff');
    font-weight: 700;
    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;
    --radius-card: 1.5rem;
    --radius-input: 1.25rem;
    --radius-button: 1rem;
    --radius-modal: 1.5rem;
    --radius-chip: 0.75rem;
}

body[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-tint: #fff4ef;
    --theme-choices-chip-border: #ffd0b8;
    --theme-choices-chip-text: #FF5101;
    --theme-choices-close-border: #e54900;
    --theme-modal-info-gradient: linear-gradient(155deg, #ff6b1f 0%, #e55200 40%, #cc4900 100%);
    --embed-accent: #e55200;
    --embed-accent-light: #fff4ef;
    --embed-accent-border: #ffd0b8;
    --radius-card: 0.5rem;
    --radius-input: 0.75rem;
    --radius-button: 0.75rem;
    --radius-modal: 0.5rem;
    --radius-chip: 0.5rem;
    --font-main: 'Roboto Condensed', Arial, sans-serif;
    --font-header: 'Montserrat', Arial, sans-serif;
}

body[data-theme$="cpb"] {
    background-color: #faf9f8;
}

body[data-theme$="cpb"] .header-flex {
}

/* CPB: form title stays dark to match logo, MoskvichSans like default theme */
body[data-theme$="cpb"] h1.h3.header-title {
    color: var(--theme-header);
    font-family: 'MoskvichSans-Medium', sans-serif;
}

/* CPB: even shadow around card */
body[data-theme$="cpb"] .card.shadow {
    box-shadow: 0 0 1rem rgba(0,0,0,.08) !important;
}

body[data-theme$="czn"] {
    --font-main: 'Circe', Arial, sans-serif;
    --font-header: 'Circe', Arial, sans-serif;
    --theme-header: #3a5dae;
    --theme-header-dark: #2f4d91;
    --theme-header-focus-shadow: rgba(58, 93, 174, .25);
    --theme-button: #3a5dae;
    --theme-button-dark: #2f4d91;
    --theme-button-focus-shadow: rgba(58, 93, 174, .25);
    --theme-primary-focus: #3a5dae;
    --theme-focus-shadow: rgba(58, 93, 174, .25);
    --theme-choices-chip-bg: #edf2fa;
    --theme-tint: #edf2fa;
    --theme-choices-chip-border: #b1c9e5;
    --theme-choices-chip-text: #3a5dae;
    --theme-choices-close-border: #2f4d91;
    --theme-modal-info-gradient: linear-gradient(155deg, #4878d4 0%, #3a5dae 40%, #2f4d91 100%);
    --embed-accent: #3a5dae;
    --embed-accent-light: #edf2fa;
    --embed-accent-border: #b1c9e5;
    --radius-card: 0.25rem;
    --radius-input: 0.25rem;
    --radius-button: 0.25rem;
    --radius-modal: 0.3rem;
    --radius-chip: 0.25rem;
}

/* CZN theme font-size overrides (match cznmos.ru: inputs/buttons 16px, headings 20px bold) */
body[data-theme$="czn"] h2.h4 {
    font-size: 1.25rem;
    font-weight: 600;
}
body[data-theme$="czn"] .custom-input,
body[data-theme$="czn"] .custom-select,
body[data-theme$="czn"] .custom-select option,
body[data-theme$="czn"] .choices,
body[data-theme$="czn"] .choices__list--dropdown .choices__item,
body[data-theme$="czn"] .toggle-track .toggle-option {
    font-size: 1rem;
}
body[data-theme$="czn"] .btn-custom {
    font-size: 1.1rem;
}
body[data-theme$="czn"] .btn-custom-modal {
    font-size: 1.05rem;
}
body[data-theme$="czn"] .option-cpb,
body[data-theme$="czn"] .option-mfc {
    font-size: 1rem !important;
}

body[data-theme$="mk"] {
    --theme-header: #2062a5;
    --theme-header-dark: #1c568f;
    --theme-header-focus-shadow: rgba(32, 98, 165, .25);
    --theme-modal-info-gradient: linear-gradient(155deg, #3078c4 0%, #2062a5 40%, #1a548d 100%);
    --embed-accent: #2062a5;
    --embed-accent-light: #eef4fa;
    --embed-accent-border: #b8d2eb;
    --theme-primary-focus: #007BFF;
    --theme-focus-shadow: rgba(0, 123, 255, .25);
    --theme-choices-chip-bg: #eef4fa;
    --theme-tint: #eef4fa;
    --theme-choices-chip-border: #b8d2eb;
    --theme-choices-chip-text: #2062a5;
    --theme-choices-close-border: #1c568f;
}

/* SVO — «Работа для героев» (work-svo.cznmos.ru): оливковая палитра, Circe, бежевый фон.
   Цвета сняты с боевого сайта: green #4F6631, lightGreen #b5cb92, border #BAC8A4,
   фон страницы #efefe4, нейтральные блоки #F5F5F5. */
body[data-theme$="svo"] {
    --font-main: 'Circe', Arial, sans-serif;
    --font-header: 'Circe', Arial, sans-serif;
    --theme-header: #4F6631;
    --theme-header-dark: #3e5127;
    --theme-header-focus-shadow: rgba(79, 102, 49, .25);
    --theme-button: #4F6631;
    --theme-button-dark: #3e5127;
    --theme-button-focus-shadow: rgba(79, 102, 49, .25);
    --theme-primary-focus: #4F6631;
    --theme-focus-shadow: rgba(79, 102, 49, .25);
    --theme-choices-chip-bg: #eef1e5;
    --theme-tint: #eef1e5;
    --theme-choices-chip-border: #BAC8A4;
    --theme-choices-chip-text: #4F6631;
    --theme-choices-close-border: #3e5127;
    --theme-modal-info-gradient: linear-gradient(155deg, #6c8a45 0%, #4F6631 40%, #3e5127 100%);
    --embed-accent: #4F6631;
    --embed-accent-light: #eef1e5;
    --embed-accent-border: #BAC8A4;
    --radius-card: 0.75rem;
    --radius-input: 0.5rem;
    --radius-button: 0.5rem;
    --radius-modal: 0.75rem;
    --radius-chip: 0.5rem;
}

/* Фон страницы — бежевый, как на work-svo.cznmos.ru (:root background-color) */
body[data-theme$="svo"] {
    background-color: #efefe4;
}

/* Заголовок формы шрифтом темы, а не MoskvichSans */
body[data-theme$="svo"] h1.h3.header-title {
    color: var(--theme-header);
    font-family: 'Circe', Arial, sans-serif;
}

/* Размеры как на сайте-образце: базовый текст 16px, заголовки блоков 20px полужирные */
body[data-theme$="svo"] h2.h4 {
    font-size: 1.25rem;
    font-weight: 600;
}
body[data-theme$="svo"] .custom-input,
body[data-theme$="svo"] .custom-select,
body[data-theme$="svo"] .custom-select option,
body[data-theme$="svo"] .choices,
body[data-theme$="svo"] .choices__list--dropdown .choices__item,
body[data-theme$="svo"] .toggle-track .toggle-option {
    font-size: 1rem;
}
body[data-theme$="svo"] .btn-custom {
    font-size: 1.1rem;
}

/* ===== Темы форм обратной связи (os.mosfuture.ru / os.cznmos.ru / os.mycareer.moscow) =====
   Наследуют базовые темы через суффиксные селекторы [data-theme$="..."] выше;
   здесь — только отличия по прототипу ОС: фон страницы, tint, радиусы, заголовки. */

body[data-theme="os_cpb"] {
    --radius-card: 16px;
    --radius-input: 12px;
    --radius-button: 12px;
    --radius-modal: 16px;
    --radius-chip: 12px;
    --theme-tint: #fff2ea;
    background-color: #faf6f2;
}
body[data-theme="os_czn"] {
    --radius-card: 6px;
    --radius-input: 4px;
    --radius-button: 4px;
    --radius-modal: 6px;
    --radius-chip: 4px;
    --theme-tint: #eaeef8;
    background-color: #f1f4fa;
}

body[data-theme="os_mk"] {
    --radius-card: 12px;
    --radius-input: 8px;
    --radius-button: 8px;
    --radius-modal: 12px;
    --radius-chip: 8px;
    --theme-tint: #e6f0f9;
    background-color: #eef4fb;
}
/* Заголовок анкеты ОС берёт типографику темы (акцентный цвет + шрифт заголовков)
   вместо прежнего тёмно-синего хардкода #122036: заголовки блоков, кнопки и чипы
   уже красятся из --theme-header, и h1 оставался единственным чужим элементом.
   Названия анкет длиннее «Регистрации на мероприятие» — отсюда более мелкий кегль,
   плотный трекинг и balance-перенос, чтобы двухстрочный заголовок делился ровно. */
body[data-theme="os_cpb"] h1.h3.header-title,
body[data-theme="os_czn"] h1.h3.header-title,
body[data-theme="os_mk"] h1.h3.header-title {
    font-family: var(--font-header);
    font-weight: 600;
    color: var(--theme-header);
    font-size: clamp(1.15rem, 0.95rem + 0.9vw, 1.55rem);
    line-height: 1.25;
    letter-spacing: -0.01em;
    text-wrap: balance;
}

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%;
}

/* REG-181: тема по полю мероприятия приходит с /api/measure — до ответа форма скрыта, чтобы
   не перекрашиваться на глазах (класс ставит form.php или app.js, снимает app.js). Анимация —
   страховка без JS: через 3 с форма видна в любом случае, в теме маршрута. Прячется .row, а не
   сам контейнер: у контейнера во встроенном режиме своя анимация появления (rf-embed-failsafe) */
.main-container.rf-theme-pending > .row {
    visibility: hidden;
    animation: rf-theme-reveal 0s linear 3s forwards; /* 3 с — утверждено Сергеем 17.10.2026 (REG-181) */
}

@keyframes rf-theme-reveal {
    to { visibility: visible; }
}

.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.3rem;
    margin: 0;
    font-weight: 500;
    text-align: right;
    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 */
}

.card h2.h4.mt-4 {
    margin-top: 2.5rem !important;
}

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

.header-title-group {
    flex: 1 1 60%;
    min-width: 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: 22px;
    height: 22px;
    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: var(--radius-card);
    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: var(--radius-input);
    background-color: #f8f8f8;
}

textarea.custom-input {
    height: auto;
    min-height: calc(var(--input-height) * 2.25);
    padding: 1rem 1.35rem;
    line-height: 1.45;
    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: var(--radius-button);
    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 redesign v2 ─── */
.modal-custom-content {
    border-radius: var(--radius-modal);
    color: #fff;
    border: none;
    padding: 0;
    transition: background-color .3s ease-in-out;
    position: relative;
    overflow: hidden;
}

.modal-custom-content .modal-header {
    padding: 0.75rem 1rem 0;
}

.modal-custom-content .modal-body {
    padding: 0 2rem 2rem;
}

/* Subtle geometric accent overlays */
.modal-custom-content::before {
    content: '';
    position: absolute;
    top: -60%;
    right: -20%;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    pointer-events: none;
}
.modal-custom-content::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -15%;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
    pointer-events: none;
}

.modal-custom-content.modal-state-success {
    background: linear-gradient(155deg, #1a9f5c 0%, #15804a 40%, #117a45 100%);
}

.modal-custom-content.modal-state-info {
    background: var(--theme-modal-info-gradient, linear-gradient(155deg, #4878d4 0%, #3a5dae 40%, #2f4d91 100%));
}

.modal-custom-content.modal-state-danger {
    background: linear-gradient(155deg, #e04555 0%, #c93545 40%, #b52d3c 100%);
}

.modal-custom-content.modal-state-loading {
    background: linear-gradient(155deg, #f8f8fa 0%, #f0f0f4 100%);
    color: #3A3C42;
}
.modal-custom-content.modal-state-loading::before,
.modal-custom-content.modal-state-loading::after {
    display: none;
}

.modal-custom-content .modal-body {
    position: relative;
    z-index: 1;
}

.modal-header .btn-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 10;
    width: 32px;
    height: 32px;
    border: none;
    background-color: rgba(255,255,255,0.15);
    border-radius: 50%;
    opacity: 1;
    filter: invert(1) grayscale(100%) brightness(200%);
    padding: 0;
    transition: background-color 0.2s;
}
.modal-header .btn-close:hover {
    background-color: rgba(255,255,255,0.25);
}

/* ─── Modal icon ─── */
.modal-state-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.18);
    animation: modalIconPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.modal-state-icon svg {
    width: 28px;
    height: 28px;
    color: #fff;
}
.modal-state-icon .check-path {
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: modalDrawCheck 0.6s 0.3s ease forwards;
}

@keyframes modalIconPop {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes modalDrawCheck {
    to { stroke-dashoffset: 0; }
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    width: 100%;
    text-align: center;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.lead-modal {
    font-size: 1rem;
    font-weight: 400;
    color: #fff;
    opacity: 0.92;
    line-height: 1.4;
}

/* ─── Candidate ID badge ─── */
.modal-candidate-id {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    padding: .5rem 0;
}

.modal-candidate-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin: 0.75rem auto;
    padding: 0.75rem 2rem;
    background: rgba(255,255,255,0.13);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 0.75rem;
}

.modal-candidate-badge__label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    opacity: 0.75;
    margin-bottom: 0.2rem;
    color: #fff;
}

.modal-candidate-badge .modal-candidate-id {
    padding: 0;
    display: block;
}

/* ─── QR code container ─── */
#qrCodeContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

#qrCodeImage {
    background-color: #fff;
    padding: 1rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

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

#qrEmailNotice {
    opacity: 0.85;
    font-size: 0.88rem;
    line-height: 1.4;
}

/* ─── Online link blocks ─── */
.online-link-block {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 0.6rem;
    padding: 0.7rem 1rem;
    max-width: 100%;
    word-break: break-all;
}

.online-link-url {
    color: #fff;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: underline;
    text-decoration-color: rgba(255,255,255,0.4);
    text-underline-offset: 2px;
    flex: 1;
    min-width: 0;
}

.online-link-copy {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 0.4rem;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.online-link-copy:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.35);
    color: #fff;
}

.online-link-copy.copied {
    color: #a5f3c0;
    border-color: rgba(165,243,192,0.4);
}

.online-links-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem 0.5rem;
    padding: 0.6rem 1rem;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    max-width: 100%;
    word-break: break-all;
}

.online-links-item .component-name {
    font-weight: 600;
    font-size: 0.82rem;
    opacity: 0.8;
    flex: 1 1 100%;
}

.online-links-item .online-link-url {
    font-size: 0.9rem;
    flex: 1;
    min-width: 0;
}

.online-links-item .online-link-copy {
    width: 28px;
    height: 28px;
}

/* Online links section heading */
#onlineLinksSection .fw-semibold {
    font-weight: 600;
    font-size: 0.95rem;
    opacity: 0.9;
}

/* Personal link notice */
.online-link-notice {
    font-size: 0.82rem;
    opacity: 0.7;
    margin-top: 0.5rem;
    font-style: italic;
}
.online-link-notice a {
    color: #fff;
    text-decoration: underline;
}

/* ─── Modular results ─── */
#modularResultsList .fw-semibold {
    font-weight: 600;
    font-size: 0.95rem;
    opacity: 0.9;
}
#modularResultsList .text-success {
    color: rgba(255,255,255,0.9) !important;
}
#modularResultsList .text-danger {
    color: #fbb !important;
}
#modularResultsList .text-muted {
    color: rgba(255,255,255,0.5) !important;
}

/* Module status icons */
.modal-module-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.7rem;
}
.modal-module-icon--ok {
    background: rgba(255,255,255,0.2);
    color: #fff;
}
.modal-module-icon--fail {
    background: rgba(255,80,80,0.3);
    color: #fbb;
}
.modal-module-icon--pending {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
}

/* ─── Close button ─── */
.btn-custom-modal {
    display: block;
    width: 100%;
    border: 1.5px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    padding: .7rem 1.25rem;
    border-radius: 0.65rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-custom-modal:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.5);
    color: #fff;
}

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

/* Loading state button override */
.modal-state-loading .btn-custom-modal {
    display: none;
}

/* ─── Loading spinner (used in both standalone & embed) ─── */
.modal-loading-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    position: relative;
}
.modal-loading-spinner::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid #e5e7eb;
    border-top-color: var(--theme-button, #2c5ab5);
    border-radius: 50%;
    animation: modalSpin 0.9s linear infinite;
}
@keyframes modalSpin {
    to { transform: rotate(360deg); }
}

.modal-loading-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: #6b6b78;
    margin-bottom: 0.75rem;
    min-height: 1.5em;
    text-align: center;
}

.modal-loading-track {
    width: 200px;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
}

.modal-loading-bar {
    height: 100%;
    width: 0;
    background: var(--theme-button, #2c5ab5);
    border-radius: 2px;
    transition: width 1.5s ease;
}

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

.choices__inner {
    padding: .95rem 1.35rem;
    border-radius: var(--radius-input);
    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: var(--radius-chip) !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: var(--radius-input);
    z-index: 20;
    /* choices.min.css sets word-break: break-all on the list — long options were torn
       mid-word («профе/ссиональный»). Wrap by words; break a word only if it alone is
       wider than the list. */
    word-break: normal;
    overflow-wrap: break-word;
}

.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;
}

.choices__list--dropdown .choices__item--selectable.is-selected {
    background-color: #eef4fa;
    color: #2062a5;
    font-weight: 500;
}

.choices__list--dropdown .choices__item--selectable.is-selected .choices-option-title {
    color: #2062a5;
    font-weight: 600;
}

.choices__list--dropdown .choices__item--selectable.is-selected.is-highlighted {
    background-color: #e2eef9;
    color: #2062a5;
}

/* 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: var(--radius-input) !important;
    border-top-right-radius: var(--radius-input) !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: var(--radius-input) !important;
    border-bottom-right-radius: var(--radius-input) !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: var(--radius-input) !important;
    border-bottom-right-radius: var(--radius-input) !important;
}

.choices.is-open.is-flipped .choices__list--dropdown {
    border-top-left-radius: var(--radius-input) !important;
    border-top-right-radius: var(--radius-input) !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 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.captcha-wrapper {
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}

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

.captcha-refresh-icon {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.65);
    border-radius: 50%;
    color: #999;
    transition: background 0.2s, color 0.2s;
    pointer-events: none;
}

.captcha-wrapper:hover .captcha-refresh-icon {
    background: rgba(255, 255, 255, 0.95);
    color: #555;
}

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

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

    .logo {
        max-width: 180px;
    }

    h1.h3.header-title {
        font-size: 1.6rem;
        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;
}

/* Псевдоплейсхолдер обязательных полей со скрытым label: серое название + красная «*».
   Нативный placeholder нельзя покрасить частично, поэтому рисуем оверлеем поверх поля
   (само поле с пустым плейсхолдером). Прячется JS-ом когда в поле есть значение. */
[data-field-container].has-req-overlay {
    position: relative;
}
.rf-req-ph {
    position: absolute;
    left: 1.35rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 1.15rem;
    line-height: 1;
    pointer-events: none;
    white-space: nowrap;
    max-width: calc(100% - 3rem);
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 2;
}
[data-field-container].field-type-textarea .rf-req-ph {
    top: 1rem;
    transform: none;
}
.rf-req-star {
    color: var(--bs-danger, #dc3545);
}

/* Доп. участники: валидность только по классам is-valid/is-invalid (blur/Продолжить),
   гасим Bootstrap-псевдоклассы :valid/:invalid под .was-validated — иначе обязательные
   поля краснеют, а пустые необязательные зеленеют сразу при показе блока. */
.was-validated #companions-card .form-control:not(.is-valid):not(.is-invalid),
.was-validated #companions-card .form-select:not(.is-valid):not(.is-invalid) {
    border-color: #dee2e6;
    background-image: none;
}

/* Подсказки валидации в потоке с плавным появлением */
[data-field-container] .invalid-feedback {
    font-size: 0.8rem;
    animation: feedbackReveal 0.2s ease;
}

@keyframes feedbackReveal {
    from { opacity: 0; max-height: 0; overflow: hidden; }
    to { opacity: 1; max-height: 3rem; }
}

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

/* Warning (non-blocking) validation */
.form-control.is-warning,
.custom-select.is-warning {
    border-color: #ed6c02 !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='%23ed6c02'%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='%23ed6c02' 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;
}

[data-field-container] .warning-feedback {
    display: none;
    font-size: 0.8rem;
    color: #ed6c02;
    animation: feedbackReveal 0.2s ease;
}

/* Two-line select option styles for Choices.js */
/* Vertical padding is chosen so that a one-line value still fits into min-height
   (field height unchanged), while a value wrapped onto several lines grows the field
   and keeps the same gap to the border as a one-line value instead of touching it. */
.choices[data-type*="select-one"] .choices__inner {
    display: flex;
    align-items: center;
    min-height: var(--input-height);
    padding-top: 12px;
    padding-bottom: 12px;
}

/* 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;
}

/* Выбранное значение в закрытом поле: шрифт названия крупнее поля, из-за этого текст
   стоял на 1px выше, чем в соседних полях ввода и в плейсхолдере того же селекта
   (замер по пикселям на 326/522/900px). Сдвиг только в закрытом поле, не в списке. */
.choices[data-type*="select-one"] .choices__inner .choices__list--single .choices-item-title {
    position: relative;
    top: 1px;
}

.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: var(--radius-input);
}

.image-field-container .image-placeholder,
.cover-field-container .cover-placeholder {
    border-radius: var(--radius-input);
    border: 1px solid #e5e7eb;
}

/* MeasureInfo field styles */
.measure-info-container {
    border-radius: var(--radius-input);
}

.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; }

/* Modules section (parent + per-module cards) */
.measure-modules-section {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.measure-modules-section__title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.15rem;
}

.measure-module-card {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.5rem;
    padding: 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.measure-module-card--selectable {
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.measure-module-card--selectable:hover,
.measure-module-card--selectable:focus-visible {
    border-color: var(--theme-button, #2563eb);
    background: rgba(37, 99, 235, 0.04);
    outline: none;
}

.measure-module-card--selectable.is-selected {
    border-color: var(--theme-button, #2563eb);
    background: rgba(37, 99, 235, 0.07);
    box-shadow: 0 0 0 1px var(--theme-button, #2563eb);
}

.measure-module-card__header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
}

.measure-module-card__title {
    font-weight: 600;
    color: #111827;
    font-size: 0.95rem;
    line-height: 1.3;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.measure-module-card__choice {
    width: 0.95rem;
    height: 0.95rem;
    border-radius: 999px;
    border: 2px solid #cbd5e1;
    flex: 0 0 auto;
    background: #fff;
    box-shadow: inset 0 0 0 3px #fff;
}

.measure-module-card--selectable.is-selected .measure-module-card__choice {
    border-color: var(--theme-button, #2563eb);
    background: var(--theme-button, #2563eb);
}

.measure-module-card__dates {
    color: #6b7280;
    font-size: 0.85rem;
}

.measure-module-card__meta-row {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    color: #6b7280;
    font-size: 0.85rem;
}

.measure-module-card__meta-item {
    display: block;
}

.measure-module-card__meta-label {
    color: #9ca3af;
    margin-right: 0.25rem;
}

.measure-module-card__format {
    font-weight: 500;
    color: #374151;
}

.measure-module-card__description {
    margin-top: 0.15rem;
}

.measure-module-card__description > summary {
    list-style: none;
    cursor: pointer;
    color: #6b7280;
    font-size: 0.85rem;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.measure-module-card__description > summary::-webkit-details-marker { display: none; }

.measure-module-card__description > summary::before {
    content: '▸';
    display: inline-block;
    transition: transform 0.15s ease;
    font-size: 0.75rem;
    color: #9ca3af;
}

.measure-module-card__description[open] > summary::before {
    transform: rotate(90deg);
}

.measure-module-card__description > summary:hover { color: #374151; }

.measure-module-card__description-body {
    margin-top: 0.4rem;
    padding: 0.5rem 0.65rem;
    background: #fff;
    border-radius: 0.35rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 0.88rem;
    line-height: 1.5;
    color: #374151;
}

.measure-module-card__description-body p:last-child,
.measure-module-card__description-body ul:last-child,
.measure-module-card__description-body ol:last-child {
    margin-bottom: 0;
}

.exclusive-module-error {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.1rem;
}

/* Confirm-replace dialog (exclusive module conflict) — transient Bootstrap modal.
   Global .modal-title is styled for the white-on-gradient status modal; reset here. */
.confirm-replace-modal .modal-title {
    color: var(--bs-body-color, #212529);
    font-size: 1.1rem;
    text-align: left;
}

/* REG-187 duplicate-submit warnings: footer buttons equal in size (the global .btn-custom is the
   big page CTA), full width side by side on a phone. Colours stay from the theme.
   !important: the desktop block (min-width 992px) forces .btn-custom size with !important. */
.duplicate-submit-modal .modal-footer .btn {
    font-size: 1rem !important;
    padding: 0.6rem 1.25rem !important;
    border-radius: var(--radius-button);
    font-weight: 600;
}
@media (max-width: 575.98px) {
    .duplicate-submit-modal .modal-footer .btn {
        flex: 1 1 auto;
    }
}

/* Full module — blocked from exclusive selection */
.measure-module-card--full {
    opacity: 0.6;
    cursor: not-allowed;
}

.measure-module-card__full-badge {
    font-size: 0.78rem;
    font-weight: 600;
    color: #dc3545;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Организованные группы: календарь свободных тайм-слотов. */
.group-calendar { position: relative; margin-top: 1rem; padding: .75rem; border: 2px solid transparent; border-radius: .8rem; transition: opacity .15s ease, filter .15s ease, border-color .15s ease, box-shadow .15s ease; }
.group-calendar.is-disabled { opacity: .52; filter: grayscale(.8); background: #f3f4f6; }
.group-calendar.is-disabled.is-count-invalid { opacity: .82; filter: grayscale(.35); }
.group-calendar.is-disabled .group-calendar__balloon { display: none; }
.group-calendar.is-invalid { border-color: #dc3545; box-shadow: 0 0 0 3px rgba(220, 53, 69, .12); }
.group-calendar.is-count-invalid .group-calendar__notice { color: #dc3545; font-weight: 650; }
.group-calendar__disabled-overlay { position: absolute; z-index: 30; inset: 0; width: 100%; border: 0; border-radius: inherit; background: transparent; cursor: not-allowed; }
.group-calendar__notice { margin-bottom: .75rem; color: #5f6672; font-size: .925rem; }
.group-calendar__empty-message { color: #5f6672; font-weight: 650; }
.group-calendar__header { display: grid; grid-template-columns: 2.5rem 1fr 2.5rem; align-items: center; text-align: center; margin-bottom: .75rem; }
.group-calendar__header strong { text-transform: capitalize; }
.group-calendar__nav { border: 1px solid #d8dde6; border-radius: .55rem; background: #fff; font-size: 1.5rem; line-height: 2rem; }
.group-calendar__nav:disabled { opacity: .35; }
.group-calendar__nav.is-next-available { color: #fff; border-color: #198754; background: #198754; animation: group-calendar-next-available 1.15s ease-in-out infinite; }
.group-calendar__nav.is-next-available:hover,
.group-calendar__nav.is-next-available:focus-visible { color: #fff; border-color: #146c43; background: #146c43; }
@keyframes group-calendar-next-available {
    0%, 100% { box-shadow: 0 0 0 0 rgba(25, 135, 84, .15); }
    50% { box-shadow: 0 0 0 .45rem rgba(25, 135, 84, .28); background: #20a066; }
}
@media (prefers-reduced-motion: reduce) {
    .group-calendar__nav.is-next-available { animation: none; box-shadow: 0 0 0 3px rgba(25, 135, 84, .22); }
}
.group-calendar__weekdays,
.group-calendar__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .35rem; }
.group-calendar__weekdays { margin-bottom: .35rem; color: #777f8c; font-size: .75rem; text-align: center; }
.group-calendar__day { position: relative; min-height: 2.7rem; border: 1px solid #e1e5eb; border-radius: .55rem; background: #f7f8fa; color: #9aa0aa; }
.group-calendar__day.has-slots { background: color-mix(in srgb, var(--theme-primary, #2062a5) 9%, #fff); border-color: color-mix(in srgb, var(--theme-primary, #2062a5) 35%, #dfe4eb); color: var(--theme-primary, #2062a5); font-weight: 650; }
.group-calendar__day.has-slots:not(:disabled):hover,
.group-calendar__day.has-slots:not(:disabled):focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-primary, #2062a5) 17%, transparent); }
.group-calendar__day.has-slots.is-selected { color: #fff; background: var(--theme-primary, #2062a5); border-color: var(--theme-primary, #2062a5); box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-primary, #2062a5) 18%, transparent); }
.group-calendar__day.is-empty { border: 0; background: transparent; }
.group-calendar__balloon { display: none; position: absolute; z-index: 20; left: 50%; bottom: calc(100% + .45rem); transform: translateX(-50%); min-width: 12rem; padding: .55rem .7rem; border-radius: .6rem; background: #242832; color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: .78rem; font-weight: 400; text-align: left; white-space: nowrap; }
.group-calendar__balloon span { display: block; }
.group-calendar__day.has-slots:hover .group-calendar__balloon,
.group-calendar__day.has-slots:focus-visible .group-calendar__balloon { display: block; }
.group-calendar__slots-wrap { margin-top: 1rem; }
.group-calendar__slots-status { padding: .75rem; border-radius: .6rem; background: #f3f6fa; color: #5f6672; }
.group-calendar__slots-status.is-error { background: #fff1f2; color: #b42318; }
.group-calendar__slots-title { margin-bottom: .5rem; font-weight: 650; }
.group-calendar__slots { display: grid; gap: .5rem; }
.group-calendar__slot { padding: .7rem .85rem; border: 1px solid #d7dde7; border-radius: .6rem; background: #fff; text-align: left; }
.group-calendar__slot:hover,
.group-calendar__slot.is-selected { border-color: var(--theme-primary, #2062a5); background: color-mix(in srgb, var(--theme-primary, #2062a5) 9%, #fff); }

@media (max-width: 480px) {
    .group-calendar__weekdays, .group-calendar__grid { gap: .2rem; }
    .group-calendar__day { min-height: 2.35rem; padding: 0; }
    .group-calendar__balloon { min-width: 10rem; }
}

/* Date groups in exclusive module selection (cards grouped by calendar date) */
.measure-modules-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.measure-modules-group + .measure-modules-group {
    margin-top: 0.85rem;
}

.measure-modules-group__date {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding-bottom: 0.15rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* Аккордеон модулей по дням (<details>): дни свёрнуты, клик раскрывает карточки дня */
.measure-modules-group--accordion {
    display: block;
    gap: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.measure-modules-group--accordion + .measure-modules-group--accordion {
    margin-top: 0.5rem;
}

.measure-modules-group--accordion > summary.measure-modules-group__date {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.7rem 0.85rem;
    border-bottom: none;
    padding-bottom: 0.7rem;
    user-select: none;
}

.measure-modules-group--accordion > summary.measure-modules-group__date::-webkit-details-marker {
    display: none;
}

.measure-modules-group--accordion > summary.measure-modules-group__date::before {
    content: '';
    flex: 0 0 auto;
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.18s ease;
}

.measure-modules-group--accordion[open] > summary.measure-modules-group__date::before {
    transform: rotate(45deg);
}

.measure-modules-group--accordion > summary.measure-modules-group__date:hover {
    background: rgba(0, 0, 0, 0.03);
}

.measure-modules-group__count {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 700;
    color: #6b7280;
    background: rgba(0, 0, 0, 0.07);
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
    text-transform: none;
    letter-spacing: 0;
}

.measure-modules-group__body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.15rem 0.85rem 0.8rem;
}

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

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

.radio-group.radio-group-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 0.75rem;
}

@media (max-width: 575px) {
    .radio-group.radio-group-2col {
        grid-template-columns: 1fr;
    }
}

.radio-group .radio-option {
    padding: 0.65rem 1rem;
    border: 1px solid #dee2e6;
    border-radius: var(--radius-chip);
    transition: border-color 0.2s, background-color 0.2s;
    cursor: pointer;
}

.radio-group .radio-option label {
    cursor: pointer;
}

.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;
}

.address-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--theme-button);
    font-size: 0.75rem;
    line-height: 1.2;
    margin-top: 0.2rem;
}

.address-badge svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

/* ========================================
   ADDRESS LIST (radio + inline map)
   ======================================== */

.radio-group .address-list-option {
    background-size: 50% auto;
    background-position: right center;
    background-repeat: no-repeat;
    min-height: 110px;
    background-color: #fff;
    position: relative;
}

/* Label positioning for address list */
.radio-group .address-list-option .form-check-label {
    display: inline-block;
    position: relative;
    z-index: 1;
    max-width: 50%;
    padding: 0.3rem 0.5rem 0.3rem 0.1rem;
}

/* Radio button above the overlay */
.radio-group .address-list-option .form-check-input[type="radio"] {
    position: relative;
    z-index: 2;
}

@media (max-width: 767px) {
    .radio-group .address-list-option {
        background-size: cover;
        background-position: center;
    }

    .radio-group .address-list-option .form-check-label {
        background: rgba(255, 255, 255, 0.7);
        max-width: none;
        margin-left: calc(-1rem - 1.5em);
        padding-left: calc(1rem + 1.5em + 0.1rem);
    }
}


/* ========================================
   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: var(--radius-chip);
    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: var(--radius-input);
    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;
}

/* 4-6 позиций (курс обучения, короткие шкалы): подписи там в один-два знака,
   а отступы по 1.35rem съедали бы ширину и переполняли полосу на узких экранах */
.toggle-switch[data-positions="4"] .toggle-option,
.toggle-switch[data-positions="5"] .toggle-option,
.toggle-switch[data-positions="6"] .toggle-option {
    padding: 0 0.5rem;
}

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

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

/* ========================================
   ВИДЖЕТЫ ФОРМ ОБРАТНОЙ СВЯЗИ: шкала оценки, switch-группа, счётчик знаков
   ======================================== */

.rf-scale-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.rf-scale-btn {
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.12s, transform 0.1s, background 0.12s, border-color 0.12s;
}

.rf-scale-star {
    font-size: 2.3rem;
    line-height: 1;
    color: #d5dde8;
}

.rf-scale-star.active {
    color: var(--theme-button, var(--theme-header, #2062a5));
}

.rf-scale-star:hover {
    transform: scale(1.12);
}

.rf-scale-digit {
    width: 44px;
    height: 44px;
    border: 1.5px solid #dde5ef;
    border-radius: var(--radius-chip);
    background: #fff;
    font-size: 1rem;
    font-weight: 600;
    color: #4a5a72;
}

.rf-scale-digit.active {
    background: var(--theme-button, var(--theme-header, #2062a5));
    border-color: var(--theme-button, var(--theme-header, #2062a5));
    color: #fff;
}

.rf-scale-digit:hover:not(.active) {
    border-color: var(--theme-button, var(--theme-header, #2062a5));
    color: var(--theme-button, var(--theme-header, #2062a5));
}

.rf-scale-labels {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.8rem;
    color: #8494ab;
    margin-top: 4px;
}

/* Подсветка невалидной шкалы (validation.js вешает is-invalid на .rf-scale) */
.rf-scale.is-invalid .rf-scale-star {
    color: #f1aeb5;
}

.rf-scale.is-invalid .rf-scale-digit {
    border-color: #dc3545;
}

/* Switch-группа (multiselect display_mode: switch) — строки с тумблером справа */
.switch-group .switch-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    background: #fff;
}

.switch-group .switch-option-label {
    font-size: 0.95rem;
}

.switch-group .switch-option-control {
    padding: 0;
    margin: 0;
    min-height: 0;
    flex: 0 0 auto;
}

.switch-group .form-check-input {
    width: 2.6em;
    height: 1.45em;
    margin: 0;
    cursor: pointer;
}

/* Счётчик знаков textarea (maxLength) */
.rf-char-count {
    text-align: right;
    font-size: 0.78rem;
    color: #8494ab;
    margin-top: 2px;
}

/* Статус-экраны форм обратной связи (успех / уже заполнено / не найден) */
.fb-status {
    padding: 3rem 2rem;
    text-align: center;
    border: none;
    border-radius: var(--radius-card);
    box-shadow: 0 2px 16px rgba(18, 32, 54, 0.06);
    margin-bottom: 1.5rem;
    animation: fbPopIn 0.35s ease;
}

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

.fb-status-icon {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    line-height: 1;
    margin: 0 auto 24px;
}

.fb-status-icon--ok { background: #e6f5ee; color: #1f8a5b; }
.fb-status-icon--accent { background: var(--theme-tint, #eef2f7); color: var(--theme-button, #2062a5); }
.fb-status-icon--warn { background: #fdf3e3; color: #e0932e; }

.fb-status-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #122036;
    font-family: var(--font-header);
    margin-bottom: 12px;
}

.fb-status-text {
    font-size: 1rem;
    color: #5c6b83;
    line-height: 1.6;
    max-width: 460px;
    margin: 0 auto;
}

.fb-status .fb-status-back {
    margin-top: 24px;
}

/* 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: var(--radius-button);
}

/* Отступ снизу для абсолютного 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;
    }

    .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;
    }

    textarea.custom-input {
        height: auto !important;
        min-height: calc(var(--input-height) * 2.25) !important;
        padding: 0.9rem 1.2rem !important;
        line-height: 1.45 !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;
        /* see the base rule: one-line value keeps min-height (48px here), wrapped value grows */
        padding-top: 10px !important;
        padding-bottom: 10px !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;
    }

    .toggle-switch[data-positions="4"] .toggle-option,
    .toggle-switch[data-positions="5"] .toggle-option,
    .toggle-switch[data-positions="6"] .toggle-option {
        padding: 0 0.35rem !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;
    }

}

/* 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;
    height: auto;
    min-height: auto;
    overflow: hidden !important;
}

body.embed-mode {
    background: transparent !important;
    background-color: transparent !important;
    min-height: auto !important;
    height: auto;
    overflow: visible !important;
}

body.embed-mode .main-container {
    padding: 0;
    margin: 0 auto;
    min-height: auto;
    max-width: 100%;
}

body.embed-mode .main-container > .row {
    margin-left: 0;
    margin-right: 0;
}

body.embed-mode .main-container > .row > [class*="col"] {
    padding-left: 6px;
    padding-right: 6px;
}


/* Скругление и внутренние отступы карточек в embed — ручки хост-страницы
   (`rf_radius` / `rf_pad` → EmbedTheme). Фолбэки повторяют то, что было до появления
   переменных: 0.75rem у рамки и bootstrap-утилиты `p-4 p-sm-5` у паддинга — поэтому
   лендинги, которые ничего не просят, выглядят ровно как раньше. */
body.embed-mode .card {
    border-radius: var(--embed-card-radius, 0.75rem);
    padding: var(--embed-card-pad, 1.5rem) !important;
}

@media (min-width: 576px) {
    body.embed-mode .card {
        padding: var(--embed-card-pad, 3rem) !important;
    }
}

/* Flat-встраивание (?embed_flat=1): форма стоит внутри чужой карточки/модалки,
   у которой уже есть рамка и внутренние отступы. Без этого получается «коробка в
   коробке»: тень card + p-4/p-sm-5 поверх padding хоста (work-svo — модалка с p-10). */
/* Ряды-обёртки (вокруг карточек) теряют отрицательные margin: карточка сама является
   колонкой, и без своего padding она утаскивалась на 12px влево, где содержимое срезал
   край iframe (было: «аполните ваши данные», обрезанный чекбокс).
   Внутренний ряд полей (`.row.gy-3` в карточке) не трогаем — его отрицательные margin
   гасятся padding'ом колонок и держат промежутки между полями в паре col-md-6.
   Поля flat-формы должны вставать ровно по сетке страницы-хозяина, но рамке фокуса и
   ошибки (тень 0.2rem снаружи поля) нужно место, иначе её срезает край iframe. Это место —
   «вылет» `--embed-flat-bleed`, одинаковый со всех четырёх сторон. Форма сообщает его
   хосту в сообщении `resize` (app.js, поле `bleed`), и сниппеты встраивания расширяют рамку
   на этот вылет отрицательным margin: поля стоят вровень с колонкой, тень помещается.
   Хосту ничего подбирать не нужно; `rf_pad` во flat — необязательный дополнительный отступ. */
body.embed-mode.embed-flat {
    --embed-flat-bleed: 6px;
}

body.embed-mode.embed-flat .main-container {
    padding-top: var(--embed-flat-bleed);
    padding-bottom: var(--embed-flat-bleed);
}

body.embed-mode.embed-flat .main-container > .row > [class*="col"] {
    padding-left: var(--embed-flat-bleed);
    padding-right: var(--embed-flat-bleed);
}

body.embed-mode.embed-flat .main-container > .row,
body.embed-mode.embed-flat form > .row {
    --bs-gutter-x: 0;
    margin-left: 0;
    margin-right: 0;
}

body.embed-mode.embed-flat .card {
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    /* Место под рамку фокуса даёт вылет (--embed-flat-bleed), а не этот отступ */
    padding: var(--embed-card-pad, 0) !important;
    /* Под последней карточкой пустоты нет: 16px снизу только раздували рамку у хоста.
       Промежуток остаётся между соседними карточками. */
    margin-bottom: 0 !important;
}

body.embed-mode.embed-flat .card ~ .card {
    margin-top: 1rem !important;
}

/* Крестик закрытия у flat-формы прижимался бы к первому полю — но в flat-режиме
   его и не рисуют (embed_close=0); правило на случай ручного включения */
body.embed-mode.embed-flat .embed-close-btn {
    top: 0;
    right: 0;
}

/* Закрытый список Choices — это скрытый (visibility), но уложенный абсолютный блок до
   300px высотой; у select у нижнего края он вылезал за body и раздувал scrollHeight, а с ним
   и высоту iframe, которую форма сообщает хосту (REG-161: 965px при контенте 916px).
   В flat закрытый список не участвует в раскладке; открытый (is-active) показывается как
   раньше, а app.js пересообщает высоту на showDropdown/hideDropdown. */
body.embed-mode.embed-flat .choices__list--dropdown:not(.is-active) {
    display: none;
}

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

/* Плавное появление встроенной формы: страница-хозяин обычно отрисована раньше формы, и поля
   возникали рывком. До первой отрисовки полей форма прозрачна, затем проявляется за 0,2 с
   (класс embed-shown ставит app.js, EmbedMessenger.initReveal). Запасная анимация показывает
   форму через 4 с, даже если скрипт не отработал. */
body.embed-mode .main-container {
    opacity: 0;
    animation: rf-embed-failsafe 0s linear 4s forwards;
}

body.embed-mode.embed-shown .main-container {
    opacity: 1;
    animation: none;
    transition: opacity 0.2s ease-out;
}

@keyframes rf-embed-failsafe {
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    body.embed-mode.embed-shown .main-container {
        transition: none;
    }
}

/* 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;
}
body.embed-mode .wizard-nav .btn-custom.disabled-look {
    opacity: 1 !important;
    background-color: #e0e0e0 !important;
    border-color: #e0e0e0 !important;
    color: #999 !important;
    cursor: default;
}

body[data-theme$="cpb"] .btn-custom,
body[data-theme$="cpb"] .wizard-nav .btn,
body[data-theme$="cpb"] .wizard-prev.btn-outline-secondary {
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
}

/* Wizard + embed mode: same width as regular embed (main-container max-width: 80%) */

/* 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;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 0;
    opacity: 0.4;
    transition: opacity 0.2s;
}
.embed-close-btn img {
    width: 1.25rem;
    height: 1.25rem;
}
.embed-close-btn:hover {
    opacity: 0.7;
}


/* 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: var(--radius-card);
    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 ─── */
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: var(--radius-modal);
    box-shadow: none;
    border: 1px solid #e8e8ed;
}
body.embed-mode #statusModal.embed-inline-result .modal-header .btn-close {
    display: none;
}

/* Embed: white bg for all non-error states */
body.embed-mode #statusModal.embed-inline-result .modal-custom-content.modal-state-success,
body.embed-mode #statusModal.embed-inline-result .modal-custom-content.modal-state-info,
body.embed-mode #statusModal.embed-inline-result .modal-custom-content.modal-state-loading {
    background: #fff;
    color: #2c2c35;
}
body.embed-mode #statusModal.embed-inline-result .modal-custom-content::before,
body.embed-mode #statusModal.embed-inline-result .modal-custom-content::after {
    display: none;
}

/* Embed: compact sizing */
body.embed-mode #statusModal.embed-inline-result .modal-title {
    font-size: 1.35rem;
    color: #1a1a24;
}
body.embed-mode #statusModal.embed-inline-result .lead-modal {
    font-size: 1rem;
    color: #4a4a58;
    opacity: 1;
}
body.embed-mode #statusModal.embed-inline-result .modal-body {
    padding: 1rem 1.5rem 1.5rem;
}
body.embed-mode #statusModal.embed-inline-result #qrCodeImage {
    padding: 0.75rem;
    border-radius: var(--radius-button);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid #e8e8ed;
}
body.embed-mode #statusModal.embed-inline-result #qrCodeImage img {
    max-width: 180px;
    height: auto;
}
body.embed-mode #statusModal.embed-inline-result #qrEmailNotice {
    color: #8b8b9a;
    opacity: 1;
}
body.embed-mode #statusModal.embed-inline-result #modalSuccessText {
    color: #4a4a58;
}

/* Embed: candidate badge */
body.embed-mode #statusModal.embed-inline-result .modal-candidate-badge {
    background: var(--embed-accent-light, #eef4fa);
    border-color: var(--embed-accent-border, #b8d2eb);
}
body.embed-mode #statusModal.embed-inline-result .modal-candidate-badge__label {
    color: #6b6b78;
    opacity: 1;
}
body.embed-mode #statusModal.embed-inline-result .modal-candidate-id {
    font-size: 1.8rem;
    padding: 0;
    color: var(--embed-accent, #2c5ab5);
}

/* Embed: icon */
body.embed-mode #statusModal.embed-inline-result .modal-state-icon {
    background: var(--embed-accent-light, #eef4fa);
}
body.embed-mode #statusModal.embed-inline-result .modal-state-icon svg {
    color: var(--embed-accent, #2c5ab5);
}

/* Embed: online links */
body.embed-mode #statusModal.embed-inline-result .online-link-block {
    background: #f5f5f8;
    border-color: #e0e0e6;
}
body.embed-mode #statusModal.embed-inline-result .online-link-url {
    color: var(--embed-accent, #2c5ab5);
    text-decoration-color: rgba(44, 90, 181, 0.3);
}
body.embed-mode #statusModal.embed-inline-result .online-link-copy {
    border-color: #d0d0d8;
    background: #fff;
    color: #8b8b9a;
}
body.embed-mode #statusModal.embed-inline-result .online-link-copy:hover {
    color: var(--embed-accent, #2c5ab5);
    border-color: var(--embed-accent, #2c5ab5);
}
body.embed-mode #statusModal.embed-inline-result .online-links-item {
    background: #f5f5f8;
    border-color: #e0e0e6;
}
body.embed-mode #statusModal.embed-inline-result .online-links-item .component-name {
    color: #4a4a58;
    opacity: 1;
}
body.embed-mode #statusModal.embed-inline-result #onlineLinksSection .fw-semibold {
    color: #2c2c35;
    opacity: 1;
}

body.embed-mode #statusModal.embed-inline-result .online-link-notice {
    color: #4a4a58;
}
body.embed-mode #statusModal.embed-inline-result .online-link-notice a {
    color: var(--embed-accent, #2c5ab5);
}

/* Embed: modular results */
body.embed-mode #statusModal.embed-inline-result #modularResultsList .fw-semibold {
    color: #2c2c35;
    opacity: 1;
}
body.embed-mode #statusModal.embed-inline-result .modal-module-icon--ok {
    background: #d4edda;
    color: #15804a;
}
body.embed-mode #statusModal.embed-inline-result .modal-module-icon--fail {
    background: #f8d7da;
    color: #c93545;
}
body.embed-mode #statusModal.embed-inline-result .modal-module-icon--pending {
    background: #e8e8ed;
    color: #8b8b9a;
}
body.embed-mode #statusModal.embed-inline-result #modularResultsList .text-success {
    color: #15804a !important;
}
body.embed-mode #statusModal.embed-inline-result #modularResultsList .text-danger {
    color: #c93545 !important;
}
body.embed-mode #statusModal.embed-inline-result #modularResultsList .text-muted {
    color: #8b8b9a !important;
}

/* Embed: close button — filled with accent */
body.embed-mode #statusModal.embed-inline-result .btn-custom-modal {
    background: var(--embed-accent, #2c5ab5);
    color: #fff;
    border: none;
    font-size: 1rem;
    padding: 0.6rem 1.25rem;
}
body.embed-mode #statusModal.embed-inline-result .btn-custom-modal:hover {
    filter: brightness(1.08);
    background: var(--embed-accent, #2c5ab5);
    color: #fff;
}

/* Embed: error state keeps red bg */
body.embed-mode #statusModal.embed-inline-result .modal-custom-content.modal-state-danger .btn-custom-modal {
    background: #c93545;
}

/* ─── Error debug info ─── */
.modal-debug-info {
    font-size: 0.75rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.65);
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    text-align: left;
    word-break: break-word;
    max-width: 100%;
}

/* ─── Embed loading (reused from v1, updated classes) ─── */
.embed-loading-spinner {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.25rem;
    position: relative;
}
.embed-loading-spinner::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid #e5e7eb;
    border-top-color: var(--theme-button, #2062a5);
    border-radius: 50%;
    animation: embedSpin 0.9s linear infinite;
}

.embed-loading-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: #6b6b78;
    margin: 0.75rem 0 0.5rem;
    min-height: 1.5em;
    text-align: center;
}

/* Route disabled message */
/* ========================================
   SKELETON LOADING PLACEHOLDERS
   ======================================== */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-text { height: 1em; margin-bottom: 0.5em; }
.skeleton-title { height: 1.5em; width: 70%; margin-bottom: 1rem; }
.skeleton-image { height: 200px; width: 100%; margin-bottom: 1rem; }
.skeleton-field { height: 3.5rem; margin-bottom: 1rem; }

/* MeasureInfo skeleton placeholder */
.measure-info-skeleton {
    width: 100%;
}
.measure-info-skeleton-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 0.5rem;
}
.measure-info-skeleton-row:last-child {
    border-bottom: none;
}
@media (max-width: 575px) {
    .measure-info-skeleton-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}

/* Status messages (info/warning inside cards) */
.status-message {
    text-align: center;
    font-size: 1rem;
    line-height: 1.6;
}

/* ===== CAS-34: candidate-screen live sync + custom on-screen keyboards =====
   One accent colour only (route/embed theme via --embed-accent / --theme-button),
   neutral surfaces otherwise. Reuses the form's own theme variables so a route's
   ?rf_accent=/theme_overrides keep controlling it, same as the rest of the form. */

/* Recognised-value highlight: a 2.4s accent glow that settles back to normal —
   the flash is transient, the "из беседы" badge (.rf-cs-fromconvo below) is the
   persistent label state and lives in markup (candidate-sync.js toggles a class). */
.rf-cs-recog {
    animation: rfCsRecog 2.4s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes rfCsRecog {
    0% {
        background-color: var(--embed-accent-light, #fbece6);
        box-shadow: 0 0 0 3px var(--embed-accent-border, rgba(172, 60, 12, .35)), 0 0 18px var(--embed-accent-border, rgba(172, 60, 12, .25));
    }
    55% {
        background-color: var(--embed-accent-light, #fbece6);
        box-shadow: 0 0 0 2px var(--embed-accent-border, rgba(172, 60, 12, .2)), 0 0 10px rgba(0, 0, 0, 0);
    }
    100% {
        background-color: transparent;
        box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
    }
}
@media (prefers-reduced-motion: reduce) {
    .rf-cs-recog { animation: none; }
}

/* "из беседы" badge: shown while a field's current value came from reg_recognised
   (speech recognition mirrored from the mentor screen), hidden the moment the
   candidate edits the field themselves or the mentor sends plain reg_typing. */
.rf-cs-fromconvo {
    position: absolute;
    top: -.6rem;
    right: .5rem;
    z-index: 2;
    padding: .15rem .45rem;
    border-radius: .5rem;
    background: var(--embed-accent, var(--theme-button, #3a5dae));
    color: #fff;
    font-size: .7rem;
    line-height: 1;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(2px);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}
.rf-cs-fromconvo.rf-cs-fromconvo-visible {
    opacity: 1;
    transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
    .rf-cs-fromconvo { transition: none; }
}

/* Bottom-sheet keyboard: appears above the form, page does not scroll behind it */
body.rf-kb-open { overflow: hidden; }
.rf-kb-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1070;
    background: #eeeef1;
    border-top: 1px solid var(--line, #e6e6e9);
    box-shadow: 0 -12px 32px rgba(0, 0, 0, .12);
    padding: .75rem .75rem calc(1rem + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.rf-kb-row {
    display: grid;
    grid-template-columns: repeat(var(--rf-kb-cols, 3), 1fr);
    gap: .5rem;
}
.rf-kb-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
}
.rf-kb-key {
    height: 3.5rem;
    border-radius: .75rem;
    border: 1px solid var(--line-strong, #d4d5d9);
    background: #fff;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .06);
    font-size: 1.35rem;
    font-weight: 500;
    color: #1f2024;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    padding: 0 .5rem;
}
.rf-kb-key:active {
    background: var(--sunken, #f2f2f4);
    transform: translateY(1px);
    box-shadow: none;
}
.rf-kb-key.rf-kb-fn {
    background: #e2e3e7;
    font-size: 1rem;
    font-weight: 500;
}
.rf-kb-key.rf-kb-done {
    background: var(--embed-accent, var(--theme-button, #3a5dae));
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}
.rf-kb-row-domains {
    grid-template-columns: repeat(3, 1fr);
}
.rf-kb-key.rf-kb-domain {
    font-size: 1rem;
    background: #e2e3e7;
}
.rf-kb-email .rf-kb-row:not(.rf-kb-row-domains):not(.rf-kb-row-actions) {
    grid-auto-flow: column;
    grid-template-columns: none;
    grid-auto-columns: 1fr;
}
.rf-kb-email .rf-kb-key {
    font-size: 1.15rem;
    height: 3.1rem;
}
.rf-kb-row-actions {
    grid-template-columns: 1fr 2fr;
    margin-top: .25rem;
}

@media (min-width: 576px) {
    .rf-kb-sheet {
        max-width: 30rem;
        margin: 0 auto;
        border-radius: 1rem 1rem 0 0;
    }
}

/* REG-162: встроенная форма живёт в рамке, а Bootstrap считает пороги по ширине ОКНА формы,
   то есть по ширине iframe. В рамке уже 768px поля col-md-* падали в один столбец
   («мобильная» раскладка на компьютере: трекинг, рамка 510px). Во встраивании пары
   сохраняются до 480px, а промежутки между полями и по вертикали ужимаются вместе с рамкой.
   col-md-4/col-md-3 в такой рамке слишком узки для трёх-четырёх в ряд — встают по два.
   Уже 480px — один столбец, как раньше. Отдельные страницы форм не меняются. */
@media (max-width: 767.98px) {
    body.embed-mode .card .row.gy-3 {
        --bs-gutter-x: 1rem;
        --bs-gutter-y: 1rem;
    }
}
/* В этой же полосе (рамка 480–767px, поля по два в ряд) поля чуть компактнее: высота 48px
   вместо 56, внутренние отступы и шрифт меньше — чтобы подписи вроде «Мобильный телефон*»
   помещались в половину строки. Шрифт не меньше 16px: мельче — и iOS увеличивает страницу
   при фокусе. Уже 480px (телефон) метрики прежние. */
@media (min-width: 480px) and (max-width: 767.98px) {
    body.embed-mode {
        --input-height: 3rem;
    }
    body.embed-mode .custom-input,
    body.embed-mode .custom-select {
        font-size: 1rem;
        padding: 0 1rem;
    }
    body.embed-mode textarea.custom-input {
        padding: 0.75rem 1rem;
    }
    body.embed-mode .choices__inner {
        padding: 0.65rem 1rem;
        min-height: var(--input-height);
        font-size: 1rem;
    }
    body.embed-mode .choices__placeholder,
    body.embed-mode .choices__inner .choices__item.is-placeholder,
    body.embed-mode .choices__list--single .choices__item {
        font-size: 1rem;
    }
    /* Список той же высоты, что и поле ввода (48px): как в компактном блоке ≥992px. */
    body.embed-mode .choices[data-type*="select-one"] .choices__inner {
        display: flex;
        align-items: center;
        padding-top: 10px;
        padding-bottom: 10px;
    }
    body.embed-mode .choices__list--single,
    body.embed-mode .choices__list--single .choices__item {
        padding: 0;
    }
}
@media (min-width: 480px) and (max-width: 767.98px) {
    body.embed-mode .card .row.gy-3 > .col-md-6,
    body.embed-mode .card .row.gy-3 > .col-md-4,
    body.embed-mode .card .row.gy-3 > .col-md-3 {
        flex: 0 0 auto;
        width: 50%;
    }
}
