.structure-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid #39779b;
    border-radius: 8px;
    background: #263943;
    color: #9cddff;
    font: inherit;
    font-weight: 780;
    white-space: nowrap;
    cursor: pointer;
}

.structure-inline-action {
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid #39779b;
    border-radius: 8px;
    background: #263943;
    color: #9cddff;
    font: inherit;
    font-weight: 780;
    white-space: nowrap;
    cursor: pointer;
}

.structure-inline-action.primary {
    border-color: #118fdc;
    background: #0b86d2;
    color: #fff;
}

.tree-node.highlighted {
    border-color: #32b5ff;
    box-shadow: 0 0 0 2px rgba(50, 181, 255, .18);
}

.structure-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    align-items: start;
    justify-items: center;
    overflow-y: auto;
    padding: 20px;
    background: rgba(0, 0, 0, .72);
}

.structure-dialog {
    box-sizing: border-box;
    width: min(980px, 100%);
    max-height: calc(100vh - 40px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 22px;
    border: 1px solid #454545;
    border-radius: 15px;
    background: #222;
    box-shadow: 0 30px 90px #000;
}

.structure-dialog.structure-dialog-medium {
    width: min(900px, 100%);
}

.structure-dialog.structure-dialog-wide {
    width: min(1100px, 100%);
}

.structure-dialog > header {
    display: flex;
    justify-content: space-between;
}

.structure-dialog > header p {
    margin: 2px 0 14px;
    color: #aaa;
}

.structure-dialog > header span {
    color: #34b3ff;
    font-size: .75rem;
    font-weight: 850;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.structure-dialog > header h2 {
    margin: 5px 0 16px;
}

.structure-dialog > header button {
    width: 38px;
    height: 38px;
    border: 1px solid #555;
    border-radius: 50%;
    background: #303030;
    color: #fff;
    font-size: 1.35rem;
}

.structure-form-mode {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #3d6577;
    border-radius: 10px;
    background: #203640;
}

.structure-form-mode p {
    margin: 0;
    color: #bed0d8;
}

.structure-form-mode.compact-info {
    display: block;
}

.structure-form-mode button {
    padding: 8px 12px;
    border: 1px solid #4f91b0;
    border-radius: 8px;
    background: #294653;
    color: #aee2ff;
    font-weight: 800;
}

.structure-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.structure-form-grid label {
    display: grid;
    align-content: start;
    grid-auto-rows: max-content;
    gap: 7px;
    min-width: 0;
    font-weight: 800;
}

.structure-form-grid label.wide {
    grid-column: 1 / -1;
}

.structure-form-grid label.check {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: end;
}

.structure-form-grid label.check input {
    width: 22px;
    height: 22px;
}

.structure-form-grid input:not([type=checkbox]),
.structure-form-grid select,
.structure-form-grid textarea {
    box-sizing: border-box;
    width: 100%;
    padding: 11px;
    border: 1px solid #555;
    border-radius: 8px;
    background: #303030;
    color: #eee;
    font: inherit;
}

.structure-form-grid input[readonly] {
    background: #292929;
    color: #bbb;
}

.structure-form-grid textarea {
    min-height: 96px;
    resize: vertical;
}

.structure-form-grid small {
    color: #8fa3ad;
    font-weight: 500;
}

.structure-expert {
    grid-column: 1 / -1;
    padding: 12px;
    border: 1px dashed #4b5b63;
    border-radius: 9px;
    background: #272d30;
}

.structure-expert summary {
    cursor: pointer;
    color: #9cddff;
    font-weight: 800;
}

.structure-expert label {
    margin-top: 12px;
}

.structure-picker-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    margin: 14px 0;
    padding: 12px;
    border: 1px solid #3f4e55;
    border-radius: 10px;
    background: #282d30;
}

.structure-picker-toolbar input[type=text],
.structure-picker-toolbar > input:not([type=checkbox]) {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 10px;
    border: 1px solid #50575a;
    border-radius: 8px;
    background: #303638;
    color: #eee;
}

.structure-picker-toolbar label {
    display: flex;
    gap: 7px;
    align-items: center;
    color: #c8d3d8;
}

.structure-picker-toolbar > span {
    color: #8fd5fa;
    font-weight: 800;
    white-space: nowrap;
}

.structure-question-picker {
    display: grid;
    gap: 8px;
    max-height: 48vh;
    overflow-y: auto;
    padding-right: 4px;
}

.structure-picker-question {
    display: grid;
    grid-template-columns: auto minmax(260px, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid #414141;
    border-radius: 10px;
    background: #282828;
    cursor: pointer;
}

.structure-picker-question.selected {
    border-color: #2f9edc;
    background: #233741;
}

.structure-picker-question.assigned {
    opacity: .7;
    cursor: default;
}

.structure-picker-main {
    display: grid;
    gap: 4px;
}

.structure-picker-main small {
    color: #bbb;
    line-height: 1.35;
}

.structure-picker-main em {
    color: #8197a3;
    font-size: .78rem;
    font-style: normal;
}

.structure-picker-badges {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.structure-picker-badges b {
    padding: 4px 7px;
    border: 1px solid #46606d;
    border-radius: 999px;
    background: #273840;
    color: #afdbee;
    font-size: .72rem;
}

.structure-picker-badges b.assigned {
    border-color: #6b582f;
    background: #3a3221;
    color: #f0d49a;
}

.structure-picker-empty {
    display: grid;
    gap: 8px;
    justify-items: start;
    padding: 20px;
    border: 1px dashed #4a4a4a;
    border-radius: 10px;
    color: #aaa;
}

.structure-dialog > footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #393939;
}

.structure-dialog > footer button {
    min-height: 42px;
    padding: 8px 15px;
    border: 1px solid #505050;
    border-radius: 8px;
    background: #303030;
    color: #eee;
    font-weight: 800;
}

.structure-dialog > footer button.primary {
    border-color: #168fd1;
    background: #0b86d2;
    color: #fff;
}

.structure-dialog > footer button:disabled {
    opacity: .55;
}

@media (max-width: 820px) {
    .structure-root > header > .structure-link-button {
        grid-column: 2;
    }

    .structure-form-grid {
        grid-template-columns: 1fr;
    }

    .structure-form-grid label.wide {
        grid-column: auto;
    }

    .structure-form-mode {
        align-items: stretch;
        flex-direction: column;
    }

    .structure-picker-toolbar,
    .structure-picker-question {
        grid-template-columns: 1fr;
    }

    .structure-picker-badges {
        justify-content: flex-start;
    }
}
