/* --------------------------------------------------------------------------
   Template / MASK / VARS editors
   -------------------------------------------------------------------------- */
.website-action-form { display: grid; gap: 9px; min-width: 0; }
.website-action-form__identity-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.website-action-form__field { display: grid; grid-template-columns: max-content auto; align-items: center; gap: 7px; min-width: 0; margin: 0; }
.website-action-form__field label { margin: 0; white-space: nowrap; }
.website-action-form__field--code input { width: 50px; }
.website-action-form__field--name input { width: 150px; }
.website-action-form__field--url { grid-template-columns: max-content minmax(0, 1fr); }
.website-action-form__field--url input { width: min(300ch, 100%); max-width: 100%; min-width: 0; }
.website-action-form__actions { display: flex; justify-content: flex-start; }
.website-action-edit-form { max-width: 100%; }

.vars-workspace {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 8px;
}
.vars-workspace > .panel { min-width: 0; margin: 0; }
.vars-workspace h2 { margin: 0 0 6px; color: #274967; font-size: .95rem; }
.vars-playground-status { min-height: 1.15em; margin: 4px 0 0; color: var(--sb-text-soft); font-size: var(--sb-font-xs); }
.vars-playground-status--error { color: var(--sb-danger); }
.vars-playground-status--success { color: var(--sb-success); }
.vars-playground-highlight-editor {
    width: 100%;
    min-height: 24rem;
    padding: 9px 11px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    tab-size: 4;
    background: #182230;
    color: #f8fafc;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: .9rem;
    line-height: 1.5;
    outline: none;
}
.vars-playground-highlight-editor:focus { box-shadow: inset 0 0 0 2px rgba(96, 165, 250, .8); }
.vars-playground-highlight-editor .template-error-x {
    color: #ff3b30;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
    font-weight: 800;
}

.code-editor { min-width: 0; overflow: hidden; border: 1px solid #b9c4d0; border-radius: var(--sb-radius-sm); background: #777; }
.code-editor code { display: block; }
.code-editor textarea,
.code-textarea,
.mail-body {
    min-height: 300px;
    margin: 0;
    padding: 9px 10px;
    background: #777;
    border: 0;
    border-radius: 0;
    color: #f8fafc;
    box-shadow: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: .8rem;
    line-height: 1.42;
    tab-size: 4;
    white-space: pre;
}
.code-editor textarea:focus, .code-textarea:focus, .mail-body:focus { border: 0; box-shadow: inset 0 0 0 2px #3d83b5; outline: 0; }
.mail-body--has-errors { box-shadow: inset 0 0 0 2px #bf5353; }
pre { max-width: 100%; overflow: auto; margin: 5px 0; padding: 7px 8px; background: #f3f5f7; border: 1px solid var(--sb-border); border-radius: var(--sb-radius-sm); font-size: .78rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }
.syntax-help { margin-top: 5px; border: 1px solid var(--sb-border); border-radius: var(--sb-radius-sm); background: #fafbfd; }
.syntax-help > summary { padding: 5px 7px; cursor: pointer; color: #4b5e73; font-size: .78rem; font-weight: 800; }
.syntax-help[open] > summary { border-bottom: 1px solid var(--sb-border); }
.syntax-help pre { margin: 0; border: 0; border-radius: 0; background: #f6f8fa; }
.mask-editor-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 7px;
}
.mask-editor-form > .form-errors,
.mask-editor-form > .actions-bar { grid-column: 1 / -1; }
.mask-editor-section { margin: 0; }
.mask-editor-section__header { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.mask-editor-section__header-left { min-width: 0; }
.mask-editor-section__header-left h2 { margin: 0; }
.mask-editor-section__header-right { display: flex; justify-content: flex-end; min-width: 0; margin-left: auto; }
.mask-editor-search { width: min(240px, 100%); min-width: 0; margin-left: auto; }
.mask-editor-section > p { margin: 0 0 5px; }

.template-content-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, .75fr); align-items: start; gap: 8px; }
.template-content-layout--single { grid-template-columns: 1fr; }
.template-content-main { min-width: 0; }
.template-mail-identity-fields { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.template-mail-identity-fields > .field { min-width: 0; }
.template-mail-identity-field--category { grid-column: span 2; }
.template-mail-identity-field--name { grid-column: span 4; }
.template-mail-identity-field--code,
.template-mail-identity-field--response { grid-column: span 1; }
.template-content-main .code-textarea,
.template-content-main .code-editor textarea {
    width: 100%;
    height: 50vh;
    min-height: 0;
    max-height: 50vh;
    overflow-y: auto;
    scrollbar-gutter: stable;
}
.template-content-main { position: relative; z-index: 0; }
.template-editor-sidebar-slot { min-width: 0; align-self: start; }
.template-editor-sidebar {
    min-width: 0;
    position: sticky;
    top: var(--sb-sticky-header-offset, 58px);
    z-index: 50;
    isolation: isolate;
    align-self: start;
    max-height: calc(100dvh - var(--sb-sticky-header-offset, 58px) - 8px);
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
.template-editor-sidebar.is-viewport-fixed {
    position: fixed;
    left: var(--sb-template-sidebar-left);
    width: var(--sb-template-sidebar-width);
}
.template-palette-help { margin: 0 0 4px; color: var(--sb-text-soft); font-size: .78rem; }
.palette-accordion__indicator::before { content: "+"; display: inline-block; color: #718094; font-size: .9rem; font-weight: 800; }
details[open] > summary .palette-accordion__indicator::before { content: "−"; }
.palette-accordion--nested { gap: 2px; }
.mask-palette-row { display: grid; gap: 4px; }
.mask-palette-block { padding: 4px; border: 1px solid #e1e6eb; border-radius: var(--sb-radius-sm); background: #fbfcfd; }
.mask-palette-block h4 { margin: 0 0 3px; color: #58677a; font-size: .78rem; }
.mask-palette-fields, .public-tag-buttons, .template-include-list { display: grid; gap: 2px; }
.public-vars-error { margin: 0 0 4px; }
.template-help h3 { margin: 0 0 4px; font-size: .8rem; }
.template-help p { margin: 4px 0; font-size: .78rem; }
.template-save-panel { margin-top: 8px; border-top: 2px solid #8eb3cf; }
.template-save-panel__changes textarea { min-height: 78px; }
.template-save-panel__actions { margin-top: 6px; }
.template-content-main .field:last-child { margin-bottom: 0; }
.category-management > * { min-width: 0; }
.category-management__catalog .actions { align-items: center; }
.category-management__catalog td:last-child { min-width: 125px; }

.template-attachments-table { min-width: 1000px; table-layout: fixed; }
.template-attachments-table__use { width: 7%; }
.template-attachments-table__document { width: 21%; }
.template-attachments-table__category { width: 12%; }
.template-attachments-table__required { width: 9%; }
.template-attachments-table__override { width: 15%; }
.template-attachments-table__recipient-name,
.template-attachments-table__content-id { width: 18%; }
.template-attachments-table th,
.template-attachments-table td { overflow-wrap: anywhere; }
.template-attachments-table input[type="text"] { box-sizing: border-box; min-width: 0; width: 100%; }
