@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-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-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-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.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__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: 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;
}

/* Подсказки валидации в потоке с плавным появлением */
[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 */
.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: 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;
}

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

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

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

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

}

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


body.embed-mode .card {
    border-radius: 0.75rem;
}

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

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

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