/* Modified 2026-11-16: Use shared typography and avoid double padding inside creation dialogs. */
.event-creator-window { font: 14px/1.5 Arial, sans-serif; }
.event-creator-window .ui-dialog-title { font: 600 14px/1.5 Arial, sans-serif; }
/* Modified 2026-11-18: Center wizard stages and keep the clone source picker wide enough for tournament names. */
html body .event-creator-window:is(:has(#ai-event-dialog),:has(.ec-clone)):not([style*="display: none"]):not([style*="display:none"]) { display: flex !important; flex-direction: column; box-sizing: border-box; width: min(1040px, calc(100vw - 24px)) !important; height: auto !important; max-height: calc(100dvh - 32px) !important; top: 50% !important; left: 50% !important; transform: translate(-50%, -50%) !important; }
/* Modified 2026-11-18: Use the full wizard height only while editing and a compact window during processing. */
html body .event-creator-window:has(#ai-event-dialog[aria-busy="false"] [data-review]:not([hidden])) { height: min(780px, calc(100dvh - 32px)) !important; }
html body .event-creator-window:has(#ai-event-dialog[aria-busy="true"]) { min-height: min(220px, calc(100dvh - 32px)); }
/* Modified 2026-11-17: Ignore the legacy content cap calculated from the wizard's fixed outer height. */
html body .ui-dialog .event-creator-dialog:has(#ai-event-dialog):not([style*="display: none"]):not([style*="display:none"]) { display: flex !important; flex-direction: column; flex: 1; min-height: 0; max-height: none !important; height: auto !important; overflow: hidden; }
/* Modified 2026-11-18: Fill short wizard pages while retaining one scroll container for their content. */
html body .ui-dialog .event-creator-dialog > .db_fieldsarea { display: flex; flex-direction: column; padding: 0; flex: 1; min-height: 0; max-height: none; overflow-y: auto; }
#ai-event-dialog, #ai-event-dialog .db_fieldsarea { max-height: none; overflow: visible; }
/* Modified 2026-11-18: Carry the available dialog height through the native form wrappers to the wizard. */
.event-creator-dialog > .db_fieldsarea > .formTable { display: flex; flex-direction: column; flex: 1; width: 100%; }
.event-creator-dialog > .db_fieldsarea > .formTable > tbody,
.event-creator-dialog > .db_fieldsarea > .formTable > tbody > tr,
.event-creator-dialog > .db_fieldsarea > .formTable > tbody > tr > td:last-child { display: flex; flex-direction: column; flex: 1; width: auto; }
.event-creator-dialog > .db_fieldsarea > .formTable > tbody > tr > td:first-child { display: none; }
.event-creator-dialog > .db_fieldsarea > .formTable > tbody > tr > td:last-child { padding: 0; }
.event-creator-dialog [fieldName="content"] > td:last-child > p { margin: 20px; }
.event-creator-dialog > .db_buttonsarea:empty { display: none; }
.event-creator-window { max-width: calc(100vw - 24px); }
/* Modified 2026-11-06: Present the three creation methods as full-width choices. */
/* Modified 2026-11-16: Keep body copy and labels independent of legacy table fonts. */
.ec-choice, .ec-clone, #ai-event-dialog { padding: 20px; color: var(--shell-dialog-text); font: 400 14px/1.5 Arial, sans-serif; }
.ec-clone p, #ai-event-dialog p { font-weight: 400; margin: 0 0 12px; }
.ec-clone p:last-child, #ai-event-dialog p:last-child { margin-bottom: 0; }
.ec-choice { display: grid; gap: 12px; }
html body .ec-choice > button {
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
    width: 100%; max-width: none; height: auto; min-height: 76px; margin: 0; padding: 16px 18px;
    border: 1px solid var(--shell-dialog-border); border-radius: 5px;
    background: var(--shell-dialog-field-background); color: var(--shell-dialog-text);
    text-align: left; white-space: normal; cursor: pointer;
}
html body .ec-choice > button:hover { border-color: var(--shell-accent); background: var(--shell-button-hover); }
.ec-choice strong { font-size: 16px; line-height: 1.4; color: inherit; }
.ec-choice span, .ec-intro, .ec-hint { color: var(--shell-dialog-text); opacity: .8; font: 400 13px/1.5 Arial, sans-serif; }
/* Modified 2026-11-19: Keep workflow action styles here; file inputs use the shared theme. */
.ec-clone button, #ai-event-dialog button {
    box-sizing: border-box; width: auto; max-width: 100%; height: auto; min-height: 36px; margin: 0; padding: 7px 16px;
    border: 1px solid var(--shell-button-border); border-radius: 4px;
    background: var(--shell-button-background); color: var(--shell-button-text);
    font: 600 14px/1.4 Arial, sans-serif; text-shadow: none; box-shadow: none;
    white-space: normal; overflow-wrap: anywhere; cursor: pointer;
}
.ec-clone button:enabled:hover, #ai-event-dialog button:enabled:hover {
    background: var(--shell-button-hover); border-color: var(--shell-button-hover-border);
}
.ec-clone button:focus-visible, #ai-event-dialog :is(button, input:not([type="file"]), select, textarea):focus-visible {
    outline: 2px solid var(--shell-accent); outline-offset: 2px;
}
.ec-clone button:disabled, #ai-event-dialog button:disabled, #ai-event-dialog input:not([type="file"]):disabled { opacity: .5; cursor: default; }
/* Modified 2026-11-18: Keep source choices on one line, matching the main tournament selector. */
.event-creator-window:has(.ec-clone) .tournament-autocomplete .ui-menu-item > a { white-space: nowrap; overflow-wrap: normal; overflow: hidden; text-overflow: ellipsis; }
/* Modified 2026-11-18: Keep the source picker compact like the other wizard forms. */
.ec-clone { display: grid; gap: 12px; }
.ec-clone label, #ai-event-dialog label { display: grid; gap: 8px; min-width: 0; font-weight: 600; }
/* Modified 2026-11-18: Align source selection and wizard labels to the left, matching standard site forms. */
.ec-clone > label, #ai-event-dialog :is([data-upload],[data-organizer]) > label { grid-template-columns: 185px minmax(0,1fr); align-items: center; column-gap: 12px; }
#ai-event-dialog [data-upload] .ec-hint { grid-column: 2; }
/* Modified 2026-11-18: Let the footer fill the bottom of short pages and own the lower dialog padding. */
#ai-event-dialog:not([hidden]) { display: flex; flex-direction: column; flex: 1; box-sizing: border-box; padding-bottom: 0; }
/* Modified 2026-11-19: Fit wizard controls while leaving file inputs to the shared theme. */
.ec-clone input:not([type="file"]), .ec-clone select, #ai-event-dialog input:not([type="file"]), #ai-event-dialog select, #ai-event-dialog textarea {
    width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; margin: 0; padding: 10px 12px;
    border: 1px solid var(--shell-dialog-border); border-radius: 4px;
    background: var(--shell-dialog-field-background); color: var(--shell-dialog-text);
    font: 14px/1.5 Arial, sans-serif; height: auto; min-height: 36px;
}
/* Modified 2026-11-17: Keep upload and editable schedule instructions within the sequential wizard. */
#ai-event-dialog [data-upload] { display: grid; gap: 12px; margin: 12px 0; }
#ai-event-dialog .ec-wide { grid-column: 1 / -1; }
#ai-event-dialog textarea { min-height: 160px; resize: vertical; }
.ec-actions, #ai-event-dialog footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
/* Modified 2026-11-18: Keep navigation and its divider at the same bottom position on every wizard page. */
#ai-event-dialog footer { position: sticky; bottom: 0; z-index: 1; flex-shrink: 0; margin-top: auto; padding: 16px 0 20px; border-top: 1px solid var(--shell-dialog-border); background: var(--shell-dialog-background); }
/* Modified 2026-11-06: Separate extracted data and the division tree with shared review surfaces. */
/* Modified 2026-11-18: Preserve spacing above the anchored navigation without moving its divider. */
#ai-event-dialog [data-review] { padding-top: 8px; margin-bottom: 20px; border-top: 1px solid var(--shell-dialog-border); }
#ai-event-dialog h3 { margin: 20px 0 12px; color: var(--shell-dialog-text); }
#ai-event-dialog details { margin: 8px 0; padding: 12px; border: 1px solid var(--shell-dialog-border); border-radius: 4px; background: var(--shell-dialog-field-background); }
#ai-event-dialog summary { cursor: pointer; }
/* Modified 2026-11-17: Keep manual stages, shared waiting feedback and source evidence readable. */
#ai-event-dialog .ec-steps, #ai-event-dialog .ec-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
#ai-event-dialog .ec-steps span { padding: 6px 10px; border-bottom: 2px solid var(--shell-dialog-border); opacity: .65; }
#ai-event-dialog .ec-steps .current { border-color: var(--shell-accent); opacity: 1; font-weight: 600; }
#ai-event-dialog [data-status] { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
#ai-event-dialog[aria-busy="true"] .ec-progress { display: flex; align-items: center; gap: 16px; margin: 16px 0; padding: 12px 16px; border: 1px solid var(--shell-dialog-border); border-radius: 4px; background: var(--shell-dialog-field-background); }
#ai-event-dialog[aria-busy="true"] [data-status] { margin: 0; font: 600 15px/1.5 Arial, sans-serif; }
#ai-event-dialog [data-wait] { flex: 0 0 72px; }
#ai-event-dialog [data-wait] .lds-gears { display: block; width: 72px; height: 72px; }
.event-creator-window:has(#ai-event-dialog[aria-busy="true"]), .event-creator-window:has(#ai-event-dialog[aria-busy="true"]) * { cursor: wait; }
#ai-event-dialog [data-status]:empty { display: none; }
#ai-event-dialog .ec-evidence { padding: 14px; margin: 16px 0; border: 1px solid var(--shell-dialog-border); border-radius: 4px; background: var(--shell-dialog-field-background); }
#ai-event-dialog [data-excerpts] { overflow: visible; }
#ai-event-dialog .ec-evidence blockquote { margin: 12px 0; padding-left: 12px; border-left: 2px solid var(--shell-accent); white-space: pre-wrap; overflow-wrap: anywhere; }
#ai-event-dialog .ec-evidence cite { display: block; margin-top: 6px; font-size: 12px; opacity: .75; }
#ai-event-dialog .ec-team-list { list-style: none; padding: 0; }
#ai-event-dialog .ec-team-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0; }
#ai-event-dialog .ec-team-list span { overflow-wrap: anywhere; }
#ai-event-dialog .ec-check { display: flex; align-items: center; gap: 8px; margin: 16px 0; }
#ai-event-dialog .ec-check input { width: auto; }
#ai-event-dialog .ec-timing-row > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#ai-event-dialog .ec-timing-row form { margin-top: 12px; }
#ai-event-dialog [data-copy-panel] { display: flex; align-items: end; gap: 12px; margin: 12px 0; }
#ai-event-dialog [data-copy-panel] label { flex: 1; }
/* Modified 2026-11-17: Fit compact labels, controls and provenance on the same row without clipping select text. */
#ai-event-dialog .ec-field-source { display: block; margin: 0; color: #abb8c4; font-size: 12px; line-height: 1.4; font-weight: normal; }
#ai-event-dialog :is(.formTable,.formtable) { width: 100%; }
/* Modified 2026-11-18: Give names the flexible middle column and keep provenance compact. */
#ai-event-dialog .ec-event-form { --ec-label-width: 185px; --ec-value-columns: minmax(0,1fr) 180px; }
#ai-event-dialog .ec-event-form :is(.formTable,.formtable), #ai-event-dialog .ec-event-form tbody { display: block; }
#ai-event-dialog .ec-event-form :is(.formTable,.formtable) td:first-child { width: auto; min-width: 0; margin: 0; padding: 2px 12px 2px 0; align-self: center; white-space: normal; overflow-wrap: anywhere; }
#ai-event-dialog .ec-event-form :is(.formTable,.formtable) td:last-child { display: grid; grid-template-columns: var(--ec-value-columns); align-items: center; gap: 12px; width: auto; margin: 0; padding: 2px 0; }
#ai-event-dialog [data-organizer] :is(input,select), #ai-event-dialog .ec-event-form :is(input,select,textarea) { min-height: 34px; height: auto; padding: 4px 9px; line-height: 22px; }
#ai-event-dialog .ec-event-form :is(input,select,textarea) { grid-column: 1; grid-row: 1; }
#ai-event-dialog .ec-event-form tr { display: grid; grid-template-columns: var(--ec-label-width) minmax(0,1fr); align-items: center; height: auto; }
#ai-event-dialog .ec-event-form .ec-fixed-value { grid-column: 1; grid-row: 1; padding: 1px 0; overflow-wrap: anywhere; }
#ai-event-dialog .ec-event-form :is(.formTable,.formtable) { border-spacing: 0; margin: 0; table-layout: fixed; }
#ai-event-dialog .ec-event-form td > .ec-field-source { grid-column: 2; grid-row: 1; }
/* Modified 2026-11-17: Keep autocomplete live regions accessible without adding a row between control and provenance. */
#ai-event-dialog .ec-event-form .ui-helper-hidden-accessible { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
#ai-event-dialog input[type="checkbox"] { width: auto; min-height: 0; justify-self: start; }
/* Modified 2026-11-18: Long date labels get more space; date inputs and source notes stay compact. */
#ai-event-dialog [data-dates] { --ec-label-width: 320px; --ec-value-columns: 170px 180px minmax(0,1fr); }
#ai-event-dialog [data-dates] :is(.formTable,.formtable) td:first-child { align-self: start; padding-top: 8px; }
#ai-event-dialog .ec-event-form td:first-child :is(label,span) { white-space: normal; }
/* Modified 2026-11-18: Keep date explanations below their field and duration totals separate from editable controls. */
#ai-event-dialog .ec-event-form .ec-field-help { grid-column: 1 / -1; grid-row: 2; color: var(--shell-dialog-text); opacity: .8; font: 400 12px/1.4 Arial, sans-serif; margin: 0 0 6px; }
#ai-event-dialog .ec-date-summary { margin-top: 16px; padding: 12px; border: 1px solid var(--shell-dialog-border); border-radius: 4px; background: var(--shell-dialog-field-background); }
#ai-event-dialog .ec-date-summary p { margin-bottom: 6px; overflow-wrap: anywhere; }
/* Modified 2026-11-18: Stack settings cards at full width with room for labels and provenance. */
#ai-event-dialog .ec-settings-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; margin-top: 16px; align-items: start; }
#ai-event-dialog .ec-settings-card { min-width: 0; padding: 14px; border: 1px solid var(--shell-dialog-border); border-radius: 4px; background: var(--shell-dialog-field-background); }
#ai-event-dialog .ec-settings-card > h3 { margin: 0 0 12px; font-size: 14px; }
/* Modified 2026-11-18: Use the full-width field columns inside stacked settings cards. */
#ai-event-dialog .ec-settings-grid .ec-settings-card { --ec-label-width: 185px; --ec-value-columns: minmax(0,1fr) 180px; }
#ai-event-dialog [data-dates] > .ec-settings-card + .ec-settings-card { margin-top: 12px; }
/* Modified 2026-11-17: Keep program limits compact and their provenance attached to the corresponding control. */
#ai-event-dialog .ec-limit-row { display: grid; grid-template-columns: 185px repeat(2,minmax(0,1fr)); gap: 12px; align-items: center; margin: 8px 0; }
#ai-event-dialog .ec-limit-row > strong { color: inherit; font-size: 14px; }
#ai-event-dialog .ec-limit-row label { grid-template-columns: minmax(0,1fr) minmax(100px,1fr); gap: 4px 8px; align-items: center; font-size: 13px; }
#ai-event-dialog .ec-limit-row input { grid-column: 1; grid-row: 2; }
#ai-event-dialog .ec-limit-row .ec-field-source { grid-column: 2; grid-row: 2; }
#ai-event-dialog .ec-limits cite { display: block; font-size: 12px; }
/* Modified 2026-11-18: Show only the gears and status during loading, analysis and final event creation. */
#ai-event-dialog:is([data-processing="true"],[aria-busy="true"]) > :not(.ec-progress) { display: none !important; }
#ai-event-dialog [hidden] { display: none !important; }
@media (max-width: 760px) {
    /* Modified 2026-11-18: Stack upload/source fields and creation actions on narrow screens. */
    .ec-choice, .ec-clone, #ai-event-dialog { padding: 14px; }
    /* Modified 2026-11-18: Keep the mobile footer anchored with its own lower padding. */
    #ai-event-dialog { padding-bottom: 0; }
    #ai-event-dialog footer { padding-bottom: 14px; }
    .ec-clone > label, #ai-event-dialog :is([data-upload],[data-organizer]) > label { grid-template-columns: minmax(0,1fr); }
    #ai-event-dialog [data-upload] .ec-hint { grid-column: 1; }
    /* Modified 2026-11-17: Stack native field labels and copy controls on narrow screens. */
    #ai-event-dialog :is(.formTable,.formtable), #ai-event-dialog :is(.formTable,.formtable) :is(tbody,tr,td), #ai-event-dialog :is(.formTable,.formtable) td:last-child { display: block; width: auto; text-align: left; }
    #ai-event-dialog .ec-event-form, #ai-event-dialog .ec-settings-grid .ec-settings-card { --ec-label-width: minmax(0,1fr); --ec-value-columns: minmax(0,1fr); }
    #ai-event-dialog .ec-event-form tr { grid-template-columns: minmax(0,1fr); }
    #ai-event-dialog .ec-event-form :is(.formTable,.formtable) td:first-child { width: auto; padding: 2px 0; }
    #ai-event-dialog .ec-event-form :is(.formTable,.formtable) td:last-child { grid-template-columns: minmax(0,1fr); gap: 4px; }
    #ai-event-dialog .ec-event-form td > .ec-field-source { grid-column: 1; grid-row: 2; }
    /* Modified 2026-11-18: Stack date explanations below provenance on narrow screens. */
    #ai-event-dialog .ec-event-form .ec-field-help { grid-column: 1; grid-row: 3; }
    /* Modified 2026-11-17: Stack program limit columns within narrow dialogs. */
    #ai-event-dialog .ec-limit-row { grid-template-columns: minmax(0,1fr); }
    #ai-event-dialog [data-copy-panel] { flex-direction: column; align-items: stretch; }
    #ai-event-dialog footer, .ec-actions { flex-direction: column; align-items: stretch; }
}

/* Modified 2026-11-11: Separate organizer confirmation from upload and later corrections. */
#ai-event-dialog [data-organizer] { display: grid; gap: 6px; margin: 12px 0; }
