.theme-switch{display:inline-flex;align-items:center;gap:3px;padding:3px;border:1px solid var(--line);border-radius:9px;background:var(--soft)}
.theme-switch button{display:flex;align-items:center;justify-content:center;gap:6px;border:0;border-radius:6px;padding:7px 9px;background:transparent;color:var(--muted);font-size:11px;white-space:nowrap}
.theme-switch button.active{background:#fff;color:var(--green);box-shadow:0 1px 3px #0001}
.theme-switch svg{width:15px;height:15px;flex-shrink:0}
.theme-switch button:focus-visible{outline:2px solid var(--green);outline-offset:2px}
html[data-theme=dark]{color-scheme:dark;--ink:#d9e2dc;--muted:#afbeb4;--line:#4a5d51;--green:#71bb98;--soft:#354b3e;--bg:#26352d;--accent:#ddedb3;--surface:#304137;--raised:#3b4e42}
html[data-theme=dark] .demo-bar{background:#33483a;color:#a9bdad}
html[data-theme=dark] :is(.topbar,.editor-head,.edit-panel,.login-wrap,.quiz-card,.form-card,.leads-filters,.quiz-select-options,.quiz-multiselect>summary,.lead-card,.integration-cards .integration-card,.quiz-analytics-panel,.result-rich-input,.result-modal-header,.sales-script-select summary,.sales-script-options,.question-num,.mini-button,.transition-options label,dialog){background:var(--surface);color:var(--ink);border-color:var(--line)}
html[data-theme=dark] .theme-switch button.active{background:var(--raised);color:var(--green)}
html[data-theme=dark] .avatar{background:var(--soft);border-color:var(--line);color:var(--green)}
html[data-theme=dark] :is(.question-rail,.preview-panel){background:#2a3a30}
html[data-theme=dark] :is(.answer-card,.external-code-field textarea.external-code){background:#2a3a30;border-color:var(--line)}
html[data-theme=dark] :is(input:not([type=checkbox]):not([type=radio]):not([type=range]),textarea,select):not(.preview-frame *){background:#29392f;color:var(--ink);border-color:var(--line)}
html[data-theme=dark] :is(input,textarea)::placeholder{color:#a4b2a8;opacity:1}
html[data-theme=dark] :is(input,textarea,select):focus{border-color:var(--green)}
html[data-theme=dark] :is(.button,.image-upload input::file-selector-button){background:var(--raised);color:var(--ink);border-color:var(--line)}
html[data-theme=dark] .button:hover{background:#465e4d}
html[data-theme=dark] :is(.button.primary,.active .question-num,.quiz-mode-option.selected span,.embed-copied){background:#2e6652;color:#edf4ee;border-color:#4c9675}
html[data-theme=dark] .button.primary:hover{background:#397d63}
html[data-theme=dark] .button.dark{background:#3d5546;color:#e0e9e2}
html[data-theme=dark] .button.text{background:transparent;border-color:transparent;color:var(--muted)}
html[data-theme=dark] :is(.button.danger,.mock-error,.quiz-delete-warning,.quiz-icon-action[data-action=delete-quiz],.publication-warning,.lead-record-action.danger){color:#f3978a}
html[data-theme=dark] :is(.lead-record-action.danger:hover,.question-remove:hover,.question-remove:focus-visible){background:#573b36;color:#f5a69a}
html[data-theme=dark] .badge{background:#504834;color:#d7c18c}
html[data-theme=dark] :is(.badge.published,.count,.flow-item:hover,.flow-item.active,.question-item:hover,.question-item.active,.question-row.active,.main-menu a:hover,.leads-count,.analytics-stat,.transition-options label:has(input:checked)){background:var(--soft);border-color:#536d59}
html[data-theme=dark] .info-note{background:#334b38;color:#b2c6ad;border-color:#4e6551}
html[data-theme=dark] .rail-note{color:var(--muted)}
html[data-theme=dark] .segments{background:#29392f;border-color:var(--line)}
html[data-theme=dark] .segments button{color:var(--muted)}
html[data-theme=dark] .segments button.active{background:var(--raised);color:var(--ink)}
html[data-theme=dark] .quiz-art{background:#3c5440}
html[data-theme=dark] .quiz-card:nth-child(2) .quiz-art{background:#4b4c3d}
html[data-theme=dark] .quiz-card:nth-child(3) .quiz-art{background:#3b535b}
html[data-theme=dark] .quiz-art strong{color:#b1c99d}
html[data-theme=dark] .quiz-art .art-number{color:#8da781}
html[data-theme=dark] :is(.sales-script-options button:hover,.form-card-open:hover){background:var(--soft)}
html[data-theme=dark] .integration-cards .integration-card.integration-enabled{background:#34513d;border-color:#4c9675}
html[data-theme=dark] .integration-mark.metrika{background:#564a35;color:#e6bd7e}
html[data-theme=dark] :is(.integration-mark.bitrix,.integration-mark.telegram,.integration-mark.amocrm){background:#354f5d;color:#8bc3db}
html[data-theme=dark] :is(.integration-mark.sheets,.integration-mark.webhook){background:#395640;color:#89caa1}
html[data-theme=dark] :is(.analytics-stat>span,.question-remove){color:var(--muted)}
html[data-theme=dark] .analytics-bar-track{background:#3e5244}
html[data-theme=dark] :is(.lead-integration-error,.lead-integration-error:hover,.lead-integration-error:focus-visible,#save-alert){background:#573c37;color:#f6a398;border-color:#74433c}
html[data-theme=dark] :is(#toast,.remove-tooltip,.webhook-icon:after){background:#465c4d;color:#e2eae4}
html[data-theme=dark] .check-list li span{color:#d7b27d}
html[data-theme=dark] .quiz-mode-option span{background:#2a3a30;border-color:var(--line)}
/* The preview retains the published quiz's actual colors. */
html[data-theme=dark] .preview-frame{color-scheme:light;--ink:#252e2c;--muted:#78817e;--line:#e4e8e3;--green:#2e6652;--soft:#edf3ec;--bg:#f6f7f3;background:#fff;color:var(--ink)}
html[data-theme=dark] .preview-frame :is(input,textarea)::placeholder{color:#b5bab7}
@media(max-width:1050px){.topbar{height:auto;min-height:77px;flex-wrap:wrap;gap:14px;padding-top:14px;padding-bottom:14px}.top-right{gap:10px}.theme-switch button{padding:7px}}
@media(max-width:620px){.top-right{width:100%;justify-content:flex-end}.theme-switch{margin-right:auto}.theme-switch button{font-size:11px;padding:7px 9px}}
