/* Configuration editors share PageCard's viewport. Only their middle pane scrolls. */
[data-editor-layout]:not(.editor-layout-ready) { visibility: hidden; }
html:has([data-editor-layout][data-page-card-active]) { overflow: hidden; }
html body [data-editor-layout][data-page-card-active]:not([style*="display: none"]):not([style*="display:none"]) { display: flex !important; flex-direction: column; overflow: hidden; }
[data-editor-layout] > :not(.editor-form):not(.editor-content) { flex: none; }
[data-editor-layout] .editor-form { display: flex; flex: 1 1 0; flex-direction: column; min-height: 0; min-width: 0; margin-block: 0 !important; }
[data-editor-layout] > h1 { margin-block: 0 .75rem; flex: none; padding-inline: var(--editor-heading-inset, 0px); }
/* The heading starts close below the card's edge instead of two blank lines further down. Where it
   meets the TRAMANN logo, ./UI/EditorLayout.js keeps equal room on both sides (--editor-heading-inset). */
@media (min-width: 720px) {
    html:root body [data-editor-layout][data-page-card][data-page-card-active]:not([data-page-card="full"]):is(.container, .big-card) { padding-top: .75rem; }
}
/* An opened record names itself in one line, shortened only where it would otherwise wrap. Tables and
   roles carry their color, with the symbol in its colored box. */
[data-editor-layout] > h1.editor-record-title { display: flex; align-items: center; justify-content: center; column-gap: .25em; min-width: 0; max-width: 100%; box-sizing: border-box; white-space: nowrap; }
.editor-record-title > :not(.editor-record-name) { flex: none; }
.editor-record-title > .editor-record-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-record-title.editor-record-colored { color: var(--editor-record-color); }
/* One line below the section pills separates them from the content, as below the view pills of ./UI/calendar.php. */
.editor-sections { display: flex; flex: none; gap: .5rem; align-items: center; overflow-x: auto; overflow-y: hidden; max-width: 100%; padding: .2rem 3px .6rem; margin-bottom: .75rem; border-bottom: 1px solid var(--border-color); overscroll-behavior-x: contain; scrollbar-width: thin; touch-action: pan-x pinch-zoom; }
.editor-sections::before, .editor-sections::after { content: ''; margin-inline: auto; }
/* The same pills as AnalyticsAndUsage, in a single touch/wheel-scrollable row. */
/* Exactly the pills of ./UI/AnalyticsAndUsage.php (.usage-view-card). Fully spelled out and without the
   shared log-tag-filter class: EmailBotFilterBase.css styles that class bold and fixed-height, and buttons
   would otherwise bring their own font, so the pills look the same on every configuration page. */
html body .editor-sections > .editor-section-link { flex: none; display: inline-flex; align-items: center; justify-content: center; box-sizing: content-box; width: auto; height: auto; min-width: 0; min-height: 0; margin: 0; padding: .25rem .75rem; border: 0; border-radius: 4px; outline: none; box-shadow: none; background: var(--border-color); color: var(--link-color); font-family: inherit; font-size: .8rem; font-weight: 400; font-style: normal; font-variant: normal; line-height: 1.6; letter-spacing: normal; text-transform: none; text-decoration: none; white-space: nowrap; cursor: var(--tnx-cursor-pointer, pointer); opacity: .3; filter: none; transform: none; transition: opacity .2s ease; }
html body .editor-sections > .editor-section-link:hover { opacity: .8; background: var(--border-color); filter: none; }
html body .editor-sections > .editor-section-link[aria-selected="true"], html body .editor-sections > .editor-section-link[aria-selected="true"]:hover { opacity: 1; cursor: var(--tnx-cursor-default, default); filter: none; }
html body .editor-sections > .editor-section-link:focus-visible { outline: 2px solid var(--link-color); outline-offset: -2px; }
[data-editor-layout] .editor-content { position: relative; display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; min-width: 0; overflow: auto; container-type: normal; scrollbar-gutter: stable; overscroll-behavior: contain; padding-inline: 3px; }
.editor-panel { min-width: 0; flex: none; }
.editor-panel:has(> .editor-steps) { display: flex; flex-direction: column; flex: 1 0 auto; }
.editor-panel:not(.editor-panel-fill) > * { flex-shrink: 0; }
.editor-panel.editor-panel-fill { display: flex; flex-direction: column; flex: 1 1 0; height: 100%; min-height: 0; }
.editor-panel-fill > :not(script):not(style):not(template) { flex: 1 1 0; min-height: 0; max-height: 100%; }
/* A table's own scrollbar and controls keep their full height below it; only the table gives way, so
   the section never scrolls a few pixels on its own around the table. */
.editor-panel-fill > :is(.tnx-table-horizontal-scrollbar, .tnx-table-controls) { flex: none; }
/* A decorated section reaches the actions. Its decoration lies on that edge, outside the flow, and
   appears only once ./UI/EditorLayout.js has found room for all of it below the fields. */
.editor-panel-decorated { position: relative; box-sizing: border-box; min-height: 100%; }
.editor-panel-decorated > .editor-decoration { position: absolute; inset-inline: 0; bottom: 0; pointer-events: none; }
.editor-panel-decorated > .editor-decoration:not([data-editor-fits]) { visibility: hidden; }
.editor-panel-decorated > .editor-decoration:not([data-editor-fits]) * { animation-play-state: paused !important; }
/* Never taller than the free space ./UI/EditorLayout.js measured below the fields. */
.editor-panel-decorated > .editor-decoration > * { max-height: var(--editor-decoration-room, none); }
/* Short sections place navigation at the bottom. Long sections scroll to it after their fields. */
[data-editor-layout] .editor-panel > .editor-steps { flex: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 0; max-height: none; margin: auto 0 0; padding: 2lh 3px .35rem; }
/* Content that fills the section and scrolls on its own (columns, a rights grid) is the main content:
   no blank lines take room from it. */
[data-editor-layout] .editor-panel-fill > .editor-steps { margin-top: 0; padding-top: 0; }
[data-editor-layout] .editor-panel > .editor-steps[hidden] { display: none; }
.editor-steps > .editor-step-link { min-width: 0; text-decoration: none; overflow-wrap: anywhere; }
.editor-steps > .editor-step-next { margin-inline-start: auto; text-align: end; }
[data-editor-layout] .editor-obsolete, [data-editor-layout] .editor-panel[hidden], .editor-section-link[hidden], .editor-sections[hidden] { display: none !important; }
/* A deactivated record's notice: between the section pills and the content, with its own line below,
   never scrolling away. */
[data-editor-layout] > .tnx-deactivation-notice { flex: none; margin: 0 0 .75rem; padding: 0 3px .75rem; border-bottom: 1px solid var(--border-color); }
[data-editor-layout] > .tnx-deactivation-notice > p { margin: 0; }
/* Very narrow: SAVE (or RETURN in its place), CANCEL, REMOVE and the circles stack. With room for them,
   one row: REMOVE left, SAVE right, circles beside it. A configured slot keeps its room while its
   action is hidden, so nothing moves when it appears; a slot the page never uses takes none. */
/* SAVE and CANCEL never grow beyond --editor-action-button-max, however wide the screen. */
.editor-actions { --editor-action-button-max: 15rem; flex: none; container: editor-actions / inline-size; padding: .6rem 3px max(3px, env(safe-area-inset-bottom)); }
.editor-actions-grid { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: 'primary' 'secondary' 'remove' 'utilities'; align-items: center; gap: .1rem; }
.editor-actions-grid:has(> .editor-action-extra:not(:empty)) { grid-template-areas: 'extra' 'primary' 'secondary' 'remove' 'utilities'; }
/* Narrow, but both buttons fit: CANCEL left, SAVE right, then REMOVE and the circles. */
@container editor-actions (min-width: 340px) and (max-width: 639.98px) {
    .editor-actions-grid { grid-template-columns: minmax(0, var(--editor-action-button-max)) minmax(0, var(--editor-action-button-max)); justify-content: center; grid-template-areas: 'secondary primary' 'remove remove' 'utilities utilities'; column-gap: .75rem; }
    .editor-actions-grid:has(> .editor-action-extra:not(:empty)) { grid-template-areas: 'extra extra' 'secondary primary' 'remove remove' 'utilities utilities'; }
    .editor-actions-grid:has(> .editor-action-secondary[data-editor-unused]) { grid-template-areas: 'primary primary' 'remove remove' 'utilities utilities'; }
    .editor-actions-grid:has(> .editor-action-secondary[data-editor-unused]):has(> .editor-action-extra:not(:empty)) { grid-template-areas: 'extra extra' 'primary primary' 'remove remove' 'utilities utilities'; }
}
@container editor-actions (min-width: 640px) {
    .editor-actions-grid { grid-template-columns: minmax(0, 1fr) minmax(0, var(--editor-action-button-max)) minmax(0, var(--editor-action-button-max)) auto; grid-template-areas: 'remove secondary primary utilities'; gap: .35rem 1rem; }
    .editor-actions-grid:has(> .editor-action-extra:not(:empty)) { grid-template-areas: 'extra extra extra extra' 'remove secondary primary utilities'; }
    /* One class more than the narrow centred rule below, which comes later in the file. */
    .editor-actions-grid > .editor-action-remove { align-items: flex-start; }
    /* Without any REMOVE on the page, its room simply stays free. */
    .editor-actions-grid:has(> .editor-action-remove[data-editor-unused]) { grid-template-areas: '. secondary primary utilities'; }
    .editor-actions-grid:has(> .editor-action-remove[data-editor-unused]):has(> .editor-action-extra:not(:empty)) { grid-template-areas: 'extra extra extra extra' '. secondary primary utilities'; }
}
.editor-action-slot { min-width: 0; display: flex; align-items: center; gap: .5rem; }
.editor-action-slot[data-editor-unused], .editor-action-extra:empty { display: none; }
.editor-action-primary { grid-area: primary; min-height: 3rem; }
.editor-action-secondary { grid-area: secondary; min-height: 3rem; justify-content: center; }
.editor-action-remove { grid-area: remove; min-height: 1.6rem; flex-direction: column; align-items: center; justify-content: center; row-gap: .2rem; }
.editor-action-utilities { grid-area: utilities; justify-content: flex-end; min-height: 42px; }
.editor-action-extra { grid-area: extra; }
/* Actions brought their old page spacing (inline margins, blank lines). The footer spaces them. */
.editor-action-slot > * { flex: 1 1 auto; min-width: 0; max-width: 100%; margin: 0 !important; }
.editor-action-slot > :is(div, span, p) > br { display: none; }
.editor-actions button:not(.tnx-attachment-circle-action) { width: 100%; margin: 0 !important; padding: .75rem 1.5rem; font-size: 1rem; box-sizing: border-box; }
.editor-action-remove > * { flex: 0 1 auto; }
/* DEACTIVATE above REMOVE on every configuration page: two short, equally faint links, small enough
   that both lines stay within the height of the buttons beside them. */
.editor-action-remove > :is(div, a) { font-size: .8rem; line-height: 1.25; opacity: .2 !important; }
.editor-action-remove a:not([hidden]) { display: block; min-width: 0; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor-action-remove > [id^="deactivate"] { order: -1; }
/* A deactivated record's REACTIVATE takes DEACTIVATE's place, bold and fully visible. */
.editor-action-remove > .tnx-reactivating { opacity: 1 !important; }
.editor-action-utilities .entry-utility-links { flex: 0 1 auto; width: auto; margin: 0 !important; }
/* Three fixed 42px places (36px circle and its 3px margins): one missing circle moves none. */
.editor-action-utilities .configuration-utility-links:not([hidden]) { display: grid; grid-template-columns: repeat(3, 42px); gap: 0; }
.editor-action-utilities [data-entry-utility-item="download"] { grid-column: 1; grid-row: 1; }
.editor-action-utilities [data-entry-utility-item="share"] { grid-column: 2; grid-row: 1; }
.editor-action-utilities [data-entry-utility-item="log-entry"] { grid-column: 3; grid-row: 1; }
.editor-action-primary #agentSaveActions, .editor-action-primary .agent-action-slot { width: 100%; }
/* PaymentLinks: SHARE, COPY and SHOW of the generated link stay one row, also on phones. */
.editor-action-extra .link-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem 1rem; min-height: 0; max-width: none; }
.editor-action-extra .link-actions button { padding-inline: .5rem; }
/* SetupShop's astronomer: decoration only, with room for his sky above the last field. */
.editor-content .editor-scene { pointer-events: none; }
.editor-content .editor-scene.qw-shop-footer { margin-top: 4.5rem; }
[data-editor-layout] #setupEntryRelations { margin-block: 0; }
[data-editor-layout] .setup-relations-scroll { flex: 1; }
[data-editor-layout] .setup-columns-section { height: 100%; max-height: 100%; }
[data-editor-layout] #columnsWrapper.has-row-cards.is-row-detail { overflow: auto; min-height: 0; }
[data-editor-layout] .team-detail-field { display: revert; }
[data-editor-layout] .account-editor-content > .editor-panel > .form-section { margin: 0; }
@media (max-width: 719px) {
    .editor-actions { padding-top: .35rem; }
    .editor-actions button:not(.tnx-attachment-circle-action) { padding-block: .6rem; }
    [data-editor-layout] .editor-content { scrollbar-gutter: auto; }
}
