/* === Setup Wizard Minimalist Theme === */
:root {
    --sw-blue: #0052FF;
    --sw-blue-hover: #0041CC;
    --sw-bg: #f8fafc;
    --sw-card: #ffffff;
    --sw-border: #e2e8f0;
    --sw-border-hover: #cbd5e1;
    --sw-text: #0f172a;
    --sw-muted: #475569;
    --sw-light: #f1f5f9;
    --sw-red: #ef4444;
    --sw-green: #00c853;
    --sw-yellow: #f59e0b;
    --sw-radius: 12px;
    --sw-font: 'Inter', system-ui, sans-serif;
    --sw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --sw-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .setup-wizard-overlay,
[data-theme="dark"] .setup-wizard-dialog-overlay {
    --sw-bg: #0f172a;
    --sw-card: #1e293b;
    --sw-border: #334155;
    --sw-border-hover: #475569;
    --sw-text: #f8fafc;
    --sw-muted: #94a3b8;
    --sw-light: #0f172a;
}

/* /start page must stay light even if html got data-theme=dark from localStorage */
html.aispap-start-html[data-theme="dark"] .setup-wizard-overlay,
html.aispap-start-html[data-theme="dark"] .setup-wizard-dialog-overlay,
.aispap-start-wizard-page .setup-wizard-overlay,
.aispap-start-wizard-page .setup-wizard-dialog-overlay {
    --sw-bg: #f8fafc;
    --sw-card: #ffffff;
    --sw-border: #e2e8f0;
    --sw-border-hover: #cbd5e1;
    --sw-text: #0f172a;
    --sw-muted: #475569;
    --sw-light: #f1f5f9;
}

/* === Overlays === */
.setup-wizard-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: var(--sw-bg) !important;
    display: none;
    align-items: stretch;
    justify-content: center;
    z-index: 9999999 !important;
    font-family: var(--sw-font);
    color: var(--sw-text);
}

.setup-wizard-overlay[style*="flex"] {
    display: flex !important;
}

.setup-wizard-dialog-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 10000030 !important;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.55) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-family: var(--sw-font);
    color: var(--sw-text);
}

.setup-wizard-dialog-overlay.is-open {
    display: flex !important;
}

[data-theme="dark"] .setup-wizard-dialog-overlay {
    background: rgba(2, 6, 23, 0.72) !important;
}

/* === Content Wrapper === */
.setup-wizard-content {
    width: 100% !important;
    height: 100vh !important;
    max-width: none !important;
    margin: 0;
    display: flex !important;
    flex-direction: column !important;
    padding: 24px 40px !important;
    background: var(--sw-bg) !important;
    box-sizing: border-box;
}

/* === Header === */
.setup-wizard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--sw-border);
}
.setup-wizard-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.15rem;
    font-weight: 700;
}
.modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--sw-muted);
    cursor: pointer;
    transition: color 0.2s;
}
.modal-close:hover {
    color: var(--sw-red);
}
.modal-close::after {
    display: none !important;
}

/* === Progress Bar === */
.setup-wizard-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}
.progress-step {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sw-light);
    color: var(--sw-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    border: 2px solid var(--sw-border);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    z-index: 1;
}
.progress-step.completed {
    background: var(--sw-green);
    border-color: var(--sw-green);
    color: #fff;
}
.progress-step.active {
    background: var(--sw-blue);
    border-color: var(--sw-blue);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(0, 82, 255, 0.15);
}
.progress-step.skipped {
    background: var(--sw-red);
    border-color: var(--sw-red);
    color: #fff;
}
/* Half fill left → right; number always on top */
.progress-step.partial {
    background: linear-gradient(
        to right,
        var(--sw-green) 0%,
        var(--sw-green) calc(var(--fill, 0.5) * 100%),
        var(--sw-light) calc(var(--fill, 0.5) * 100%),
        var(--sw-light) 100%
    );
    border-color: var(--sw-green);
    color: var(--sw-text);
    box-shadow: none;
}
.progress-step--finish {
    font-size: 0;
    color: var(--sw-muted);
}
.progress-step--finish .progress-finish-flag {
    width: 14px;
    height: 14px;
    display: block;
    position: relative;
    z-index: 1;
}
.progress-step--finish.active,
.progress-step--finish.completed {
    color: #fff;
}
.progress-step--finish.partial {
    color: var(--sw-text);
}
.progress-step.error {
    background: #ff4757 !important;
    border-color: #ff4757 !important;
    color: white !important;
}
.progress-line {
    flex-grow: 1;
    height: 2px;
    background: var(--sw-border);
    margin: 0 8px;
    transition: background 0.3s ease;
}
.progress-line.completed {
    background: var(--sw-green);
}
.progress-line.skipped {
    background: var(--sw-red);
}

/* === Wizard Body === */
.setup-wizard-body {
    flex-grow: 1;
    padding: 32px 0 0;
    overflow-y: auto;
    overflow-x: visible;
    scrollbar-width: thin;
    scrollbar-color: var(--sw-border) transparent;
}
.wizard-step {
    display: none;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    opacity: 0;
    transition: opacity 0.35s ease-in-out;
}
.wizard-step.wizard-step--wide {
    max-width: 1000px;
}
.wizard-step.active {
    display: block;
    opacity: 1;
}

.wizard-step h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--sw-text);
}
.wizard-step p {
    color: var(--sw-muted);
    font-size: 1.05rem;
    margin: 0 0 24px;
    line-height: 1.5;
}

/* === Welcome Step === */
.setup-wizard-welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 48px;
    margin-bottom: 40px;
    min-height: 300px;
}
.setup-wizard-welcome__copy {
    flex: 1;
}
.setup-wizard-welcome-title {
    font-size: 2.2rem !important;
    margin-bottom: 16px !important;
    color: var(--sw-text);
    line-height: 1.2;
}
.setup-wizard-welcome__art {
    flex: 0 0 auto;
}
.setup-wizard-welcome__art img {
    width: 320px;
    max-width: 100%;
    height: auto;
}
.setup-wizard-welcome-actions {
    justify-content: flex-start !important;
}

/* === Grids & Cards === */
.goals-grid, .platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.goal-card input[type="radio"],
.platform-card input[type="radio"],
.vblock-mode-picker input[type="radio"] {
    display: none;
}
.goal-content, .platform-content {
    border: 2px solid var(--sw-border);
    padding: 24px;
    border-radius: var(--sw-radius);
    background: var(--sw-card);
    cursor: pointer;
    transition: all 0.2s ease;
    height: 100%;
    box-sizing: border-box;
}
.goal-content h3, .platform-content h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--sw-text);
}
.goal-content p, .platform-content p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--sw-muted);
}
.goal-card:hover .goal-content,
.platform-card:hover .platform-content {
    border-color: var(--sw-border-hover);
}
.goal-card input:checked + .goal-content,
.platform-card input:checked + .platform-content {
    border-color: var(--sw-blue);
    background: var(--sw-card);
    box-shadow: var(--sw-shadow);
}
.goal-card input:checked + .goal-content::after,
.platform-card input:checked + .platform-content::after {
    display: none;
}

/* === Channels List === */
.channels-vertical-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}
.channel-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    border: 2px solid var(--sw-border);
    border-radius: var(--sw-radius);
    padding: 20px;
    background: var(--sw-card);
    transition: all 0.2s ease;
}
.channel-row:has(input[type="checkbox"]:checked) {
    border-color: var(--sw-blue);
    box-shadow: var(--sw-shadow);
}
.channel-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}
.channel-toggle input {
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    position: absolute !important;
    pointer-events: none;
}
.channel-toggle input::after {
    content: none !important;
    display: none !important;
}
.channel-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--sw-border);
    transition: .3s;
    border-radius: 24px;
}
.channel-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.channel-toggle input:checked + .channel-toggle-slider {
    background-color: var(--sw-blue);
}
.channel-toggle input:checked + .channel-toggle-slider:before {
    transform: translateX(20px);
}
.channel-info {
    flex-grow: 1;
}
.channel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}
.channel-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--sw-text);
}
.channel-icon {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.channel-fields {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--sw-border);
    animation: fadeIn 0.3s ease;
}

/* === Buttons === */
.wizard-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--sw-border);
}
.wizard-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    border-radius: var(--sw-radius);
    transition: all 0.2s;
    font-family: inherit;
}
.wizard-btn::after {
    display: none !important;
}
.wizard-btn-primary {
    background: var(--sw-blue);
    color: #fff;
}
.wizard-btn-primary:hover {
    background: var(--sw-blue-hover);
}
.wizard-btn-secondary {
    background: var(--sw-light);
    color: var(--sw-text);
    border: 1px solid var(--sw-border);
}
.wizard-btn-secondary:hover {
    background: var(--sw-border);
}

/* === Calculator & Slider === */
.calculator-section {
    background: var(--sw-card);
    border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius);
    padding: 32px;
    margin-bottom: 32px;
}
.calc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.calc-header h3 {
    margin: 0;
    font-size: 1.15rem;
}
.volume-display-cyber {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sw-blue);
}
.volume-display-cyber small {
    font-size: 0.9rem;
    color: var(--sw-muted);
    font-weight: 400;
}
.range-slider-wrap {
    position: relative;
    height: 32px;
    margin-bottom: 12px;
}
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    position: absolute;
    background: transparent;
    height: 32px;
    z-index: 2;
    cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
    height: 8px;
    background: var(--sw-border);
    border-radius: 4px;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: var(--sw-blue);
    margin-top: -8px;
    border: 4px solid var(--sw-card);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.slider-progress-track {
    position: absolute;
    top: 12px;
    left: 0;
    height: 8px;
    background: var(--sw-blue);
    border-radius: 4px;
    z-index: 1;
}
.slider-tooltip {
    position: absolute;
    top: -30px;
    transform: translateX(-50%);
    background: var(--sw-text);
    color: var(--sw-bg);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
.range-slider-wrap:hover .slider-tooltip {
    opacity: 1;
}
.slider-labels {
    display: flex;
    justify-content: space-between;
    color: var(--sw-muted);
    font-size: 0.85rem;
    margin-bottom: 24px;
}
.savings-display-cyber {
    background: rgba(16, 185, 129, 0.1);
    border-radius: var(--sw-radius);
    padding: 16px;
    text-align: center;
}
.savings-title {
    color: var(--sw-green);
    font-weight: 600;
    margin-bottom: 4px;
}
.savings-amount {
    font-size: 1.5rem;
    color: var(--sw-green);
    font-weight: 700;
}
.savings-display-cyber small {
    color: var(--sw-muted);
    font-size: 0.85rem;
}

.wizard-tariff-roles .role-checkbox,
.wizard-tariff-addons .addon-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    font-size: 0.9rem;
    color: var(--sw-text);
    cursor: pointer;
}

.wizard-tariff-roles,
.wizard-tariff-addons {
    padding: 12px 14px;
    border: 1px solid var(--sw-border);
    border-radius: 12px;
    background: var(--sw-light);
}

#wizardTariffsContainer {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 0 auto 24px;
    max-width: 1080px;
}
.wizard-tariff-card {
    border: 2px solid var(--sw-border);
    padding: 24px;
    border-radius: var(--sw-radius);
    background: var(--sw-card);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}
.wizard-tariff-card:hover {
    border-color: var(--sw-border-hover);
}
.wizard-tariff-card.selected {
    border-color: var(--sw-blue);
    background: var(--sw-card);
    box-shadow: var(--sw-shadow);
}
.wizard-tariff-card.selected::after {
    display: none;
}
.wizard-tariff-card h4 {
    margin: 0 0 12px;
    font-size: 1.2rem;
    color: var(--sw-text);
}
.wt-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--sw-text);
    margin-bottom: 20px;
}
.wt-features {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}
.wt-features li {
    font-size: 0.95rem;
    color: var(--sw-muted);
    margin-bottom: 12px;
    padding-left: 24px;
    position: relative;
}
.wt-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--sw-blue);
    font-weight: 700;
}

/* === Design Settings (Split View) === */
.split-view {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 450px;
    gap: 32px;
    align-items: start;
}
.floating-label-group {
    position: relative;
    margin-bottom: 20px;
}
.floating-label-group input,
.floating-label-group textarea,
.floating-label-group select,
.wizard-domain-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--sw-border);
    border-radius: 8px;
    background: var(--sw-card);
    color: var(--sw-text);
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.floating-label-group input:focus,
.floating-label-group textarea:focus,
.floating-label-group select:focus {
    outline: none;
    border-color: var(--sw-blue);
}
.floating-label-group label {
    position: absolute;
    top: -10px;
    left: 12px;
    background: var(--sw-card);
    padding: 0 4px;
    font-size: 0.8rem;
    color: var(--sw-muted);
    font-weight: 500;
}

.wizard-tone-select-group select {
    cursor: pointer;
    appearance: auto;
}

.wizard-tone-example {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--sw-muted);
    line-height: 1.45;
}

#wizard-step-5 .smart-select-wrapper {
    width: 100%;
    max-width: 100%;
}
.color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--sw-card);
    border: 1px solid var(--sw-border);
    padding: 8px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.color-picker-wrap input[type="color"] {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    padding: 0;
}
.color-picker-wrap input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
.color-picker-wrap input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}
.vblock-mode-picker {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}
.vblock-mode-card {
    border: 2px solid var(--sw-border);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    background: var(--sw-card);
    transition: all 0.2s;
}
.vblock-mode-card__title {
    font-weight: 500;
    color: var(--sw-text);
}
.vblock-mode-picker label:has(input[type="radio"]:checked) {
    border-color: var(--sw-blue);
    background: var(--sw-card);
}
.setup-wizard-field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--sw-muted);
    font-weight: 500;
}
.lwp-preview-container {
    width: 100%;
    height: auto;
    min-height: 600px;
    position: relative;
    border: none;
    background: transparent;
    box-shadow: none;
}
#wizardRealPreviewIframe {
    width: 100%;
    height: 100%;
    border: none;
}
#wizardPreviewLoading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    color: var(--sw-muted);
    font-weight: 500;
}
[data-theme="dark"] #wizardPreviewLoading {
    background: rgba(30, 41, 59, 0.8);
}

/* === Dropzone === */
.wizard-dropzone {
    border: 2px dashed var(--sw-border);
    border-radius: var(--sw-radius);
    padding: 48px 24px;
    text-align: center;
    background: var(--sw-light);
    color: var(--sw-muted);
    transition: all 0.2s;
    margin-bottom: 16px;
    cursor: pointer;
}
.wizard-dropzone:hover,
.wizard-dropzone.drag-active {
    border-color: var(--sw-blue);
    background: var(--sw-card);
}
.wizard-dropzone.is-busy {
    pointer-events: none;
    opacity: 0.72;
}
.wizard-knowledge-progress {
    margin: 0 0 16px;
}
.wizard-knowledge-progress-bar {
    height: 6px;
    border-radius: 999px;
    background: var(--sw-border);
    overflow: hidden;
}
.wizard-knowledge-progress-bar span {
    display: block;
    height: 100%;
    width: 28%;
    border-radius: inherit;
    background: var(--sw-blue);
    animation: wizard-knowledge-indeterminate 1.1s ease-in-out infinite;
}
.wizard-knowledge-progress-text {
    margin: 8px 0 0;
    font-size: 0.9rem;
    color: var(--sw-muted);
}
@keyframes wizard-knowledge-indeterminate {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(420%); }
}
.wizard-knowledge-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
    min-height: 0;
}
.wizard-knowledge-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--sw-border);
    border-radius: 10px;
    background: var(--sw-card);
    font-size: 0.95rem;
}
.wizard-knowledge-item strong {
    font-weight: 600;
    color: var(--sw-text, #111);
    word-break: break-word;
}
.wizard-knowledge-item .wizard-knowledge-meta {
    flex-shrink: 0;
    font-size: 0.8rem;
    color: var(--sw-muted);
}
.wizard-knowledge-item.is-ok .wizard-knowledge-meta {
    color: #166534;
}
.wizard-knowledge-item.is-err .wizard-knowledge-meta {
    color: var(--sw-red, #b91c1c);
}
.wizard-knowledge-hint {
    margin: -8px 0 20px;
    font-size: 0.9rem;
    color: var(--sw-red, #b91c1c);
}

/* === Domains === */
.domains-manager {
    background: var(--sw-card);
    border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius);
    padding: 24px;
    margin-bottom: 24px;
}
.domains-manager h3 {
    margin: 0 0 16px;
    font-size: 1.1rem;
}
.wizard-extra-domain-item {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}
.btn-remove-domain {
    background: var(--sw-red);
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 48px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s;
}
.btn-remove-domain:hover {
    background: #b91c1c;
}
.domains-cost-summary {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--sw-text);
}

/* === Summary Box === */
.summary-box {
    background: var(--sw-card);
    border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius);
    padding: 24px;
    margin-bottom: 32px;
}
.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 1.05rem;
    color: var(--sw-muted);
}
.summary-line strong {
    color: var(--sw-text);
}
.summary-line.total {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--sw-border);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--sw-text);
}

/* === Dialog Overlays (Exit/Resume) === */
.setup-wizard-dialog {
    background: var(--sw-card);
    border-radius: 16px;
    padding: 28px;
    max-width: min(440px, 100%);
    width: 100%;
    box-shadow: var(--sw-shadow-lg);
    border: 1px solid var(--sw-border);
    animation: dialogIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

@keyframes dialogIn {
    from { transform: translateY(8px) scale(0.98); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.setup-wizard-dialog__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.setup-wizard-dialog__icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex: 0 0 28px;
}

.setup-wizard-dialog__title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--sw-text);
    line-height: 1.3;
}

.setup-wizard-dialog__text {
    margin: 0 0 22px;
    color: var(--sw-muted);
    line-height: 1.55;
    font-size: 0.98rem;
}

.setup-wizard-dialog__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setup-wizard-dialog-overlay .wizard-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 14px 20px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    border: none !important;
    cursor: pointer !important;
    font-family: inherit !important;
    box-shadow: none !important;
    transform: none !important;
    transition: background-color 0.15s ease, color 0.15s ease !important;
}

.setup-wizard-dialog-overlay .wizard-btn::after {
    display: none !important;
    content: none !important;
}

.setup-wizard-dialog-overlay .wizard-btn-primary {
    background: var(--sw-blue) !important;
    color: #fff !important;
}

.setup-wizard-dialog-overlay .wizard-btn-primary:hover,
.setup-wizard-dialog-overlay .wizard-btn-primary:focus-visible {
    background: var(--sw-blue-hover) !important;
    color: #fff !important;
    box-shadow: none !important;
    transform: none !important;
}

.setup-wizard-dialog-overlay .wizard-btn-secondary {
    background: var(--sw-light) !important;
    color: var(--sw-text) !important;
    border: 1px solid var(--sw-border) !important;
}

.setup-wizard-dialog-overlay .wizard-btn-secondary:hover,
.setup-wizard-dialog-overlay .wizard-btn-secondary:focus-visible {
    background: var(--sw-border) !important;
    color: var(--sw-text) !important;
    box-shadow: none !important;
    transform: none !important;
}

.setup-wizard-dialog__abort {
    background: var(--sw-red) !important;
    color: #fff !important;
    border: none !important;
}

.setup-wizard-dialog__abort:hover,
.setup-wizard-dialog__abort:focus-visible {
    background: #dc2626 !important;
    color: #fff !important;
    box-shadow: none !important;
    transform: none !important;
}

.setup-wizard-overlay .channel-fields .input-wrapper { margin-bottom: 12px; }

.setup-wizard-overlay .input-wrapper.error {
    border-color: #ff4757 !important;
    box-shadow: 0 0 0 3px rgba(255, 71, 87, 0.25) !important;
}
.setup-wizard-overlay .input-wrapper.error .input {
    border-color: #ff4757 !important;
}

/* === Личность ИИ — паспортная карточка === */
.wizard-step-eyebrow {
    display: inline-flex;
    align-items: center;
    margin: 0 0 10px;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--sw-light);
    color: var(--sw-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.setup-wizard-welcome__copy .wizard-step-eyebrow {
    margin-bottom: 12px;
}

.wizard-passport-card {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    margin: 20px 0 8px;
    padding: 24px;
    border: 1px solid var(--sw-border);
    border-radius: 16px;
    background: var(--sw-card);
    box-shadow: var(--sw-shadow);
}

.wizard-passport-card__photo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.wizard-passport-avatar-wrap {
    width: 168px;
    height: 168px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--sw-light);
    border: 1px solid var(--sw-border);
}

.wizard-passport-avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: filter .25s ease, opacity .25s ease;
}

.wizard-passport-avatar-wrap--disabled img {
    filter: grayscale(1);
    opacity: 0.45;
}

/* Avatar enable switch — inside passport, directly above avatar */
.wizard-passport-card__photo .wizard-avatar-switch-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    margin: 0 0 8px;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

.wizard-passport-card__photo .wizard-avatar-switch-row:has(.switch-input:checked) {
    border: none;
    box-shadow: none;
}

.wizard-avatar-switch {
    margin: 0;
    gap: 0;
    flex-shrink: 0;
}

.wizard-avatar-switch .switch-input {
    width: 36px !important;
    height: 20px !important;
    min-width: 36px !important;
    flex: 0 0 36px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 999px !important;
    border: 1.5px solid #dc2626 !important;
    background-color: #dc2626 !important;
    background-image: none !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 4px rgba(220, 38, 38, 0.3) !important;
    cursor: pointer;
    transition: background-color 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    display: inline-block !important;
    position: relative !important;
    vertical-align: middle !important;
}

.wizard-avatar-switch .switch-input:checked {
    background-color: #16a34a !important;
    border-color: #16a34a !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 4px rgba(22, 163, 74, 0.3) !important;
}

.wizard-avatar-switch .switch-input::before {
    display: none !important;
    content: none !important;
}

.wizard-avatar-switch .switch-input::after {
    content: '' !important;
    position: absolute !important;
    width: 14px !important;
    height: 14px !important;
    top: 1.5px !important;
    left: 1.5px !important;
    border-radius: 50% !important;
    background: #fff !important;
    border: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22) !important;
    transition: left 0.28s cubic-bezier(0.34, 1.4, 0.64, 1) !important;
    display: block !important;
    color: transparent !important;
    font-size: 0 !important;
    line-height: 0 !important;
    transform: none !important;
}

.wizard-avatar-switch .switch-input:checked::after {
    left: 18px !important;
    content: '' !important;
    color: transparent !important;
    background: #fff !important;
}

.wizard-avatar-switch .switch-input:focus-visible {
    outline: 2px solid #16a34a;
    outline-offset: 2px;
}

.wizard-avatar-switch-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--sw-muted, #475569);
    cursor: pointer;
    user-select: none;
    line-height: 1.2;
    text-align: left;
    white-space: nowrap;
}

.wizard-passport-card__photo .wizard-avatar-switch-row:has(.switch-input:checked) .wizard-avatar-switch-label {
    color: #16a34a;
}

[data-theme='dark'] .wizard-avatar-switch .switch-input::after {
    background: #fff !important;
}

.wizard-passport-refresh:disabled,
.wizard-passport-upload:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.wizard-passport-refresh,
.wizard-passport-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 168px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--sw-border);
    background: var(--sw-bg);
    color: var(--sw-text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.wizard-passport-refresh:hover,
.wizard-passport-upload:hover {
    background: var(--sw-light);
    border-color: var(--sw-border-hover);
}

.wizard-passport-upload {
    background: transparent;
    font-weight: 500;
    color: var(--sw-muted);
}

.wizard-passport-card__fields .settings-item {
    margin-bottom: 18px;
}

.wizard-passport-card__fields .setup-wizard-field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--sw-muted);
    font-weight: 500;
}

@media (max-width: 780px) {
    .wizard-passport-card {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .wizard-passport-card__photo {
        max-width: 220px;
        margin: 0 auto;
    }
}

/* === Actions Sub-screens === */
.wizard-actions-sub {
    display: none;
    opacity: 0;
    animation: wizardFadeIn 0.25s ease;
}

.wizard-actions-sub.is-active {
    display: block;
    opacity: 1;
}

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

/* === Auth Components === */
.consent-group,
.wizard-consent-group {
    margin: 20px 0 24px;
}

.wizard-consent {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    position: relative;
}

/* Hide native checkbox completely — auth CSS often draws a second box */
.wizard-consent__input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    opacity: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

.wizard-consent__input::before,
.wizard-consent__input::after,
.wizard-consent::before,
.wizard-consent::after,
.wizard-consent-group input[type="checkbox"]::before,
.wizard-consent-group input[type="checkbox"]::after {
    content: none !important;
    display: none !important;
}

.wizard-consent__box {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    border: 2px solid var(--sw-border-hover);
    border-radius: 6px;
    background: var(--sw-card);
    box-sizing: border-box;
    position: relative;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.wizard-consent__box::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.15s ease;
}

.wizard-consent__input:focus-visible + .wizard-consent__box {
    box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.2);
    border-color: var(--sw-blue);
}

.wizard-consent__input:checked + .wizard-consent__box {
    background: var(--sw-blue);
    border-color: var(--sw-blue);
}

.wizard-consent__input:checked + .wizard-consent__box::after {
    transform: rotate(45deg) scale(1);
}

.wizard-consent__text {
    font-size: 0.9rem;
    color: var(--sw-muted);
    line-height: 1.5;
}

.wizard-consent__text a {
    color: var(--sw-blue);
    text-decoration: none;
}

.wizard-consent__text a:hover {
    text-decoration: underline;
}

/* legacy aliases (unused markup) */
.consent-label { display: flex; align-items: start; gap: 12px; cursor: pointer; }
.consent-checkbox { display: none; }
.consent-text { font-size: 0.9rem; color: var(--sw-muted); line-height: 1.5; }
.consent-text a { color: var(--sw-blue); text-decoration: none; }

/* === Action Cards === */
.wizard-action-card,
.wizard-lead-type-card {
    border: 1px solid var(--sw-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    background: var(--sw-card);
    transition: all 0.2s ease;
    overflow: visible;
}

.wizard-action-card:hover,
.wizard-lead-type-card:hover {
    border-color: var(--sw-border-hover);
    box-shadow: var(--sw-shadow);
}

/* Settings/inputs: use admin-panel.css ui-kit (do not override .input-wrapper/.label globally) */
.setup-wizard-overlay .settings-item {
    margin-bottom: 20px;
}

.setup-wizard-overlay .settings-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.setup-wizard-overlay .settings-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.setup-wizard-overlay .color-input {
    width: 48px;
    height: 48px;
    border: 1px solid var(--sw-border);
    border-radius: 8px;
    cursor: pointer;
    padding: 4px;
}

/* Leads mode — same card chrome as goals step, compact stack */
.wizard-leads-mode-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 560px;
    margin: 16px auto 24px;
}

.wizard-leads-mode-list .wizard-leads-mode-card {
    display: block;
    margin: 0;
}

.wizard-leads-mode-list .goal-content {
    height: auto;
    padding: 16px 18px;
}

.wizard-leads-mode-list .goal-content h3 {
    font-size: 1.05rem;
    margin-bottom: 6px;
}

.wizard-leads-mode-list .goal-content p {
    font-size: 0.9rem;
}

.wizard-leads-mode-list .wizard-leads-mode-card.is-disabled,
.wizard-leads-mode-list .wizard-leads-mode-card:has(input:disabled) {
    opacity: 0.55;
    pointer-events: none;
}

.wizard-leads-mode-list .wizard-leads-mode-card.is-disabled .goal-content,
.wizard-leads-mode-list .wizard-leads-mode-card:has(input:disabled) .goal-content {
    cursor: not-allowed;
}

.smart-select-wrapper--compact {
    width: 100%;
    min-width: 0;
}

.smart-select-trigger,
.smart-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.smart-select-flag.setup-wizard-emoji,
.smart-select-flag .setup-wizard-emoji-img {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}

.wizard-action-field .smart-select-wrapper,
.wizard-lead-field .smart-select-wrapper {
    min-width: 100px;
}

.wizard-field-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--sw-muted);
    line-height: 1.4;
}

.wizard-field-required {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--sw-text);
    cursor: pointer;
    user-select: none;
    position: relative;
}

.wizard-field-required input[type="checkbox"],
.wizard-check__input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    opacity: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

.wizard-check,
.wizard-org-official {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    position: relative;
    flex-shrink: 0;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--sw-border);
    background: var(--sw-card);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.wizard-check:hover,
.wizard-org-official:hover {
    border-color: var(--sw-border-hover);
}

.wizard-check__box {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--sw-border-hover);
    background: #fff;
    box-sizing: border-box;
    flex-shrink: 0;
    position: relative;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.wizard-check__box::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.15s ease;
}

.wizard-check__input:focus-visible + .wizard-check__box {
    box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.2);
}

.wizard-check__input:checked + .wizard-check__box,
.wizard-field-required .wizard-check__input:checked + .wizard-check__box {
    background: var(--sw-blue);
    border-color: var(--sw-blue);
}

.wizard-check__input:checked + .wizard-check__box::after,
.wizard-field-required .wizard-check__input:checked + .wizard-check__box::after {
    transform: rotate(45deg) scale(1);
}

.wizard-check__input:checked ~ .wizard-check__text {
    color: var(--sw-text);
}

.wizard-org-official:has(.wizard-check__input:checked) {
    border-color: rgba(0, 82, 255, 0.35);
    background: rgba(0, 82, 255, 0.06);
}

.wizard-check__text {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--sw-muted);
    white-space: nowrap;
    line-height: 1.2;
}

.wizard-org-name-row {
    display: flex;
    align-items: stretch;
    gap: 12px;
}

.wizard-field-required .wizard-check__box {
    width: 18px;
    height: 18px;
    border-radius: 5px;
}

.wizard-field-required .wizard-check__box::after {
    left: 4px;
    top: 0;
    width: 4px;
    height: 9px;
}

.wizard-field-required .wizard-check__text {
    font-size: 0.82rem;
    font-weight: 500;
}

.color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

/* === Шаг 9: Тарифы — scoped redesign === */
#wizard-step-9.wizard-step--wide {
    max-width: 1080px;
}

#wizard-step-9 .wizard-tariffs-shell {
    max-width: 1080px;
    margin: 0 auto;
}

/* Volume block — compact card */
#wizard-step-9 .wizard-volume-card {
    background: var(--sw-card);
    border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius);
    padding: 20px 24px;
    margin: 0 auto 24px;
    max-width: 640px;
}

#wizard-step-9 .wizard-volume-card .setup-wizard-field-label {
    display: block;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--sw-muted);
    font-weight: 500;
}

#wizard-step-9 .wizard-volume-card #wizardVolumeLabel {
    color: var(--sw-text);
    font-weight: 700;
}

#wizard-step-9 .wizard-volume-card .range-slider-wrap {
    position: relative;
    margin-bottom: 8px;
}

#wizard-step-9 .wizard-volume-card .slider-labels {
    margin-bottom: 16px;
}

#wizard-step-9 .wizard-volume-card .savings-display-cyber {
    margin-top: 4px;
    padding: 12px 16px;
}

#wizard-step-9 .wizard-volume-card .savings-amount {
    font-size: 1.25rem;
}

/* Tariff cards — up to 4 in one row (packages + custom/free) */
#wizard-step-9 #wizardTariffsContainer {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 0 auto 24px;
    max-width: 1080px;
}

#wizard-step-9 #wizardTariffsContainer:has(> :nth-child(3):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 820px;
}

#wizard-step-9 #wizardTariffsContainer:has(> :nth-child(2):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 560px;
}

#wizard-step-9 #wizardTariffsContainer:has(> :only-child) {
    grid-template-columns: minmax(0, 280px);
    max-width: 280px;
}

#wizard-step-9 .wizard-tariff-card {
    border: 2px solid var(--sw-border);
    padding: 16px;
    border-radius: var(--sw-radius);
    background: var(--sw-card);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    box-sizing: border-box;
}

#wizard-step-9 .wizard-tariff-card:hover {
    border-color: var(--sw-border-hover);
}

#wizard-step-9 .wizard-tariff-card.selected {
    border-color: var(--sw-blue);
    background: var(--sw-card);
    box-shadow: var(--sw-shadow);
}

#wizard-step-9 .wizard-tariff-card.selected::after {
    display: none;
}

#wizard-step-9 .wizard-tariff-card h4 {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--sw-text);
}

#wizard-step-9 .wt-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sw-text);
    margin-bottom: 10px;
}

#wizard-step-9 .wt-features {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

#wizard-step-9 .wt-features li {
    font-size: 0.8rem;
    color: var(--sw-muted);
    padding: 4px 0 4px 16px;
    position: relative;
    line-height: 1.35;
    margin-bottom: 6px;
}

#wizard-step-9 .wt-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 0;
    color: var(--sw-blue);
    font-weight: 700;
}

/* Options panel — contained, below selected tariff */
#wizard-step-9 #wizardTariffOptions {
    max-width: 760px;
    margin: 0 auto 24px;
    background: var(--sw-card);
    border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius);
    padding: 20px 24px;
}

#wizard-step-9 #wizardTariffOptions > h4 {
    margin: 0 0 16px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--sw-text);
}

#wizard-step-9 .wizard-tariff-roles,
#wizard-step-9 .wizard-tariff-addons {
    padding: 14px 16px;
    border: 1px solid var(--sw-border);
    border-radius: 10px;
    background: var(--sw-light);
}

#wizard-step-9 .wizard-tariff-addons {
    margin-top: 12px;
}

/* 2-column wrap for role / addon checkboxes */
#wizard-step-9 .wizard-tariff-roles,
#wizard-step-9 .wizard-tariff-addons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
    align-content: start;
}

#wizard-step-9 .wizard-tariff-roles .role-checkbox,
#wizard-step-9 .wizard-tariff-addons .addon-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 0.9rem;
    color: var(--sw-text);
    cursor: pointer;
    line-height: 1.4;
}

#wizard-step-9 .wizard-tariff-roles .role-checkbox input,
#wizard-step-9 .wizard-tariff-addons .addon-checkbox input {
    accent-color: var(--sw-blue);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

#wizard-step-9 .wizard-tariff-roles .role-checkbox .tariff-role-icon,
#wizard-step-9 .wizard-tariff-roles .role-checkbox .role-chip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Live price — prominent */
#wizard-step-9 #wizardTariffLivePrice {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(0, 82, 255, 0.08);
    color: var(--sw-blue);
    font-size: 1.25rem;
    font-weight: 700;
    text-align: right;
    line-height: 1.2;
}

@media (max-width: 980px) {
    #wizard-step-9 #wizardTariffsContainer,
    #wizard-step-9 #wizardTariffsContainer:has(> :nth-child(3):last-child),
    #wizard-step-9 #wizardTariffsContainer:has(> :nth-child(4):last-child) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-width: 560px;
    }
}

@media (max-width: 780px) {
    #wizard-step-9 #wizardTariffsContainer,
    #wizard-step-9 #wizardTariffsContainer:has(> :nth-child(3):last-child),
    #wizard-step-9 #wizardTariffsContainer:has(> :nth-child(4):last-child),
    #wizard-step-9 #wizardTariffsContainer:has(> :nth-child(2):last-child) {
        grid-template-columns: 1fr;
        max-width: 420px;
    }

    #wizard-step-9 .wizard-tariff-card {
        min-height: auto;
    }

    #wizard-step-9 .wizard-tariff-roles,
    #wizard-step-9 .wizard-tariff-addons {
        grid-template-columns: 1fr;
    }

    #wizard-step-9 .wizard-volume-card,
    #wizard-step-9 #wizardTariffOptions {
        padding: 16px 18px;
    }

    .wizard-org-name-row {
        flex-direction: column;
    }
}

/* === Шаг 11: Success view — centered === */
#wizard-step-11 #wizardSuccessView[hidden] {
    display: none !important;
}

#wizard-step-11 #wizardSuccessView:not([hidden]) {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 560px;
    width: 100%;
    margin: 0 auto;
    padding: 48px 20px;
    box-sizing: border-box;
}

#wizard-step-11 #wizardSuccessView h2 {
    text-align: center !important;
    width: 100%;
    margin: 0 0 16px;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--sw-text);
}

#wizard-step-11 #wizardSuccessView p,
#wizard-step-11 #wizardSuccessView .wizard-success-lead,
#wizard-step-11 #wizardSuccessView .wizard-success-payhint,
#wizard-step-11 #wizardSuccessView .wizard-success-delay {
    text-align: center !important;
    margin: 0 0 14px;
    color: var(--sw-muted);
    font-size: 1rem;
    line-height: 1.6;
    max-width: 480px;
}

#wizard-step-11 #wizardSuccessView .wizard-success-lead {
    color: var(--sw-text);
    font-size: 1.05rem;
}

#wizard-step-11 #wizardSuccessView .wizard-success-num {
    display: inline-block;
    font-size: 2em;
    font-weight: 800;
    line-height: 1;
    color: #0052FF;
    font-variant-numeric: tabular-nums;
    text-shadow: none;
    vertical-align: -0.12em;
    margin: 0 0.06em;
}

#wizard-step-11 #wizardSuccessView .wizard-success-payhint {
    margin-bottom: 20px;
    font-weight: 500;
}

#wizard-step-11 #wizardSuccessView .wizard-success-delay {
    margin-bottom: 28px;
    font-size: 0.92rem;
}

#wizard-step-11 #wizardSuccessView #wizardSuccessTrialCopy[hidden],
#wizard-step-11 #wizardSuccessView #wizardSuccessPaidCopy[hidden] {
    display: none !important;
}

#wizard-step-11 #wizardSuccessView .wizard-btn {
    margin: 0 auto;
    display: inline-flex;
}

#wizard-step-11 #wizardSuccessView .wizard-success-survey {
    width: 100%;
    max-width: 400px;
    margin: 28px auto 0;
    text-align: left;
}

#wizard-step-11 #wizardSuccessView .wizard-success-survey .setup-wizard-field-label {
    display: block;
    margin: 0 0 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--sw-text);
    line-height: 1.35;
}

#wizard-step-11 #wizardSuccessView .wizard-success-survey .smart-select-wrapper {
    width: 100%;
}

#wizard-step-11 #wizardSummaryPaymentView[hidden] {
    display: none !important;
}

/* Action slash toggle + emoji picker */
.wizard-action-slash-switch-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.wizard-action-slash-switch-label {
    font-size: 0.92rem;
    color: var(--sw-text);
    font-weight: 500;
    line-height: 1.35;
}

.wizard-action-slash-fields {
    overflow: visible;
    max-height: 0;
    opacity: 0;
    transform: translateY(-6px);
    margin-bottom: 0;
    transition: max-height 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease, transform 0.28s ease;
    pointer-events: none;
}

.wizard-action-slash-fields.is-visible {
    max-height: 520px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    margin-bottom: 4px;
    overflow: visible;
}

.wizard-action-slash-name-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.sw-emoji-picker {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sw-emoji-picker__trigger {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--sw-border);
    background: var(--sw-card, #fff);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.sw-emoji-picker__trigger:hover {
    border-color: var(--sw-blue, #2563eb);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.sw-emoji-picker__preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    line-height: 1;
}

.sw-emoji-picker__placeholder {
    font-size: 18px;
    color: var(--sw-muted, #94a3b8);
    font-weight: 400;
}

.sw-emoji-picker__clear {
    display: none;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--sw-muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
}

.sw-emoji-picker.has-emoji .sw-emoji-picker__clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sw-emoji-picker__clear:hover {
    color: var(--sw-red, #dc2626);
    background: rgba(220, 38, 38, 0.08);
}

.sw-emoji-picker__popover {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    bottom: auto;
    z-index: 120;
    width: min(320px, 78vw);
    max-height: 320px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid var(--sw-border);
    background: var(--sw-card, #fff);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.sw-emoji-picker.is-open .sw-emoji-picker__popover {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.sw-emoji-picker__popover.is-portaled {
    position: fixed;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid var(--sw-border);
    background: var(--sw-card, #fff);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
    opacity: 1;
    transform: none;
    pointer-events: auto;
    max-height: 320px;
    z-index: 100010;
}

#wizard-step-8 .wizard-action-card {
    overflow: visible;
}

.sw-emoji-picker__search {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.88rem !important;
    padding: 8px 10px !important;
}

.sw-emoji-picker__cats {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
}

.sw-emoji-picker__cat {
    flex: 0 0 auto;
    border: none;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--sw-muted);
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.sw-emoji-picker__cat:hover {
    background: rgba(37, 99, 235, 0.08);
    color: var(--sw-blue, #2563eb);
}

.sw-emoji-picker__cat.is-active {
    background: rgba(37, 99, 235, 0.12);
    color: var(--sw-blue, #2563eb);
}

.sw-emoji-picker__grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    overflow-y: auto;
    max-height: 200px;
    padding: 2px;
}

.sw-emoji-picker__item {
    width: 100%;
    aspect-ratio: 1;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    transition: background 0.12s ease, transform 0.12s ease;
}

.sw-emoji-picker__item:hover {
    background: rgba(37, 99, 235, 0.1);
    transform: scale(1.08);
}

.sw-emoji-picker__img,
.sw-emoji-fallback {
    display: block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    font-size: 20px;
}

/* === Phone layout only. Desktop/PC rules above stay unchanged. === */
@media (max-width: 780px) {
    .setup-wizard-overlay {
        overflow-x: hidden;
        overscroll-behavior: contain;
    }

    .setup-wizard-content {
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        padding: 10px 16px 0 !important;
        padding-top: max(10px, env(safe-area-inset-top)) !important;
        padding-left: max(16px, env(safe-area-inset-left)) !important;
        padding-right: max(16px, env(safe-area-inset-right)) !important;
        overflow: hidden !important;
    }

    .setup-wizard-header {
        padding-bottom: 10px;
        gap: 8px;
    }

    .setup-wizard-logo {
        gap: 8px;
        font-size: 0.95rem;
        min-width: 0;
    }

    .setup-wizard-logo img {
        width: 20px !important;
        height: 20px !important;
        flex-shrink: 0;
    }

    .setup-wizard-logo span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .setup-wizard-progress {
        padding: 12px 0 8px;
        max-width: none;
        gap: 0;
    }

    .progress-step {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
        box-shadow: none;
    }

    .progress-step.active {
        box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.15);
    }

    .progress-step--finish .progress-finish-flag {
        width: 11px;
        height: 11px;
    }

    .progress-line {
        margin: 0 3px;
        min-width: 4px;
    }

    .setup-wizard-body {
        padding: 12px 0 0;
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
        overscroll-behavior: contain;
    }

    .wizard-step,
    .wizard-step.wizard-step--wide,
    #wizard-step-9.wizard-step--wide {
        max-width: none;
    }

    .wizard-step h2,
    .setup-wizard-welcome-title {
        font-size: 1.35rem !important;
        line-height: 1.25;
        margin-bottom: 8px !important;
    }

    .wizard-step > p,
    .wizard-step p {
        font-size: 0.95rem;
        margin-bottom: 16px;
    }

    .setup-wizard-welcome {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        margin-bottom: 16px;
        min-height: 0;
        text-align: left;
    }

    .setup-wizard-welcome__art {
        display: none;
    }

    .goals-grid,
    .platform-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 16px;
    }

    .goal-content,
    .platform-content {
        padding: 16px;
    }

    .channel-row {
        flex-wrap: wrap;
        gap: 12px;
        padding: 14px;
    }

    .channel-fields .settings-item,
    .setup-wizard-overlay .settings-item {
        margin-bottom: 14px;
    }

    .wizard-actions {
        position: sticky;
        bottom: 0;
        z-index: 8;
        display: flex;
        flex-wrap: nowrap;
        justify-content: stretch;
        gap: 10px;
        margin-top: 16px;
        padding: 12px 0 calc(10px + env(safe-area-inset-bottom));
        background: var(--sw-bg);
        border-top: 1px solid var(--sw-border);
        box-shadow: 0 -8px 16px -12px rgba(15, 23, 42, 0.18);
    }

    .wizard-actions .wizard-btn {
        flex: 1 1 0;
        min-height: 44px;
        padding: 12px 14px;
        font-size: 0.95rem;
    }

    .setup-wizard-welcome-actions {
        justify-content: stretch !important;
    }

    .setup-wizard-welcome-actions .wizard-btn {
        flex: 1 1 100%;
        width: 100%;
    }

    .split-view {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .lwp-preview-container {
        min-height: 0;
        order: 2;
    }

    .setup-wizard-overlay .lwp-preview-container iframe,
    .setup-wizard-overlay #wizardRealPreviewIframe,
    .setup-wizard-overlay .design-preview-iframe {
        height: 240px !important;
        max-height: 38vh;
    }

    .setup-wizard-overlay #wizardPreviewExpandedBg {
        min-height: 0 !important;
        padding: 10px !important;
    }

    .setup-wizard-overlay #wizardPreviewCollapsedBg {
        min-height: 160px;
    }

    .setup-wizard-overlay .lwp-preview-container > .preview-card[style*="flex: 0 0 250px"] {
        flex: 0 0 180px !important;
    }

    .vblock-mode-picker,
    .vblock-mode-picker--visual {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 8px;
    }

    .vblock-mode-card {
        padding: 8px 6px;
    }

    .setup-wizard-overlay .settings-row {
        flex-wrap: wrap;
        align-items: stretch;
    }

    .setup-wizard-overlay .color-input {
        width: 44px;
        height: 44px;
    }

    .setup-wizard-overlay input.input,
    .setup-wizard-overlay textarea.input,
    .setup-wizard-overlay select,
    .setup-wizard-overlay .input-wrapper .input,
    .floating-label-group input,
    .floating-label-group textarea,
    .floating-label-group select {
        font-size: 16px !important;
    }

    .calculator-section {
        padding: 18px 16px;
        margin-bottom: 16px;
    }

    .calc-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .wizard-dropzone {
        padding: 28px 16px;
    }

    .wizard-header-row {
        flex-wrap: wrap;
    }

    .wizard-leads-mode-list {
        max-width: none;
        margin: 12px 0 16px;
    }

    .setup-wizard-dialog-overlay {
        padding: 12px;
        align-items: flex-end;
    }

    .setup-wizard-dialog-overlay .setup-wizard-dialog {
        width: 100%;
        max-width: none;
        margin: 0;
        border-radius: 16px 16px 0 0;
        padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
    }

    #wizard-step-11 #wizardSuccessView:not([hidden]) {
        padding: 24px 8px 12px;
    }

    #wizard-step-11 #wizardSuccessView h2 {
        font-size: 1.35rem;
    }

    .wizard-step--stroke {
        max-width: none;
    }

    .wizard-stroke-inline-host {
        min-height: 220px;
    }
}

@media (max-width: 480px) {
    .setup-wizard-content {
        padding-left: max(12px, env(safe-area-inset-left)) !important;
        padding-right: max(12px, env(safe-area-inset-right)) !important;
    }

    .progress-step {
        width: 22px;
        height: 22px;
        font-size: 0.65rem;
        border-width: 1.5px;
    }

    .progress-line {
        margin: 0 2px;
    }

    .vblock-mode-picker,
    .vblock-mode-picker--visual {
        grid-template-columns: 1fr 1fr;
    }
}

@media (hover: none) {
    .setup-wizard-overlay .vblock-mode-card:hover,
    .setup-wizard-overlay .vblock-theme-card:hover,
    .setup-wizard-overlay .vblock-pos-card:hover,
    .setup-wizard-overlay .goal-card:hover .goal-content,
    .setup-wizard-overlay .wizard-tariff-card:hover,
    .setup-wizard-overlay .wizard-action-card:hover,
    .setup-wizard-overlay .wizard-lead-type-card:hover {
        transform: none !important;
        box-shadow: none;
    }
}



