/* The form's header bar: white, edge to edge, 56px like the plugin header (admin_header.css). .wrap sits 10px
   below the top, 22px from the admin menu (#wpcontent padding 20px + .wrap margin 2px) and 20px from the right;
   the negative margins undo that. */
.wp-sjs-editor__header {
    display: flex;
    flex-wrap: nowrap; /* the actions never move under the title: actions-overflow.js puts the extra ones in "…" */
    align-items: center;
    gap: 8px 24px;
    box-sizing: border-box;
    min-height: 56px;
    margin: -10px -20px 0 -22px;
    padding: 8px 20px;
    background: #fff;
    border-bottom: 1px solid #dcdcde;
}

@media screen and (max-width: 782px) {
    .wp-sjs-editor__header {
        margin: -10px -12px 0 -10px;
        padding: 8px 10px;
    }
}

/* All Forms / form name at 16px: the main text of the bar, a step above the 14px of the plugin header's tabs.
   The form name is the page h1, in the same size. */
.wp-sjs-editor .wp-sjs-editor__crumbs {
    flex: 1 1 auto;
    min-width: 0; /* shrinks without overflow: hidden, which would clip the focus frame of the name field */
    margin: 0;
    font-size: 16px;
    line-height: 24px;
}

.wp-sjs-editor__crumbs li {
    min-width: 0;
}

.wp-sjs-editor .wp-sjs-editor__crumbs li + li::before {
    margin: 0 12px;
}

.wp-sjs-editor .wp-sjs-editor__crumbs h1 {
    margin-block: 0;
    padding: 0;
    color: #1d2327;
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
}

/* Form name, edited in place. The button and the input share padding, border and font with the h1 text; the
   h1 is pulled left by that padding and border (9px), so the name sits where plain h1 text would and does not
   move when it turns into the input. Hover and focus follow the WP core field: #949494 border on hover, the
   theme color with a 1.5px ring on focus. */
.wp-sjs-editor .wp-sjs-editor__title {
    min-width: 0;
    margin-inline: -9px 0;
}

.wp-sjs-editor__title-button,
.wp-sjs-editor__title-input {
    box-sizing: border-box;
    max-width: 100%;
    margin: -3px 0;
    padding: 2px 8px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: inherit;
    font: inherit;
    line-height: inherit;
}

.wp-sjs-editor__title-button {
    cursor: text;
    text-align: start;
}

.wp-sjs-editor__title-button:hover {
    border-color: #949494;
}

.wp-sjs-editor__title-button:focus-visible {
    outline: none;
    border-color: var(--wp-admin-theme-color);
    box-shadow: 0 0 0 var(--wp-admin-border-width-focus, 1.5px) var(--wp-admin-theme-color);
}

/* WP core text inputs are 40px tall with 12px padding; the title input keeps the h1's size instead. */
.wp-core-ui .wp-sjs-editor input.wp-sjs-editor__title-input {
    height: auto;
    min-height: 0;
    margin: -3px 0;
    padding: 2px 8px;
    font: inherit;
    line-height: inherit;
}

.wp-sjs-editor__title-input {
    min-width: 12ch;
    field-sizing: content;
    border-color: var(--wp-admin-theme-color);
    background: #fff;
    box-shadow: 0 0 0 var(--wp-admin-border-width-focus, 1.5px) var(--wp-admin-theme-color);
    min-height: 0;
}

/* Browsers without field-sizing get a fixed width instead of one that follows the text. */
@supports not (field-sizing: content) {
    .wp-sjs-editor__title-input {
        width: 32ch;
    }
}

.wp-core-ui .wp-sjs-editor input.wp-sjs-editor__title-input:focus {
    border-color: var(--wp-admin-theme-color);
    box-shadow: 0 0 0 var(--wp-admin-border-width-focus, 1.5px) var(--wp-admin-theme-color);
}

.wp-sjs-editor__title-button[hidden],
.wp-sjs-editor__title-input[hidden] {
    display: none;
}

.wp-sjs-editor__tabs {
    display: flex;
    align-items: flex-end;
    margin-top: 16px;
    margin-bottom: 12px;
}

.wp-sjs-editor__tabs .nav-tab {
    transition-property: background, color;
}

.wp-sjs-editor__tabs .nav-tab:focus:not(:focus-visible) {
    box-shadow: none;
}

/* Editor actions on the title row, right-aligned: the add-on's Full screen, Open full preview, Embed,
   Save as Template and Save. The spacing comes from the gap, not from margins on each button. */
.wp-sjs-editor__actions {
    display: flex;
    flex: none; /* the title gives way first, down to 200px; then actions-overflow.js moves buttons into "…" */
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin-inline-start: auto;
}

.wp-sjs-editor__actions > * {
    flex: none;
}

/* A long form name ends with an ellipsis instead of pushing the actions away. */
.wp-sjs-editor__crumbs ol {
    flex-wrap: nowrap;
}

.wp-sjs-editor__crumbs li:first-child {
    flex: none;
    white-space: nowrap;
}

.wp-sjs-editor__crumbs li:last-child {
    min-width: 0;
}

.wp-sjs-editor__title-button {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Actions that do not fit go into the "…" menu (actions-overflow.js). */
/* (.button in the selector: it must beat .wp-core-ui .button.wp-sjs-button-icon, which is inline-flex.) */
.wp-core-ui .wp-sjs-editor__actions > .button.wp-sjs-is-overflowed,
.wp-sjs-editor__more[hidden] {
    display: none;
}

.wp-sjs-editor__more {
    position: relative;
}

/* "…": a square button as high as the others (40px). */
.wp-core-ui .wp-sjs-editor__more-toggle.button {
    justify-content: center;
    width: 40px;
    padding: 0;
}

/* The menu looks like the form switcher's menu on Entries: white, 1px #dcdcde border, 2px radius, a soft shadow,
   rows with the hover gray of core lists; right-aligned under "…". */
.wp-sjs-editor__more-menu {
    position: absolute;
    z-index: 1000;
    top: calc(100% + 4px);
    right: 0;
    min-width: 200px;
    box-sizing: border-box;
    margin: 0;
    padding: 4px;
    border: 1px solid #dcdcde;
    border-radius: 2px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    list-style: none;
}

.wp-sjs-editor__more-menu[hidden] {
    display: none;
}

.wp-sjs-editor__more-menu li {
    margin: 0;
}

.wp-sjs-editor__more-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border: 0;
    border-radius: 2px;
    background: none;
    color: #1d2327;
    font: inherit;
    font-size: 13px;
    line-height: 20px;
    text-align: start;
    white-space: nowrap;
    cursor: pointer;
}

.wp-sjs-editor__more-item:hover,
.wp-sjs-editor__more-item:focus {
    outline: none;
    background: #f0f0f1;
}

.wp-sjs-editor__more-item .dashicons,
.wp-sjs-editor__more-item svg {
    flex: none;
    width: 16px;
    height: 16px;
    font-size: 16px;
    line-height: 1;
    color: #50575e;
    fill: currentColor;
}

.wp-sjs-editor__actions .wp-sjs-editor__embed[aria-expanded="true"] {
    background: #f0f0f1;
    border-color: #0a4b78;
    color: #0a4b78;
}

.wp-sjs-embed {
    width: min(640px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100vh - 32px);
    padding: 0;
    border: 0;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, .3);
    background: #fff;
    color: #3c434a;
}

.wp-sjs-embed[open] {
    display: flex;
    flex-direction: column;
}

.wp-sjs-embed::backdrop {
    background: rgba(0, 0, 0, .7);
}

html:has(.wp-sjs-embed[open]) {
    overflow: hidden;
}

.wp-sjs-embed__header,
.wp-sjs-embed__footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
}

.wp-sjs-embed__header {
    border-bottom: 1px solid #dcdcde;
}

.wp-sjs-embed__header h2 {
    flex: 1;
    margin: 0;
    color: #1d2327;
    font-size: 18px;
}

.wp-sjs-embed__close {
    color: #646970;
}

.wp-sjs-embed__close .dashicons {
    width: 24px;
    height: 24px;
    font-size: 24px;
}

.wp-sjs-embed__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 16px 16px;
    overflow: auto;
}

.wp-sjs-embed__footer {
    justify-content: flex-end;
    border-top: 1px solid #dcdcde;
}

.wp-sjs-embed__unsaved[hidden],
.wp-sjs-editor-next[hidden] {
    display: none;
}

.wp-sjs-embed h3 {
    margin-block: 16px 4px;
    color: #1d2327;
    font-size: 13px;
}

.wp-sjs-embed__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.wp-sjs-embed__row select {
    max-width: 100%;
}

.wp-sjs-editor__pane-header {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #c3c4c7;
    background: #f6f7f7;
}

/* Theme tab, compact: one line without titles or hints, 12px from the edges.
   Line 1: Adaptive, then what applies to it (Customize Adaptive theme when on; the theme and Transparent background
   when off), 16px apart, wrapped lines 12px apart. Match your site with AI ends the line and opens a dialog. */
.wp-sjs-editor__theme-mode[hidden] {
    display: none;
}

.wp-sjs-editor__theme-mode {
    border-bottom: 1px solid #c3c4c7;
}

.wp-sjs-editor__theme-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    padding: 12px;
}

.wp-sjs-editor__theme-line > span:not([hidden]) {
    display: inline-flex;
    align-items: center;
}

.wp-sjs-editor__theme-line > [hidden] {
    display: none;
}

.wp-sjs-editor__theme-line .wp-sjs-editor__theme-label {
    font-size: 14px;
    line-height: 20px;
    color: #1d2327;
}

.wp-sjs-editor__media {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    border-top: 1px solid #c3c4c7;
}

.wp-sjs-editor__media > .description {
    flex-basis: 100%;
}

.wp-sjs-editor__media .button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.wp-core-ui .wp-sjs-editor__media .button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
    vertical-align: middle;
}

.wp-sjs-editor__media .button[hidden] {
    display: none;
}

.wp-sjs-editor__images {
    display: flex;
    flex-direction: column;
    flex-basis: 100%;
    gap: 4px;
    margin: 4px 0 0;
}

.wp-sjs-editor__images[hidden] {
    display: none;
}

.wp-sjs-editor__image {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.wp-sjs-editor__image img {
    flex: none;
    width: 32px;
    height: 32px;
    object-fit: cover;
    border: 1px solid #dcdcde;
}

.wp-sjs-editor__image-name {
    flex: 0 1 auto;
    max-width: 30%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wp-sjs-editor__image input {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
}

.wp-sjs-editor__image-remove {
    flex: none;
    color: #646970;
}

.wp-sjs-editor__image-remove:hover,
.wp-sjs-editor__image-remove:focus {
    color: #d63638;
}

.wp-sjs-media-frame .attachment-details .setting[data-setting="alt"],
.wp-sjs-media-frame .attachment-details #alt-text-description,
.wp-sjs-media-frame .attachment-details .setting[data-setting="title"],
.wp-sjs-media-frame .attachment-details .setting[data-setting="caption"],
.wp-sjs-media-frame .attachment-details .setting[data-setting="description"] {
    display: none;
}

.wp-sjs-editor__pane.is-theme-json-locked .wp-sjs-editor__monaco {
    opacity: 0.5;
}

.wp-sjs-editor__ai-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wp-sjs-editor__issues {
    margin: 0 0 8px 18px;
    list-style: disc;
}

.wp-sjs-editor__issues li {
    margin-bottom: 2px;
    overflow-wrap: anywhere;
}

.wp-sjs-editor__issue-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

#wp-sjs-ai-notice {
    flex-basis: 100%;
}

#wp-sjs-ai-notice:empty {
    display: none;
}

#wp-sjs-ai-notice .notice {
    margin: 0;
}

#wp-sjs-ai-notice code {
    font-size: 12px;
}

.wp-core-ui .button.wp-sjs-editor__builder-button {
    display: inline-flex;
    flex: 0 1 260px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    height: auto;
    padding: 8px 16px;
    line-height: 1.4;
    white-space: normal;
    text-align: center;
}

.wp-core-ui .button.wp-sjs-editor__builder-button[hidden] {
    display: none;
}

.wp-sjs-editor__builder-title {
    font-size: 14px;
    font-weight: 600;
}

.wp-sjs-editor__builder-note {
    font-size: 12px;
    font-weight: 400;
}

@media screen and (max-width: 782px) {
    .wp-core-ui .button.wp-sjs-editor__builder-button {
        flex-basis: 100%;
    }
}

.wp-sjs-editor__ui-builder-status {
    flex-basis: 100%;
}

.wp-sjs-editor__ui-builder-status:empty {
    display: none;
}

.wp-sjs-editor__ui-builder-status .notice {
    margin: 0;
}

.wp-sjs-editor__columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.wp-sjs-editor__pane {
    border: 1px solid #c3c4c7;
    background: #fff;
}

.wp-sjs-editor__overlay {
    position: sticky;
    top: calc(var(--wp-admin--admin-bar--height, 32px) + 8px);
    z-index: 20;
    height: 0;
}

.wp-sjs-editor__overlay .wp-sjs-editor__format {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    transition: opacity 0.1s;
}

.wp-sjs-editor__pane:hover .wp-sjs-editor__format,
.wp-sjs-editor__pane:focus-within .wp-sjs-editor__format {
    opacity: 1;
}

.wp-sjs-editor__pane:has(.find-widget.visible) .wp-sjs-editor__format {
    display: none;
}

.wp-sjs-editor__monaco {
    direction: ltr;
    min-height: 300px;
}

/* WordPress styles every .button, input and textarea in the admin, and Monaco's widgets (find and replace, command
   palette) use that class and those elements but set only what they need, so this resets just the properties Monaco
   leaves to WordPress, in SurveyJS Forms' JSON editor and Survey Creator's alike. WordPress marks disabled buttons !important. */
body.wp-core-ui .monaco-editor .button {
    min-height: auto;
    margin-block: 0;
    border: 0;
    box-shadow: none;
    box-sizing: content-box;
    color: inherit;
    vertical-align: baseline;
    white-space: normal;
}

body.wp-core-ui .monaco-editor .button:is(.disabled, [aria-disabled="true"]) {
    color: inherit !important;
    background: transparent !important;
}

body.wp-core-ui .monaco-editor :is(input, textarea) {
    min-height: auto;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    background-color: transparent;
}

/* Monaco leaves the keyboard focus ring of these to the browser, and WordPress removes it from every div and input. */
body.wp-core-ui .monaco-editor :where(.button, .monaco-custom-toggle, input):focus {
    outline: revert;
}

.wp-sjs-editor__settings {
    min-width: 0;
}

.wp-sjs-editor__settings h2:first-child,
.wp-sjs-editor__settings > input[type="hidden"] + h2 {
    margin-top: 0;
}

.wp-sjs-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0 8px;
}

.wp-sjs-item {
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    background: #fff;
}

.wp-sjs-item.is-inactive .wp-sjs-item__name,
.wp-sjs-item.is-inactive .wp-sjs-item__summary {
    color: #646970;
}

.wp-sjs-item__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 0 0 12px;
}

.wp-sjs-item__active {
    flex: none;
    white-space: nowrap;
}

.wp-sjs-item__title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.wp-sjs-item__title:focus-visible {
    outline: 2px solid var(--wp-admin-theme-color, #2271b1);
    outline-offset: -2px;
}

.wp-sjs-item__name {
    font-weight: 600;
}

.wp-sjs-item__summary {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: #50575e;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wp-sjs-item.is-open .wp-sjs-item__title .dashicons {
    transform: rotate(180deg);
}

.wp-sjs-item__body {
    padding: 0 12px 12px;
    border-top: 1px solid #dcdcde;
}

.wp-sjs-item__body .form-table th {
    width: 160px;
}

.wp-sjs-item__actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 8px 0 0;
}

.wp-sjs-conditions__rules {
    margin: 0 0 8px;
}

.wp-sjs-conditions__rule {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.wp-sjs-conditions__rule select,
.wp-sjs-conditions__rule input[type="text"] {
    max-width: 240px;
}

.wp-sjs-conditions__always {
    margin-top: 0;
}

.wp-sjs-webhook-headers {
    margin: 0 0 8px;
}

.wp-sjs-webhook-headers__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.wp-sjs-webhook-log {
    max-width: 640px;
}

.wp-sjs-webhook-log__error {
    color: #b32d2e;
}

.wp-sjs-webhook-log__resend {
    margin-left: 4px;
}

.wp-sjs-integrations__add {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.wp-sjs-integrations__webhooks,
.wp-sjs-editor .wp-sjs-editor__settings > input[type="hidden"] + h2.wp-sjs-integrations__webhooks {
    margin-top: 32px;
}

.wp-sjs-single-choice {
    display: inline-block;
    margin-right: 8px;
    font-weight: 600;
    line-height: 30px;
}

.wp-sjs-field-map {
    max-width: 640px;
}

.wp-sjs-field-map th[scope="row"] {
    width: 40%;
    padding: 8px 10px;
}

.wp-sjs-field-map input[type="text"] {
    margin-top: 4px;
}

.wp-sjs-webhook-format pre {
    max-width: 640px;
    overflow: auto;
    padding: 8px 12px;
    background: #f6f7f7;
}

.wp-sjs-editor__loading {
    padding: 0 12px;
    color: #646970;
}

.wp-sjs-editor__preview {
    position: sticky;
    top: calc(var(--wp-admin--admin-bar--height, 32px) + 16px);
    height: calc(100vh - var(--wp-admin--admin-bar--height, 32px) - 32px);
    display: flex;
    flex-direction: column;
    border: 1px solid #c3c4c7;
    background: #fff;
}

.wp-sjs-editor__preview-bar {
    display: flex;
    align-items: center;
    gap: 8px 12px;
    padding: 8px 12px;
    border-bottom: 1px solid #c3c4c7;
    background: #f6f7f7;
}

.wp-sjs-editor__preview-note {
    flex: 1 1 auto;
    margin: 0;
}

.wp-sjs-editor__preview-close {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 4px;
}

.wp-sjs-editor__preview-close[hidden] {
    display: none;
}

/* Above the admin bar (99999) and SurveyJS popups (2000). The extra classes outrank rules that hide the preview
   on some tabs, such as those of SurveyJS Forms Add-on, which load later. */
.wp-sjs-editor.wp-sjs-editor--full-preview .wp-sjs-editor__columns > .wp-sjs-editor__preview {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 100000;
    width: auto;
    height: auto;
    border: 0;
}

body.wp-sjs-editor-full-preview-open {
    overflow: hidden;
}

.wp-sjs-editor__preview-frame {
    display: block;
    flex: 1;
    width: 100%;
    min-height: 0;
    border: 0;
}

@media (max-width: 960px) {
    .wp-sjs-editor__columns {
        grid-template-columns: minmax(0, 1fr);
    }

    .wp-sjs-editor__preview {
        position: static;
        height: 70vh;
    }
}

.wp-sjs-lint {
    position: sticky;
    bottom: 0;
    z-index: 20;
    border-top: 1px solid #c3c4c7;
    background: #fff;
}

.wp-sjs-lint__bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
}

.wp-sjs-lint__summary {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wp-sjs-lint__meta {
    flex-shrink: 0;
    color: #646970;
    font-size: 12px;
}

.wp-sjs-lint .wp-sjs-lint__toggle {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-inline-start: auto;
    color: #2271b1;
    text-decoration: none;
}

.wp-sjs-lint .wp-sjs-lint__toggle:hover,
.wp-sjs-lint .wp-sjs-lint__toggle:focus {
    color: #135e96;
}

.wp-sjs-lint__toggle .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.wp-sjs-lint__details {
    max-height: 288px;
    overflow-y: auto;
    padding: 4px 12px 12px;
    border-top: 1px solid #f0f0f1;
}

.wp-sjs-lint__heading {
    margin: 8px 0 0;
    color: #646970;
    font-size: 11px;
    text-transform: uppercase;
}

.wp-sjs-lint__rule-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 12px 0 4px;
    font-weight: 600;
}

.wp-sjs-lint__findings {
    margin: 0;
}

.wp-sjs-lint__finding {
    display: block;
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    background: #fff;
    text-align: start;
    cursor: pointer;
}

.wp-sjs-lint__finding:hover,
.wp-sjs-lint__finding.is-selected {
    border-color: #2271b1;
    background: #f0f6fc;
}

.wp-sjs-lint__finding .description,
.wp-sjs-lint__path {
    display: block;
    margin-top: 4px;
}

.wp-sjs-lint__path {
    padding: 0;
    background: none;
    color: #646970;
    font-size: 12px;
}

.wp-sjs-lint__passing {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 2px 16px;
    margin: 12px 0 0;
    color: #646970;
}

.wp-sjs-lint__passing li {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}

.wp-sjs-lint__icon-warning,
.wp-sjs-lint__severity-warning {
    color: #dba617;
}

.wp-sjs-lint__severity-error {
    color: #d63638;
}

.wp-sjs-lint__severity-info {
    color: #646970;
}

.wp-sjs-lint-glyph::before {
    content: "";
    display: block;
    width: 8px;
    height: 8px;
    margin: 6px auto;
    border-radius: 50%;
}

.wp-sjs-lint-glyph-error::before {
    background: #d63638;
}

.wp-sjs-lint-glyph-warning::before {
    background: #dba617;
}

.wp-sjs-lint-glyph-info::before {
    background: #646970;
}

.wp-sjs-lint-line {
    width: 3px !important;
    margin-left: 3px;
}

.wp-sjs-lint-line-error {
    background: #d63638;
}

.wp-sjs-lint-line-warning {
    background: #dba617;
}

.wp-sjs-lint-line-info {
    background: #646970;
}

.wp-sjs-lint-line-highlight {
    background: rgba(34, 113, 177, 0.12);
}

.wp-sjs-editor__preview-frame--full,
.wp-sjs-editor--full-preview #wp-sjs-preview {
    display: none;
}

.wp-sjs-editor--full-preview .wp-sjs-editor__preview-frame--full {
    display: block;
}

.wp-sjs-editor--preview-loading .wp-sjs-editor__preview-frame--full {
    visibility: hidden;
}

@media screen and (max-width: 782px) {
    .wp-sjs-editor__tabs {
        flex-wrap: wrap;
    }
}

.wp-sjs-editor__empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 64px 24px 24px;
    text-align: center;
}

.wp-sjs-editor__empty[hidden],
.wp-sjs-editor--full-preview .wp-sjs-editor__empty,
.wp-sjs-editor--empty:not(.wp-sjs-editor--full-preview) #wp-sjs-preview {
    display: none;
}

.wp-sjs-editor__empty p {
    max-width: 440px;
    margin: 0 0 16px;
}

.wp-sjs-editor .wp-sjs-editor__empty-title {
    margin: 0 0 8px;
    font-size: 1.3em;
}

.wp-sjs-editor__empty-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.wp-sjs-editor__empty .wp-sjs-editor__empty-actions {
    align-self: stretch;
    max-width: none;
}

.wp-core-ui .wp-sjs-editor__empty-actions .button {
    flex: 0 1 220px;
    min-width: 0;
    white-space: normal;
}

@media screen and (max-width: 782px) {
    .wp-core-ui .wp-sjs-editor__empty-actions .button {
        flex-basis: 100%;
    }
}

.wp-sjs-editor .button.wp-sjs-editor__highlight {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #00a32a;
}

.wp-sjs-editor-next .button-link {
    vertical-align: baseline;
}

.wp-sjs-editor__ai-notice .wp-sjs-editor__ai-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.wp-sjs-editor__ai-notice .wp-sjs-editor__ai-alert {
    color: #8a2424;
}

.wp-sjs-editor__ai-notice .wp-sjs-editor__ai-actions .button {
    margin-right: 4px;
}

.wp-sjs-editor .form-table tr.wp-sjs-editor__ai-changed > th {
    box-shadow: inset 3px 0 0 #dba617;
    padding-left: 10px;
}

.wp-sjs-editor__tabs .nav-tab.wp-sjs-editor__tab--ai::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 6px;
    border-radius: 50%;
    background: #dba617;
    vertical-align: middle;
}

/* Settings tabs of the form editor (Email, Webhooks, Entries, Restrictions, Spam Protection, Advanced, the
   Add-on's PDF): sections on the page background, no cards.
   - A section is a top-level row: its title (14px semibold) and 8px under it the checkbox or field.
     Sections are 16px above and below a 1px #dcdcde line.
   - The settings a checkbox turns on (rows with data-enabled-by) are hidden while it is off and sit under it,
     24px in from the section: label in a 176px column, field 24px from it, so fields line up at 224px.
     A label next to a 40px field sits in its middle (10px down). Rows in a section are 16px apart.
   - Fields: 350px for a text, email, URL, date or a select on its own; 120px for a number; textareas fill the
     column. Fields in a sentence ("10 per day", "Identify people by …") keep their own size.
   - Tab titles (Webhooks) are 16.9px / 22px.
   The tables inside a webhook keep their own compact layout. */
.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table),
.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) > tbody {
    display: block;
    margin: 0;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) > tbody > tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 8px;
    padding: 16px 0;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) > tbody > tr[hidden] {
    display: none;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) > tbody > tr:first-child {
    padding-top: 0;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) > tbody > tr:not([data-enabled-by]):not(:first-child) {
    border-top: 1px solid #dcdcde;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) > tbody > tr > th,
.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) > tbody > tr > td {
    display: block;
    width: auto;
    margin: 0;
    padding: 0;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) > tbody > tr > th {
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
    color: #1d2327;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) > tbody > tr[data-enabled-by] {
    grid-template-columns: 176px minmax(0, 1fr);
    column-gap: 24px;
    padding: 0 0 16px 24px;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) > tbody > tr[data-enabled-by] > th {
    font-weight: 400;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) > tbody > tr[data-enabled-by]:has(> td > :is(input:not([type="checkbox"]), select, .wp-sjs-inline-fields):first-child) > th {
    padding-top: 10px;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) > tbody > tr[data-enabled-by]:has(> td > textarea:first-child) > th {
    padding-top: 4px;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) td > :is(input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="datetime-local"], select):first-child:not(:has(+ :is(input, select, label, span))) {
    width: 350px;
    max-width: 100%;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) input.small-text {
    width: 120px;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) textarea.large-text {
    width: 100%;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) td .description {
    margin-top: 8px;
}

/* A group of rows after the tab's main rows (Auto-reply, PDF link in emails) is one more section. */
.wp-sjs-editor .wp-sjs-editor__settings > .form-table + [role="group"],
.wp-sjs-editor .wp-sjs-editor__settings > [role="group"] + [role="group"] {
    border-top: 1px solid #dcdcde;
    padding-top: 16px;
}

.wp-sjs-editor .wp-sjs-editor__settings > h2 {
    margin: 32px 0 8px;
    font-size: 16.9px;
    line-height: 22px;
}

.wp-sjs-editor .wp-sjs-editor__settings > h2:first-child,
.wp-sjs-editor .wp-sjs-editor__settings > input[type="hidden"] + h2 {
    margin-top: 0;
}

/* Send test email: on its own line under Send To, 8px below the field. */
.wp-core-ui .wp-sjs-editor #wp-sjs-send-test-email {
    display: block;
    margin-top: 8px;
}

/* Notices inside a settings row ("CAPTCHA is not set up yet"): 8px under the checkbox and 8px above the next hint. */
.wp-sjs-editor .wp-sjs-editor__settings .form-table td > .notice.inline {
    margin: 8px 0 0;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table td > .notice.inline + .description {
    margin-top: 8px;
}

/* Webhooks tab: title, 8px, intro paragraphs 8px apart, then the list, Add webhook and Request format 16px apart. */
.wp-sjs-editor .wp-sjs-editor__settings[data-panel="webhooks"] > p.description {
    margin: 0 0 8px;
}

.wp-sjs-editor .wp-sjs-editor__settings[data-panel="webhooks"] > .wp-sjs-items {
    margin: 16px 0 0;
}

.wp-sjs-editor .wp-sjs-editor__settings[data-panel="webhooks"] .wp-sjs-items__empty {
    margin: 0;
}

.wp-sjs-editor .wp-sjs-editor__settings[data-panel="webhooks"] > p:has(> #wp-sjs-webhook-add) {
    margin: 16px 0 0;
}

.wp-sjs-editor .wp-sjs-editor__settings[data-panel="webhooks"] > .wp-sjs-webhook-format {
    margin-top: 16px;
}

/* A notice above a tab's settings ("Entry limits … work only when Store entries is on"): 16px above the first row. */
.wp-sjs-editor .wp-sjs-editor__settings > .notice.inline:first-child {
    margin: 0 0 16px;
}

/* Fields in a sentence ("100 in total", "1 Identify people by User account", "Delete after … 90 days"):
   one centered line with 8px between the parts. */
.wp-sjs-editor .wp-sjs-inline-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.wp-sjs-editor .wp-sjs-inline-fields > * {
    margin: 0;
}

.wp-sjs-editor .wp-sjs-inline-fields > span:not([hidden]) {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Hints on the settings tabs and the Theme tab look the same everywhere: 14px / 21px, #646970, as the hints under
   the fields of the settings rows (WordPress sets those to 14px). */
.wp-sjs-editor .wp-sjs-editor__settings .description,
.wp-sjs-editor .wp-sjs-ai-dialog .description,
.wp-sjs-editor .wp-sjs-editor__media .description {
    font-size: 14px;
    line-height: 21px;
    color: #646970;
}

/* Everything under a field in a settings row is 8px apart: hints, "Add a … question" checkboxes, Use HTML content type,
   the accent color swatch. A textarea is a block, so no descender gap is left under it. */
.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) td > textarea {
    display: block;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) td > p:not(.description),
.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) td > div:not(.wp-sjs-inline-fields):not(.notice) > p {
    margin: 8px 0 0;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) td > div:not(.wp-sjs-inline-fields):not(.notice) {
    margin: 0;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) td > span[data-enabled-by]:not([hidden]) {
    display: block;
    margin-top: 8px;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) td > fieldset {
    display: grid;
    justify-items: start;
    gap: 8px;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) td > fieldset > br {
    display: none;
}

/* A note under all the rows of a tab ("Messages replace the form…") is one more section: a line, then 16px. */
.wp-sjs-editor .wp-sjs-editor__settings > .form-table + p.description {
    margin: 0;
    padding-top: 16px;
    border-top: 1px solid #dcdcde;
}

/* WordPress gives fieldset labels .35em / .5em margins with !important; here checkboxes in a list are 8px apart. */
.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) td > fieldset > label {
    margin: 0 !important;
    line-height: 20px;
}

/* A dependent setting that is just a checkbox (Partial entries, PDF Attachment) needs no label column and no indent:
   the checkbox text says it, at the left edge like the checkbox it depends on. The row header stays in the markup for the AI draft notice, hidden here. */
.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) > tbody > tr[data-enabled-by]:has(> td > label:first-child > input[type="checkbox"]) {
    grid-template-columns: minmax(0, 1fr);
    padding-left: 0;
}

.wp-sjs-editor .wp-sjs-editor__settings .form-table:not(.wp-sjs-item .form-table) > tbody > tr[data-enabled-by]:has(> td > label:first-child > input[type="checkbox"]) > th {
    display: none;
}

/* GDPR agreement is a setting, not one of the image buttons: 16px from Set logo (8px + the 8px gap). */
.wp-sjs-editor__media .wp-sjs-editor__gdpr {
    margin-left: 8px;
}

/* Picking an image (Insert image, Set logo, the PDF logo): the WordPress media window, kept as it is, but not over
   the whole screen: 960 x 640px in the middle, smaller on small screens. Below 900px WordPress makes it full screen. */
@media screen and (min-width: 901px) {
    .media-modal:has(.wp-sjs-media-frame) {
        top: 50%;
        right: auto;
        bottom: auto;
        left: 50%;
        width: min(960px, calc(100vw - 60px));
        height: min(640px, calc(100vh - 60px));
        transform: translate(-50%, -50%);
    }
}

/* Under the JSON: the image buttons and the static analysis bar stay pinned to the bottom of the window while the
   JSON scrolls, as one footer of the pane. The list of chosen images scrolls inside it after 160px. */
.wp-sjs-editor__pane-footer {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: #fff;
}

.wp-sjs-editor__pane-footer .wp-sjs-lint {
    position: static;
}

.wp-sjs-editor__pane-footer .wp-sjs-editor__images {
    max-height: 160px;
    overflow-y: auto;
}

/* Match your site with AI dialog: the Embed dialog's frame (640px, header, footer with the buttons on the right).
   The intro is 16px under the header; each step title 16px above its control, 8px under it. */
.wp-sjs-ai-dialog .wp-sjs-embed__body > .description {
    margin: 16px 0 0;
}

.wp-sjs-ai-dialog .wp-sjs-embed__body h3 {
    margin: 16px 0 8px;
}

.wp-sjs-ai-dialog .wp-sjs-embed__body h3 + p {
    margin: 0;
}

.wp-sjs-ai-dialog #wp-sjs-ai-answer {
    display: block;
}

.wp-sjs-ai-dialog #wp-sjs-ai-notice:not(:empty) {
    margin-top: 8px;
}

.wp-sjs-ai-dialog #wp-sjs-ai-notice .notice {
    margin: 0;
}

/* Customize (Adaptive on) and Match your site with AI: a group at the right end of the line, 8px apart. */
.wp-sjs-editor__theme-line > .wp-sjs-editor__theme-actions {
    gap: 8px;
    margin-left: auto;
}

.wp-sjs-editor__theme-actions > .button[hidden] {
    display: none;
}

/* The image block under the JSON is for the Config tab only (hidden on Theme). */
.wp-sjs-editor__media[hidden] {
    display: none;
}

/* Background image (Theme tab, Adaptive off): the button, then Remove 8px after it when the theme has an image. */
#wp-sjs-theme-bg-image-row {
    gap: 8px;
}

#wp-sjs-theme-bg-image-row > [hidden] {
    display: none;
}

/* The theme list (Adaptive off) takes the free width of its line. */
.wp-sjs-editor__theme-line > #wp-sjs-theme-preset-row {
    flex: 1 1 200px;
}

.wp-sjs-editor__theme-line #wp-sjs-theme-preset {
    width: 100%;
    max-width: none;
}
