.stage-setup-backdrop
{
    position: absolute;
    inset: 0;
    z-index: 25;
    display: grid;
    place-items: start center;
    overflow: auto;
    padding: 104px 24px 24px;
    background: rgba(248, 250, 252, 0.84);
    backdrop-filter: blur(3px);
}

.stage-setup-backdrop[hidden]
{
    display: none !important;
}

.stage-setup-dialog
{
    display: grid;
    gap: 14px;
    width: min(980px, 100%);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.14);
    background: var(--panel);
}

.stage-setup-header
{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding: 0 0 14px;
}

.stage-setup-close
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-dim);
    background: transparent;
    cursor: pointer;
}

.stage-setup-close:hover,
.stage-setup-close:focus
{
    border-color: var(--border);
    color: var(--text);
    background: var(--panel-muted);
    outline: none;
}

.stage-setup-close svg
{
    width: 17px;
    height: 17px;
    stroke-width: 2.2;
}

.stage-setup-header h3
{
    margin: 0;
    font-size: 18px;
}

.stage-setup-header p
{
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--text-dim);
}

.stage-setup-grid
{
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 14px;
}

.stage-card
{
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-soft);
}

.stage-card-head
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
}

.stage-card-head h3
{
    margin: 0;
    font-size: 15px;
}

.stage-card-head span
{
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    color: var(--text-dim);
    background: var(--panel);
}

.stage-field
{
    display: grid;
    gap: 6px;
    padding: 14px 16px 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
}

.stage-field select
{
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 10px;
    font: inherit;
    color: var(--text);
    background: #ffffff;
}

.stage-field select.placeholder
{
    color: var(--text-dim);
}

.stage-field select option
{
    color: var(--text);
}

.stage-field select option:disabled
{
    color: var(--text-dim);
}

.stage-field select:focus
{
    border-color: #8bcfc6;
    box-shadow: 0 0 0 3px #d7f3ec;
    outline: none;
}

.stage-field-note
{
    margin: 8px 16px 16px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-dim);
}

.stage-field-note.inline
{
    margin: 0;
}

.stage-selected-model-list
{
    display: grid;
    gap: 6px;
    padding-bottom: 16px;
}

.stage-selected-model-item
{
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    background: #ffffff;
}

.stage-selected-model-item span
{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stage-selected-model-item button
{
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-dim);
    background: transparent;
    cursor: pointer;
}

.stage-selected-model-item button:hover,
.stage-selected-model-item button:focus
{
    border-color: var(--border);
    color: var(--text);
    background: var(--panel-soft);
    outline: none;
}

.stage-member-slots
{
    display: grid;
    gap: 10px;
    padding-bottom: 16px;
}

.stage-member-slots .stage-field
{
    padding-top: 10px;
}

.stage-start-row
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--panel-soft);
}

.stage-start-status
{
    font-size: 13px;
    color: var(--text-dim);
}

.stage-rule-info
{
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

.stage-rule-info-btn
{
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid #a8ded8;
    border-radius: 8px;
    color: var(--accent-hover);
    background: rgba(238, 248, 246, 0.72);
    cursor: pointer;
}

.stage-rule-info-btn.empty
{
    border-color: var(--border);
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.65);
}

.stage-rule-info-btn:hover,
.stage-rule-info-btn:focus
{
    border-color: var(--accent);
    color: var(--accent-hover);
    background: #ffffff;
    outline: none;
}

.stage-rule-info-btn svg
{
    width: 16px;
    height: 16px;
}

.stage-rule-info-panel
{
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
    display: none;
    width: min(420px, 70vw);
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid rgba(18, 131, 116, 0.24);
    border-radius: 8px;
    padding: 14px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 18px 50px rgba(19, 41, 48, 0.18);
    backdrop-filter: blur(10px);
}

.stage-rule-info:hover .stage-rule-info-panel,
.stage-rule-info:focus-within .stage-rule-info-panel
{
    display: grid;
    gap: 12px;
}

.stage-rule-info-title
{
    font-size: 14px;
    font-weight: 900;
}

.stage-rule-info-section
{
    display: grid;
    gap: 5px;
}

.stage-rule-info-section strong
{
    font-size: 11px;
    color: #28292b;
}

.stage-rule-info-section p
{
    margin: 0;
    white-space: pre-line;
    font-size: 12px;
    color: #333942;
    line-height: 1.55;
}

.stage-rule-info-section ul
{
    display: grid;
    gap: 4px;
    margin: 0;
    padding-left: 16px;
    font-size: 12px;
    color: #333942;
    line-height: 1.45;
}

@media (max-width: 900px)
{
    .stage-setup-grid
    {
        grid-template-columns: 1fr;
    }
}
