.spellcheck-editor {
    position: relative;
    width: 100%;
    min-width: 0;
}
/* CAF/report fields use inline-flex. Keep feedback below its textarea. */
.inputWrap:not(tr):not(td):not(th):has(> .spellcheck-editor),
.input-with-label-wrapper:has(> .spellcheck-editor) {
    flex-wrap: wrap;
}
.inputWrap > .spellcheck-editor,
.input-with-label-wrapper > .spellcheck-editor,
.inputWrap > .spellcheck-feedback,
.input-with-label-wrapper > .spellcheck-feedback {
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.spellcheck-editor .spellcheck-backdrop {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    color: transparent;
    background: #fff;
    border-radius: 6px;
}
/* Survey report review notes have their own flex row and trailing action buttons. */
.stnd-caf-item-review-row:has(> .spellcheck-editor) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
}
.stnd-caf-item-review-row > .spellcheck-editor {
    grid-column: 1;
    grid-row: 1;
}
.stnd-caf-item-review-row > .stnd-caf-item-actions {
    grid-column: 2;
    grid-row: 1;
}
.stnd-caf-item-review-row > .spellcheck-feedback {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}
.stnd-caf-item-review-row .spellcheck-editor textarea.stnd-caf-review-input {
    width: 100%;
}
.spellcheck-backdrop mark {
    color: transparent;
    background: #ffe3e1;
    border-bottom: 2px solid #d33443;
    padding: 0;
    font: inherit;
}
.spellcheck-editor textarea.spellcheck-input,
.spellcheck-editor input.spellcheck-input {
    position: relative;
    display: block;
    width: 100%;
    background: transparent;
}
.spellcheck-feedback {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: #52647d;
}
/* Attach on focus inserts this area up front; keep it collapsed until a status, issue, or detail exists. */
.spellcheck-feedback:has(> [role="status"]:empty):not(:has(.spellcheck-issues > button, .spellcheck-detail:not(:empty))) {
    display: none;
}
.spellcheck-issues,
.spellcheck-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.spellcheck-feedback button {
    padding: 4px 10px;
    border: 1px solid #cbd9ec;
    border-radius: 5px;
    color: #244e95;
    background: #f2f6ff;
    font: inherit;
    cursor: pointer;
}
.spellcheck-feedback button:focus-visible {
    outline: 2px solid #2563eb;
}
.spellcheck-issues button {
    color: #a52d49;
    background: #fff0f3;
    border-color: #efbdca;
}
.spellcheck-issues button:hover {
    background: #ffe2e9;
    border-color: #d9869c;
}
.spellcheck-backdrop mark.spellcheck-corrected {
    background: #dff3e5;
    border-bottom-color: #368653;
}
.spellcheck-issues button.spellcheck-corrected {
    color: #24653c;
    background: #e7f5ec;
    border-color: #a6d5b5;
}
.spellcheck-issues button.spellcheck-corrected:hover {
    background: #d4eddd;
    border-color: #6eb286;
}
.spellcheck-detail {
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid #dce5f3;
    border-radius: 6px;
}
.spellcheck-feedback .spellcheck-correct-all,
.spellcheck-feedback .spellcheck-restore-all {
    flex-shrink: 0;
    font-weight: 600;
}
.spellcheck-feedback .spellcheck-restore-all:disabled {
    opacity: 0.45;
    cursor: default;
}
.spellcheck-issue-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 6px;
}
.spellcheck-issue-row .spellcheck-issues {
    flex: 1;
    min-width: 0;
    margin-top: 0;
}
.spell-dictionary-overlay {
    position: fixed; inset: 0; z-index: 11000; background: rgba(16, 36, 64, .38);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.spell-dictionary-dialog {
    background: #fff; border: 1px solid #d8e3f3; border-radius: 16px;
    width: 540px; max-width: 100%; max-height: calc(100vh - 40px); overflow: auto;
    padding: 28px; box-shadow: 0 18px 60px rgba(20, 40, 80, .2); color: #20334d;
}
.spell-dictionary-dialog h2 { font-size: 21px; margin: 0 0 16px; }
.spell-dictionary-dialog p { margin: 12px 0; line-height: 1.65; font-size: 14px; }
.spell-dictionary-dialog label { display: block; margin: 16px 0 8px; font-weight: 600; }
.spell-dictionary-dialog input, .spell-dictionary-dialog select {
    width: 100%; min-height: 40px; border: 1px solid #cbd8ed; border-radius: 6px; padding: 8px 10px;
}
.spell-dictionary-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.spellcheck-suggestions .spellcheck-dictionary-add { background: #fff; border-color: #9bacc4; color: #344b68; }
